1strsignal(3) Library Functions Manual strsignal(3)
2
3
4
6 strsignal, sigabbrev_np, sigdescr_np, sys_siglist - return string de‐
7 scribing signal
8
10 Standard C library (libc, -lc)
11
13 #include <string.h>
14
15 char *strsignal(int sig);
16 const char *sigdescr_np(int sig);
17 const char *sigabbrev_np(int sig);
18
19 [[deprecated]] extern const char *const sys_siglist[];
20
21 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
22
23 sigabbrev_np(), sigdescr_np():
24 _GNU_SOURCE
25
26 strsignal():
27 From glibc 2.10 to glibc 2.31:
28 _POSIX_C_SOURCE >= 200809L
29 Before glibc 2.10:
30 _GNU_SOURCE
31
32 sys_siglist:
33 Since glibc 2.19:
34 _DEFAULT_SOURCE
35 glibc 2.19 and earlier:
36 _BSD_SOURCE
37
39 The strsignal() function returns a string describing the signal number
40 passed in the argument sig. The string can be used only until the next
41 call to strsignal(). The string returned by strsignal() is localized
42 according to the LC_MESSAGES category in the current locale.
43
44 The sigdescr_np() function returns a string describing the signal num‐
45 ber passed in the argument sig. Unlike strsignal() this string is not
46 influenced by the current locale.
47
48 The sigabbrev_np() function returns the abbreviated name of the signal,
49 sig. For example, given the value SIGINT, it returns the string "INT".
50
51 The (deprecated) array sys_siglist holds the signal description strings
52 indexed by signal number. The strsignal() or the sigdescr_np() func‐
53 tion should be used instead of this array; see also VERSIONS.
54
56 The strsignal() function returns the appropriate description string, or
57 an unknown signal message if the signal number is invalid. On some
58 systems (but not on Linux), NULL may instead be returned for an invalid
59 signal number.
60
61 The sigdescr_np() and sigabbrev_np() functions return the appropriate
62 description string. The returned string is statically allocated and
63 valid for the lifetime of the program. These functions return NULL for
64 an invalid signal number.
65
67 For an explanation of the terms used in this section, see at‐
68 tributes(7).
69
70 ┌───────────────┬───────────────┬──────────────────────────────────────┐
71 │Interface │ Attribute │ Value │
72 ├───────────────┼───────────────┼──────────────────────────────────────┤
73 │strsignal() │ Thread safety │ MT-Unsafe race:strsignal locale │
74 ├───────────────┼───────────────┼──────────────────────────────────────┤
75 │sigdescr_np(), │ Thread safety │ MT-Safe │
76 │sigabbrev_np() │ │ │
77 └───────────────┴───────────────┴──────────────────────────────────────┘
78
80 strsignal()
81 POSIX.1-2008.
82
83 sigdescr_np()
84 sigabbrev_np()
85 GNU.
86
87 sys_siglist
88 None.
89
91 strsignal()
92 POSIX.1-2008. Solaris, BSD.
93
94 sigdescr_np()
95 sigabbrev_np()
96 glibc 2.32.
97
98 sys_siglist
99 Removed in glibc 2.32.
100
102 sigdescr_np() and sigabbrev_np() are thread-safe and async-signal-safe.
103
105 psignal(3), strerror(3)
106
107
108
109Linux man-pages 6.04 2023-03-30 strsignal(3)