summaryrefslogtreecommitdiffstats
path: root/common/exechelp.h
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2010-08-20 14:18:38 +0200
committerWerner Koch <wk@gnupg.org>2010-08-20 14:18:38 +0200
commit15330f36a72a98db06e7e3e8ea2204645a5c470b (patch)
tree53a98514afe9a0f654fffdc0d2cf966ced285d06 /common/exechelp.h
parentPrepare for gpg-error change (diff)
downloadgnupg2-15330f36a72a98db06e7e3e8ea2204645a5c470b.tar.xz
gnupg2-15330f36a72a98db06e7e3e8ea2204645a5c470b.zip
Reworked the posix and w32 exechelpers.
Diffstat (limited to 'common/exechelp.h')
-rw-r--r--common/exechelp.h39
1 files changed, 26 insertions, 13 deletions
diff --git a/common/exechelp.h b/common/exechelp.h
index 3a5b9e2b8..e6a0ee5e1 100644
--- a/common/exechelp.h
+++ b/common/exechelp.h
@@ -52,15 +52,24 @@ gpg_error_t gnupg_create_inbound_pipe (int filedes[2]);
gpg_error_t gnupg_create_outbound_pipe (int filedes[2]);
-/* Fork and exec the PGMNAME, connect the file descriptor of INFILE to
- stdin, write the output to OUTFILE. INFILE or PUTFILE may be NULL
- to connect thenm to /dev/null. Returns a new stream in STATUSFILE
- for stderr and the pid of the process in PID. 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, that function will be called right before the exec.
- Calling gnupg_wait_process and gnupg_release_process is required.
- Returns 0 on success or an error code.
+/* Fork and exec the PGMNAME. If INFP is NULL connect /dev/null to
+ stdin of the new process; if it is not NULL connect the file
+ descriptor retrieved from INFP to stdin. If R_OUTFP is NULL
+ connect stdout of the new process to /dev/null; if it is not NULL
+ store the address of a pointer to a new estream there. If R_ERRFP
+ is NULL connect stderr of the new process to /dev/null; if it is
+ not NULL store the address of a pointer to a new estream there. On
+ success the pid of the new process is stored at PID. On error -1
+ is stored at PID and if R_OUTFP or R_ERRFP are not NULL, NULL is
+ stored there.
+
+ 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.
+
+ Returns 0 on success or an error code. Calling gnupg_wait_process
+ and gnupg_release_process is required if the function succeeded.
FLAGS is a bit vector:
@@ -74,10 +83,14 @@ gpg_error_t gnupg_create_outbound_pipe (int filedes[2]);
allows SetForegroundWindow for all childs of this process.
*/
-gpg_error_t gnupg_spawn_process (const char *pgmname, const char *argv[],
- estream_t infile, estream_t outfile,
- void (*preexec)(void), unsigned int flags,
- estream_t *statusfile, pid_t *pid);
+gpg_error_t
+gnupg_spawn_process (const char *pgmname, const char *argv[],
+ gpg_err_source_t errsource,
+ void (*preexec)(void), unsigned int flags,
+ estream_t infp,
+ estream_t *r_outfp,
+ estream_t *r_errfp,
+ pid_t *pid);
/* Simplified version of gnupg_spawn_process. This function forks and