2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 #include <afsconfig.h>
11 #include <afs/param.h>
17 #include "pmgtprivate.h"
20 /* ----------------- Processes ---------------- */
24 * pmgt_ProcessSpawnVE() -- Spawn a process (Unix fork()/execve() semantics)
26 * Returns pid of the child process ((pid_t)-1 on failure with errno set).
28 * Notes: A senvp value of NULL results in Unix fork()/execv() semantics.
29 * Open files are not inherited, except stdin, stdout, and stderr.
30 * If child fails to exec() spath, its exit code is estatus.
32 * If provided, a signal mask will be set for the spawned process.
34 * ASSUMPTIONS: sargv[0] is the same as spath (or its last component).
37 pmgt_ProcessSpawnVE(const char *spath
, char *sargv
[], char *senvp
[],
38 int estatus
, sigset_t
*mask
)
42 /* create child process to exec spath */
43 if ((pid
= fork()) == 0) {
47 /* close random fd's above stderr */
48 for (i
= 3; i
< 64; i
++) {
52 sigprocmask(SIG_SETMASK
, mask
, NULL
);
55 execve(spath
, sargv
, senvp
);
60 /* this point is only reached if exec() failed */