aboutsummaryrefslogtreecommitdiffstats
path: root/include/unistd.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/unistd.h186
1 files changed, 186 insertions, 0 deletions
diff --git a/include/unistd.h b/include/unistd.h
index 6fa36bb..f85c1ae 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -143,5 +143,191 @@ int isatty(int);
+/**
+ * Replace the current process image with a new process image.
+ *
+ * @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.
+ * @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 execve(2).
+ */
+int execl(const char*, ... /*, NULL */)
+ __GCC_ONLY(__attribute__((sentinel(0), nonnull(1))));
+
+/**
+ * Replace the current process image with a new process image.
+ *
+ * @param file The pathname of the file to execute,
+ * or the filename of a file in $PATH,
+ * 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.
+ * @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 execve(2).
+ */
+int execlp(const char*, ... /*, NULL */)
+ __GCC_ONLY(__attribute__((sentinel(0), nonnull(1))));
+
+/**
+ * Replace the current process image with a new process image.
+ *
+ * @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 foramtted $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,
+ * on error, -1 is returned and `errno` is
+ * set to describe the error.
+ *
+ * @throws Any error specified for execve(2).
+ */
+int execle(const char*, ... /*, NULL, char* const[] */)
+ __GCC_ONLY(__attribute__((sentinel(1), nonnull(1))));
+
+#if (defined(_SLIBC_SOURCE) && !defined(__PORTABLE))
+/**
+ * Replace the current process image with a new process image.
+ *
+ * This is a slibc extension, added for completeness.
+ *
+ * @param file The pathname of the file to execute,
+ * or the filename of a file in $PATH,
+ * 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 foramtted $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,
+ * on error, -1 is returned and `errno` is
+ * set to describe the error.
+ *
+ * @throws Any error specified for execve(2).
+ */
+int execlpe(const char*, ... /*, NULL, char* const[] */)
+ __GCC_ONLY(__attribute__((sentinel(1), nonnull(1))));
+#endif
+
+/**
+ * Replace the current process image with a new process image.
+ *
+ * @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`.
+ * @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 execve(2).
+ */
+int execv(const char*, char* const[])
+ __GCC_ONLY(__attribute__((nonnull(1))));
+
+/**
+ * Replace the current process image with a new process image.
+ *
+ * @param file The pathname of the file to execute,
+ * or the filename of a file in $PATH,
+ * 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`.
+ * @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 execve(2).
+ */
+int execvp(const char*, char* const[])
+ __GCC_ONLY(__attribute__((nonnull(1))));
+
+/**
+ * Replace the current process image with a new process image.
+ *
+ * @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 foramtted $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,
+ * on error, -1 is returned and `errno` is
+ * set to describe the error.
+ *
+ * @throws Any error specified for execve(2).
+ */
+int execve(const char*, char* const[], char* const[])
+ __GCC_ONLY(__attribute__((nonnull(1))));
+
+#if (defined(_GNU_SOURCE) || defined(_SLIBC_SOURCE)) && !defined(__PORTABLE)
+/**
+ * Replace the current process image with a new process image.
+ *
+ * This is a GNU-compliant slibc extension.
+ *
+ * @param file The pathname of the file to execute,
+ * or the filename of a file in $PATH,
+ * 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 foramtted $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,
+ * on error, -1 is returned and `errno` is
+ * set to describe the error.
+ *
+ * @throws Any error specified for execve(2).
+ */
+int execvpe(const char*, char* const[], char* const[])
+ __GCC_ONLY(__attribute__((nonnull(1))));
+#endif
+
+
+
#endif