luaposix 35.1 Reference

# Module `posix.signal`

Software Signal Facilities.

Constants and functions for propagating signals among processes.

Note that `posix.signal.signal` is implemented with sigaction(2) for consistent semantics across platforms.

## Functions

kill (pid, opt) | Send a signal to the given process.
killpg (pgrp[, sig=`SIGTERM`]) | Send a signal to the given process group.
raise (sig) | Raise a signal on this process.
signal (signum[, handler=SIG_DFL[, flags]]) | Install a signal handler for this signal number.

## Constants

posix.signal | Signal constants.

## Functions

kill (pid, opt)
  Send a signal to the given process.

  ### Parameters:

  - pid int process to act on
  - opt int =`SIGTERM` sig signal to send

  ### Returns:

  int `0`, if successful

  ### Or

  1. nil
  2. string error message
  3. int errnum

  ### See also:

  kill(2)
killpg (pgrp[, sig=`SIGTERM`])
  Send a signal to the given process group.

  ### Parameters:

  - pgrp int group id to act on, or `0` for the sending process`s group
  - sig int signal to send (default `SIGTERM`)

  ### Returns:

  int `0`, if successful

  ### Or

  1. nil
  2. string error message
  3. int errnum

  ### See also:

  killpg(2)
raise (sig)
  Raise a signal on this process.

  ### Parameters:

  - sig int signal to send

  ### Returns:

  int `0`, if successful

  ### Or

  1. nil
  2. string error message
  3. int errnum

  ### See also:

  raise(3)
signal (signum[, handler=SIG_DFL[, flags]])
  Install a signal handler for this signal number. Although this is the same API as signal(2), it uses sigaction for guaranteed semantics.

  ### Parameters:

  - signum int
  - handler function function, or `SIG_IGN` or `SIG_DFL` constants (default SIG_DFL)
  - flags the `sa_flags` element of `struct sigaction` (optional)

  ### Returns:

  function previous handler function

  ### See also:

  - sigaction(2)
  - signal.lua

## Constants

posix.signal
  Signal constants. Any constants not available in the underlying system will be `nil` valued.

  ### Fields:

  - SIGABRT int abort ()
  - SIGALRM int alarm clock
  - SIGBUS int bus error
  - SIGCHLD int to parent on child stop or exit
  - SIGCONT int continue a stopped process
  - SIGFPE int floating point error
  - SIGHUP int hangup
  - SIGILL int illegal instruction
  - SIGINFO int information request
  - SIGINT int interrupt
  - SIGKILL int kill
  - SIGPIPE int write on pipe with no reader
  - SIGQUIT int quit
  - SIGSEGV int segmentation violation
  - SIGSTOP int stop
  - SIGSYS int bad argument to system call
  - SIGTERM int terminate
  - SIGTRAP int trace trap
  - SIGTSTP int stop signal from tty
  - SIGTTIN int to readers process group on background tty read
  - SIGTTOU int to readers process group on background tty output
  - SIGURG int urgent condition on i/o channel
  - SIGUSR1 int user defined
  - SIGUSR2 int user defined
  - SIGVTALRM int virtual time alarm
  - SIGWINCH int window size change
  - SIGXCPU int exceeded cpu time limit
  - SIGXFSZ int exceeded file size limit
  - SA_NOCLDSTOP int do not generate a SIGCHLD on child stop
  - SA_NOCLDWAIT int don't keep zombies child processes
  - SA_NODEFER int don't mask the signal we're delivering
  - SA_RESETHAND int reset to SIG_DFL when taking a signal
  - SA_RESTART int allow syscalls to restart instead of returning EINTR

  ### Usage:

      -- Print signal constants supported on this host.
      for name, value in pairs (require "posix.signal") do
        if type (value) == "number" then
          print (name, value)
         end
      end

generated by LDoc 1.4.6 Last updated 2021-09-09 17:41:28