Stdio.Syscall behaviour (stdio v0.1.0)
System call portability for operating systems.
Link to this section Summary
Callbacks
Operations required to disable setuid.
Path to procfs file system
Terminate descendents of a supervisor process.
Terminate a process subtree (descendents of a child process) of the supervisor.
Operations required to terminate a process if the parent exits.
Set the process title.
Set process as init(1) for descendent processes.
Functions
The default implementation for disable_setuid/0
Get the syscall implementation for this platform.
Terminating descendents of a supervisor process
Terminate descendents of a process.
The default implementation for set_pdeathsig/0
The default implementation for setproctitle/2
The default implementation for subreaper/1
Link to this section Callbacks
disable_setuid()
@callback disable_setuid() :: [Stdio.Op.t()]
Operations required to disable setuid.
procfs()
@callback procfs() :: String.t()
Path to procfs file system
reap(task, atom)
@callback reap(:prx.task(), atom()) :: :ok | {:error, :prx.posix()}
Terminate descendents of a supervisor process.
reap(task, pid_t, atom)
@callback reap(:prx.task(), :prx.pid_t(), atom()) :: :ok | {:error, :prx.posix()}
Terminate a process subtree (descendents of a child process) of the supervisor.
set_pdeathsig()
@callback set_pdeathsig() :: [Stdio.Op.t()]
Operations required to terminate a process if the parent exits.
setproctitle(task, t)
@callback setproctitle(:prx.task(), String.t()) :: :ok | {:error, :prx.posix()}
Set the process title.
subreaper(task)
@callback subreaper(:prx.task()) :: :ok | {:error, :prx.posix()}
Set process as init(1) for descendent processes.
Link to this section Functions
disable_setuid()
The default implementation for disable_setuid/0
Disabling the ability for the process to escalate privileges is not available on this platform.
@spec os() :: module()
Get the syscall implementation for this platform.
The default implementation is based on the operating system.
Set the implementation by configuring the application environment:
import Config
config :stdio, :syscall, Stdio.Syscall.Linux
procfs()
The default implementation for procfs/0
reap(task, signal)
Terminating descendents of a supervisor process
reap(task, pid, signal)
Terminate descendents of a process.
reap signals subprocesses of a process identified by PID. If the
process called PR_SET_CHILD_SUBREAPER
, background and daemonized
subprocesses will also be terminated.
Note: terminating subprocesses using this method is subject to race conditions:
new processes may have been forked
processes may have exited and unrelated processes assigned the PID
processes may ignore some signals
processes may not immediately exit after signalling
set_pdeathsig()
The default implementation for set_pdeathsig/0
Signalling a process when the parent has exited is not available on this platform.
setproctitle(task, title)
The default implementation for setproctitle/2
Uses :prx.setproctitle/2
on all platforms.
subreaper(task)
The default implementation for subreaper/1
No changes are made to the process: background processes will not be terminated.