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 * ASSUMPTIONS: sargv[0] is the same as spath (or its last component).
35 pmgt_ProcessSpawnVE(const char *spath, char *sargv[], char *senvp[],
40 /* create child process to exec spath */
41 if ((pid = fork()) == 0) {
45 /* close random fd's above stderr */
46 for (i = 3; i < 64; i++) {
51 execve(spath, sargv, senvp);
56 /* this point is only reached if exec() failed */