1
/* exechelp.h - Definitions for the fork and exec helpers
2
* Copyright (C) 2004 Free Software Foundation, Inc.
4
* This file is part of GnuPG.
6
* GnuPG is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* GnuPG is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
21
#ifndef GNUPG_COMMON_EXECHELP_H
22
#define GNUPG_COMMON_EXECHELP_H
26
/* Fork and exec the PGMNAME, connect the file descriptor of INFILE to
27
stdin, write the output to OUTFILE, return a new stream in
28
STATUSFILE for stderr and the pid of the process in PID. The
29
arguments for the process are expected in the NULL terminated array
30
ARGV. The program name itself should not be included there. if
31
PREEXEC is not NULL, that function will be called right before the
32
exec. Returns 0 on success or an error code. */
33
gpg_error_t gnupg_spawn_process (const char *pgmname, const char *argv[],
34
FILE *infile, FILE *outfile,
35
void (*preexec)(void),
36
FILE **statusfile, pid_t *pid);
38
/* Wait for the process identified by PID to terminate. PGMNAME should
39
be the same as suplieed to the spawn fucntion and is only used for
40
diagnostics. Returns 0 if the process succeded, GPG_ERR_GENERAL for
41
any failures of the spawned program or other error codes.*/
42
gpg_error_t gnupg_wait_process (const char *pgmname, pid_t pid);
45
#endif /*GNUPG_COMMON_EXECHELP_H*/