diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/spawn-posix.c | 45 | ||||
-rw-r--r-- | src/spawn-w32.c | 40 |
2 files changed, 51 insertions, 34 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[], diff --git a/src/spawn-w32.c b/src/spawn-w32.c index 0e6b77d..e6ce28f 100644 --- a/src/spawn-w32.c +++ b/src/spawn-w32.c @@ -67,6 +67,30 @@ #define handle_to_fd(a) ((intptr_t)(a)) +/* Definition for the gpgrt_spawn_actions_t. Note that there is a + * different one for Unices. */ +struct gpgrt_spawn_actions { + void *hd[3]; + void **inherit_hds; + char *env; +}; + + +/* Definition for the gpgrt_process_t. Note that there is a different + * one for Unices. */ +struct gpgrt_process { + const char *pgmname; + unsigned int terminated:1; /* or detached */ + unsigned int flags; + HANDLE hProcess; + HANDLE hd_in; + HANDLE hd_out; + HANDLE hd_err; + int exitcode; +}; + + + /* Return the maximum number of currently allowed open file * descriptors. Only useful on POSIX systems but returns a value on * other systems too. */ @@ -301,22 +325,6 @@ _gpgrt_make_pipe (int filedes[2], estream_t *r_fp, int direction, int nonblock) return do_create_pipe_and_estream (filedes, NULL, 0, 0); } -struct gpgrt_spawn_actions { - void *hd[3]; - void **inherit_hds; - char *env; -}; - -struct gpgrt_process { - const char *pgmname; - unsigned int terminated :1; /* or detached */ - unsigned int flags; - HANDLE hProcess; - HANDLE hd_in; - HANDLE hd_out; - HANDLE hd_err; - int exitcode; -}; /* * Check if STARTUPINFOEXW supports PROC_THREAD_ATTRIBUTE_HANDLE_LIST. |