Paraslash Audio Streaming | |
About News Download Documentation Development |
Helper functions for spawning new processes. More...
Functions | |
int | para_exec_cmdline_pid (pid_t *pid, const char *cmdline, int *fds) |
Execute a file as a background process, honoring $PATH. More... | |
Helper functions for spawning new processes.
int para_exec_cmdline_pid | ( | pid_t * | pid, |
const char * | cmdline, | ||
int * | fds | ||
) |
Execute a file as a background process, honoring $PATH.
pid | Contains the PID of the child process on return. |
cmdline | Path to the file to execute, followed by arguments. |
fds | A pointer to a value-result array. |
This function first splits the command line argument by calling create_argv(), then calls fork(2) to create a new process. The parent returns without waiting for the child to terminate. The child calls execvp(2) to replace itself with the process image that corresponds to the first word of the given command line.
The fd pointer must point to an array of three integers. Initially, the integers specify how to deal with fd 0, 1, 2 in the child:
- < 0: Leave fd alone. - == 0: Dup fd to /dev/null. - > 0: Create a pipe and dup to one end of that pipe.
In the third case, the corresponding integer in the fd array is set to the file descriptor of the pipe that has been created. In any case, all unneeded file descriptors are closed.
References create_argv().