Go to main content

man pages section 3: Basic Library Functions

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

strsignal(3C)

Name

strsignal - get string describing signal

Synopsis

#include <string.h>

char *strsignal(int sig);

Description

The strsignal() function maps the signal number in sig to a string describing the signal and returns a pointer to that string. It uses the same set of the messages as psignal(3C).

The returned string should not be overwritten or freed by the caller. The returned pointer might be invalidated or the string content might be overwritten by a subsequent call to either strsignal() or setlocale(). The returned pointer might also be invalidated if the calling thread is terminated.

Return Values

The strsignal() function returns NULL if sig is not a valid signal number.

Usage

Messages returned from this function are in the native language specified by the LC_MESSAGES locale category. See setlocale(3C).

The strsignal() function returns a description of the signal, while the sig2str(3C) function returns the signal name (without the "SIG" prefix). For instance, strsignal(SIGHUP) in the "C" locale returns the string "Hangup", while sig2str(SIGHUP, buf) returns the string "HUP".

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Interface Stability
Committed
MT-Level
Safe
Standard
POSIX.1-2008, SUSv4, XPG7

See Also

gettext(3C), psignal(3C), setlocale(3C), sig2str(3C), attributes(7)

History

The strsignal() function has been included in Solaris since the Solaris 2.0 release.