View Source Stdio.Syscall behaviour (stdio v0.4.4)

System call portability for operating systems.

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.

Fork a subprocess.

Set process as init(1) for descendent processes.

Functions

The default implementation for disable_setuid/0

Get the syscall implementation for this platform.

The default implementation for procfs/0

Terminate 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 subprocess/1

The default implementation for subreaper/1

Callbacks

@callback disable_setuid() :: [Stdio.Op.t()]

Operations required to disable setuid.

@callback procfs() :: String.t()

Path to procfs file system

@callback reap(Stdio.ProcessTree.t(), atom()) :: :ok | {:error, :prx.posix()}

Terminate descendents of a supervisor process.

@callback reap(Stdio.ProcessTree.t(), :prx.pid_t(), atom()) ::
  :ok | {:error, :prx.posix()}

Terminate a process subtree (descendents of a child process) of the supervisor.

@callback set_pdeathsig() :: [Stdio.Op.t()]

Operations required to terminate a process if the parent exits.

@callback setproctitle(:prx.task(), String.t()) :: :ok | {:error, :prx.posix()}

Set the process title.

@callback subprocess(Keyword.t()) :: (:prx.task() ->
                              {:ok, [Stdio.ProcessTree.t()]}
                              | {:error, :prx.posix()})

Fork a subprocess.

@callback subreaper(:prx.task()) :: :ok | {:error, :prx.posix()}

Set process as init(1) for descendent processes.

Functions

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

The default implementation for procfs/0

Link to this function

reap(process_tree, signal)

View Source

Terminate descendents of a supervisor process.

Link to this function

reap(process_tree, pid, signal)

View Source

Terminate descendents of a process.

Signals the process group for each child process.

The default implementation for set_pdeathsig/0

Signalling a process when the parent has exited is not available on this platform.

Link to this function

setproctitle(task, title)

View Source

The default implementation for setproctitle/2

Uses :prx.setproctitle/2 on all platforms.

The default implementation for subprocess/1

fork(2) a subprocess from the supervisor.

The default implementation for subreaper/1

No changes are made to the process: background processes will not be terminated.