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