diff options
Diffstat (limited to '')
-rw-r--r-- | include/unistd.h | 315 |
1 files changed, 311 insertions, 4 deletions
diff --git a/include/unistd.h b/include/unistd.h index a783f57..33a3db0 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -190,7 +190,7 @@ int execlp(const char*, ... /*, NULL */) * As a slibc extension, it can be empty. * This list shall be terminated by a `NULL` sentinel. * @param envp The list of environment variables the new program shall - * have set. Each element shall be foramtted $name=$value. + * have set. Each element shall be formatted $name=$value. * This list shall be `NULL`-terminated. The behaviour * is system-dependant if this argument is `NULL`. * @return This function does not return on success, @@ -218,7 +218,7 @@ int execle(const char*, ... /*, NULL, char* const[] */) * As a slibc extension, it can be empty. * This list shall be terminated by a `NULL` sentinel. * @param envp The list of environment variables the new program shall - * have set. Each element shall be foramtted $name=$value. + * have set. Each element shall be formatted $name=$value. * This list shall be `NULL`-terminated. The behaviour * is system-dependant if this argument is `NULL`. * @return This function does not return on success, @@ -290,7 +290,7 @@ int execvp(const char*, char* const[]) * be `NULL`-terminated. The behaviour is * system-dependant if this argument is `NULL`. * @param envp The list of environment variables the new program shall - * have set. Each element shall be foramtted $name=$value. + * have set. Each element shall be formatted $name=$value. * This list shall be `NULL`-terminated. The behaviour * is system-dependant if this argument is `NULL`. * @return This function does not return on success, @@ -322,7 +322,7 @@ int execve(const char*, char* const[], char* const[]) * be `NULL`-terminated. The behaviour is * system-dependant if this argument is `NULL`. * @param envp The list of environment variables the new program shall - * have set. Each element shall be foramtted $name=$value. + * have set. Each element shall be formatted $name=$value. * This list shall be `NULL`-terminated. The behaviour * is system-dependant if this argument is `NULL`. * @return This function does not return on success, @@ -336,6 +336,313 @@ int execvpe(const char*, char* const[], char* const[]) #endif +#if defined(_SLIBC_SOURCE) && !defined(__PORTABLE) +/** + * Replace the current process image with a new process image. + * + * This is a slibc extension. + * + * @param dirfd File descriptor for a directory (opened with + * with the open(2) `O_PATH` flag,) that will + * act as the current working directory. + * If `AT_FDCWD`, the current working directory + * will be used. + * @param path The pathname of the file to execute. + * @param ... The arguments with which to execute the file. + * The arguments should have the type `const char*`. + * As a slibc extension, it can be empty. + * This list shall be terminated by a `NULL` sentinel. + * @param flags Bit mask that can include zero or more of the + * following flags: + * AT_EMPTY_PATH: + * If `path` is an empty string, operate on the + * file (not directory) referred to by `dirfd`. + * AT_SYMLINK_NOFOLLOW: + * If `path` is relative is a symbolic link, + * fail with `errno` set to `ELOOP`. + * @return This function does not return on success, + * on error, -1 is returned and `errno` is + * set to describe the error. + * + * @throws Any error specified for execveat(2). + */ +int execlat(int, const char*, ... /*, NULL, int */) + __GCC_ONLY(__attribute__((sentinel(1), nonnull(2)))); + +/** + * Replace the current process image with a new process image. + * + * This is a slibc extension. + * + * @param dirfd File descriptor for a directory (opened with + * with the open(2) `O_PATH` flag,) that will + * act as the current working directory. + * If `AT_FDCWD`, the current working directory + * will be used. + * @param file The pathname of the file to execute, + * or the filename of a file in $PATH, + * to execute. If $PATH is not set, the current + * working directory (yes, you read that right,) + * and a default value for $PATH will be used. + * @param ... The arguments with which to execute the file. + * The arguments should have the type `const char*`. + * As a slibc extension, it can be empty. + * This list shall be terminated by a `NULL` sentinel. + * @param flags Bit mask that can include zero or more of the + * following flags: + * AT_EMPTY_PATH: + * If `file` is an empty string, operate on the + * file (not directory) referred to by `dirfd`. + * AT_SYMLINK_NOFOLLOW: + * If `file` is relative is a symbolic link, + * fail with `errno` set to `ELOOP`. + * @return This function does not return on success, + * on error, -1 is returned and `errno` is + * set to describe the error. + * + * @throws Any error specified for execveat(2). + */ +int execlpat(int, const char*, ... /*, NULL, int */) + __GCC_ONLY(__attribute__((sentinel(1), nonnull(2)))); + +/** + * Replace the current process image with a new process image. + * + * This is a slibc extension. + * + * @param dirfd File descriptor for a directory (opened with + * with the open(2) `O_PATH` flag,) that will + * act as the current working directory. + * If `AT_FDCWD`, the current working directory + * will be used. + * @param path The pathname of the file to execute. + * @param ... The arguments with which to execute the file. + * The arguments should have the type `const char*`. + * As a slibc extension, it can be empty. + * This list shall be terminated by a `NULL` sentinel. + * @param envp The list of environment variables the new program shall + * have set. Each element shall be formatted $name=$value. + * This list shall be `NULL`-terminated. The behaviour + * is system-dependant if this argument is `NULL`. + * @param flags Bit mask that can include zero or more of the + * following flags: + * AT_EMPTY_PATH: + * If `path` is an empty string, operate on the + * file (not directory) referred to by `dirfd`. + * AT_SYMLINK_NOFOLLOW: + * If `path` is relative is a symbolic link, + * fail with `errno` set to `ELOOP`. + * @return This function does not return on success, + * on error, -1 is returned and `errno` is + * set to describe the error. + * + * @throws Any error specified for execveat(2). + */ +int execleat(int, const char*, ... /*, NULL, char* const[], int */) + __GCC_ONLY(__attribute__((sentinel(2), nonnull(2)))); + +/** + * Replace the current process image with a new process image. + * + * This is a slibc extension. + * + * @param dirfd File descriptor for a directory (opened with + * with the open(2) `O_PATH` flag,) that will + * act as the current working directory. + * If `AT_FDCWD`, the current working directory + * will be used. + * @param file The pathname of the file to execute, + * or the filename of a file in $PATH, + * to execute. If $PATH is not set, the current + * working directory (yes, you read that right,) + * and a default value for $PATH will be used. + * @param ... The arguments with which to execute the file. + * The arguments should have the type `const char*`. + * As a slibc extension, it can be empty. + * This list shall be terminated by a `NULL` sentinel. + * @param envp The list of environment variables the new program shall + * have set. Each element shall be formatted $name=$value. + * This list shall be `NULL`-terminated. The behaviour + * is system-dependant if this argument is `NULL`. + * @param flags Bit mask that can include zero or more of the + * following flags: + * AT_EMPTY_PATH: + * If `file` is an empty string, operate on the + * file (not directory) referred to by `dirfd`. + * AT_SYMLINK_NOFOLLOW: + * If `file` is relative is a symbolic link, + * fail with `errno` set to `ELOOP`. + * @return This function does not return on success, + * on error, -1 is returned and `errno` is + * set to describe the error. + * + * @throws Any error specified for execveat(2). + */ +int execlpeat(int, const char*, ... /*, NULL, char* const[], int */) + __GCC_ONLY(__attribute__((sentinel(2), nonnull(2)))); + +/** + * Replace the current process image with a new process image. + * + * This is a slibc extension. + * + * @param dirfd File descriptor for a directory (opened with + * with the open(2) `O_PATH` flag,) that will + * act as the current working directory. + * If `AT_FDCWD`, the current working directory + * will be used. + * @param path The pathname of the file to execute. + * @param argv The arguments with which to execute the file. + * This parameter should really have the type + * `const char* const[]`, but that probably not + * so because compiles take issue with casts + * adding const to any pointer in the type + * except the outmost pointer. This list shall + * be `NULL`-terminated. The behaviour is + * system-dependant if this argument is `NULL`. + * @param flags Bit mask that can include zero or more of the + * following flags: + * AT_EMPTY_PATH: + * If `path` is an empty string, operate on the + * file (not directory) referred to by `dirfd`. + * AT_SYMLINK_NOFOLLOW: + * If `path` is relative is a symbolic link, + * fail with `errno` set to `ELOOP`. + * @return This function does not return on success, + * on error, -1 is returned and `errno` is + * set to describe the error. + * + * @throws Any error specified for execveat(2). + */ +int execvat(int, const char*, char* const[], int) + __GCC_ONLY(__attribute__((nonnull(2)))); + +/** + * Replace the current process image with a new process image. + * + * This is a slibc extension. + * + * @param dirfd File descriptor for a directory (opened with + * with the open(2) `O_PATH` flag,) that will + * act as the current working directory. + * If `AT_FDCWD`, the current working directory + * will be used. + * @param file The pathname of the file to execute, + * or the filename of a file in $PATH, + * to execute. If $PATH is not set, the current + * working directory (yes, you read that right,) + * and a default value for $PATH will be used. + * @param argv The arguments with which to execute the file. + * This parameter should really have the type + * `const char* const[]`, but that probably not + * so because compiles take issue with casts + * adding const to any pointer in the type + * except the outmost pointer. This list shall + * be `NULL`-terminated. The behaviour is + * system-dependant if this argument is `NULL`. + * @param flags Bit mask that can include zero or more of the + * following flags: + * AT_EMPTY_PATH: + * If `file` is an empty string, operate on the + * file (not directory) referred to by `dirfd`. + * AT_SYMLINK_NOFOLLOW: + * If `file` is relative is a symbolic link, + * fail with `errno` set to `ELOOP`. + * @return This function does not return on success, + * on error, -1 is returned and `errno` is + * set to describe the error. + * + * @throws Any error specified for execveat(2). + */ +int execvpat(int, const char*, char* const[], int) + __GCC_ONLY(__attribute__((nonnull(2)))); +#endif + +/** + * Replace the current process image with a new process image. + * + * @param dirfd File descriptor for a directory (opened with + * with the open(2) `O_PATH` flag,) that will + * act as the current working directory. + * If `AT_FDCWD`, the current working directory + * will be used. + * @param path The pathname of the file to execute. + * @param argv The arguments with which to execute the file. + * This parameter should really have the type + * `const char* const[]`, but that probably not + * so because compiles take issue with casts + * adding const to any pointer in the type + * except the outmost pointer. This list shall + * be `NULL`-terminated. The behaviour is + * system-dependant if this argument is `NULL`. + * @param envp The list of environment variables the new program shall + * have set. Each element shall be formatted $name=$value. + * This list shall be `NULL`-terminated. The behaviour + * is system-dependant if this argument is `NULL`. + * @param flags Bit mask that can include zero or more of the + * following flags: + * AT_EMPTY_PATH: + * If `path` is an empty string, operate on the + * file (not directory) referred to by `dirfd`. + * AT_SYMLINK_NOFOLLOW: + * If `path` is relative is a symbolic link, + * fail with `errno` set to `ELOOP`. + * @return This function does not return on success, + * on error, -1 is returned and `errno` is + * set to describe the error. + * + * @throws Any error specified for execveat(2). + */ +int execveat(int, const char*, char* const[], char* const[], int) + __GCC_ONLY(__attribute__((nonnull(2)))); + +#if defined(_SLIBC_SOURCE) && !defined(__PORTABLE) +/** + * Replace the current process image with a new process image. + * + * This is a slibc extension. + * + * @param dirfd File descriptor for a directory (opened with + * with the open(2) `O_PATH` flag,) that will + * act as the current working directory. + * If `AT_FDCWD`, the current working directory + * will be used. + * @param file The pathname of the file to execute, + * or the filename of a file in $PATH, + * to execute. If $PATH is not set, the current + * working directory (yes, you read that right,) + * and a default value for $PATH will be used. + * @param argv The arguments with which to execute the file. + * This parameter should really have the type + * `const char* const[]`, but that probably not + * so because compiles take issue with casts + * adding const to any pointer in the type + * except the outmost pointer. This list shall + * be `NULL`-terminated. The behaviour is + * system-dependant if this argument is `NULL`. + * @param envp The list of environment variables the new program shall + * have set. Each element shall be formatted $name=$value. + * This list shall be `NULL`-terminated. The behaviour + * is system-dependant if this argument is `NULL`. + * @param flags Bit mask that can include zero or more of the + * following flags: + * AT_EMPTY_PATH: + * If `file` is an empty string, operate on the + * file (not directory) referred to by `dirfd`. + * AT_SYMLINK_NOFOLLOW: + * If `file` is relative is a symbolic link, + * fail with `errno` set to `ELOOP`. + * @return This function does not return on success, + * on error, -1 is returned and `errno` is + * set to describe the error. + * + * @throws Any error specified for execveat(2). + */ +int execvpeat(int, const char*, char* const[], char* const[], int) + __GCC_ONLY(__attribute__((nonnull(2)))); +#endif + + #endif |