Debian Codegraph @

generic/tclPosixStr.c

raw
1 /*
2 * tclPosixStr.c --
3 *
4 * This file contains procedures that generate strings corresponding to
5 * various POSIX-related codes, such as errno and signals.
6 *
7 * Copyright (c) 1991-1994 The Regents of the University of California.
8 * Copyright (c) 1994-1996 Sun Microsystems, Inc.
9 *
10 * See the file "license.terms" for information on usage and redistribution
11 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
12 */
13
14 #include "tclInt.h"
15
16 /*
17 *----------------------------------------------------------------------
18 *
19 * Tcl_ErrnoId --
20 *
21 * Return a textual identifier for the current errno value.
22 *
23 * Results:
24 * This procedure returns a machine-readable textual identifier that
25 * corresponds to the current errno value (e.g. "EPERM"). The identifier
26 * is the same as the #define name in errno.h.
27 *
28 * Side effects:
29 * None.
30 *
31 *----------------------------------------------------------------------
32 */
33
34 #ifdef __CYGWIN__
35 /* Those are deprecated in Cygwin, but still might be used by Cygwin applications */
36 # undef ENOSHARE
37 # define ENOSHARE 136
38 # undef ECASECLASH
39 # define ECASECLASH 137
40 #endif
41
42 const char *
43 Tcl_ErrnoId(void)
44 {
45 switch (errno) {
46 #if defined(E2BIG) && (!defined(EOVERFLOW) || (E2BIG != EOVERFLOW))
47 case E2BIG: return "E2BIG";
48 #endif
49 #ifdef EACCES
50 case EACCES: return "EACCES";
51 #endif
52 #ifdef EADDRINUSE
53 case EADDRINUSE: return "EADDRINUSE";
54 #endif
55 #ifdef EADDRNOTAVAIL
56 case EADDRNOTAVAIL: return "EADDRNOTAVAIL";
57 #endif
58 #ifdef EADV
59 case EADV: return "EADV";
60 #endif
61 #ifdef EAFNOSUPPORT
62 case EAFNOSUPPORT: return "EAFNOSUPPORT";
63 #endif
64 #ifdef EAGAIN
65 case EAGAIN: return "EAGAIN";
66 #endif
67 #ifdef EALIGN
68 case EALIGN: return "EALIGN";
69 #endif
70 #if defined(EALREADY) && (!defined(EBUSY) || (EALREADY != EBUSY))
71 case EALREADY: return "EALREADY";
72 #endif
73 #ifdef EBADE
74 case EBADE: return "EBADE";
75 #endif
76 #ifdef EBADF
77 case EBADF: return "EBADF";
78 #endif
79 #ifdef EBADFD
80 case EBADFD: return "EBADFD";
81 #endif
82 #ifdef EBADMSG
83 case EBADMSG: return "EBADMSG";
84 #endif
85 #ifdef EBADR
86 case EBADR: return "EBADR";
87 #endif
88 #ifdef EBADRPC
89 case EBADRPC: return "EBADRPC";
90 #endif
91 #ifdef EBADRQC
92 case EBADRQC: return "EBADRQC";
93 #endif
94 #ifdef EBADSLT
95 case EBADSLT: return "EBADSLT";
96 #endif
97 #ifdef EBFONT
98 case EBFONT: return "EBFONT";
99 #endif
100 #ifdef EBUSY
101 case EBUSY: return "EBUSY";
102 #endif
103 #ifdef ECANCELED
104 case ECANCELED: return "ECANCELED";
105 #endif
106 #ifdef ECASECLASH
107 case ECASECLASH: return "ECASECLASH";
108 #endif
109 #ifdef ECHILD
110 case ECHILD: return "ECHILD";
111 #endif
112 #ifdef ECHRNG
113 case ECHRNG: return "ECHRNG";
114 #endif
115 #ifdef ECOMM
116 case ECOMM: return "ECOMM";
117 #endif
118 #ifdef ECONNABORTED
119 case ECONNABORTED: return "ECONNABORTED";
120 #endif
121 #ifdef ECONNREFUSED
122 case ECONNREFUSED: return "ECONNREFUSED";
123 #endif
124 #ifdef ECONNRESET
125 case ECONNRESET: return "ECONNRESET";
126 #endif
127 #if defined(EDEADLK) && (!defined(EWOULDBLOCK) || (EDEADLK != EWOULDBLOCK))
128 case EDEADLK: return "EDEADLK";
129 #endif
130 #if defined(EDEADLOCK) && (!defined(EDEADLK) || (EDEADLOCK != EDEADLK))
131 case EDEADLOCK: return "EDEADLOCK";
132 #endif
133 #ifdef EDESTADDRREQ
134 case EDESTADDRREQ: return "EDESTADDRREQ";
135 #endif
136 #ifdef EDIRTY
137 case EDIRTY: return "EDIRTY";
138 #endif
139 #ifdef EDOM
140 case EDOM: return "EDOM";
141 #endif
142 #ifdef EDOTDOT
143 case EDOTDOT: return "EDOTDOT";
144 #endif
145 #ifdef EDQUOT
146 case EDQUOT: return "EDQUOT";
147 #endif
148 #ifdef EDUPPKG
149 case EDUPPKG: return "EDUPPKG";
150 #endif
151 #ifdef EEXIST
152 case EEXIST: return "EEXIST";
153 #endif
154 #ifdef EFAULT
155 case EFAULT: return "EFAULT";
156 #endif
157 #ifdef EFBIG
158 case EFBIG: return "EFBIG";
159 #endif
160 #ifdef EFTYPE
161 case EFTYPE: return "EFTYPE";
162 #endif
163 #ifdef EHOSTDOWN
164 case EHOSTDOWN: return "EHOSTDOWN";
165 #endif
166 #ifdef EHOSTUNREACH
167 case EHOSTUNREACH: return "EHOSTUNREACH";
168 #endif
169 #if defined(EIDRM) && (!defined(EINPROGRESS) || (EIDRM != EINPROGRESS))
170 case EIDRM: return "EIDRM";
171 #endif
172 #ifdef EINIT
173 case EINIT: return "EINIT";
174 #endif
175 #ifdef EILSEQ
176 case EILSEQ: return "EILSEQ";
177 #endif
178 #ifdef EINPROGRESS
179 case EINPROGRESS: return "EINPROGRESS";
180 #endif
181 #ifdef EINTR
182 case EINTR: return "EINTR";
183 #endif
184 #ifdef EINVAL
185 case EINVAL: return "EINVAL";
186 #endif
187 #ifdef EIO
188 case EIO: return "EIO";
189 #endif
190 #ifdef EISCONN
191 case EISCONN: return "EISCONN";
192 #endif
193 #ifdef EISDIR
194 case EISDIR: return "EISDIR";
195 #endif
196 #ifdef EISNAM
197 case EISNAM: return "EISNAM";
198 #endif
199 #ifdef EL2HLT
200 case EL2HLT: return "EL2HLT";
201 #endif
202 #ifdef EL2NSYNC
203 case EL2NSYNC: return "EL2NSYNC";
204 #endif
205 #ifdef EL3HLT
206 case EL3HLT: return "EL3HLT";
207 #endif
208 #ifdef EL3RST
209 case EL3RST: return "EL3RST";
210 #endif
211 #ifdef ELBIN
212 case ELBIN: return "ELBIN";
213 #endif
214 #ifdef ELIBACC
215 case ELIBACC: return "ELIBACC";
216 #endif
217 #ifdef ELIBBAD
218 case ELIBBAD: return "ELIBBAD";
219 #endif
220 #ifdef ELIBEXEC
221 case ELIBEXEC: return "ELIBEXEC";
222 #endif
223 #if defined(ELIBMAX) && (!defined(ECANCELED) || (ELIBMAX != ECANCELED))
224 case ELIBMAX: return "ELIBMAX";
225 #endif
226 #ifdef ELIBSCN
227 case ELIBSCN: return "ELIBSCN";
228 #endif
229 #ifdef ELNRNG
230 case ELNRNG: return "ELNRNG";
231 #endif
232 #if defined(ELOOP) && (!defined(ENOENT) || (ELOOP != ENOENT))
233 case ELOOP: return "ELOOP";
234 #endif
235 #ifdef EMEDIUMTYPE
236 case EMEDIUMTYPE: return "EMEDIUMTYPE";
237 #endif
238 #ifdef EMFILE
239 case EMFILE: return "EMFILE";
240 #endif
241 #ifdef EMLINK
242 case EMLINK: return "EMLINK";
243 #endif
244 #ifdef EMSGSIZE
245 case EMSGSIZE: return "EMSGSIZE";
246 #endif
247 #ifdef EMULTIHOP
248 case EMULTIHOP: return "EMULTIHOP";
249 #endif
250 #ifdef ENAMETOOLONG
251 case ENAMETOOLONG: return "ENAMETOOLONG";
252 #endif
253 #ifdef ENAVAIL
254 case ENAVAIL: return "ENAVAIL";
255 #endif
256 #ifdef ENET
257 case ENET: return "ENET";
258 #endif
259 #ifdef ENETDOWN
260 case ENETDOWN: return "ENETDOWN";
261 #endif
262 #ifdef ENETRESET
263 case ENETRESET: return "ENETRESET";
264 #endif
265 #ifdef ENETUNREACH
266 case ENETUNREACH: return "ENETUNREACH";
267 #endif
268 #ifdef ENFILE
269 case ENFILE: return "ENFILE";
270 #endif
271 #ifdef ENMFILE
272 case ENMFILE: return "ENMFILE";
273 #endif
274 #ifdef ENOANO
275 case ENOANO: return "ENOANO";
276 #endif
277 #if defined(ENOBUFS) && (!defined(ENOSR) || (ENOBUFS != ENOSR))
278 case ENOBUFS: return "ENOBUFS";
279 #endif
280 #ifdef ENOCSI
281 case ENOCSI: return "ENOCSI";
282 #endif
283 #if defined(ENODATA) && (!defined(ECONNREFUSED) || (ENODATA != ECONNREFUSED))
284 case ENODATA: return "ENODATA";
285 #endif
286 #ifdef ENODEV
287 case ENODEV: return "ENODEV";
288 #endif
289 #ifdef ENOENT
290 case ENOENT: return "ENOENT";
291 #endif
292 #ifdef ENOEXEC
293 case ENOEXEC: return "ENOEXEC";
294 #endif
295 #ifdef ENOLCK
296 case ENOLCK: return "ENOLCK";
297 #endif
298 #ifdef ENOLINK
299 case ENOLINK: return "ENOLINK";
300 #endif
301 #ifdef ENOMEM
302 case ENOMEM: return "ENOMEM";
303 #endif
304 #ifdef ENOMEDIUM
305 case ENOMEDIUM: return "ENOMEDIUM";
306 #endif
307 #ifdef ENOMSG
308 case ENOMSG: return "ENOMSG";
309 #endif
310 #ifdef ENONET
311 case ENONET: return "ENONET";
312 #endif
313 #ifdef ENOPKG
314 case ENOPKG: return "ENOPKG";
315 #endif
316 #ifdef ENOPROTOOPT
317 case ENOPROTOOPT: return "ENOPROTOOPT";
318 #endif
319 #ifdef ENOSHARE
320 case ENOSHARE: return "ENOSHARE";
321 #endif
322 #ifdef ENOSPC
323 case ENOSPC: return "ENOSPC";
324 #endif
325 #if defined(ENOSR) && (!defined(ENAMETOOLONG) || (ENAMETOOLONG != ENOSR))
326 case ENOSR: return "ENOSR";
327 #endif
328 #if defined(ENOSTR) && (!defined(ENOTTY) || (ENOTTY != ENOSTR))
329 case ENOSTR: return "ENOSTR";
330 #endif
331 #ifdef ENOSYM
332 case ENOSYM: return "ENOSYM";
333 #endif
334 #ifdef ENOSYS
335 case ENOSYS: return "ENOSYS";
336 #endif
337 #ifdef ENOTBLK
338 case ENOTBLK: return "ENOTBLK";
339 #endif
340 #ifdef ENOTCONN
341 case ENOTCONN: return "ENOTCONN";
342 #endif
343 #ifdef ENOTRECOVERABLE
344 case ENOTRECOVERABLE: return "ENOTRECOVERABLE";
345 #endif
346 #ifdef ENOTDIR
347 case ENOTDIR: return "ENOTDIR";
348 #endif
349 #if defined(ENOTEMPTY) && (!defined(EEXIST) || (ENOTEMPTY != EEXIST))
350 case ENOTEMPTY: return "ENOTEMPTY";
351 #endif
352 #ifdef ENOTNAM
353 case ENOTNAM: return "ENOTNAM";
354 #endif
355 #ifdef ENOTSOCK
356 case ENOTSOCK: return "ENOTSOCK";
357 #endif
358 #ifdef ENOTSUP
359 case ENOTSUP: return "ENOTSUP";
360 #endif
361 #ifdef ENOTTY
362 case ENOTTY: return "ENOTTY";
363 #endif
364 #ifdef ENOTUNIQ
365 case ENOTUNIQ: return "ENOTUNIQ";
366 #endif
367 #ifdef ENXIO
368 case ENXIO: return "ENXIO";
369 #endif
370 #if defined(EOPNOTSUPP) && (!defined(ENOTSUP) || (ENOTSUP != EOPNOTSUPP))
371 case EOPNOTSUPP: return "EOPNOTSUPP";
372 #endif
373 #ifdef EOTHER
374 case EOTHER: return "EOTHER";
375 #endif
376 #if defined(EOVERFLOW) && (!defined(EFBIG) || (EOVERFLOW != EFBIG)) && (!defined(EINVAL) || (EOVERFLOW != EINVAL))
377 case EOVERFLOW: return "EOVERFLOW";
378 #endif
379 #ifdef EOWNERDEAD
380 case EOWNERDEAD: return "EOWNERDEAD";
381 #endif
382 #ifdef EPERM
383 case EPERM: return "EPERM";
384 #endif
385 #if defined(EPFNOSUPPORT) && (!defined(ENOLCK) || (ENOLCK != EPFNOSUPPORT))
386 case EPFNOSUPPORT: return "EPFNOSUPPORT";
387 #endif
388 #ifdef EPIPE
389 case EPIPE: return "EPIPE";
390 #endif
391 #ifdef EPROCLIM
392 case EPROCLIM: return "EPROCLIM";
393 #endif
394 #ifdef EPROCUNAVAIL
395 case EPROCUNAVAIL: return "EPROCUNAVAIL";
396 #endif
397 #ifdef EPROGMISMATCH
398 case EPROGMISMATCH: return "EPROGMISMATCH";
399 #endif
400 #ifdef EPROGUNAVAIL
401 case EPROGUNAVAIL: return "EPROGUNAVAIL";
402 #endif
403 #ifdef EPROTO
404 case EPROTO: return "EPROTO";
405 #endif
406 #ifdef EPROTONOSUPPORT
407 case EPROTONOSUPPORT: return "EPROTONOSUPPORT";
408 #endif
409 #ifdef EPROTOTYPE
410 case EPROTOTYPE: return "EPROTOTYPE";
411 #endif
412 #ifdef ERANGE
413 case ERANGE: return "ERANGE";
414 #endif
415 #if defined(EREFUSED) && (!defined(ECONNREFUSED) || (EREFUSED != ECONNREFUSED))
416 case EREFUSED: return "EREFUSED";
417 #endif
418 #ifdef EREMCHG
419 case EREMCHG: return "EREMCHG";
420 #endif
421 #ifdef EREMDEV
422 case EREMDEV: return "EREMDEV";
423 #endif
424 #ifdef EREMOTE
425 case EREMOTE: return "EREMOTE";
426 #endif
427 #ifdef EREMOTEIO
428 case EREMOTEIO: return "EREMOTEIO";
429 #endif
430 #ifdef EREMOTERELEASE
431 case EREMOTERELEASE: return "EREMOTERELEASE";
432 #endif
433 #ifdef ERESTART
434 case ERESTART: return "ERESTART";
435 #endif
436 #ifdef EROFS
437 case EROFS: return "EROFS";
438 #endif
439 #ifdef ERPCMISMATCH
440 case ERPCMISMATCH: return "ERPCMISMATCH";
441 #endif
442 #ifdef ERREMOTE
443 case ERREMOTE: return "ERREMOTE";
444 #endif
445 #ifdef ESHUTDOWN
446 case ESHUTDOWN: return "ESHUTDOWN";
447 #endif
448 #ifdef ESOCKTNOSUPPORT
449 case ESOCKTNOSUPPORT: return "ESOCKTNOSUPPORT";
450 #endif
451 #ifdef ESPIPE
452 case ESPIPE: return "ESPIPE";
453 #endif
454 #ifdef ESRCH
455 case ESRCH: return "ESRCH";
456 #endif
457 #ifdef ESRMNT
458 case ESRMNT: return "ESRMNT";
459 #endif
460 #ifdef ESTALE
461 case ESTALE: return "ESTALE";
462 #endif
463 #ifdef ESUCCESS
464 case ESUCCESS: return "ESUCCESS";
465 #endif
466 #if defined(ETIME) && (!defined(ELOOP) || (ETIME != ELOOP))
467 case ETIME: return "ETIME";
468 #endif
469 #if defined(ETIMEDOUT) && (!defined(ENOSTR) || (ETIMEDOUT != ENOSTR))
470 case ETIMEDOUT: return "ETIMEDOUT";
471 #endif
472 #ifdef ETOOMANYREFS
473 case ETOOMANYREFS: return "ETOOMANYREFS";
474 #endif
475 #ifdef ETXTBSY
476 case ETXTBSY: return "ETXTBSY";
477 #endif
478 #ifdef EUCLEAN
479 case EUCLEAN: return "EUCLEAN";
480 #endif
481 #ifdef EUNATCH
482 case EUNATCH: return "EUNATCH";
483 #endif
484 #ifdef EUSERS
485 case EUSERS: return "EUSERS";
486 #endif
487 #ifdef EVERSION
488 case EVERSION: return "EVERSION";
489 #endif
490 #if defined(EWOULDBLOCK) && (!defined(EAGAIN) || (EWOULDBLOCK != EAGAIN))
491 case EWOULDBLOCK: return "EWOULDBLOCK";
492 #endif
493 #ifdef EXDEV
494 case EXDEV: return "EXDEV";
495 #endif
496 #ifdef EXFULL
497 case EXFULL: return "EXFULL";
498 #endif
499 }
500 return "unknown error";
501 }
502
503 /*
504 *----------------------------------------------------------------------
505 *
506 * Tcl_ErrnoMsg --
507 *
508 * Return a human-readable message corresponding to a given errno value.
509 *
510 * Results:
511 * The return value is the standard POSIX error message for errno. This
512 * procedure is used instead of strerror because strerror returns
513 * slightly different values on different machines (e.g. different
514 * capitalizations), which cause problems for things such as regression
515 * tests. This procedure provides messages for most standard errors, then
516 * it calls strerror for things it doesn't understand.
517 *
518 * Side effects:
519 * None.
520 *
521 *----------------------------------------------------------------------
522 */
523
524 const char *
525 Tcl_ErrnoMsg(
526 int err) /* Error number (such as in errno variable). */
527 {
528 switch (err) {
529 #if defined(E2BIG) && (!defined(EOVERFLOW) || (E2BIG != EOVERFLOW))
530 case E2BIG: return "argument list too long";
531 #endif
532 #ifdef EACCES
533 case EACCES: return "permission denied";
534 #endif
535 #ifdef EADDRINUSE
536 case EADDRINUSE: return "address already in use";
537 #endif
538 #ifdef EADDRNOTAVAIL
539 case EADDRNOTAVAIL: return "cannot assign requested address";
540 #endif
541 #ifdef EADV
542 case EADV: return "advertise error";
543 #endif
544 #ifdef EAFNOSUPPORT
545 case EAFNOSUPPORT: return "address family not supported by protocol";
546 #endif
547 #ifdef EAGAIN
548 case EAGAIN: return "resource temporarily unavailable";
549 #endif
550 #ifdef EALIGN
551 case EALIGN: return "EALIGN";
552 #endif
553 #if defined(EALREADY) && (!defined(EBUSY) || (EALREADY != EBUSY))
554 case EALREADY: return "operation already in progress";
555 #endif
556 #ifdef EBADE
557 case EBADE: return "bad exchange descriptor";
558 #endif
559 #ifdef EBADF
560 case EBADF: return "bad file number";
561 #endif
562 #ifdef EBADFD
563 case EBADFD: return "file descriptor in bad state";
564 #endif
565 #ifdef EBADMSG
566 case EBADMSG: return "not a data message";
567 #endif
568 #ifdef EBADR
569 case EBADR: return "bad request descriptor";
570 #endif
571 #ifdef EBADRPC
572 case EBADRPC: return "RPC structure is bad";
573 #endif
574 #ifdef EBADRQC
575 case EBADRQC: return "bad request code";
576 #endif
577 #ifdef EBADSLT
578 case EBADSLT: return "invalid slot";
579 #endif
580 #ifdef EBFONT
581 case EBFONT: return "bad font file format";
582 #endif
583 #ifdef EBUSY
584 case EBUSY: return "file busy";
585 #endif
586 #ifdef ECANCELED
587 case ECANCELED: return "operation canceled";
588 #endif
589 #ifdef ECASECLASH
590 case ECASECLASH: return "filename exists with different case";
591 #endif
592 #ifdef ECHILD
593 case ECHILD: return "no children";
594 #endif
595 #ifdef ECHRNG
596 case ECHRNG: return "channel number out of range";
597 #endif
598 #ifdef ECOMM
599 case ECOMM: return "communication error on send";
600 #endif
601 #ifdef ECONNABORTED
602 case ECONNABORTED: return "software caused connection abort";
603 #endif
604 #ifdef ECONNREFUSED
605 case ECONNREFUSED: return "connection refused";
606 #endif
607 #ifdef ECONNRESET
608 case ECONNRESET: return "connection reset by peer";
609 #endif
610 #if defined(EDEADLK) && (!defined(EWOULDBLOCK) || (EDEADLK != EWOULDBLOCK))
611 case EDEADLK: return "resource deadlock avoided";
612 #endif
613 #if defined(EDEADLOCK) && (!defined(EDEADLK) || (EDEADLOCK != EDEADLK))
614 case EDEADLOCK: return "resource deadlock avoided";
615 #endif
616 #ifdef EDESTADDRREQ
617 case EDESTADDRREQ: return "destination address required";
618 #endif
619 #ifdef EDIRTY
620 case EDIRTY: return "mounting a dirty fs w/o force";
621 #endif
622 #ifdef EDOM
623 case EDOM: return "math argument out of range";
624 #endif
625 #ifdef EDOTDOT
626 case EDOTDOT: return "cross mount point";
627 #endif
628 #ifdef EDQUOT
629 case EDQUOT: return "disk quota exceeded";
630 #endif
631 #ifdef EDUPPKG
632 case EDUPPKG: return "duplicate package name";
633 #endif
634 #ifdef EEXIST
635 case EEXIST: return "file already exists";
636 #endif
637 #ifdef EFAULT
638 case EFAULT: return "bad address in system call argument";
639 #endif
640 #ifdef EFBIG
641 case EFBIG: return "file too large";
642 #endif
643 #ifdef EFTYPE
644 case EFTYPE: return "inappropriate file type or format";
645 #endif
646 #ifdef EHOSTDOWN
647 case EHOSTDOWN: return "host is down";
648 #endif
649 #ifdef EHOSTUNREACH
650 case EHOSTUNREACH: return "host is unreachable";
651 #endif
652 #if defined(EIDRM) && (!defined(EINPROGRESS) || (EIDRM != EINPROGRESS))
653 case EIDRM: return "identifier removed";
654 #endif
655 #ifdef EINIT
656 case EINIT: return "initialization error";
657 #endif
658 #ifdef EILSEQ
659 case EILSEQ: return "illegal byte sequence";
660 #endif
661 #ifdef EINPROGRESS
662 case EINPROGRESS: return "operation now in progress";
663 #endif
664 #ifdef EINTR
665 case EINTR: return "interrupted system call";
666 #endif
667 #ifdef EINVAL
668 case EINVAL: return "invalid argument";
669 #endif
670 #ifdef EIO
671 case EIO: return "I/O error";
672 #endif
673 #ifdef EISCONN
674 case EISCONN: return "socket is already connected";
675 #endif
676 #ifdef EISDIR
677 case EISDIR: return "illegal operation on a directory";
678 #endif
679 #ifdef EISNAM
680 case EISNAM: return "is a name file";
681 #endif
682 #ifdef EL2HLT
683 case EL2HLT: return "level 2 halted";
684 #endif
685 #ifdef EL2NSYNC
686 case EL2NSYNC: return "level 2 not synchronized";
687 #endif
688 #ifdef EL3HLT
689 case EL3HLT: return "level 3 halted";
690 #endif
691 #ifdef EL3RST
692 case EL3RST: return "level 3 reset";
693 #endif
694 #ifdef ELBIN
695 case ELBIN: return "inode is remote";
696 #endif
697 #ifdef ELIBACC
698 case ELIBACC: return "cannot access a needed shared library";
699 #endif
700 #ifdef ELIBBAD
701 case ELIBBAD: return "accessing a corrupted shared library";
702 #endif
703 #ifdef ELIBEXEC
704 case ELIBEXEC: return "cannot exec a shared library directly";
705 #endif
706 #if defined(ELIBMAX) && (!defined(ECANCELED) || (ELIBMAX != ECANCELED))
707 case ELIBMAX: return
708 "attempting to link in more shared libraries than system limit";
709 #endif
710 #ifdef ELIBSCN
711 case ELIBSCN: return ".lib section in a.out corrupted";
712 #endif
713 #ifdef ELNRNG
714 case ELNRNG: return "link number out of range";
715 #endif
716 #if defined(ELOOP) && (!defined(ENOENT) || (ELOOP != ENOENT))
717 case ELOOP: return "too many levels of symbolic links";
718 #endif
719 #ifdef EMEDIUMTYPE
720 case EMEDIUMTYPE: return "wrong medium type";
721 #endif
722 #ifdef EMFILE
723 case EMFILE: return "too many open files";
724 #endif
725 #ifdef EMLINK
726 case EMLINK: return "too many links";
727 #endif
728 #ifdef EMSGSIZE
729 case EMSGSIZE: return "message too long";
730 #endif
731 #ifdef EMULTIHOP
732 case EMULTIHOP: return "multihop attempted";
733 #endif
734 #ifdef ENAMETOOLONG
735 case ENAMETOOLONG: return "file name too long";
736 #endif
737 #ifdef ENAVAIL
738 case ENAVAIL: return "not available";
739 #endif
740 #ifdef ENET
741 case ENET: return "ENET";
742 #endif
743 #ifdef ENETDOWN
744 case ENETDOWN: return "network is down";
745 #endif
746 #ifdef ENETRESET
747 case ENETRESET: return "network dropped connection on reset";
748 #endif
749 #ifdef ENETUNREACH
750 case ENETUNREACH: return "network is unreachable";
751 #endif
752 #ifdef ENFILE
753 case ENFILE: return "file table overflow";
754 #endif
755 #ifdef ENMFILE
756 case ENMFILE: return "no more files";
757 #endif
758 #ifdef ENOANO
759 case ENOANO: return "anode table overflow";
760 #endif
761 #if defined(ENOBUFS) && (!defined(ENOSR) || (ENOBUFS != ENOSR))
762 case ENOBUFS: return "no buffer space available";
763 #endif
764 #ifdef ENOCSI
765 case ENOCSI: return "no CSI structure available";
766 #endif
767 #if defined(ENODATA) && (!defined(ECONNREFUSED) || (ENODATA != ECONNREFUSED))
768 case ENODATA: return "no data available";
769 #endif
770 #ifdef ENODEV
771 case ENODEV: return "no such device";
772 #endif
773 #ifdef ENOENT
774 case ENOENT: return "no such file or directory";
775 #endif
776 #ifdef ENOEXEC
777 case ENOEXEC: return "exec format error";
778 #endif
779 #ifdef ENOLCK
780 case ENOLCK: return "no locks available";
781 #endif
782 #ifdef ENOLINK
783 case ENOLINK: return "link has been severed";
784 #endif
785 #ifdef ENOMEM
786 case ENOMEM: return "not enough memory";
787 #endif
788 #ifdef ENOMEDIUM
789 case ENOMEDIUM: return "no medium found";
790 #endif
791 #ifdef ENOMSG
792 case ENOMSG: return "no message of desired type";
793 #endif
794 #ifdef ENONET
795 case ENONET: return "machine is not on the network";
796 #endif
797 #ifdef ENOPKG
798 case ENOPKG: return "package not installed";
799 #endif
800 #ifdef ENOPROTOOPT
801 case ENOPROTOOPT: return "bad protocol option";
802 #endif
803 #ifdef ENOSHARE
804 case ENOSHARE: return "no such host or network path";
805 #endif
806 #ifdef ENOSPC
807 case ENOSPC: return "no space left on device";
808 #endif
809 #if defined(ENOSR) && (!defined(ENAMETOOLONG) || (ENAMETOOLONG != ENOSR))
810 case ENOSR: return "out of stream resources";
811 #endif
812 #if defined(ENOSTR) && (!defined(ENOTTY) || (ENOTTY != ENOSTR))
813 case ENOSTR: return "not a stream device";
814 #endif
815 #ifdef ENOSYM
816 case ENOSYM: return "unresolved symbol name";
817 #endif
818 #ifdef ENOSYS
819 case ENOSYS: return "function not implemented";
820 #endif
821 #ifdef ENOTBLK
822 case ENOTBLK: return "block device required";
823 #endif
824 #ifdef ENOTCONN
825 case ENOTCONN: return "socket is not connected";
826 #endif
827 #ifdef ENOTDIR
828 case ENOTDIR: return "not a directory";
829 #endif
830 #if defined(ENOTEMPTY) && (!defined(EEXIST) || (ENOTEMPTY != EEXIST))
831 case ENOTEMPTY: return "directory not empty";
832 #endif
833 #ifdef ENOTNAM
834 case ENOTNAM: return "not a name file";
835 #endif
836 #ifdef ENOTRECOVERABLE
837 case ENOTRECOVERABLE: return "state not recoverable";
838 #endif
839 #ifdef ENOTSOCK
840 case ENOTSOCK: return "socket operation on non-socket";
841 #endif
842 #ifdef ENOTSUP
843 case ENOTSUP: return "operation not supported";
844 #endif
845 #ifdef ENOTTY
846 case ENOTTY: return "inappropriate device for ioctl";
847 #endif
848 #ifdef ENOTUNIQ
849 case ENOTUNIQ: return "name not unique on network";
850 #endif
851 #ifdef ENXIO
852 case ENXIO: return "no such device or address";
853 #endif
854 #if defined(EOPNOTSUPP) && (!defined(ENOTSUP) || (ENOTSUP != EOPNOTSUPP))
855 case EOPNOTSUPP: return "operation not supported on socket";
856 #endif
857 #ifdef EOTHER
858 case EOTHER: return "other error";
859 #endif
860 #if defined(EOVERFLOW) && (!defined(EFBIG) || (EOVERFLOW != EFBIG)) && (!defined(EINVAL) || (EOVERFLOW != EINVAL))
861 case EOVERFLOW: return "file too big";
862 #endif
863 #ifdef EOWNERDEAD
864 case EOWNERDEAD: return "owner died";
865 #endif
866 #ifdef EPERM
867 case EPERM: return "not owner";
868 #endif
869 #if defined(EPFNOSUPPORT) && (!defined(ENOLCK) || (ENOLCK != EPFNOSUPPORT))
870 case EPFNOSUPPORT: return "protocol family not supported";
871 #endif
872 #ifdef EPIPE
873 case EPIPE: return "broken pipe";
874 #endif
875 #ifdef EPROCLIM
876 case EPROCLIM: return "too many processes";
877 #endif
878 #ifdef EPROCUNAVAIL
879 case EPROCUNAVAIL: return "bad procedure for program";
880 #endif
881 #ifdef EPROGMISMATCH
882 case EPROGMISMATCH: return "program version wrong";
883 #endif
884 #ifdef EPROGUNAVAIL
885 case EPROGUNAVAIL: return "RPC program not available";
886 #endif
887 #ifdef EPROTO
888 case EPROTO: return "protocol error";
889 #endif
890 #ifdef EPROTONOSUPPORT
891 case EPROTONOSUPPORT: return "protocol not supported";
892 #endif
893 #ifdef EPROTOTYPE
894 case EPROTOTYPE: return "protocol wrong type for socket";
895 #endif
896 #ifdef ERANGE
897 case ERANGE: return "math result unrepresentable";
898 #endif
899 #if defined(EREFUSED) && (!defined(ECONNREFUSED) || (EREFUSED != ECONNREFUSED))
900 case EREFUSED: return "connection refused";
901 #endif
902 #ifdef EREMCHG
903 case EREMCHG: return "remote address changed";
904 #endif
905 #ifdef EREMDEV
906 case EREMDEV: return "remote device";
907 #endif
908 #ifdef EREMOTE
909 case EREMOTE: return "pathname hit remote file system";
910 #endif
911 #ifdef EREMOTEIO
912 case EREMOTEIO: return "remote i/o error";
913 #endif
914 #ifdef EREMOTERELEASE
915 case EREMOTERELEASE: return "remote peer released connection";
916 #endif
917 #ifdef ERESTART
918 case ERESTART: return "interrupted system call should be restarted";
919 #endif
920 #ifdef EROFS
921 case EROFS: return "read-only file system";
922 #endif
923 #ifdef ERPCMISMATCH
924 case ERPCMISMATCH: return "RPC version is wrong";
925 #endif
926 #ifdef ERREMOTE
927 case ERREMOTE: return "object is remote";
928 #endif
929 #ifdef ESHUTDOWN
930 case ESHUTDOWN: return "cannot send after socket shutdown";
931 #endif
932 #ifdef ESOCKTNOSUPPORT
933 case ESOCKTNOSUPPORT: return "socket type not supported";
934 #endif
935 #ifdef ESPIPE
936 case ESPIPE: return "invalid seek";
937 #endif
938 #ifdef ESRCH
939 case ESRCH: return "no such process";
940 #endif
941 #ifdef ESRMNT
942 case ESRMNT: return "srmount error";
943 #endif
944 #ifdef ESTALE
945 case ESTALE: return "stale remote file handle";
946 #endif
947 #ifdef ESTRPIPE
948 case ESTRPIPE: return "streams pipe error";
949 #endif
950 #ifdef ESUCCESS
951 case ESUCCESS: return "Error 0";
952 #endif
953 #if defined(ETIME) && (!defined(ELOOP) || (ETIME != ELOOP))
954 case ETIME: return "timer expired";
955 #endif
956 #if defined(ETIMEDOUT) && (!defined(ENOSTR) || (ETIMEDOUT != ENOSTR))
957 case ETIMEDOUT: return "connection timed out";
958 #endif
959 #ifdef ETOOMANYREFS
960 case ETOOMANYREFS: return "too many references: cannot splice";
961 #endif
962 #ifdef ETXTBSY
963 case ETXTBSY: return "text file or pseudo-device busy";
964 #endif
965 #ifdef EUCLEAN
966 case EUCLEAN: return "structure needs cleaning";
967 #endif
968 #ifdef EUNATCH
969 case EUNATCH: return "protocol driver not attached";
970 #endif
971 #ifdef EUSERS
972 case EUSERS: return "too many users";
973 #endif
974 #ifdef EVERSION
975 case EVERSION: return "version mismatch";
976 #endif
977 #if defined(EWOULDBLOCK) && (!defined(EAGAIN) || (EWOULDBLOCK != EAGAIN))
978 case EWOULDBLOCK: return "operation would block";
979 #endif
980 #ifdef EXDEV
981 case EXDEV: return "cross-domain link";
982 #endif
983 #ifdef EXFULL
984 case EXFULL: return "message tables full";
985 #endif
986 default:
987 #ifdef NO_STRERROR
988 return "unknown POSIX error";
989 #else
990 return strerror(err);
991 #endif
992 }
993 }
994
995 /*
996 *----------------------------------------------------------------------
997 *
998 * Tcl_SignalId --
999 *
1000 * Return a textual identifier for a signal number.
1001 *
1002 * Results:
1003 * This procedure returns a machine-readable textual identifier that
1004 * corresponds to sig. The identifier is the same as the #define name in
1005 * signal.h.
1006 *
1007 * Side effects:
1008 * None.
1009 *
1010 *----------------------------------------------------------------------
1011 */
1012
1013 const char *
1014 Tcl_SignalId(
1015 int sig) /* Number of signal. */
1016 {
1017 switch (sig) {
1018 #ifdef SIGABRT
1019 case SIGABRT: return "SIGABRT";
1020 #endif
1021 #ifdef SIGALRM
1022 case SIGALRM: return "SIGALRM";
1023 #endif
1024 #ifdef SIGBUS
1025 case SIGBUS: return "SIGBUS";
1026 #endif
1027 #ifdef SIGCHLD
1028 case SIGCHLD: return "SIGCHLD";
1029 #endif
1030 #if defined(SIGCLD) && (!defined(SIGCHLD) || (SIGCLD != SIGCHLD))
1031 case SIGCLD: return "SIGCLD";
1032 #endif
1033 #ifdef SIGCONT
1034 case SIGCONT: return "SIGCONT";
1035 #endif
1036 #if defined(SIGEMT) && (!defined(SIGXCPU) || (SIGEMT != SIGXCPU))
1037 case SIGEMT: return "SIGEMT";
1038 #endif
1039 #ifdef SIGFPE
1040 case SIGFPE: return "SIGFPE";
1041 #endif
1042 #ifdef SIGHUP
1043 case SIGHUP: return "SIGHUP";
1044 #endif
1045 #ifdef SIGILL
1046 case SIGILL: return "SIGILL";
1047 #endif
1048 #ifdef SIGINT
1049 case SIGINT: return "SIGINT";
1050 #endif
1051 #ifdef SIGIO
1052 case SIGIO: return "SIGIO";
1053 #endif
1054 #if defined(SIGIOT) && (!defined(SIGABRT) || (SIGIOT != SIGABRT))
1055 case SIGIOT: return "SIGIOT";
1056 #endif
1057 #ifdef SIGKILL
1058 case SIGKILL: return "SIGKILL";
1059 #endif
1060 #if defined(SIGLOST) && (!defined(SIGIOT) || (SIGLOST != SIGIOT)) && (!defined(SIGURG) || (SIGLOST != SIGURG)) && (!defined(SIGPROF) || (SIGLOST != SIGPROF)) && (!defined(SIGIO) || (SIGLOST != SIGIO))
1061 case SIGLOST: return "SIGLOST";
1062 #endif
1063 #ifdef SIGPIPE
1064 case SIGPIPE: return "SIGPIPE";
1065 #endif
1066 #if defined(SIGPOLL) && (!defined(SIGIO) || (SIGPOLL != SIGIO))
1067 case SIGPOLL: return "SIGPOLL";
1068 #endif
1069 #ifdef SIGPROF
1070 case SIGPROF: return "SIGPROF";
1071 #endif
1072 #if defined(SIGPWR) && (!defined(SIGXFSZ) || (SIGPWR != SIGXFSZ)) && (!defined(SIGLOST) || (SIGPWR != SIGLOST))
1073 case SIGPWR: return "SIGPWR";
1074 #endif
1075 #ifdef SIGQUIT
1076 case SIGQUIT: return "SIGQUIT";
1077 #endif
1078 #if defined(SIGSEGV) && (!defined(SIGBUS) || (SIGSEGV != SIGBUS))
1079 case SIGSEGV: return "SIGSEGV";
1080 #endif
1081 #ifdef SIGSTOP
1082 case SIGSTOP: return "SIGSTOP";
1083 #endif
1084 #ifdef SIGSYS
1085 case SIGSYS: return "SIGSYS";
1086 #endif
1087 #ifdef SIGTERM
1088 case SIGTERM: return "SIGTERM";
1089 #endif
1090 #ifdef SIGTRAP
1091 case SIGTRAP: return "SIGTRAP";
1092 #endif
1093 #ifdef SIGTSTP
1094 case SIGTSTP: return "SIGTSTP";
1095 #endif
1096 #ifdef SIGTTIN
1097 case SIGTTIN: return "SIGTTIN";
1098 #endif
1099 #ifdef SIGTTOU
1100 case SIGTTOU: return "SIGTTOU";
1101 #endif
1102 #if defined(SIGURG) && (!defined(SIGIO) || (SIGURG != SIGIO))
1103 case SIGURG: return "SIGURG";
1104 #endif
1105 #if defined(SIGUSR1) && (!defined(SIGIO) || (SIGUSR1 != SIGIO))
1106 case SIGUSR1: return "SIGUSR1";
1107 #endif
1108 #if defined(SIGUSR2) && (!defined(SIGURG) || (SIGUSR2 != SIGURG))
1109 case SIGUSR2: return "SIGUSR2";
1110 #endif
1111 #ifdef SIGVTALRM
1112 case SIGVTALRM: return "SIGVTALRM";
1113 #endif
1114 #ifdef SIGWINCH
1115 case SIGWINCH: return "SIGWINCH";
1116 #endif
1117 #ifdef SIGXCPU
1118 case SIGXCPU: return "SIGXCPU";
1119 #endif
1120 #ifdef SIGXFSZ
1121 case SIGXFSZ: return "SIGXFSZ";
1122 #endif
1123 #if defined(SIGINFO) && (!defined(SIGPWR) || (SIGINFO != SIGPWR))
1124 case SIGINFO: return "SIGINFO";
1125 #endif
1126 }
1127 return "unknown signal";
1128 }
1129
1130 /*
1131 *----------------------------------------------------------------------
1132 *
1133 * Tcl_SignalMsg --
1134 *
1135 * Return a human-readable message describing a signal.
1136 *
1137 * Results:
1138 * This procedure returns a string describing sig that should make sense
1139 * to a human. It may not be easy for a machine to parse.
1140 *
1141 * Side effects:
1142 * None.
1143 *
1144 *----------------------------------------------------------------------
1145 */
1146
1147 const char *
1148 Tcl_SignalMsg(
1149 int sig) /* Number of signal. */
1150 {
1151 switch (sig) {
1152 #ifdef SIGABRT
1153 case SIGABRT: return "SIGABRT";
1154 #endif
1155 #ifdef SIGALRM
1156 case SIGALRM: return "alarm clock";
1157 #endif
1158 #ifdef SIGBUS
1159 case SIGBUS: return "bus error";
1160 #endif
1161 #ifdef SIGCHLD
1162 case SIGCHLD: return "child status changed";
1163 #endif
1164 #if defined(SIGCLD) && (!defined(SIGCHLD) || (SIGCLD != SIGCHLD))
1165 case SIGCLD: return "child status changed";
1166 #endif
1167 #ifdef SIGCONT
1168 case SIGCONT: return "continue after stop";
1169 #endif
1170 #if defined(SIGEMT) && (!defined(SIGXCPU) || (SIGEMT != SIGXCPU))
1171 case SIGEMT: return "EMT instruction";
1172 #endif
1173 #ifdef SIGFPE
1174 case SIGFPE: return "floating-point exception";
1175 #endif
1176 #ifdef SIGHUP
1177 case SIGHUP: return "hangup";
1178 #endif
1179 #ifdef SIGILL
1180 case SIGILL: return "illegal instruction";
1181 #endif
1182 #ifdef SIGINT
1183 case SIGINT: return "interrupt";
1184 #endif
1185 #ifdef SIGIO
1186 case SIGIO: return "input/output possible on file";
1187 #endif
1188 #if defined(SIGIOT) && (!defined(SIGABRT) || (SIGABRT != SIGIOT))
1189 case SIGIOT: return "IOT instruction";
1190 #endif
1191 #ifdef SIGKILL
1192 case SIGKILL: return "kill signal";
1193 #endif
1194 #if defined(SIGLOST) && (!defined(SIGIOT) || (SIGLOST != SIGIOT)) && (!defined(SIGURG) || (SIGLOST != SIGURG)) && (!defined(SIGPROF) || (SIGLOST != SIGPROF)) && (!defined(SIGIO) || (SIGLOST != SIGIO))
1195 case SIGLOST: return "resource lost";
1196 #endif
1197 #ifdef SIGPIPE
1198 case SIGPIPE: return "write on pipe with no readers";
1199 #endif
1200 #if defined(SIGPOLL) && (!defined(SIGIO) || (SIGPOLL != SIGIO))
1201 case SIGPOLL: return "input/output possible on file";
1202 #endif
1203 #ifdef SIGPROF
1204 case SIGPROF: return "profiling alarm";
1205 #endif
1206 #if defined(SIGPWR) && (!defined(SIGXFSZ) || (SIGPWR != SIGXFSZ)) && (!defined(SIGLOST) || (SIGPWR != SIGLOST))
1207 case SIGPWR: return "power-fail restart";
1208 #endif
1209 #ifdef SIGQUIT
1210 case SIGQUIT: return "quit signal";
1211 #endif
1212 #if defined(SIGSEGV) && (!defined(SIGBUS) || (SIGSEGV != SIGBUS))
1213 case SIGSEGV: return "segmentation violation";
1214 #endif
1215 #ifdef SIGSTOP
1216 case SIGSTOP: return "stop";
1217 #endif
1218 #ifdef SIGSYS
1219 case SIGSYS: return "bad argument to system call";
1220 #endif
1221 #ifdef SIGTERM
1222 case SIGTERM: return "software termination signal";
1223 #endif
1224 #ifdef SIGTRAP
1225 case SIGTRAP: return "trace trap";
1226 #endif
1227 #ifdef SIGTSTP
1228 case SIGTSTP: return "stop signal from tty";
1229 #endif
1230 #ifdef SIGTTIN
1231 case SIGTTIN: return "background tty read";
1232 #endif
1233 #ifdef SIGTTOU
1234 case SIGTTOU: return "background tty write";
1235 #endif
1236 #if defined(SIGURG) && (!defined(SIGIO) || (SIGURG != SIGIO))
1237 case SIGURG: return "urgent I/O condition";
1238 #endif
1239 #if defined(SIGUSR1) && (!defined(SIGIO) || (SIGUSR1 != SIGIO))
1240 case SIGUSR1: return "user-defined signal 1";
1241 #endif
1242 #if defined(SIGUSR2) && (!defined(SIGURG) || (SIGUSR2 != SIGURG))
1243 case SIGUSR2: return "user-defined signal 2";
1244 #endif
1245 #ifdef SIGVTALRM
1246 case SIGVTALRM: return "virtual time alarm";
1247 #endif
1248 #ifdef SIGWINCH
1249 case SIGWINCH: return "window changed";
1250 #endif
1251 #ifdef SIGXCPU
1252 case SIGXCPU: return "exceeded CPU time limit";
1253 #endif
1254 #ifdef SIGXFSZ
1255 case SIGXFSZ: return "exceeded file size limit";
1256 #endif
1257 #if defined(SIGINFO) && (!defined(SIGPWR) || (SIGINFO != SIGPWR))
1258 case SIGINFO: return "information request";
1259 #endif
1260 }
1261 return "unknown signal";
1262 }
1263
1264 /*
1265 * Local Variables:
1266 * mode: c
1267 * c-basic-offset: 4
1268 * fill-column: 78
1269 * End:
1270 */