3 <<strsignal>>---convert signal number to string
10 char *strsignal(int <[signal]>);
13 <<strsignal>> converts the signal number <[signal]> into a
14 string. If <[signal]> is not a known signal number, the result
15 will be of the form "Unknown signal NN" where NN is the <[signal]>
19 This function returns a pointer to a string. Your application must
20 not modify that string.
23 POSIX.1-2008 C requires <<strsignal>>, but does not specify the strings used
24 for each signal number.
26 <<strsignal>> requires no supporting OS subroutines.
33 * Written by Joel Sherrill <joel.sherrill@OARcorp.com>.
35 * COPYRIGHT (c) 2010, 2017.
36 * On-Line Applications Research Corporation (OAR).
38 * Permission to use, copy, modify, and distribute this software for any
39 * purpose without fee is hereby granted, provided that this entire notice
40 * is included in all copies of any software which is or includes a copy
41 * or modification of this software.
43 * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
44 * WARRANTY. IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION
45 * OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS
46 * SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
55 #ifdef _REENT_THREAD_LOCAL
56 _Thread_local
char _tls_signal_buf
[_REENT_SIGNAL_SIZE
];
60 strsignal (int signal
)
67 _REENT_CHECK_SIGNAL_BUF(ptr
);
68 buffer
= _REENT_SIGNAL_BUF(ptr
);
70 #if defined(SIGRTMIN) && defined(SIGRTMAX)
71 if ((signal
>= SIGRTMIN
) && (signal
<= SIGRTMAX
)) {
72 siprintf (buffer
, "Real-time signal %d", signal
- SIGRTMIN
);
95 buffer
= "Illegal instruction";
100 buffer
= "Trace/breakpoint trap";
104 #if defined(SIGABRT) && (SIGIOT != SIGABRT)
118 buffer
= "Floating point exception";
128 buffer
= "Bus error";
133 buffer
= "Segmentation fault";
138 buffer
= "Bad system call";
143 buffer
= "Broken pipe";
148 buffer
= "Alarm clock";
153 buffer
= "Terminated";
158 buffer
= "Urgent I/O condition";
163 buffer
= "Stopped (signal)";
173 buffer
= "Continued";
177 #if defined(SIGCLD) && (SIGCHLD != SIGCLD)
181 buffer
= "Child exited";
186 buffer
= "Stopped (tty input)";
191 buffer
= "Stopped (tty output)";
195 #if defined(SIGPOLL) && (SIGIO != SIGPOLL)
199 buffer
= "I/O possible";
204 buffer
= "Window changed";
209 buffer
= "User defined signal 1";
214 buffer
= "User defined signal 2";
219 buffer
= "Power Failure";
224 buffer
= "CPU time limit exceeded";
229 buffer
= "File size limit exceeded";
234 buffer
= "Virtual timer expired";
239 buffer
= "Profiling timer expired";
242 #if defined(SIGLOST) && SIGLOST != SIGPWR
244 buffer
= "Resource lost";
248 siprintf (buffer
, "Unknown signal %d", signal
);