NAME
signalname,
signalnumber,
signalnext —
convert between signal
numbers and names
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <signal.h>
const char *
signalname(
int
sig);
int
signalnumber(
const
char *name);
int
signalnext(
int
sig);
DESCRIPTION
The
signalname() function takes a signal number
sig, and returns the name of that signal. The name
returned is locale independent, and can be the string representation of one of
the signal names from
<signal.h>
such as
SIGHUP
,
SIGSTOP
,
SIGKILL
, or some similar name, but does not contain
the leading “
SIG
” prefix.
The return value of
signalname() is
NULL
if
sig does not represent a
valid signal number, or if the signal number given has no name.
The
signalnumber() function converts the signal name
name to the number corresponding to that signal. The
name is handled in a case-insensitive manner. Any
leading “
SIG
” prefix in
name is ignored.
The
signalnumber() function returns the signal number, or zero
(0) if the name given does not represent a valid signal.
The
signalnext() function takes a signal number, and returns
the number of the next available bigger signal number. When no higher signal
numbers remain, it returns zero (0). The parameter
sig
can be given as zero (0), to obtain the smallest implemented signal number.
The
signalnext() function returns minus one (-1) on error, if
the given signal
sig is neither a valid signal number
nor zero. It returns zero when the input signal number,
sig, is the biggest available signal number. Otherwise
it returns the signal number of an implemented signal that is larger than
sig and such that there are no implemented signals with
values between
sig and the value returned.
The
signalnext() function can also be used to determine if a
non-zero signal number is valid or not (0 is always invalid, but cannot be
detected as such this way.) Given the non-zero signal number to check as
sig, if
signalnext() returns anything
other than minus one (-1) then
sig represents a valid
signal number. If the return value is -1 then
sig is
invalid.
SEE ALSO
kill(1),
intro(2),
psignal(3),
strsignal(3)
HISTORY
The
signalname(),
signalnext(), and
signalnumber() functions first appeared in
NetBSD 8.0.