Skip to main content

Module process

Module process 

Source
Expand description

Low-level process management primitives.

Safe wrappers around fork, setsid, setpgid, dup2, prctl, and fd-range close — building blocks for double-fork supervisor patterns.

Enums§

ForkResult
Result of a fork call.

Functions§

close_fds_from
Close all file descriptors >= start.
fork
Fork the current process.
redirect_fd_to
Duplicate src_fd onto dst_fd and close src_fd.
redirect_stdio_to_devnull
Redirect stdin, stdout, and stderr to /dev/null.
set_pdeathsig
Set the signal sent to this process when its parent dies (PR_SET_PDEATHSIG).
setgid
Drop process privileges to the given GID (setresgid).
setpgid
Set the process group ID of pid to pgid (use 0 for self).
setsid
Create a new session and set the calling process as leader.
setuid
Drop process privileges to the given UID (setresuid).