From 0078afb8c60af2c61c01688ca52f51ca95b25721 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 19 Jun 2024 09:23:47 +0200 Subject: 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. --- src/spawn-posix.c | 45 +++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) (limited to 'src/spawn-posix.c') 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 #include +#include #include #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 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[], -- cgit v1.2.3