aboutsummaryrefslogtreecommitdiffstats
path: root/src/gpgrt-int.h
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2022-10-20 05:23:20 +0000
committerNIIBE Yutaka <[email protected]>2022-10-20 05:23:20 +0000
commit5ad97e8fa62882b2014a67b4e57dab3b37ccaf4c (patch)
tree7741b9acdb2a9c5f596da2e362c01d394d2b0122 /src/gpgrt-int.h
parentspawn: Update changes from gnupg. (diff)
downloadlibgpg-error-5ad97e8fa62882b2014a67b4e57dab3b37ccaf4c.tar.gz
libgpg-error-5ad97e8fa62882b2014a67b4e57dab3b37ccaf4c.zip
gpgrt_spawn_process, gpgrt_spawn_process_fd: Change the API.
* src/gpg-error.h.in (gpgrt_spawn_process): Remove PREEXEC argument. (gpgrt_spawn_process_fd): Add AFTER_FORK_CB and AFTER_FORK_CB_ARG. * src/gpgrt-int.h (_gpgrt_spawn_process): Remove PREEXEC argument. (_gpgrt_spawn_process_fd): Add AFTER_FORK_CB and AFTER_FORK_CB_ARG. * src/spawn-posix.c (do_exec): Remove PREEXEC argument. (_gpgrt_spawn_process): Remove PREEXEC argument. (_gpgrt_spawn_process_fd): Add AFTER_FORK_CB and AFTER_FORK_CB_ARG. (_gpgrt_spawn_process_detached): Follow the change of do_exec. * src/spawn-w32.c (_gpgrt_spawn_process): Remove PREEXEC argument. (_gpgrt_spawn_process_fd): Add AFTER_FORK_CB and AFTER_FORK_CB_ARG. * src/visibility.c (gpgrt_spawn_process): Remove PREEXEC argument. (gpgrt_spawn_process_fd): Add AFTER_FORK_CB and AFTER_FORK_CB_ARG. -- GnuPG-bug-id: 6249 Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'src/gpgrt-int.h')
-rw-r--r--src/gpgrt-int.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/gpgrt-int.h b/src/gpgrt-int.h
index 78d5938..209e974 100644
--- a/src/gpgrt-int.h
+++ b/src/gpgrt-int.h
@@ -646,8 +646,6 @@ gpg_err_code_t _gpgrt_make_pipe (int filedes[2], estream_t *r_fp,
*
* The arguments for the process are expected in the NULL terminated
* array ARGV. The program name itself should not be included there.
- * If PREEXEC is not NULL, the given function will be called right
- * before the exec.
*
* IF EXCEPT is not NULL, it is expected to be an ordered list of file
* descriptors, terminated by an entry with the value (-1). These
@@ -685,7 +683,7 @@ gpg_err_code_t _gpgrt_make_pipe (int filedes[2], estream_t *r_fp,
*/
gpg_err_code_t
_gpgrt_spawn_process (const char *pgmname, const char *argv[],
- int *execpt, void (*preexec)(void), unsigned int flags,
+ int *execpt, unsigned int flags,
estream_t *r_infp,
estream_t *r_outfp,
estream_t *r_errfp,
@@ -699,10 +697,15 @@ _gpgrt_spawn_process (const char *pgmname, const char *argv[],
* terminated array ARGV. The program name itself should not be
* included there. Calling gpgrt_wait_process and
* gpgrt_release_process is required. Returns 0 on success or an
- * error code. */
+ * error code.
+ * If AFTER_FORK_CB is not NULL, the given function will be called
+ * right after the fork, by child process.
+ */
gpg_err_code_t _gpgrt_spawn_process_fd (const char *pgmname,
const char *argv[],
int infd, int outfd, int errfd,
+ void (*after_fork_cb)(void *),
+ void *after_fork_cb_arg,
pid_t *pid);
/* Spawn a new process and immediately detach from it. The name of
@@ -713,7 +716,7 @@ gpg_err_code_t _gpgrt_spawn_process_fd (const char *pgmname,
* provide an absolute file name. */
gpg_err_code_t _gpgrt_spawn_process_detached (const char *pgmname,
const char *argv[],
- const char *envp[] );
+ const char *envp[]);
/* If HANG is true, waits for the process identified by PID to exit;
* if HANG is false, checks whether the process has terminated.