]>
Commit | Line | Data |
---|---|---|
6a5fa4e0 MG |
1 | /* |
2 | * tclUnixStr.c -- | |
3 | * | |
4 | * This file contains procedures that generate strings | |
5 | * corresponding to various UNIX-related codes, such | |
6 | * as errno and signals. | |
7 | * | |
8 | * Copyright 1991 Regents of the University of California | |
9 | * Permission to use, copy, modify, and distribute this | |
10 | * software and its documentation for any purpose and without | |
11 | * fee is hereby granted, provided that this copyright | |
12 | * notice appears in all copies. The University of California | |
13 | * makes no representations about the suitability of this | |
14 | * software for any purpose. It is provided "as is" without | |
15 | * express or implied warranty. | |
16 | */ | |
17 | ||
18 | #ifndef lint | |
19 | static char rcsid[] = "$Header: /user6/ouster/tcl/RCS/tclUnixStr.c,v 1.12 92/04/30 15:51:15 ouster Exp $ SPRITE (Berkeley)"; | |
20 | #endif /* not lint */ | |
21 | ||
22 | #include "tclint.h" | |
23 | #include "tclunix.h" | |
24 | \f | |
25 | /* | |
26 | *---------------------------------------------------------------------- | |
27 | * | |
28 | * Tcl_ErrnoId -- | |
29 | * | |
30 | * Return a textual identifier for the current errno value. | |
31 | * | |
32 | * Results: | |
33 | * This procedure returns a machine-readable textual identifier | |
34 | * that corresponds to the current errno value (e.g. "EPERM"). | |
35 | * The identifier is the same as the #define name in errno.h. | |
36 | * | |
37 | * Side effects: | |
38 | * None. | |
39 | * | |
40 | *---------------------------------------------------------------------- | |
41 | */ | |
42 | ||
43 | char * | |
44 | Tcl_ErrnoId() | |
45 | { | |
46 | switch (errno) { | |
47 | #ifdef E2BIG | |
48 | case E2BIG: return "E2BIG"; | |
49 | #endif | |
50 | #ifdef EACCES | |
51 | case EACCES: return "EACCES"; | |
52 | #endif | |
53 | #ifdef EADDRINUSE | |
54 | case EADDRINUSE: return "EADDRINUSE"; | |
55 | #endif | |
56 | #ifdef EADDRNOTAVAIL | |
57 | case EADDRNOTAVAIL: return "EADDRNOTAVAIL"; | |
58 | #endif | |
59 | #ifdef EADV | |
60 | case EADV: return "EADV"; | |
61 | #endif | |
62 | #ifdef EAFNOSUPPORT | |
63 | case EAFNOSUPPORT: return "EAFNOSUPPORT"; | |
64 | #endif | |
65 | #ifdef EAGAIN | |
66 | case EAGAIN: return "EAGAIN"; | |
67 | #endif | |
68 | #ifdef EALIGN | |
69 | case EALIGN: return "EALIGN"; | |
70 | #endif | |
71 | #ifdef EALREADY | |
72 | case EALREADY: return "EALREADY"; | |
73 | #endif | |
74 | #ifdef EBADE | |
75 | case EBADE: return "EBADE"; | |
76 | #endif | |
77 | #ifdef EBADF | |
78 | case EBADF: return "EBADF"; | |
79 | #endif | |
80 | #ifdef EBADFD | |
81 | case EBADFD: return "EBADFD"; | |
82 | #endif | |
83 | #ifdef EBADMSG | |
84 | case EBADMSG: return "EBADMSG"; | |
85 | #endif | |
86 | #ifdef EBADR | |
87 | case EBADR: return "EBADR"; | |
88 | #endif | |
89 | #ifdef EBADRPC | |
90 | case EBADRPC: return "EBADRPC"; | |
91 | #endif | |
92 | #ifdef EBADRQC | |
93 | case EBADRQC: return "EBADRQC"; | |
94 | #endif | |
95 | #ifdef EBADSLT | |
96 | case EBADSLT: return "EBADSLT"; | |
97 | #endif | |
98 | #ifdef EBFONT | |
99 | case EBFONT: return "EBFONT"; | |
100 | #endif | |
101 | #ifdef EBUSY | |
102 | case EBUSY: return "EBUSY"; | |
103 | #endif | |
104 | #ifdef ECHILD | |
105 | case ECHILD: return "ECHILD"; | |
106 | #endif | |
107 | #ifdef ECHRNG | |
108 | case ECHRNG: return "ECHRNG"; | |
109 | #endif | |
110 | #ifdef ECOMM | |
111 | case ECOMM: return "ECOMM"; | |
112 | #endif | |
113 | #ifdef ECONNABORTED | |
114 | case ECONNABORTED: return "ECONNABORTED"; | |
115 | #endif | |
116 | #ifdef ECONNREFUSED | |
117 | case ECONNREFUSED: return "ECONNREFUSED"; | |
118 | #endif | |
119 | #ifdef ECONNRESET | |
120 | case ECONNRESET: return "ECONNRESET"; | |
121 | #endif | |
122 | #if defined(EDEADLK) && (!defined(EWOULDBLOCK) || (EDEADLK != EWOULDBLOCK)) | |
123 | case EDEADLK: return "EDEADLK"; | |
124 | #endif | |
125 | #ifndef IS_LINUX | |
126 | #ifdef EDEADLOCK | |
127 | case EDEADLOCK: return "EDEADLOCK"; | |
128 | #endif | |
129 | #endif | |
130 | #ifdef EDESTADDRREQ | |
131 | case EDESTADDRREQ: return "EDESTADDRREQ"; | |
132 | #endif | |
133 | #ifdef EDIRTY | |
134 | case EDIRTY: return "EDIRTY"; | |
135 | #endif | |
136 | #ifdef EDOM | |
137 | case EDOM: return "EDOM"; | |
138 | #endif | |
139 | #ifdef EDOTDOT | |
140 | case EDOTDOT: return "EDOTDOT"; | |
141 | #endif | |
142 | #ifdef EDQUOT | |
143 | case EDQUOT: return "EDQUOT"; | |
144 | #endif | |
145 | #ifdef EDUPPKG | |
146 | case EDUPPKG: return "EDUPPKG"; | |
147 | #endif | |
148 | #ifdef EEXIST | |
149 | case EEXIST: return "EEXIST"; | |
150 | #endif | |
151 | #ifdef EFAULT | |
152 | case EFAULT: return "EFAULT"; | |
153 | #endif | |
154 | #ifdef EFBIG | |
155 | case EFBIG: return "EFBIG"; | |
156 | #endif | |
157 | #ifdef EHOSTDOWN | |
158 | case EHOSTDOWN: return "EHOSTDOWN"; | |
159 | #endif | |
160 | #ifdef EHOSTUNREACH | |
161 | case EHOSTUNREACH: return "EHOSTUNREACH"; | |
162 | #endif | |
163 | #ifdef EIDRM | |
164 | case EIDRM: return "EIDRM"; | |
165 | #endif | |
166 | #ifdef EINIT | |
167 | case EINIT: return "EINIT"; | |
168 | #endif | |
169 | #ifdef EINPROGRESS | |
170 | case EINPROGRESS: return "EINPROGRESS"; | |
171 | #endif | |
172 | #ifdef EINTR | |
173 | case EINTR: return "EINTR"; | |
174 | #endif | |
175 | #ifdef EINVAL | |
176 | case EINVAL: return "EINVAL"; | |
177 | #endif | |
178 | #ifdef EIO | |
179 | case EIO: return "EIO"; | |
180 | #endif | |
181 | #ifdef EISCONN | |
182 | case EISCONN: return "EISCONN"; | |
183 | #endif | |
184 | #ifdef EISDIR | |
185 | case EISDIR: return "EISDIR"; | |
186 | #endif | |
187 | #ifdef EISNAME | |
188 | case EISNAM: return "EISNAM"; | |
189 | #endif | |
190 | #ifdef ELBIN | |
191 | case ELBIN: return "ELBIN"; | |
192 | #endif | |
193 | #ifdef EL2HLT | |
194 | case EL2HLT: return "EL2HLT"; | |
195 | #endif | |
196 | #ifdef EL2NSYNC | |
197 | case EL2NSYNC: return "EL2NSYNC"; | |
198 | #endif | |
199 | #ifdef EL3HLT | |
200 | case EL3HLT: return "EL3HLT"; | |
201 | #endif | |
202 | #ifdef EL3RST | |
203 | case EL3RST: return "EL3RST"; | |
204 | #endif | |
205 | #ifdef ELIBACC | |
206 | case ELIBACC: return "ELIBACC"; | |
207 | #endif | |
208 | #ifdef ELIBBAD | |
209 | case ELIBBAD: return "ELIBBAD"; | |
210 | #endif | |
211 | #ifdef ELIBEXEC | |
212 | case ELIBEXEC: return "ELIBEXEC"; | |
213 | #endif | |
214 | #ifdef ELIBMAX | |
215 | case ELIBMAX: return "ELIBMAX"; | |
216 | #endif | |
217 | #ifdef ELIBSCN | |
218 | case ELIBSCN: return "ELIBSCN"; | |
219 | #endif | |
220 | #ifdef ELNRNG | |
221 | case ELNRNG: return "ELNRNG"; | |
222 | #endif | |
223 | #ifdef ELOOP | |
224 | case ELOOP: return "ELOOP"; | |
225 | #endif | |
226 | #ifdef EMFILE | |
227 | case EMFILE: return "EMFILE"; | |
228 | #endif | |
229 | #ifdef EMLINK | |
230 | case EMLINK: return "EMLINK"; | |
231 | #endif | |
232 | #ifdef EMSGSIZE | |
233 | case EMSGSIZE: return "EMSGSIZE"; | |
234 | #endif | |
235 | #ifdef EMULTIHOP | |
236 | case EMULTIHOP: return "EMULTIHOP"; | |
237 | #endif | |
238 | #ifdef ENAMETOOLONG | |
239 | case ENAMETOOLONG: return "ENAMETOOLONG"; | |
240 | #endif | |
241 | #ifdef ENAVAIL | |
242 | case ENAVAIL: return "ENAVAIL"; | |
243 | #endif | |
244 | #ifdef ENET | |
245 | case ENET: return "ENET"; | |
246 | #endif | |
247 | #ifdef ENETDOWN | |
248 | case ENETDOWN: return "ENETDOWN"; | |
249 | #endif | |
250 | #ifdef ENETRESET | |
251 | case ENETRESET: return "ENETRESET"; | |
252 | #endif | |
253 | #ifdef ENETUNREACH | |
254 | case ENETUNREACH: return "ENETUNREACH"; | |
255 | #endif | |
256 | #ifdef ENFILE | |
257 | case ENFILE: return "ENFILE"; | |
258 | #endif | |
259 | #ifdef ENOANO | |
260 | case ENOANO: return "ENOANO"; | |
261 | #endif | |
262 | #if defined(ENOBUFS) && (!defined(ENOSR) || (ENOBUFS != ENOSR)) | |
263 | case ENOBUFS: return "ENOBUFS"; | |
264 | #endif | |
265 | #ifdef ENOCSI | |
266 | case ENOCSI: return "ENOCSI"; | |
267 | #endif | |
268 | #ifdef ENODATA | |
269 | case ENODATA: return "ENODATA"; | |
270 | #endif | |
271 | #ifdef ENODEV | |
272 | case ENODEV: return "ENODEV"; | |
273 | #endif | |
274 | #ifdef ENOENT | |
275 | case ENOENT: return "ENOENT"; | |
276 | #endif | |
277 | #ifdef ENOEXEC | |
278 | case ENOEXEC: return "ENOEXEC"; | |
279 | #endif | |
280 | #ifdef ENOLCK | |
281 | case ENOLCK: return "ENOLCK"; | |
282 | #endif | |
283 | #ifdef ENOLINK | |
284 | case ENOLINK: return "ENOLINK"; | |
285 | #endif | |
286 | #ifdef ENOMEM | |
287 | case ENOMEM: return "ENOMEM"; | |
288 | #endif | |
289 | #ifdef ENOMSG | |
290 | case ENOMSG: return "ENOMSG"; | |
291 | #endif | |
292 | #ifdef ENONET | |
293 | case ENONET: return "ENONET"; | |
294 | #endif | |
295 | #ifdef ENOPKG | |
296 | case ENOPKG: return "ENOPKG"; | |
297 | #endif | |
298 | #ifdef ENOPROTOOPT | |
299 | case ENOPROTOOPT: return "ENOPROTOOPT"; | |
300 | #endif | |
301 | #ifdef ENOSPC | |
302 | case ENOSPC: return "ENOSPC"; | |
303 | #endif | |
304 | #ifdef ENOSR | |
305 | case ENOSR: return "ENOSR"; | |
306 | #endif | |
307 | #ifdef ENOSTR | |
308 | case ENOSTR: return "ENOSTR"; | |
309 | #endif | |
310 | #ifdef ENOSYM | |
311 | case ENOSYM: return "ENOSYM"; | |
312 | #endif | |
313 | #ifdef ENOSYS | |
314 | case ENOSYS: return "ENOSYS"; | |
315 | #endif | |
316 | #ifdef ENOTBLK | |
317 | case ENOTBLK: return "ENOTBLK"; | |
318 | #endif | |
319 | #ifdef ENOTCONN | |
320 | case ENOTCONN: return "ENOTCONN"; | |
321 | #endif | |
322 | #ifdef ENOTDIR | |
323 | case ENOTDIR: return "ENOTDIR"; | |
324 | #endif | |
325 | #if defined(ENOTEMPTY) && (!defined(EEXIST) || (ENOTEMPTY != EEXIST)) | |
326 | case ENOTEMPTY: return "ENOTEMPTY"; | |
327 | #endif | |
328 | #ifdef ENOTNAM | |
329 | case ENOTNAM: return "ENOTNAM"; | |
330 | #endif | |
331 | #ifdef ENOTSOCK | |
332 | case ENOTSOCK: return "ENOTSOCK"; | |
333 | #endif | |
334 | #ifdef ENOTTY | |
335 | case ENOTTY: return "ENOTTY"; | |
336 | #endif | |
337 | #ifdef ENOTUNIQ | |
338 | case ENOTUNIQ: return "ENOTUNIQ"; | |
339 | #endif | |
340 | #ifndef __GNUC__ | |
341 | #ifdef ENXIO | |
342 | case ENXIO: return "ENXIO"; | |
343 | #endif | |
344 | #endif | |
345 | #ifdef EOPNOTSUPP | |
346 | case EOPNOTSUPP: return "EOPNOTSUPP"; | |
347 | #endif | |
348 | #ifndef __GNUC__ | |
349 | #ifdef EPERM | |
350 | case EPERM: return "EPERM"; | |
351 | #endif | |
352 | #endif | |
353 | #ifdef EPFNOSUPPORT | |
354 | case EPFNOSUPPORT: return "EPFNOSUPPORT"; | |
355 | #endif | |
356 | #ifdef EPIPE | |
357 | case EPIPE: return "EPIPE"; | |
358 | #endif | |
359 | #ifdef EPROCLIM | |
360 | case EPROCLIM: return "EPROCLIM"; | |
361 | #endif | |
362 | #ifdef EPROCUNAVAIL | |
363 | case EPROCUNAVAIL: return "EPROCUNAVAIL"; | |
364 | #endif | |
365 | #ifdef EPROGMISMATCH | |
366 | case EPROGMISMATCH: return "EPROGMISMATCH"; | |
367 | #endif | |
368 | #ifdef EPROGUNAVAIL | |
369 | case EPROGUNAVAIL: return "EPROGUNAVAIL"; | |
370 | #endif | |
371 | #ifdef EPROTO | |
372 | case EPROTO: return "EPROTO"; | |
373 | #endif | |
374 | #ifdef EPROTONOSUPPORT | |
375 | case EPROTONOSUPPORT: return "EPROTONOSUPPORT"; | |
376 | #endif | |
377 | #ifdef EPROTOTYPE | |
378 | case EPROTOTYPE: return "EPROTOTYPE"; | |
379 | #endif | |
380 | #ifdef ERANGE | |
381 | case ERANGE: return "ERANGE"; | |
382 | #endif | |
383 | #if defined(EREFUSED) && (!defined(ECONNREFUSED) || (EREFUSED != ECONNREFUSED)) | |
384 | case EREFUSED: return "EREFUSED"; | |
385 | #endif | |
386 | #ifdef EREMCHG | |
387 | case EREMCHG: return "EREMCHG"; | |
388 | #endif | |
389 | #ifdef EREMDEV | |
390 | case EREMDEV: return "EREMDEV"; | |
391 | #endif | |
392 | #ifdef EREMOTE | |
393 | case EREMOTE: return "EREMOTE"; | |
394 | #endif | |
395 | #ifdef EREMOTEIO | |
396 | case EREMOTEIO: return "EREMOTEIO"; | |
397 | #endif | |
398 | #ifdef EREMOTERELEASE | |
399 | case EREMOTERELEASE: return "EREMOTERELEASE"; | |
400 | #endif | |
401 | #ifdef EROFS | |
402 | case EROFS: return "EROFS"; | |
403 | #endif | |
404 | #ifdef ERPCMISMATCH | |
405 | case ERPCMISMATCH: return "ERPCMISMATCH"; | |
406 | #endif | |
407 | #ifdef ERREMOTE | |
408 | case ERREMOTE: return "ERREMOTE"; | |
409 | #endif | |
410 | #ifdef ESHUTDOWN | |
411 | case ESHUTDOWN: return "ESHUTDOWN"; | |
412 | #endif | |
413 | #ifdef ESOCKTNOSUPPORT | |
414 | case ESOCKTNOSUPPORT: return "ESOCKTNOSUPPORT"; | |
415 | #endif | |
416 | #ifdef ESPIPE | |
417 | case ESPIPE: return "ESPIPE"; | |
418 | #endif | |
419 | #ifdef ESRCH | |
420 | case ESRCH: return "ESRCH"; | |
421 | #endif | |
422 | #ifdef ESRMNT | |
423 | case ESRMNT: return "ESRMNT"; | |
424 | #endif | |
425 | #ifdef ESTALE | |
426 | case ESTALE: return "ESTALE"; | |
427 | #endif | |
428 | #ifdef ESUCCESS | |
429 | case ESUCCESS: return "ESUCCESS"; | |
430 | #endif | |
431 | #ifdef ETIME | |
432 | case ETIME: return "ETIME"; | |
433 | #endif | |
434 | #ifdef ETIMEDOUT | |
435 | case ETIMEDOUT: return "ETIMEDOUT"; | |
436 | #endif | |
437 | #ifdef ETOOMANYREFS | |
438 | case ETOOMANYREFS: return "ETOOMANYREFS"; | |
439 | #endif | |
440 | #ifdef ETXTBSY | |
441 | case ETXTBSY: return "ETXTBSY"; | |
442 | #endif | |
443 | #ifdef EUCLEAN | |
444 | case EUCLEAN: return "EUCLEAN"; | |
445 | #endif | |
446 | #ifdef EUNATCH | |
447 | case EUNATCH: return "EUNATCH"; | |
448 | #endif | |
449 | #ifdef EUSERS | |
450 | case EUSERS: return "EUSERS"; | |
451 | #endif | |
452 | #ifdef EVERSION | |
453 | case EVERSION: return "EVERSION"; | |
454 | #endif | |
455 | #if defined(EWOULDBLOCK) && (!defined(EAGAIN) || (EWOULDBLOCK != EAGAIN)) | |
456 | case EWOULDBLOCK: return "EWOULDBLOCK"; | |
457 | #endif | |
458 | #ifdef EXDEV | |
459 | case EXDEV: return "EXDEV"; | |
460 | #endif | |
461 | #ifdef EXFULL | |
462 | case EXFULL: return "EXFULL"; | |
463 | #endif | |
464 | } | |
465 | return "unknown error"; | |
466 | } | |
467 | \f | |
468 | /* | |
469 | *---------------------------------------------------------------------- | |
470 | * | |
471 | * Tcl_SignalId -- | |
472 | * | |
473 | * Return a textual identifier for a signal number. | |
474 | * | |
475 | * Results: | |
476 | * This procedure returns a machine-readable textual identifier | |
477 | * that corresponds to sig. The identifier is the same as the | |
478 | * #define name in signal.h. | |
479 | * | |
480 | * Side effects: | |
481 | * None. | |
482 | * | |
483 | *---------------------------------------------------------------------- | |
484 | */ | |
485 | ||
486 | char * | |
487 | Tcl_SignalId(sig) | |
488 | int sig; /* Number of signal. */ | |
489 | { | |
490 | switch (sig) { | |
491 | #ifdef SIGABRT | |
492 | case SIGABRT: return "SIGABRT"; | |
493 | #endif | |
494 | #ifdef SIGALRM | |
495 | case SIGALRM: return "SIGALRM"; | |
496 | #endif | |
497 | #ifdef SIGBUS | |
498 | case SIGBUS: return "SIGBUS"; | |
499 | #endif | |
500 | #ifdef SIGCHLD | |
501 | case SIGCHLD: return "SIGCHLD"; | |
502 | #endif | |
503 | #if defined(SIGCLD) && (!defined(SIGCHLD) || (SIGCLD != SIGCHLD)) | |
504 | case SIGCLD: return "SIGCLD"; | |
505 | #endif | |
506 | #ifdef SIGCONT | |
507 | case SIGCONT: return "SIGCONT"; | |
508 | #endif | |
509 | #if defined(SIGEMT) && (!defined(SIGXCPU) || (SIGEMT != SIGXCPU)) | |
510 | case SIGEMT: return "SIGEMT"; | |
511 | #endif | |
512 | #ifdef SIGFPE | |
513 | case SIGFPE: return "SIGFPE"; | |
514 | #endif | |
515 | #ifdef SIGHUP | |
516 | case SIGHUP: return "SIGHUP"; | |
517 | #endif | |
518 | #ifdef SIGILL | |
519 | case SIGILL: return "SIGILL"; | |
520 | #endif | |
521 | #ifdef SIGINT | |
522 | case SIGINT: return "SIGINT"; | |
523 | #endif | |
524 | #ifdef SIGIO | |
525 | case SIGIO: return "SIGIO"; | |
526 | #endif | |
527 | #if defined(SIGIOT) && (!defined(SIGABRT) || (SIGIOT != SIGABRT)) | |
528 | case SIGIOT: return "SIGIOT"; | |
529 | #endif | |
530 | #ifdef SIGKILL | |
531 | case SIGKILL: return "SIGKILL"; | |
532 | #endif | |
287584cf | 533 | #if defined(SIGLOST) && (!defined(SIGIOT) || (SIGLOST != SIGIOT)) && (!defined(SIGPWR) || (SIGLOST != SIGPWR)) |
6a5fa4e0 MG |
534 | case SIGLOST: return "SIGLOST"; |
535 | #endif | |
536 | #ifdef SIGPIPE | |
537 | case SIGPIPE: return "SIGPIPE"; | |
538 | #endif | |
539 | #if defined(SIGPOLL) && (!defined(SIGIO) || (SIGPOLL != SIGIO)) | |
540 | case SIGPOLL: return "SIGPOLL"; | |
541 | #endif | |
542 | #ifdef SIGPROF | |
543 | case SIGPROF: return "SIGPROF"; | |
544 | #endif | |
545 | #if defined(SIGPWR) && (!defined(SIGXFSZ) || (SIGPWR != SIGXFSZ)) | |
546 | case SIGPWR: return "SIGPWR"; | |
547 | #endif | |
548 | #ifdef SIGQUIT | |
549 | case SIGQUIT: return "SIGQUIT"; | |
550 | #endif | |
551 | #ifdef SIGSEGV | |
552 | case SIGSEGV: return "SIGSEGV"; | |
553 | #endif | |
554 | #ifdef SIGSTOP | |
555 | case SIGSTOP: return "SIGSTOP"; | |
556 | #endif | |
557 | #ifdef SIGSYS | |
558 | case SIGSYS: return "SIGSYS"; | |
559 | #endif | |
560 | #ifdef SIGTERM | |
561 | case SIGTERM: return "SIGTERM"; | |
562 | #endif | |
563 | #ifdef SIGTRAP | |
564 | case SIGTRAP: return "SIGTRAP"; | |
565 | #endif | |
566 | #ifdef SIGTSTP | |
567 | case SIGTSTP: return "SIGTSTP"; | |
568 | #endif | |
569 | #ifdef SIGTTIN | |
570 | case SIGTTIN: return "SIGTTIN"; | |
571 | #endif | |
572 | #ifdef SIGTTOU | |
573 | case SIGTTOU: return "SIGTTOU"; | |
574 | #endif | |
575 | #ifdef SIGURG | |
576 | case SIGURG: return "SIGURG"; | |
577 | #endif | |
578 | #ifdef SIGUSR1 | |
579 | case SIGUSR1: return "SIGUSR1"; | |
580 | #endif | |
581 | #ifdef SIGUSR2 | |
582 | case SIGUSR2: return "SIGUSR2"; | |
583 | #endif | |
584 | #ifdef SIGVTALRM | |
585 | case SIGVTALRM: return "SIGVTALRM"; | |
586 | #endif | |
587 | #ifdef SIGWINCH | |
588 | case SIGWINCH: return "SIGWINCH"; | |
589 | #endif | |
590 | #ifdef SIGXCPU | |
591 | case SIGXCPU: return "SIGXCPU"; | |
592 | #endif | |
593 | #ifdef SIGXFSZ | |
594 | case SIGXFSZ: return "SIGXFSZ"; | |
595 | #endif | |
596 | } | |
597 | return "unknown signal"; | |
598 | } | |
599 | \f | |
600 | /* | |
601 | *---------------------------------------------------------------------- | |
602 | * | |
603 | * Tcl_SignalMsg -- | |
604 | * | |
605 | * Return a human-readable message describing a signal. | |
606 | * | |
607 | * Results: | |
608 | * This procedure returns a string describing sig that should | |
609 | * make sense to a human. It may not be easy for a machine | |
610 | * to parse. | |
611 | * | |
612 | * Side effects: | |
613 | * None. | |
614 | * | |
615 | *---------------------------------------------------------------------- | |
616 | */ | |
617 | ||
618 | char * | |
619 | Tcl_SignalMsg(sig) | |
620 | int sig; /* Number of signal. */ | |
621 | { | |
622 | switch (sig) { | |
623 | #ifdef SIGABRT | |
624 | case SIGABRT: return "SIGABRT"; | |
625 | #endif | |
626 | #ifdef SIGALRM | |
627 | case SIGALRM: return "alarm clock"; | |
628 | #endif | |
629 | #ifdef SIGBUS | |
630 | case SIGBUS: return "bus error"; | |
631 | #endif | |
632 | #ifdef SIGCHLD | |
633 | case SIGCHLD: return "child status changed"; | |
634 | #endif | |
635 | #if defined(SIGCLD) && (!defined(SIGCHLD) || (SIGCLD != SIGCHLD)) | |
636 | case SIGCLD: return "child status changed"; | |
637 | #endif | |
638 | #ifdef SIGCONT | |
639 | case SIGCONT: return "continue after stop"; | |
640 | #endif | |
641 | #if defined(SIGEMT) && (!defined(SIGXCPU) || (SIGEMT != SIGXCPU)) | |
642 | case SIGEMT: return "EMT instruction"; | |
643 | #endif | |
644 | #ifdef SIGFPE | |
645 | case SIGFPE: return "floating-point exception"; | |
646 | #endif | |
647 | #ifdef SIGHUP | |
648 | case SIGHUP: return "hangup"; | |
649 | #endif | |
650 | #ifdef SIGILL | |
651 | case SIGILL: return "illegal instruction"; | |
652 | #endif | |
653 | #ifdef SIGINT | |
654 | case SIGINT: return "interrupt"; | |
655 | #endif | |
656 | #ifdef SIGIO | |
657 | case SIGIO: return "input/output possible on file"; | |
658 | #endif | |
659 | #if defined(SIGIOT) && (!defined(SIGABRT) || (SIGABRT != SIGIOT)) | |
660 | case SIGIOT: return "IOT instruction"; | |
661 | #endif | |
662 | #ifdef SIGKILL | |
663 | case SIGKILL: return "kill signal"; | |
664 | #endif | |
287584cf | 665 | #if defined(SIGLOST) && (!defined(SIGIOT) || (SIGLOST != SIGIOT)) && (!defined(SIGPWR) || (SIGLOST != SIGPWR)) |
6a5fa4e0 MG |
666 | case SIGLOST: return "resource lost"; |
667 | #endif | |
668 | #ifdef SIGPIPE | |
669 | case SIGPIPE: return "write on pipe with no readers"; | |
670 | #endif | |
671 | #if defined(SIGPOLL) && (!defined(SIGIO) || (SIGPOLL != SIGIO)) | |
672 | case SIGPOLL: return "input/output possible on file"; | |
673 | #endif | |
674 | #ifdef SIGPROF | |
675 | case SIGPROF: return "profiling alarm"; | |
676 | #endif | |
677 | #if defined(SIGPWR) && (!defined(SIGXFSZ) || (SIGPWR != SIGXFSZ)) | |
678 | case SIGPWR: return "power-fail restart"; | |
679 | #endif | |
680 | #ifdef SIGQUIT | |
681 | case SIGQUIT: return "quit signal"; | |
682 | #endif | |
683 | #ifdef SIGSEGV | |
684 | case SIGSEGV: return "segmentation violation"; | |
685 | #endif | |
686 | #ifdef SIGSTOP | |
687 | case SIGSTOP: return "stop"; | |
688 | #endif | |
689 | #ifdef SIGSYS | |
690 | case SIGSYS: return "bad argument to system call"; | |
691 | #endif | |
692 | #ifdef SIGTERM | |
693 | case SIGTERM: return "software termination signal"; | |
694 | #endif | |
695 | #ifdef SIGTRAP | |
696 | case SIGTRAP: return "trace trap"; | |
697 | #endif | |
698 | #ifdef SIGTSTP | |
699 | case SIGTSTP: return "stop signal from tty"; | |
700 | #endif | |
701 | #ifdef SIGTTIN | |
702 | case SIGTTIN: return "background tty read"; | |
703 | #endif | |
704 | #ifdef SIGTTOU | |
705 | case SIGTTOU: return "background tty write"; | |
706 | #endif | |
707 | #ifdef SIGURG | |
708 | case SIGURG: return "urgent I/O condition"; | |
709 | #endif | |
710 | #ifdef SIGUSR1 | |
711 | case SIGUSR1: return "user-defined signal 1"; | |
712 | #endif | |
713 | #ifdef SIGUSR2 | |
714 | case SIGUSR2: return "user-defined signal 2"; | |
715 | #endif | |
716 | #ifdef SIGVTALRM | |
717 | case SIGVTALRM: return "virtual time alarm"; | |
718 | #endif | |
719 | #ifdef SIGWINCH | |
720 | case SIGWINCH: return "window changed"; | |
721 | #endif | |
722 | #ifdef SIGXCPU | |
723 | case SIGXCPU: return "exceeded CPU time limit"; | |
724 | #endif | |
725 | #ifdef SIGXFSZ | |
726 | case SIGXFSZ: return "exceeded file size limit"; | |
727 | #endif | |
728 | } | |
729 | return "unknown signal"; | |
730 | } |