Multiprocess (multiprocess)#

group multiprocess

Process management (fork/exec, CPU affinity).

For an overview, see Multiprocess.

rcsw/multiprocess/procm.h#

Useful routines related to fork()/exec() process management.

Functions

status_t procm_socket_lock(int socket)#

Lock a process to a particular CPU socket.

Parameters:
  • socket – The socket to lock to, 0 indexed.

Returns:

OK if the lock with successful, ERROR otherwise.

pid_t procm_fork_exec(char **cmd, const char *new_wd, bool stdout_sup, int *pipefd)#

Wrapper for fork()/exec() functonality.

Parameters:
  • cmd – The cmd to run exec() on

  • new_wd – The new working directory of the fork()ed process, or NULL if no change is desired.

  • stdout_sup – If true, then the stdout of the child process will be sent to /dev/null. stderr is not touched.

  • pipefd – If not NULL, the child will read data from the parent’s stdin.

Returns:

The pid of the child in the parent, nothing in the child.