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>
21 #include "pmgtprivate.h"
24 /* ----------------- Processes ---------------- */
28 * pmgt_ProcessSpawnVE() -- Spawn a process (Unix fork()/execve() semantics)
30 * Returns pid of the child process ((pid_t)-1 on failure with errno set).
32 * Notes: A senvp value of NULL results in Unix fork()/execv() semantics.
33 * Open files are not inherited, except stdin, stdout, and stderr.
34 * If child fails to exec() spath, its exit code is estatus.
36 * ASSUMPTIONS: sargv[0] is the same as spath (or its last component).
39 pmgt_ProcessSpawnVE(const char *spath, char *sargv[], char *senvp[],
44 /* create child process to exec spath */
45 if ((pid = fork()) == 0) {
49 /* close random fd's above stderr */
50 for (i = 3; i < 64; i++) {
55 execve(spath, sargv, senvp);
60 /* this point is only reached if exec() failed */