Module signal

POSIX Signals

Functions

kill (pid[, sig]) Sends a signal to a process.
sigmask (sig[, cmd]) Modifies signal mask for current task.
sigpending () Checks if the current task has pending signals.
sigstate (sig[, state]) Checks signal state for current task.

Tables

flags Signal constants.


Functions

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

Parameters:

  • pid integer Target process ID.
  • sig integer Signal to send (default: signal.flags.KILL). (optional)

Returns:

    boolean true on success.

Raises:

Error if the process is not found or the operation is not permitted.
sigmask (sig[, cmd])
Modifies signal mask for current task.

Parameters:

  • sig integer Signal number.
  • cmd integer SIGBLOCK (0, default) or SIGUNBLOCK (1). (optional)

Raises:

Error if the signal is invalid or the operation is not permitted.
sigpending ()
Checks if the current task has pending signals.

Returns:

    boolean
sigstate (sig[, state])
Checks signal state for current task.

Parameters:

  • sig integer Signal number.
  • state string "blocked" (default), "pending", or "allowed". (optional)

Returns:

    boolean

Usage:

    signal.sigstate(15) -- check if SIGTERM is blocked
    signal.sigstate(signal.flags.TERM, "pending")

Tables

flags
Signal constants.
generated by LDoc 1.5.0 Last updated 2026-03-31 12:21:45