Fork me on GitHub

source: svn/trunk/external/tcl/tclPosixStr.c@ 1231

Last change on this file since 1231 was 593, checked in by Pavel Demin, 12 years ago

initial commit

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