aboutsummaryrefslogtreecommitdiffstats
path: root/src/spawn-posix.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2024-06-19 07:23:47 +0000
committerWerner Koch <[email protected]>2024-06-19 07:23:47 +0000
commit0078afb8c60af2c61c01688ca52f51ca95b25721 (patch)
tree9f9e617c7c70928c2c77498a9a717b4aa4a235f5 /src/spawn-posix.c
parentApply spell fix. (diff)
downloadlibgpg-error-0078afb8c60af2c61c01688ca52f51ca95b25721.tar.gz
libgpg-error-0078afb8c60af2c61c01688ca52f51ca95b25721.zip
spawn: Keep struct definitions at the top of the file.
* src/spawn-posix.c: Move include and struct defs around. * src/spawn-w32.c: Move struct defs around.
Diffstat (limited to 'src/spawn-posix.c')
-rw-r--r--src/spawn-posix.c45
1 files changed, 27 insertions, 18 deletions
diff --git a/src/spawn-posix.c b/src/spawn-posix.c
index f019f8f..03ad37a 100644
--- a/src/spawn-posix.c
+++ b/src/spawn-posix.c
@@ -38,6 +38,7 @@
#include <unistd.h>
#include <fcntl.h>
+#include <sys/socket.h>
#include <sys/wait.h>
#ifdef HAVE_GETRLIMIT
@@ -57,6 +58,32 @@
#include "gpgrt-int.h"
+/* Definition for the gpgrt_spawn_actions_t. Note that there is a
+ * different one for Windows. */
+struct gpgrt_spawn_actions {
+ int fd[3];
+ const int *except_fds;
+ char **environ;
+ void (*atfork) (void *);
+ void *atfork_arg;
+};
+
+
+/* Definition for the gpgrt_process_t. Note that there is a different
+ * one for Windows. */
+struct gpgrt_process {
+ const char *pgmname;
+ unsigned int terminated :1; /* or detached */
+ unsigned int flags;
+ pid_t pid;
+ int fd_in;
+ int fd_out;
+ int fd_err;
+ int wstatus;
+};
+
+
+
/* Return the maximum number of currently allowed open file
* descriptors. Only useful on POSIX systems but returns a value on
* other systems too. */
@@ -258,7 +285,6 @@ _gpgrt_make_pipe (int filedes[2], estream_t *r_fp, int direction,
return do_create_pipe (filedes);
}
-#include <sys/socket.h>
static gpg_err_code_t
do_create_socketpair (int filedes[2])
@@ -287,13 +313,6 @@ posix_open_null (int for_write)
return fd;
}
-struct gpgrt_spawn_actions {
- int fd[3];
- const int *except_fds;
- char **environ;
- void (*atfork) (void *);
- void *atfork_arg;
-};
static int
my_exec (const char *pgmname, const char *argv[], gpgrt_spawn_actions_t act)
@@ -462,16 +481,6 @@ _gpgrt_spawn_actions_set_inherit_fds (gpgrt_spawn_actions_t act,
act->except_fds = fds;
}
-struct gpgrt_process {
- const char *pgmname;
- unsigned int terminated :1; /* or detached */
- unsigned int flags;
- pid_t pid;
- int fd_in;
- int fd_out;
- int fd_err;
- int wstatus;
-};
gpg_err_code_t
_gpgrt_process_spawn (const char *pgmname, const char *argv1[],