diff options
author | Werner Koch <[email protected]> | 2017-11-29 18:29:18 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2017-11-29 18:29:18 +0000 |
commit | 1865c0ba1769b407a3c504f1ab0a4278704a9fc1 (patch) | |
tree | eb98697911bda0270e4aee8de308017642db8979 /src/visibility.c | |
parent | Import and relicense exechelp* functions from GnuPG. (diff) | |
download | libgpg-error-1865c0ba1769b407a3c504f1ab0a4278704a9fc1.tar.gz libgpg-error-1865c0ba1769b407a3c504f1ab0a4278704a9fc1.zip |
core: Implement the spawn functions.
* src/gpg-error.h.in (GPGRT_SPAWN_NONBLOCK): New const.
(GPGRT_SPAWN_RUN_ASFW): New const.
(GPGRT_SPAWN_DETACHED): New const.
(gpgrt_make_pipe): New function.
(gpgrt_create_pipe): New macro.
(gpgrt_create_inbound_pipe): New macro.
(gpgrt_create_outbound_pipe): New macro.
(gpgrt_spawn_process): New function.
(gpgrt_spawn_process_fd): New function.
(gpgrt_spawn_process_detached): New function.
(gpgrt_wait_process): New function.
(gpgrt_wait_processes): New function.
(gpgrt_kill_process): New function.
(gpgrt_release_process): New function.
* src/gpg-error.def.in, src/gpg-error.vers: Add new functions.
* src/visibility.c, src/visibility.h: Add wrappers for new functions.
* src/spawn-posix.c: Rework to better fit the use in gpgrt. Rename
all public function with a _gpgrt prefix.
* src/spawn-w32.c: Ditto.
* src/gpgrt-int.h: Likewise.
* src/Makefile.am (arch_sources): Add spawn-posix.c and spawn-w32.c.
* src/w32-add.h: Add pid_t typedef as a temporary hack.
* configure.ac: Check for signal.h and getrlimit.
(AC_FUNC_FORK): New.
--
This does build but porting the tests and further changes are
required. Don't assume that the API for the new fucntions is stable.
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'src/visibility.c')
-rw-r--r-- | src/visibility.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/visibility.c b/src/visibility.c index 0f6d159..fb187a5 100644 --- a/src/visibility.c +++ b/src/visibility.c @@ -1008,8 +1008,61 @@ _gpgrt_log_assert (const char *expr, const char *file, #endif } + +gpg_err_code_t +gpgrt_make_pipe (int filedes[2], estream_t *r_fp, int direction, int nonblock) +{ + return _gpgrt_make_pipe (filedes, r_fp, direction, nonblock); +} + +gpg_err_code_t +gpgrt_spawn_process (const char *pgmname, const char *argv[], + int *except, void (*preexec)(void), unsigned int flags, + estream_t *r_infp, estream_t *r_outfp, estream_t *r_errfp, + pid_t *pid) +{ + return _gpgrt_spawn_process (pgmname, argv, except, preexec, flags, + r_infp, r_outfp, r_errfp, pid); +} + +gpg_err_code_t +gpgrt_spawn_process_fd (const char *pgmname, const char *argv[], + int infd, int outfd, int errfd, pid_t *pid) +{ + return _gpgrt_spawn_process_fd (pgmname, argv, infd, outfd, errfd, pid); +} + +gpg_err_code_t +gpgrt_spawn_process_detached (const char *pgmname, const char *argv[], + const char *envp[]) +{ + return _gpgrt_spawn_process_detached (pgmname, argv, envp); +} + +gpg_err_code_t +gpgrt_wait_process (const char *pgmname, pid_t pid, int hang, int *r_exitcode) +{ + return _gpgrt_wait_process (pgmname, pid, hang, r_exitcode); +} +gpg_err_code_t +gpgrt_wait_processes (const char **pgmnames, pid_t *pids, + size_t count, int hang, int *r_exitcodes) +{ + return _gpgrt_wait_processes (pgmnames, pids, count, hang, r_exitcodes); +} +void +gpgrt_kill_process (pid_t pid) +{ + _gpgrt_kill_process (pid); +} + +void +gpgrt_release_process (pid_t pid) +{ + _gpgrt_release_process (pid); +} |