Creates a subprocess and returns a PROCESS identifying the new
process. Optionally redirects standard input, output, error
file handles to supplied file handles, changes working
directory, and environment. In some operating systems can also
optinally change the root directory (chroot()), and the uid/gid
with which the new process runs. All information required to
start the new process is specified in a PROCESS_DATA structure.
Where elements are not specified, they remain the same as the
current process. The following elements can be specified in the
PROCESS_DATA structure:
filename | File to execute,
can include arguments if argv is NULL. |
argv [] | List of
arguments; argv [0] is filename; ends in a NULL. |
path | Search path
(environments PATH is used if NULL). |
shell | Shell to use if
useshell is TRUE (default is OS specific) |
searchext | Array of
extensions to search when looking for filename |
searchpath | Flag: TRUE
indicates path should be searched for filename |
useshell | Flag: TRUE
indicates program should be started via a shell |
createdaemon | Flag: TRUE
indicates a (separate) daemon should be started |
wait | Flag: TRUE indicates
wait for process to finish |
delay
| Amount of time to wait around for errors to
happen (unix) |
rootdir | Root directory for new process (chroot()) if not
NULL |
workdir | Working directory; if NULL, remains in current
directory. |
in | File handle to use for standard input; -2 = no
redirection. |
out | File handle to use for standard output; -2 = no
redirection. |
err | File handle to use for standard error; -2 = no
redirection. |
no handles | Number of file handles to pass to child process
(default: 3) |
envv [] | Whole environment for new process; if NULL current
env used |
envadd | Strings to add into current environment (if envv
NULL). |
envrm | Keys
to remove from current environment (if envv NULL). |
username | user name under
which to run process |
groupname | groupname associated with user name |
password | required if
calling process is not privileged |
If argv is NULL,
parses the filename argument into words delimited by whitespace
and builds the necessary argv table automatically. Use this
feature to execute a command with arguments, specified as one
string. To search for the program in the path set searchpath to
TRUE, and optionally supply a path to search. To run shell
builtins set useshell to TRUE. The envv list consists of
strings in the form "name=value", ending in a NULL pointer. If
the envv argument is null, the environment of the current
process is passed, with additions from envadd (if not NULL),
and the keys listed in envrm removed (if not NULL). If envv is
not null then the envv environment is used as is. The child
process may optionally start in a new root directory and with a
different user/group (if supported by the operating system). If
rootdir, workdir, user, and group are all non null, then they
are processed in the order: rootdir, workdir, group, user, to
ensure all changes take place. Note that in this instance
workdir is relative to the new root directory. Under DOS,
Windows, and OS/2, the rootdir may be used to specify a change
to a new drive letter (processed by _chdir() or _chdir2()). If
the child command detects an error at startup, it may exit with
an error status. The sleep allows this error to be collected by
calling