| 1 |
'\" t |
| 2 |
.\" Copyright 1993, David Metcalfe <[email protected]> |
| 3 |
.\" Copyright 2020, Michael Kerrisk <[email protected]> |
| 4 |
.\" Copyright, the authors of the Linux man-pages project |
| 5 |
.\" |
| 6 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 7 |
.\" |
| 8 |
.TH strsignal 3 2026-02-08 "Linux man-pages 6.18" |
| 9 |
.SH NAME |
| 10 |
strsignal, sigabbrev_np, sigdescr_np, sys_siglist \- |
| 11 |
return string describing signal |
| 12 |
.SH LIBRARY |
| 13 |
Standard C library |
| 14 |
.RI ( libc ,\~ \-lc ) |
| 15 |
.SH SYNOPSIS |
| 16 |
.nf |
| 17 |
.B #include <string.h> |
| 18 |
.P |
| 19 |
.BI "char *strsignal(int " sig ); |
| 20 |
.BI "const char *sigdescr_np(int " sig ); |
| 21 |
.BI "const char *sigabbrev_np(int " sig ); |
| 22 |
.P |
| 23 |
.BI "[[deprecated]] extern const char *const " sys_siglist []; |
| 24 |
.fi |
| 25 |
.P |
| 26 |
.RS -4 |
| 27 |
Feature Test Macro Requirements for glibc (see |
| 28 |
.BR feature_test_macros (7)): |
| 29 |
.RE |
| 30 |
.P |
| 31 |
.BR sigabbrev_np (), |
| 32 |
.BR sigdescr_np (): |
| 33 |
.nf |
| 34 |
_GNU_SOURCE |
| 35 |
.fi |
| 36 |
.P |
| 37 |
.BR strsignal (): |
| 38 |
.nf |
| 39 |
From glibc 2.10 to glibc 2.31: |
| 40 |
_POSIX_C_SOURCE >= 200809L |
| 41 |
Before glibc 2.10: |
| 42 |
_GNU_SOURCE |
| 43 |
.fi |
| 44 |
.P |
| 45 |
.IR sys_siglist : |
| 46 |
.nf |
| 47 |
Since glibc 2.19: |
| 48 |
_DEFAULT_SOURCE |
| 49 |
glibc 2.19 and earlier: |
| 50 |
_BSD_SOURCE |
| 51 |
.fi |
| 52 |
.SH DESCRIPTION |
| 53 |
The |
| 54 |
.BR strsignal () |
| 55 |
function returns a string describing the signal |
| 56 |
number passed in the argument |
| 57 |
.IR sig . |
| 58 |
The string can be used only until the next call to |
| 59 |
.BR strsignal (). |
| 60 |
The string returned by |
| 61 |
.BR strsignal () |
| 62 |
is localized according to the |
| 63 |
.B LC_MESSAGES |
| 64 |
category in the current locale. |
| 65 |
.P |
| 66 |
The |
| 67 |
.BR sigdescr_np () |
| 68 |
function returns a string describing the signal |
| 69 |
number passed in the argument |
| 70 |
.IR sig . |
| 71 |
Unlike |
| 72 |
.BR strsignal () |
| 73 |
this string is not influenced by the current locale. |
| 74 |
.P |
| 75 |
The |
| 76 |
.BR sigabbrev_np () |
| 77 |
function returns the abbreviated name of the signal, |
| 78 |
.IR sig . |
| 79 |
For example, given the value |
| 80 |
.BR SIGINT , |
| 81 |
it returns the string "INT". |
| 82 |
.P |
| 83 |
The (deprecated) array |
| 84 |
.I sys_siglist |
| 85 |
holds the signal description strings |
| 86 |
indexed by signal number. |
| 87 |
The |
| 88 |
.BR strsignal () |
| 89 |
or the |
| 90 |
.BR sigdescr_np () |
| 91 |
function should be used instead of this array; |
| 92 |
see also VERSIONS. |
| 93 |
.SH RETURN VALUE |
| 94 |
The |
| 95 |
.BR strsignal () |
| 96 |
function returns the appropriate description |
| 97 |
string, or an unknown signal message if the signal number is invalid. |
| 98 |
On some systems (but not on Linux), NULL may instead be |
| 99 |
returned for an invalid signal number. |
| 100 |
.P |
| 101 |
The |
| 102 |
.BR sigdescr_np () |
| 103 |
and |
| 104 |
.BR sigabbrev_np () |
| 105 |
functions return the appropriate description string. |
| 106 |
The returned string is statically allocated and valid for |
| 107 |
the lifetime of the program. |
| 108 |
These functions return NULL for an invalid signal number. |
| 109 |
.SH ATTRIBUTES |
| 110 |
For an explanation of the terms used in this section, see |
| 111 |
.BR attributes (7). |
| 112 |
.TS |
| 113 |
allbox; |
| 114 |
lb lb lbx |
| 115 |
l l l. |
| 116 |
Interface Attribute Value |
| 117 |
T{ |
| 118 |
.na |
| 119 |
.nh |
| 120 |
.BR strsignal () |
| 121 |
T} Thread safety T{ |
| 122 |
.na |
| 123 |
.nh |
| 124 |
MT-Unsafe race:strsignal locale |
| 125 |
T} |
| 126 |
T{ |
| 127 |
.na |
| 128 |
.nh |
| 129 |
.BR sigdescr_np (), |
| 130 |
.BR sigabbrev_np () |
| 131 |
T} Thread safety MT-Safe |
| 132 |
.TE |
| 133 |
.SH STANDARDS |
| 134 |
.TP |
| 135 |
.BR strsignal () |
| 136 |
POSIX.1-2008. |
| 137 |
.TP |
| 138 |
.BR sigdescr_np () |
| 139 |
.TQ |
| 140 |
.BR sigabbrev_np () |
| 141 |
GNU. |
| 142 |
.TP |
| 143 |
.I sys_siglist |
| 144 |
None. |
| 145 |
.\" glibc commit b1ccfc061feee9ce616444ded8e1cd5acf9fa97f |
| 146 |
.SH HISTORY |
| 147 |
.TP |
| 148 |
.BR strsignal () |
| 149 |
POSIX.1-2008. |
| 150 |
Solaris, BSD. |
| 151 |
.TP |
| 152 |
.BR sigdescr_np () |
| 153 |
.TQ |
| 154 |
.BR sigabbrev_np () |
| 155 |
glibc 2.32. |
| 156 |
.TP |
| 157 |
.I sys_siglist |
| 158 |
Removed in glibc 2.32. |
| 159 |
.SH NOTES |
| 160 |
.BR sigdescr_np () |
| 161 |
and |
| 162 |
.BR sigabbrev_np () |
| 163 |
are thread-safe and async-signal-safe. |
| 164 |
.SH SEE ALSO |
| 165 |
.BR psignal (3), |
| 166 |
.BR strerror (3) |