Browse code

Initial commit

Dario Rodriguez authored on 02/06/2024 20:53:59
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,43 @@
1
+/*
2
+ * libexec.h
3
+ *
4
+ * Small wrapper for execve()
5
+ *
6
+ * (c) 2024 Dario Rodriguez <antartica@whereismybit.com>
7
+ * This file is in the public domain.
8
+ */
9
+
10
+typedef struct exec_t {
11
+        char *name;
12
+        char **envp;
13
+        char *prebuf;
14
+        char *postbuf;
15
+        int has_param;
16
+        int fdin;
17
+        int fdout;
18
+        int fderr;
19
+        int pid;
20
+        int laststatus;
21
+} exec_t;
22
+
23
+exec_t *exec_init(char *name, char *commandwithstringsub, char **envp);
24
+void exec_free(exec_t *exec);
25
+
26
+int exec_open(exec_t *exec, char *stringsub);
27
+int exec_close(exec_t *exec);
28
+
29
+#ifndef __GNUC__
30
+int exec_reap(exec_t *exec1, /* exec_t *exec2, */ ...);
31
+#else
32
+        int exec_reap(exec_t *exec1, /* exec_t *exec2, */ ...) __attribute__((sentinel));
33
+#endif
34
+
35
+int executil_installsignal(int sig, void (*f)(int));
36
+int executil_queued(int fd);
37
+#ifndef __GNUC__
38
+exec_t *executil_fd2exec(int fd, exec_t *exec1, /* exec_t *exec2, */ ...);
39
+#else
40
+        exec_t *executil_fd2exec(int fd, exec_t *exec1, ...) __attribute__((sentinel));
41
+#endif
42
+
43
+