7
7
8
8
#include "sys/types.h"
9
9
#include "stddef.h"
10
- #include "sys/ dirent.h"
10
+ #include "dirent.h"
11
11
12
12
#define STDIN_FILENO 0 ///< Standard input file descriptor.
13
13
#define STDOUT_FILENO 1 ///< Standard output file descriptor.
@@ -71,21 +71,17 @@ int symlink(const char *linkname, const char *path);
71
71
/// @return The number of read characters on success, -1 otherwise and errno is set to indicate the error.
72
72
int readlink (const char * path , char * buffer , size_t bufsize );
73
73
74
- /// @brief Wrapper for exit system call.
75
- /// @param status The exit status.
76
- extern void exit (int status );
77
-
78
74
/// @brief Returns the process ID (PID) of the calling process.
79
75
/// @return pid_t process identifier.
80
- extern pid_t getpid (void );
76
+ pid_t getpid (void );
81
77
82
78
///@brief Return session id of the given process.
83
79
/// If pid == 0 return the SID of the calling process
84
80
/// If pid != 0 return the SID corresponding to the process having identifier == pid
85
81
///@param pid process identifier from wich we want the SID
86
82
///@return On success return SID of the session
87
83
/// Otherwise return -1 with errno set on: EPERM or ESRCH
88
- extern pid_t getsid (pid_t pid );
84
+ pid_t getsid (pid_t pid );
89
85
90
86
///@brief creates a new session if the calling process is not a
91
87
/// process group leader. The calling process is the leader of the
@@ -95,7 +91,7 @@ extern pid_t getsid(pid_t pid);
95
91
/// is made the same as its process ID).
96
92
///@return On success return SID of the session just created
97
93
/// Otherwise return -1 with errno : EPERM
98
- extern pid_t setsid (void );
94
+ pid_t setsid (void );
99
95
100
96
///@brief returns the Process Group ID (PGID) of the process specified by pid.
101
97
/// If pid is zero, the process ID of the calling process is used.
@@ -112,56 +108,56 @@ int setpgid(pid_t pid, pid_t pgid);
112
108
113
109
///@brief returns the real group ID of the calling process.
114
110
///@return GID of the current process
115
- extern gid_t getgid (void );
111
+ gid_t getgid (void );
116
112
117
113
///@brief returns the effective group ID of the calling process.
118
114
///@return GID of the current process
119
- extern gid_t getegid (void );
115
+ gid_t getegid (void );
120
116
121
117
///@brief sets the group IDs of the calling process.
122
118
///@param gid the Group ID to set
123
119
///@return On success, zero is returned.
124
120
/// Otherwise returns -1 with errno set to :EINVAL or EPERM
125
- extern int setgid (gid_t gid );
121
+ int setgid (gid_t gid );
126
122
127
123
///@brief sets the real and effective group IDs of the calling process.
128
124
///@param rgid the new real Group ID.
129
125
///@param egid the effective real Group ID.
130
126
///@return On success, zero is returned.
131
127
/// Otherwise returns -1 with errno set EPERM
132
- extern int setregid (gid_t rgid , gid_t egid );
128
+ int setregid (gid_t rgid , gid_t egid );
133
129
134
130
///@brief Returns the real User ID of the calling process.
135
131
///@return User ID of the current process.
136
- extern uid_t getuid (void );
132
+ uid_t getuid (void );
137
133
138
134
///@brief Returns the effective User ID of the calling process.
139
135
///@return User ID of the current process.
140
- extern uid_t geteuid (void );
136
+ uid_t geteuid (void );
141
137
142
138
///@brief Sets the User IDs of the calling process.
143
139
///@param uid the new User ID.
144
140
///@return On success, zero is returned.
145
141
/// Otherwise returns -1 with errno set to :EINVAL or EPERM
146
- extern int setuid (uid_t uid );
142
+ int setuid (uid_t uid );
147
143
148
144
///@brief Sets the effective and real User IDs of the calling process.
149
145
///@param ruid the new real User ID.
150
146
///@param euid the effective real User ID.
151
147
///@return On success, zero is returned.
152
148
/// Otherwise returns -1 with errno set to EPERM
153
- extern int setreuid (uid_t ruid , uid_t euid );
149
+ int setreuid (uid_t ruid , uid_t euid );
154
150
155
151
/// @brief Returns the parent process ID (PPID) of the calling process.
156
152
/// @return pid_t parent process identifier.
157
- extern pid_t getppid (void );
153
+ pid_t getppid (void );
158
154
159
155
/// @brief Clone the calling process, but without copying the whole address space.
160
156
/// The calling process is suspended until the new process exits or is
161
157
/// replaced by a call to `execve'.
162
158
/// @return Return -1 for errors, 0 to the new process, and the process ID of
163
159
/// the new process to the old process.
164
- extern pid_t fork (void );
160
+ pid_t fork (void );
165
161
166
162
/// @brief Replaces the current process image with a new process image (argument list).
167
163
/// @param path The absolute path to the binary file to execute.
@@ -241,17 +237,6 @@ int execvpe(const char *file, char *const argv[], char *const envp[]);
241
237
/// returned, and errno is set appropriately.
242
238
int nice (int inc );
243
239
244
- /// @brief Reboots the system, or enables/disables the reboot keystroke.
245
- /// @param magic1 fails (with the error EINVAL) unless equals LINUX_REBOOT_MAGIC1.
246
- /// @param magic2 fails (with the error EINVAL) unless equals LINUX_REBOOT_MAGIC2.
247
- /// @param cmd The command to send to the reboot.
248
- /// @param arg Argument passed with some specific commands.
249
- /// @return For the values of cmd that stop or restart the system, a
250
- /// successful call to reboot() does not return. For the other cmd
251
- /// values, zero is returned on success. In all cases, -1 is
252
- /// returned on failure, and errno is set appropriately.
253
- int reboot (int magic1 , int magic2 , unsigned int cmd , void * arg );
254
-
255
240
/// @brief Get current working directory.
256
241
/// @param buf The array where the CWD will be copied.
257
242
/// @param size The size of the array.
@@ -270,15 +255,6 @@ int chdir(char const *path);
270
255
/// @return 0 on success, -1 on failure and errno is set to indicate the error.
271
256
int fchdir (int fd );
272
257
273
- /// Provide access to the directory entries.
274
- /// @param fd The fd pointing to the opened directory.
275
- /// @param dirp The buffer where de data should be placed.
276
- /// @param count The size of the buffer.
277
- /// @return On success, the number of bytes read is returned. On end of
278
- /// directory, 0 is returned. On error, -1 is returned, and errno is set
279
- /// appropriately.
280
- ssize_t getdents (int fd , dirent_t * dirp , unsigned int count );
281
-
282
258
/// @brief Return a new file descriptor
283
259
/// @param fd The fd pointing to the opened file.
284
260
/// @return On success, a new file descriptor is returned.
0 commit comments