Mercurial > hg > octave-nkf
annotate src/siglist.c @ 14686:847ed7f603cf stable
Added tag rc-3-6-2-2 for changeset 4460c4fb20e6
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 24 May 2012 15:36:06 -0400 |
parents | 72c96de7a403 |
children |
rev | line source |
---|---|
3547 | 1 /* |
2 | |
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
3 Copyright (C) 2000-2012 John W. Eaton |
3547 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
3547 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
3547 | 20 |
21 */ | |
22 | |
23 #ifdef HAVE_CONFIG_H | |
24 #include <config.h> | |
25 #endif | |
26 | |
3579 | 27 #include <signal.h> |
28 | |
3547 | 29 #include "siglist.h" |
30 | |
5844 | 31 /* The following is all borrowed from Emacs. */ |
32 | |
33 #if ! (defined HAVE_STRSIGNAL || HAVE_DECL_SYS_SIGLIST) | |
34 | |
35 static char *my_sys_siglist[NSIG]; | |
36 | |
37 #ifdef sys_siglist | |
38 #undef sys_siglist | |
39 #endif | |
40 #define sys_siglist my_sys_siglist | |
41 | |
42 #endif | |
43 | |
44 void | |
45 init_signals (void) | |
3547 | 46 { |
5844 | 47 #if ! (defined HAVE_STRSIGNAL || HAVE_DECL_SYS_SIGLIST) |
48 | |
49 static int initialized = 0; | |
50 | |
51 if (! initialized) | |
52 { | |
53 initialized = 1; | |
54 | |
55 # ifdef SIGABRT | |
56 sys_siglist[SIGABRT] = "Aborted"; | |
57 # endif | |
58 # ifdef SIGAIO | |
59 sys_siglist[SIGAIO] = "LAN I/O interrupt"; | |
60 # endif | |
61 # ifdef SIGALRM | |
62 sys_siglist[SIGALRM] = "Alarm clock"; | |
63 # endif | |
64 # ifdef SIGBUS | |
65 sys_siglist[SIGBUS] = "Bus error"; | |
66 # endif | |
67 # ifdef SIGCLD | |
68 sys_siglist[SIGCLD] = "Child status changed"; | |
69 # endif | |
70 # ifdef SIGCHLD | |
71 sys_siglist[SIGCHLD] = "Child status changed"; | |
72 # endif | |
73 # ifdef SIGCONT | |
74 sys_siglist[SIGCONT] = "Continued"; | |
75 # endif | |
76 # ifdef SIGDANGER | |
77 sys_siglist[SIGDANGER] = "Swap space dangerously low"; | |
78 # endif | |
79 # ifdef SIGDGNOTIFY | |
80 sys_siglist[SIGDGNOTIFY] = "Notification message in queue"; | |
81 # endif | |
82 # ifdef SIGEMT | |
83 sys_siglist[SIGEMT] = "Emulation trap"; | |
84 # endif | |
85 # ifdef SIGFPE | |
86 sys_siglist[SIGFPE] = "Arithmetic exception"; | |
87 # endif | |
88 # ifdef SIGFREEZE | |
89 sys_siglist[SIGFREEZE] = "SIGFREEZE"; | |
90 # endif | |
91 # ifdef SIGGRANT | |
92 sys_siglist[SIGGRANT] = "Monitor mode granted"; | |
93 # endif | |
94 # ifdef SIGHUP | |
95 sys_siglist[SIGHUP] = "Hangup"; | |
96 # endif | |
97 # ifdef SIGILL | |
98 sys_siglist[SIGILL] = "Illegal instruction"; | |
99 # endif | |
100 # ifdef SIGINT | |
101 sys_siglist[SIGINT] = "Interrupt"; | |
102 # endif | |
103 # ifdef SIGIO | |
104 sys_siglist[SIGIO] = "I/O possible"; | |
105 # endif | |
106 # ifdef SIGIOINT | |
107 sys_siglist[SIGIOINT] = "I/O intervention required"; | |
108 # endif | |
109 # ifdef SIGIOT | |
110 sys_siglist[SIGIOT] = "IOT trap"; | |
111 # endif | |
112 # ifdef SIGKILL | |
113 sys_siglist[SIGKILL] = "Killed"; | |
114 # endif | |
115 # ifdef SIGLOST | |
116 sys_siglist[SIGLOST] = "Resource lost"; | |
117 # endif | |
118 # ifdef SIGLWP | |
119 sys_siglist[SIGLWP] = "SIGLWP"; | |
120 # endif | |
121 # ifdef SIGMSG | |
122 sys_siglist[SIGMSG] = "Monitor mode data available"; | |
123 # endif | |
124 # ifdef SIGPHONE | |
125 sys_siglist[SIGWIND] = "SIGPHONE"; | |
126 # endif | |
127 # ifdef SIGPIPE | |
128 sys_siglist[SIGPIPE] = "Broken pipe"; | |
129 # endif | |
130 # ifdef SIGPOLL | |
131 sys_siglist[SIGPOLL] = "Pollable event occurred"; | |
132 # endif | |
133 # ifdef SIGPROF | |
134 sys_siglist[SIGPROF] = "Profiling timer expired"; | |
135 # endif | |
136 # ifdef SIGPTY | |
137 sys_siglist[SIGPTY] = "PTY I/O interrupt"; | |
138 # endif | |
139 # ifdef SIGPWR | |
140 sys_siglist[SIGPWR] = "Power-fail restart"; | |
141 # endif | |
142 # ifdef SIGQUIT | |
143 sys_siglist[SIGQUIT] = "Quit"; | |
144 # endif | |
145 # ifdef SIGRETRACT | |
146 sys_siglist[SIGRETRACT] = "Need to relinguish monitor mode"; | |
147 # endif | |
148 # ifdef SIGSAK | |
149 sys_siglist[SIGSAK] = "Secure attention"; | |
150 # endif | |
151 # ifdef SIGSEGV | |
152 sys_siglist[SIGSEGV] = "Segmentation violation"; | |
153 # endif | |
154 # ifdef SIGSOUND | |
155 sys_siglist[SIGSOUND] = "Sound completed"; | |
156 # endif | |
157 # ifdef SIGSTOP | |
158 sys_siglist[SIGSTOP] = "Stopped (signal)"; | |
159 # endif | |
160 # ifdef SIGSTP | |
161 sys_siglist[SIGSTP] = "Stopped (user)"; | |
162 # endif | |
163 # ifdef SIGSYS | |
164 sys_siglist[SIGSYS] = "Bad argument to system call"; | |
165 # endif | |
166 # ifdef SIGTERM | |
167 sys_siglist[SIGTERM] = "Terminated"; | |
168 # endif | |
169 # ifdef SIGTHAW | |
170 sys_siglist[SIGTHAW] = "SIGTHAW"; | |
171 # endif | |
172 # ifdef SIGTRAP | |
173 sys_siglist[SIGTRAP] = "Trace/breakpoint trap"; | |
174 # endif | |
175 # ifdef SIGTSTP | |
176 sys_siglist[SIGTSTP] = "Stopped (user)"; | |
177 # endif | |
178 # ifdef SIGTTIN | |
179 sys_siglist[SIGTTIN] = "Stopped (tty input)"; | |
180 # endif | |
181 # ifdef SIGTTOU | |
182 sys_siglist[SIGTTOU] = "Stopped (tty output)"; | |
183 # endif | |
184 # ifdef SIGURG | |
185 sys_siglist[SIGURG] = "Urgent I/O condition"; | |
186 # endif | |
187 # ifdef SIGUSR1 | |
188 sys_siglist[SIGUSR1] = "User defined signal 1"; | |
189 # endif | |
190 # ifdef SIGUSR2 | |
191 sys_siglist[SIGUSR2] = "User defined signal 2"; | |
192 # endif | |
193 # ifdef SIGVTALRM | |
194 sys_siglist[SIGVTALRM] = "Virtual timer expired"; | |
195 # endif | |
196 # ifdef SIGWAITING | |
197 sys_siglist[SIGWAITING] = "Process's LWPs are blocked"; | |
198 # endif | |
199 # ifdef SIGWINCH | |
200 sys_siglist[SIGWINCH] = "Window size changed"; | |
201 # endif | |
202 # ifdef SIGWIND | |
203 sys_siglist[SIGWIND] = "SIGWIND"; | |
204 # endif | |
205 # ifdef SIGXCPU | |
206 sys_siglist[SIGXCPU] = "CPU time limit exceeded"; | |
207 # endif | |
208 # ifdef SIGXFSZ | |
209 sys_siglist[SIGXFSZ] = "File size limit exceeded"; | |
210 # endif | |
211 } | |
212 | |
3547 | 213 #endif |
5844 | 214 } |
215 | |
216 #if ! defined (HAVE_STRSIGNAL) | |
217 | |
218 char * | |
219 strsignal (int code) | |
220 { | |
221 char *signame = ""; | |
222 | |
223 if (0 <= code && code < NSIG) | |
224 { | |
225 /* Cast to suppress warning if the table has const char *. */ | |
226 signame = (char *) sys_siglist[code]; | |
227 } | |
228 | |
229 return signame; | |
230 } | |
231 | |
3547 | 232 #endif |