Lunatik

signalModule

Sends signals to processes.

Usage

local signal = require("signal")
local sig    = require("linux.signal")

signal.kill(1234, sig.TERM)

Functions

kill (pid[, sig]) Sends a signal to a process.

Functions in detail

kill (pid[, sig])
Sends a signal to a process.

Parameters

  • pid integer Target process ID, 1 to PID_MAX_LIMIT, in the initial pid namespace: the number task:pid() returns, whichever task makes the call.
  • sig integer Signal to send, 0 to _NSIG (default: KILL, from linux.signal); 0 sends nothing and checks that the process exists. (optional)

Returns

    boolean true once the signal is sent, or the process found for signal 0; nil and "ESRCH" if no process has that pid.

Raises

Error if the pid or the signal is out of bounds, and “not allowed with IRQs disabled” when called with IRQs disabled, as in every callback of a hardirq runtime, a probe’s handlers among them, where the CPU may already hold a lock the signal takes. The signal is sent with the kernel’s privilege, so no permission check applies.