2020-08-21 01:56:56 +03:00
|
|
|
.\" $NetBSD: signalname.3,v 1.3 2020/08/20 22:56:56 kre Exp $
|
2017-05-09 14:14:16 +03:00
|
|
|
.\"
|
|
|
|
.\" Available to all and sundry, without restriction on use, or other
|
|
|
|
.\" limitations, and without fee. Also without any warranty of fitness
|
|
|
|
.\" for any purpose whatever.
|
|
|
|
.\"
|
|
|
|
.\" Licensed for any use, including redistribution in source
|
|
|
|
.\" and binary forms, with or without modifications, subject
|
|
|
|
.\" the following agreement:
|
|
|
|
.\"
|
|
|
|
.\" Licensee agrees to indemnify licensor, and distributor, for
|
|
|
|
.\" the full amount of any any claim made by the licensee against
|
|
|
|
.\" the licensor or distributor, for any action that results from
|
|
|
|
.\" any use or redistribution of this software, plus any costs
|
|
|
|
.\" incurred by licensor or distributor resulting from that claim.
|
|
|
|
.\"
|
|
|
|
.\" This licence must be retained with the software.
|
|
|
|
.\"
|
|
|
|
.Dd April 28, 2017
|
|
|
|
.Dt SIGNALNAME 3
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
2017-05-14 15:35:46 +03:00
|
|
|
.Nm signalname ,
|
|
|
|
.Nm signalnumber ,
|
2017-05-09 14:14:16 +03:00
|
|
|
.Nm signalnext
|
|
|
|
.Nd convert between signal numbers and names
|
|
|
|
.Sh LIBRARY
|
|
|
|
.Lb libc
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.In signal.h
|
|
|
|
.Ft const char *
|
|
|
|
.Fn signalname "int sig"
|
|
|
|
.Ft int
|
|
|
|
.Fn signalnumber "const char *name"
|
|
|
|
.Ft int
|
|
|
|
.Fn signalnext "int sig"
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Fn signalname
|
|
|
|
function takes a signal number
|
|
|
|
.Fa 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
|
2017-05-14 15:35:46 +03:00
|
|
|
.In signal.h
|
|
|
|
such as
|
|
|
|
.Dv SIGHUP ,
|
|
|
|
.Dv SIGSTOP ,
|
|
|
|
.Dv SIGKILL ,
|
2017-05-09 14:14:16 +03:00
|
|
|
or some similar name,
|
|
|
|
but does not contain the leading
|
2017-05-14 15:35:46 +03:00
|
|
|
.Dq Dv SIG
|
2017-05-09 14:14:16 +03:00
|
|
|
prefix.
|
|
|
|
.Pp
|
|
|
|
The return value of
|
|
|
|
.Fn signalname
|
2017-05-14 15:35:46 +03:00
|
|
|
is
|
|
|
|
.Dv NULL
|
|
|
|
if
|
2017-05-09 14:14:16 +03:00
|
|
|
.Fa sig
|
|
|
|
does not represent a valid signal number,
|
|
|
|
or if the signal number given has no name.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn signalnumber
|
|
|
|
function converts the signal name
|
|
|
|
.Fa name
|
|
|
|
to the number corresponding to that signal.
|
|
|
|
The
|
|
|
|
.Fa name
|
|
|
|
is handled in a case-insensitive manner.
|
|
|
|
Any leading
|
2017-05-14 15:35:46 +03:00
|
|
|
.Dq Dv SIG
|
2017-05-09 14:14:16 +03:00
|
|
|
prefix in
|
|
|
|
.Fa name
|
|
|
|
is ignored.
|
|
|
|
.Pp
|
2020-08-21 01:56:56 +03:00
|
|
|
This implementation also accepts
|
|
|
|
.Dv rtmax Ns \&[\-n]
|
|
|
|
and
|
|
|
|
.Dv rtmin Ns \&[+n]
|
|
|
|
.Po
|
|
|
|
where the optional
|
|
|
|
.Ar n
|
|
|
|
is a decimal integer between 0 and SIGRTMAX\-SIGRTMIN
|
|
|
|
.Pc
|
|
|
|
to refer to the real time signals.
|
|
|
|
.Pp
|
2017-05-09 14:14:16 +03:00
|
|
|
The
|
|
|
|
.Fn signalnumber
|
|
|
|
function returns the signal number,
|
|
|
|
or zero (0) if the name given does not represent a valid signal.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn 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
|
|
|
|
.Fa sig
|
|
|
|
can be given as zero (0), to obtain the smallest implemented
|
|
|
|
signal number.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn signalnext
|
2020-08-21 01:56:56 +03:00
|
|
|
function returns minus one (\-1) on error,
|
|
|
|
that is, if the given signal
|
2017-05-09 14:14:16 +03:00
|
|
|
.Fa sig
|
2017-05-14 15:35:46 +03:00
|
|
|
is neither a valid signal number nor zero.
|
2017-05-09 14:14:16 +03:00
|
|
|
It returns zero when the input signal number,
|
|
|
|
.Fa sig ,
|
|
|
|
is the biggest available signal number.
|
|
|
|
Otherwise it returns the signal number of an implemented
|
|
|
|
signal that is larger than
|
|
|
|
.Fa sig
|
|
|
|
and such that there are no implemented signals with values
|
|
|
|
between
|
|
|
|
.Fa sig
|
|
|
|
and the value returned.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn 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
|
|
|
|
.Fa sig ,
|
|
|
|
if
|
|
|
|
.Fn signalnext
|
|
|
|
returns anything other than minus one (\-1)
|
|
|
|
then
|
|
|
|
.Fa sig
|
|
|
|
represents a valid signal number.
|
|
|
|
If the return value is \-1 then
|
|
|
|
.Fa sig
|
|
|
|
is invalid.
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr kill 1 ,
|
|
|
|
.Xr intro 2 ,
|
|
|
|
.Xr psignal 3 ,
|
|
|
|
.Xr strsignal 3
|
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Fn signalname ,
|
2017-05-14 15:35:46 +03:00
|
|
|
.Fn signalnext ,
|
2017-05-09 14:14:16 +03:00
|
|
|
and
|
|
|
|
.Fn signalnumber
|
|
|
|
functions first appeared in
|
|
|
|
.Nx 8.0 .
|