VLC 4.0.0-dev
Loading...
Searching...
No Matches
Collaboration diagram for Process management:

Functions

int vlc_spawn (pid_t *pid, const char *file, const int *fdv, const char *const *argv)
 Spawn a child process (by file name).
 
int vlc_spawnp (pid_t *pid, const char *path, const int *fdv, const char *const *argv)
 Spawn a child process.
 
int vlc_waitpid (pid_t pid)
 Waits for a child process.
 

Detailed Description

Function Documentation

◆ vlc_spawn()

int vlc_spawn ( pid_t *  pid,
const char *  file,
const int *  fdv,
const char *const *  argv 
)

Spawn a child process (by file name).

This function creates a child process. For all practical purposes, it is identical to vlc_spawnp(), with one exception: vlc_spawn() does not look for the executable file name in the OS-defined search path. Instead the file name must be absolute.

Parameters
pidstorage space for the child process identifier [OUT]
fileexecutable file path [IN]
fdvfile descriptor array [IN]
argvNULL-terminated array of command line arguments [IN]
Returns
0 on success or a standard error code on failure

◆ vlc_spawnp()

int vlc_spawnp ( pid_t *  pid,
const char *  path,
const int *  fdv,
const char *const *  argv 
)

Spawn a child process.

This function creates a child process. The created process will run with the same environment and privileges as the calling process.

An array of file descriptors must be provided for the child process:

  • fdv[0] is the standard input (or -1 for nul input),
  • fdv[1] is the standard output (or -1 for nul output),
  • fdv[2] is the standard error (or -1 to ignore). The array must have at least 4 elements and be terminated by -1. Some platforms will ignore file descriptors other than the three standard ones, so those should not be used in code intended to be portable.

vlc_waitpid() must be called to collect outstanding system resources after the child process terminates.

Parameters
pidstorage space for the child process identifier [OUT]
pathexecutable path [IN]
fdvfile descriptor array [IN]
argvNULL-terminated array of command line arguments [IN]
Returns
0 on success or a standard error code on failure

Referenced by vlc_getProxyUrl().

◆ vlc_waitpid()

int vlc_waitpid ( pid_t  pid)

Waits for a child process.

This function waits until a child process created by vlc_spawn() or vlc_spawnp() has completed and releases any associated system resource.

Parameters
pidprocess identifier as returned by vlc_spawn() or vlc_spawnp()
Returns
If the process terminates cleanly, this function returns the exit code of the process. Otherwise, it returns an implementation-defined value that is not a valid exit code.

References vlc_assert_unreachable.

Referenced by vlc_getProxyUrl().