aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-10-11 03:41:32 +0200
committerMattias Andrée <maandree@operamail.com>2015-10-11 03:41:32 +0200
commit80c6f77a0a1ec44980e0feb5bd19c43110a25c8a (patch)
tree7dec0116ff6345b6f3cd8a468f8fbee1c7fea8f3 /include
parentm (diff)
downloadslibc-80c6f77a0a1ec44980e0feb5bd19c43110a25c8a.tar.gz
slibc-80c6f77a0a1ec44980e0feb5bd19c43110a25c8a.tar.bz2
slibc-80c6f77a0a1ec44980e0feb5bd19c43110a25c8a.tar.xz
add fexec functions
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--include/unistd.h91
1 files changed, 91 insertions, 0 deletions
diff --git a/include/unistd.h b/include/unistd.h
index 33a3db0..9c2b419 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -643,6 +643,97 @@ int execvpeat(int, const char*, char* const[], char* const[], int)
#endif
+#if defined(_SLIBC_SOURCE) && !defined(__PORTABLE)
+/**
+ * Replace the current process image with a new process image.
+ *
+ * This is a slibc extension.
+ *
+ * @param fd File descriptor for 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 fexecl(int, ... /*, NULL */)
+ __GCC_ONLY(__attribute__((sentinel(0))));
+
+/**
+ * Replace the current process image with a new process image.
+ *
+ * This is a slibc extension.
+ *
+ * @param fd File descriptor for 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`.
+ * @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 fexecle(int, ... /*, NULL, char* const[] */)
+ __GCC_ONLY(__attribute__((sentinel(1))));
+
+/**
+ * Replace the current process image with a new process image.
+ *
+ * This is a slibc extension.
+ *
+ * @param fd File descriptor for 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 fexecv(int, char* const[]);
+#endif
+
+/**
+ * Replace the current process image with a new process image.
+ *
+ * @param fd File descriptor for 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`.
+ * @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 fexecve(int, char* const[], char* const[]);
+
+
#endif