luaposix 33.4.0 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:

  - signal.lua
  - sigaction(2)

## 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
  - SIGINT int interrupt
  - SIGKILL int kill
  - SIGPIPE int write on pipe with no reader
  - SIGQUIT int quit
  - SIGSEGV int segmentation violation
  - SIGSTOP int stop
  - SIGTERM int terminate
  - 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
  - SIGUSR1 int user defined
  - SIGUSR2 int user defined
  - SIGSYS int bad argument to system call
  - SIGTRAP int trace trap
  - SIGURG int urgent condition on i/o channel
  - SIGVTALRM int virtual time alarm
  - 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_RESETHAND int reset to SIG_DFL when taking a signal
  - SA_NODEFER int don't mask the signal we're delivering

  ### 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.3 Last updated 2016-02-27 14:10:34