str2sig(3scl)str2sig(3scl)NAME
str2sig, sig2str - translation between signal name and signal number
LIBRARY
SCL Miscellaneous Library (libsolmisc.so, libsolmisc.a)
SYNOPSIS
#include <signal.h>
int str2sig(const char *str,
int *signum);
int sig2str(int signum,
char *str);
PARAMETERS
[str2sig] specifies the name of the signal for which the corresponding
number is returned
[sig2str] pointer to a buffer into which the signal name is
returned [str2sig] pointer to an integer location into which the
signal number is returned
[sig2str] specifies the signal number for which the name is to
be returned
DESCRIPTION
The str2sig() function maps the signal name, passed in parameter str,
to a signal number and stores that value in the address referenced by
the signum parameter. The name in str can be either the symbol for that
signal without the "SIG" prefix, or a decimal number (represented as a
string, for example "10").
All of the signals defined in sys/signal.h are accepted by this func‐
tion. To specify signals in the range SIGRTMIN to SIGRTMAX, the first
four signals can be referenced with "RTMIN", "RTMIN+1", "RTMIN+2", and
"RTMIN+3" and the last four with "RTMAX-3", "RTMAX-2", "RTMAX-1", and
"RTMAX".
The sig2str() function maps the signal number passed in parameter
signum to the symbol for that signal, without the "SIG" prefix, and
stores that symbol at the address specified by the str parameter. The
storage referenced by str should be large enough to hold the symbol and
a terminating null byte. Use the symbol SIG2STR_MAX, defined in sig‐
nal.h, to ensure that sufficient memory is allocated.
RETURN VALUES
The str2sig() function returns 0 if a valid signal name is specified,
otherwise, it returns -1.
The sig2str() function returns 0 if a valid signal number is specified,
otherwise, it returns -1.
SCL IMPLEMENTATION NOTES
The signal numbers defined for a given name (for example, SIGUSR1) may
differ between Tru64 UNIX and Solaris, therefore use of symbolic names
within source code is strongly recommended. Due to this difference, not
all signals can be specified using a numeric string (for example,
"10"). The highest signal value that is permitted to be specified with
this format is "15" (SIGTERM).
The signals supported by these routines are those that are defined on
Solaris and also supported by Tru64 UNIX. This means that some of the
signals defined on Solaris are invalid with these routines. Examples
are SIGFREEZE, SIGTHAW and SIGCANCEL. Tru64 UNIX also implements sig‐
nals that are not supported on Solaris, and these are not supported by
these routines either. Examples are additional realtime signals beyond
the eight supported on Solaris.
All signals supported by these routines are given below:
SIGABRT SIGALRM SIGBUS SIGCHLD SIGCLD SIGCONT
SIGEMT SIGFPE SIGHUP SIGILL SIGINT SIGIO
SIGIOT SIGKILL SIGLOST SIGPIPE SIGPOLL SIGPROF
SIGPWR SIGQUIT SIGSEGV SIGSTOP SIGSYS SIGTERM
SIGTRAP SIGTSTP SIGTTIN SIGTTOU SIGURG SIGUSR1
SIGUSR2 SIGVTALRM SIGWINCH SIGXCPU SIGXFSZ SIGRTMIN
SIGRTMIN+1 SIGRTMIN+2 SIGRTMIN+3 SIGRTMAX-3 SIGRTMAX-2 SIGRTMAX-1
SIGRTMAX
RELATED INFORMATION
Function: signal(2)
Manual: Solaris Compatibility Library User's Guide
str2sig(3scl)