Debian Codegraph @

upstream/debian-trixie/man3/strsignal.3

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