Last change
on this file was
444,
checked in by satin@…, 6 years ago
|
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc
|
File size:
1.3 KB
|
Line | |
---|
1 | #include <string.h> |
---|
2 | #include <signal.h> |
---|
3 | #include <stdio.h> |
---|
4 | #include <reent.h> |
---|
5 | |
---|
6 | static const char *sigstring[] = |
---|
7 | { |
---|
8 | "Signal 0", |
---|
9 | "Hangup", |
---|
10 | "Interrupt", |
---|
11 | "Quit", |
---|
12 | "Illegal instruction", |
---|
13 | "Trace/breakpoint trap", |
---|
14 | "IOT trap", |
---|
15 | "EMT trap", |
---|
16 | "Floating point exception", |
---|
17 | "Killed", |
---|
18 | "Bus error", |
---|
19 | "Segmentation fault", |
---|
20 | "Bad system call", |
---|
21 | "Broken pipe", |
---|
22 | "Alarm clock", |
---|
23 | "Terminated", |
---|
24 | "Urgent I/O condition", |
---|
25 | "Stopped (signal)", |
---|
26 | "Stopped", |
---|
27 | "Continued", |
---|
28 | "Child exited", |
---|
29 | "Stopped (tty input)", |
---|
30 | "Stopped (tty output)", |
---|
31 | "I/O possible", |
---|
32 | "CPU time limit exceeded", |
---|
33 | "File size limit exceeded", |
---|
34 | "Virtual timer expired", |
---|
35 | "Profiling timer expired", |
---|
36 | "Window changed", |
---|
37 | "Resource lost", |
---|
38 | "User defined signal 1", |
---|
39 | "User defined signal 2" |
---|
40 | }; |
---|
41 | |
---|
42 | char * |
---|
43 | strsignal (int sig) |
---|
44 | { |
---|
45 | if (sig < 0 || sig >= __SIGRTMIN) |
---|
46 | { |
---|
47 | char *buffer; |
---|
48 | struct _reent *ptr; |
---|
49 | |
---|
50 | ptr = _REENT; |
---|
51 | |
---|
52 | _REENT_CHECK_SIGNAL_BUF(ptr); |
---|
53 | buffer = _REENT_SIGNAL_BUF(ptr); |
---|
54 | |
---|
55 | if (sig < 0 || sig > __SIGRTMAX) |
---|
56 | siprintf (buffer, "Unknown signal %d", sig); |
---|
57 | else |
---|
58 | siprintf (buffer, "Real-time signal %d", sig - __SIGRTMIN); |
---|
59 | return buffer; |
---|
60 | } |
---|
61 | else |
---|
62 | return sigstring[sig]; |
---|
63 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.