aboutsummaryrefslogtreecommitdiffstats
path: root/src/gpgrt-int.h
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2024-05-29 06:14:44 +0000
committerNIIBE Yutaka <[email protected]>2024-05-29 06:16:56 +0000
commit6c05b35977c9d15da45b4fe6c0c870dbbf51657c (patch)
treeeeff919dfe06900b6f8f62b3cf45153ed2d6ab88 /src/gpgrt-int.h
parentImport spawn functions from GnuPG master. (diff)
downloadlibgpg-error-6c05b35977c9d15da45b4fe6c0c870dbbf51657c.tar.gz
libgpg-error-6c05b35977c9d15da45b4fe6c0c870dbbf51657c.zip
Cleaner semantics for _gpgrt_process_spawn without a callback.
* src/gpg-error.h.in (@define:struct_spawn_cb_arg@): Remove. (gpgrt_spawn_actions_t): New. (@define:spawn_actions_functions@): New. * src/gpgrt-int.h (_gpgrt_spawn_actions_new) (_gpgrt_spawn_actions_release, _gpgrt_spawn_actions_set_envvars) (_gpgrt_spawn_actions_set_redirect): New. [HAVE_W32_SYSTEM] (_gpgrt_spawn_actions_set_inherit_handles): New. [!HAVE_W32_SYSTEM] (_gpgrt_spawn_actions_set_inherit_fds) (_gpgrt_spawn_actions_set_atfork): New. (_gpgrt_process_spawn): Use gpgrt_spawn_actions_t. (_gpgrt_spawn_helper): Remove. * src/mkheader.c: Emit gpgrt_spawn_actions_* definition. * src/spawn-posix.c(_gpgrt_spawn_actions_new) (_gpgrt_spawn_actions_release, _gpgrt_spawn_actions_set_envvars) (_gpgrt_spawn_actions_set_redirect) (_gpgrt_spawn_actions_set_inherit_fds) (_gpgrt_spawn_actions_set_atfork): New. (spawn_detached, _gpgrt_process_spawn): Use gpgrt_spawn_actions_t. (_gpgrt_spawn_helper): Remove. * src/spawn-w32.c: Ditto, with _gpgrt_spawn_actions_set_inherit_handles, but no _gpgrt_spawn_actions_set_atfork. -- GnuPG-bug-id: 6249 Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'src/gpgrt-int.h')
-rw-r--r--src/gpgrt-int.h22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/gpgrt-int.h b/src/gpgrt-int.h
index 2cc5f41..2871128 100644
--- a/src/gpgrt-int.h
+++ b/src/gpgrt-int.h
@@ -684,10 +684,24 @@ gpg_err_code_t _gpgrt_make_pipe (int filedes[2], estream_t *r_fp,
* descriptor.
*
*/
+gpg_err_code_t _gpgrt_spawn_actions_new (gpgrt_spawn_actions_t *r_act);
+void _gpgrt_spawn_actions_release (gpgrt_spawn_actions_t act);
+void _gpgrt_spawn_actions_set_envvars (gpgrt_spawn_actions_t, char **env);
+#ifdef HAVE_W32_SYSTEM
+void _gpgrt_spawn_actions_set_redirect (gpgrt_spawn_actions_t,
+ void *, void *, void *);
+void _gpgrt_spawn_actions_set_inherit_handles (gpgrt_spawn_actions_t, void **);
+#else
+void _gpgrt_spawn_actions_set_redirect (gpgrt_spawn_actions_t, int, int, int);
+void _gpgrt_spawn_actions_set_inherit_fds (gpgrt_spawn_actions_t,
+ const int *);
+void _gpgrt_spawn_actions_set_atfork (gpgrt_spawn_actions_t,
+ void (*atfork)(void *), void *arg);
+#endif
+
gpg_err_code_t _gpgrt_process_spawn (const char *pgmname, const char *argv1[],
unsigned int flags,
- void (*spawn_cb) (struct spawn_cb_arg *),
- void *spawn_cb_arg,
+ gpgrt_spawn_actions_t act,
gpgrt_process_t *r_process);
gpg_err_code_t _gpgrt_process_terminate (gpgrt_process_t process);
@@ -713,8 +727,6 @@ void _gpgrt_process_release (gpgrt_process_t process);
gpg_err_code_t _gpgrt_process_wait_list (gpgrt_process_t *process_list,
int count, int hang);
-void _gpgrt_spawn_helper (struct spawn_cb_arg *sca);
-
/* If HANG is true, waits for the process identified by PROCESS_ID to
* exit; if HANG is false, checks whether the process has terminated.
* PGMNAME should be the same as supplied to the spawn function and is
@@ -760,7 +772,7 @@ void _gpgrt_kill_process (gpgrt_process_t process_id);
void _gpgrt_release_process (gpgrt_process_t process_id);
/* Close all file resources (descriptors), except KEEP_FDS. */
-void _gpgrt_close_all_fds (int from, int *keep_fds);
+void _gpgrt_close_all_fds (int from, const int *keep_fds);
/*