Creates a new process, with the specified characteristics.
#include <proc.h> pid_t procve ( const char *path, unsigned long flags, const char *env[], wiring_t *wiring, struct fd_set *fds, void *appdata, size_t appdata_size, void *reserved, const char *argv[] );
(IN) Points to the location of the binary for the process. The path is relative to $cwd unless a full path is specified.
(IN) Specifies one or more flags that influence how the process is created. See Process Flags.
(IN) Points to an array of environment variables. If passed as NULL, the child process inherits the parent's environment at the time of the call.
(IN) Points to file descriptors for standard input, standard output, and errno for the process. Pass NULL to inherit system defaults for wiring. To set up application-specific values, see wiring_t.
(IN) Points to a list of files to open. Not currently implemented. Pass in NULL.
(IN) Points to application-supplied data. Not currently implemented. Pass in NULL.
(IN) Specifies the size, in bytes, of the application data. Not currently implemented. Pass in 0.
(IN) Reserved. Pass NULL.
(IN) Points to an array of arguments. The first argument argv [0] must be the name of the executable. Subsequent arguments are command line parameters for the executable. The last argument in the array must be NULL, to indicate the end.
If the PROC_DETACHED flag is not set, returns a process ID on success. Otherwise, returns -1 and sets errno. The most common errors are listed below.
If the PROC_DETACHED flag is set, returns 0 on success. Otherwise, returns -1 and sets errno. The most common errors are listed below.
The procve function is a partial replacement for the fork function immediately followed by a call to the exec function. If you are using the latest support pack, the procve function can start either a LibC based NLM or a CLib based NLM.
If you create a detached process by setting the PROC_DETACHED flag, this function does not return the process ID of the detached process because you cannot perform any operations on a detached process.
The fds parameter allows the parent to specify which, if any, of its open file descriptors are to be opened in the new process. Not all file types can be opened successfully:
If any of the file descriptors specified was opened with the FD_CLOEXEC flag, the file cannot be opened in the new process.
If any of the file descriptors specified reference FIFOs, the pipe in the parent is marked “stale,” and the only function the parent can successfully call with that file descriptor is close.
For sample code, see ProcXe.c.