Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/tcl8.5.2/generic/tclPosixStr.c @ 63

Last change on this file since 63 was 25, checked in by landauf, 16 years ago

added tcl to libs

File size: 28.5 KB
Line 
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 * RCS: @(#) $Id: tclPosixStr.c,v 1.12 2005/11/07 15:16:03 dkf Exp $
14 */
15
16#include "tclInt.h"
17
18/*
19 *----------------------------------------------------------------------
20 *
21 * Tcl_ErrnoId --
22 *
23 *      Return a textual identifier for the current errno value.
24 *
25 * Results:
26 *      This procedure returns a machine-readable textual identifier that
27 *      corresponds to the current errno value (e.g. "EPERM"). The identifier
28 *      is the same as the #define name in errno.h.
29 *
30 * Side effects:
31 *      None.
32 *
33 *----------------------------------------------------------------------
34 */
35
36CONST char *
37Tcl_ErrnoId(void)
38{
39    switch (errno) {
40#ifdef E2BIG
41    case E2BIG: return "E2BIG";
42#endif
43#ifdef EACCES
44    case EACCES: return "EACCES";
45#endif
46#ifdef EADDRINUSE
47    case EADDRINUSE: return "EADDRINUSE";
48#endif
49#ifdef EADDRNOTAVAIL
50    case EADDRNOTAVAIL: return "EADDRNOTAVAIL";
51#endif
52#ifdef EADV
53    case EADV: return "EADV";
54#endif
55#ifdef EAFNOSUPPORT
56    case EAFNOSUPPORT: return "EAFNOSUPPORT";
57#endif
58#ifdef EAGAIN
59    case EAGAIN: return "EAGAIN";
60#endif
61#ifdef EALIGN
62    case EALIGN: return "EALIGN";
63#endif
64#if defined(EALREADY) && (!defined(EBUSY) || (EALREADY != EBUSY ))
65    case EALREADY: return "EALREADY";
66#endif
67#ifdef EBADE
68    case EBADE: return "EBADE";
69#endif
70#ifdef EBADF
71    case EBADF: return "EBADF";
72#endif
73#ifdef EBADFD
74    case EBADFD: return "EBADFD";
75#endif
76#ifdef EBADMSG
77    case EBADMSG: return "EBADMSG";
78#endif
79#ifdef EBADR
80    case EBADR: return "EBADR";
81#endif
82#ifdef EBADRPC
83    case EBADRPC: return "EBADRPC";
84#endif
85#ifdef EBADRQC
86    case EBADRQC: return "EBADRQC";
87#endif
88#ifdef EBADSLT
89    case EBADSLT: return "EBADSLT";
90#endif
91#ifdef EBFONT
92    case EBFONT: return "EBFONT";
93#endif
94#ifdef EBUSY
95    case EBUSY: return "EBUSY";
96#endif
97#ifdef ECHILD
98    case ECHILD: return "ECHILD";
99#endif
100#ifdef ECHRNG
101    case ECHRNG: return "ECHRNG";
102#endif
103#ifdef ECOMM
104    case ECOMM: return "ECOMM";
105#endif
106#ifdef ECONNABORTED
107    case ECONNABORTED: return "ECONNABORTED";
108#endif
109#ifdef ECONNREFUSED
110    case ECONNREFUSED: return "ECONNREFUSED";
111#endif
112#ifdef ECONNRESET
113    case ECONNRESET: return "ECONNRESET";
114#endif
115#if defined(EDEADLK) && (!defined(EWOULDBLOCK) || (EDEADLK != EWOULDBLOCK))
116    case EDEADLK: return "EDEADLK";
117#endif
118#if defined(EDEADLOCK) && (!defined(EDEADLK) || (EDEADLOCK != EDEADLK))
119    case EDEADLOCK: return "EDEADLOCK";
120#endif
121#ifdef EDESTADDRREQ
122    case EDESTADDRREQ: return "EDESTADDRREQ";
123#endif
124#ifdef EDIRTY
125    case EDIRTY: return "EDIRTY";
126#endif
127#ifdef EDOM
128    case EDOM: return "EDOM";
129#endif
130#ifdef EDOTDOT
131    case EDOTDOT: return "EDOTDOT";
132#endif
133#ifdef EDQUOT
134    case EDQUOT: return "EDQUOT";
135#endif
136#ifdef EDUPPKG
137    case EDUPPKG: return "EDUPPKG";
138#endif
139#ifdef EEXIST
140    case EEXIST: return "EEXIST";
141#endif
142#ifdef EFAULT
143    case EFAULT: return "EFAULT";
144#endif
145#ifdef EFBIG
146    case EFBIG: return "EFBIG";
147#endif
148#ifdef EHOSTDOWN
149    case EHOSTDOWN: return "EHOSTDOWN";
150#endif
151#ifdef EHOSTUNREACH
152    case EHOSTUNREACH: return "EHOSTUNREACH";
153#endif
154#if defined(EIDRM) && (!defined(EINPROGRESS) || (EIDRM != EINPROGRESS))
155    case EIDRM: return "EIDRM";
156#endif
157#ifdef EINIT
158    case EINIT: return "EINIT";
159#endif
160#ifdef EINPROGRESS
161    case EINPROGRESS: return "EINPROGRESS";
162#endif
163#ifdef EINTR
164    case EINTR: return "EINTR";
165#endif
166#ifdef EINVAL
167    case EINVAL: return "EINVAL";
168#endif
169#ifdef EIO
170    case EIO: return "EIO";
171#endif
172#ifdef EISCONN
173    case EISCONN: return "EISCONN";
174#endif
175#ifdef EISDIR
176    case EISDIR: return "EISDIR";
177#endif
178#ifdef EISNAME
179    case EISNAM: return "EISNAM";
180#endif
181#ifdef ELBIN
182    case ELBIN: return "ELBIN";
183#endif
184#ifdef EL2HLT
185    case EL2HLT: return "EL2HLT";
186#endif
187#ifdef EL2NSYNC
188    case EL2NSYNC: return "EL2NSYNC";
189#endif
190#ifdef EL3HLT
191    case EL3HLT: return "EL3HLT";
192#endif
193#ifdef EL3RST
194    case EL3RST: return "EL3RST";
195#endif
196#ifdef ELIBACC
197    case ELIBACC: return "ELIBACC";
198#endif
199#ifdef ELIBBAD
200    case ELIBBAD: return "ELIBBAD";
201#endif
202#ifdef ELIBEXEC
203    case ELIBEXEC: return "ELIBEXEC";
204#endif
205#ifdef ELIBMAX
206    case ELIBMAX: return "ELIBMAX";
207#endif
208#ifdef ELIBSCN
209    case ELIBSCN: return "ELIBSCN";
210#endif
211#ifdef ELNRNG
212    case ELNRNG: return "ELNRNG";
213#endif
214#if defined(ELOOP) && (!defined(ENOENT) || (ELOOP != ENOENT))
215    case ELOOP: return "ELOOP";
216#endif
217#ifdef EMFILE
218    case EMFILE: return "EMFILE";
219#endif
220#ifdef EMLINK
221    case EMLINK: return "EMLINK";
222#endif
223#ifdef EMSGSIZE
224    case EMSGSIZE: return "EMSGSIZE";
225#endif
226#ifdef EMULTIHOP
227    case EMULTIHOP: return "EMULTIHOP";
228#endif
229#ifdef ENAMETOOLONG
230    case ENAMETOOLONG: return "ENAMETOOLONG";
231#endif
232#ifdef ENAVAIL
233    case ENAVAIL: return "ENAVAIL";
234#endif
235#ifdef ENET
236    case ENET: return "ENET";
237#endif
238#ifdef ENETDOWN
239    case ENETDOWN: return "ENETDOWN";
240#endif
241#ifdef ENETRESET
242    case ENETRESET: return "ENETRESET";
243#endif
244#ifdef ENETUNREACH
245    case ENETUNREACH: return "ENETUNREACH";
246#endif
247#ifdef ENFILE
248    case ENFILE: return "ENFILE";
249#endif
250#ifdef ENOANO
251    case ENOANO: return "ENOANO";
252#endif
253#if defined(ENOBUFS) && (!defined(ENOSR) || (ENOBUFS != ENOSR))
254    case ENOBUFS: return "ENOBUFS";
255#endif
256#ifdef ENOCSI
257    case ENOCSI: return "ENOCSI";
258#endif
259#if defined(ENODATA) && (!defined(ECONNREFUSED) || (ENODATA != ECONNREFUSED))
260    case ENODATA: return "ENODATA";
261#endif
262#ifdef ENODEV
263    case ENODEV: return "ENODEV";
264#endif
265#ifdef ENOENT
266    case ENOENT: return "ENOENT";
267#endif
268#ifdef ENOEXEC
269    case ENOEXEC: return "ENOEXEC";
270#endif
271#ifdef ENOLCK
272    case ENOLCK: return "ENOLCK";
273#endif
274#ifdef ENOLINK
275    case ENOLINK: return "ENOLINK";
276#endif
277#ifdef ENOMEM
278    case ENOMEM: return "ENOMEM";
279#endif
280#ifdef ENOMSG
281    case ENOMSG: return "ENOMSG";
282#endif
283#ifdef ENONET
284    case ENONET: return "ENONET";
285#endif
286#ifdef ENOPKG
287    case ENOPKG: return "ENOPKG";
288#endif
289#ifdef ENOPROTOOPT
290    case ENOPROTOOPT: return "ENOPROTOOPT";
291#endif
292#ifdef ENOSPC
293    case ENOSPC: return "ENOSPC";
294#endif
295#if defined(ENOSR) && (!defined(ENAMETOOLONG) || (ENAMETOOLONG != ENOSR))
296    case ENOSR: return "ENOSR";
297#endif
298#if defined(ENOSTR) && (!defined(ENOTTY) || (ENOTTY != ENOSTR))
299    case ENOSTR: return "ENOSTR";
300#endif
301#ifdef ENOSYM
302    case ENOSYM: return "ENOSYM";
303#endif
304#ifdef ENOSYS
305    case ENOSYS: return "ENOSYS";
306#endif
307#ifdef ENOTBLK
308    case ENOTBLK: return "ENOTBLK";
309#endif
310#ifdef ENOTCONN
311    case ENOTCONN: return "ENOTCONN";
312#endif
313#ifdef ENOTDIR
314    case ENOTDIR: return "ENOTDIR";
315#endif
316#if defined(ENOTEMPTY) && (!defined(EEXIST) || (ENOTEMPTY != EEXIST))
317    case ENOTEMPTY: return "ENOTEMPTY";
318#endif
319#ifdef ENOTNAM
320    case ENOTNAM: return "ENOTNAM";
321#endif
322#ifdef ENOTSOCK
323    case ENOTSOCK: return "ENOTSOCK";
324#endif
325#ifdef ENOTSUP
326    case ENOTSUP: return "ENOTSUP";
327#endif
328#ifdef ENOTTY
329    case ENOTTY: return "ENOTTY";
330#endif
331#ifdef ENOTUNIQ
332    case ENOTUNIQ: return "ENOTUNIQ";
333#endif
334#ifdef ENXIO
335    case ENXIO: return "ENXIO";
336#endif
337#if defined(EOPNOTSUPP) &&  (!defined(ENOTSUP) || (ENOTSUP != EOPNOTSUPP))
338    case EOPNOTSUPP: return "EOPNOTSUPP";
339#endif
340#if defined(EOVERFLOW) && ( !defined(EFBIG) || (EOVERFLOW != EFBIG) ) && ( !defined(EINVAL) || (EOVERFLOW != EINVAL) )
341    case EOVERFLOW: return "EOVERFLOW";
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 * Tcl_ErrnoMsg --
465 *
466 *      Return a human-readable message corresponding to a given errno value.
467 *
468 * Results:
469 *      The return value is the standard POSIX error message for errno.  This
470 *      procedure is used instead of strerror because strerror returns
471 *      slightly different values on different machines (e.g. different
472 *      capitalizations), which cause problems for things such as regression
473 *      tests. This procedure provides messages for most standard errors, then
474 *      it calls strerror for things it doesn't understand.
475 *
476 * Side effects:
477 *      None.
478 *
479 *----------------------------------------------------------------------
480 */
481
482CONST char *
483Tcl_ErrnoMsg(
484     int err)                   /* Error number (such as in errno variable). */
485{
486    switch (err) {
487#ifdef E2BIG
488    case E2BIG: return "argument list too long";
489#endif
490#ifdef EACCES
491    case EACCES: return "permission denied";
492#endif
493#ifdef EADDRINUSE
494    case EADDRINUSE: return "address already in use";
495#endif
496#ifdef EADDRNOTAVAIL
497    case EADDRNOTAVAIL: return "can't assign requested address";
498#endif
499#ifdef EADV
500    case EADV: return "advertise error";
501#endif
502#ifdef EAFNOSUPPORT
503    case EAFNOSUPPORT: return "address family not supported by protocol family";
504#endif
505#ifdef EAGAIN
506    case EAGAIN: return "resource temporarily unavailable";
507#endif
508#ifdef EALIGN
509    case EALIGN: return "EALIGN";
510#endif
511#if defined(EALREADY) && (!defined(EBUSY) || (EALREADY != EBUSY ))
512    case EALREADY: return "operation already in progress";
513#endif
514#ifdef EBADE
515    case EBADE: return "bad exchange descriptor";
516#endif
517#ifdef EBADF
518    case EBADF: return "bad file number";
519#endif
520#ifdef EBADFD
521    case EBADFD: return "file descriptor in bad state";
522#endif
523#ifdef EBADMSG
524    case EBADMSG: return "not a data message";
525#endif
526#ifdef EBADR
527    case EBADR: return "bad request descriptor";
528#endif
529#ifdef EBADRPC
530    case EBADRPC: return "RPC structure is bad";
531#endif
532#ifdef EBADRQC
533    case EBADRQC: return "bad request code";
534#endif
535#ifdef EBADSLT
536    case EBADSLT: return "invalid slot";
537#endif
538#ifdef EBFONT
539    case EBFONT: return "bad font file format";
540#endif
541#ifdef EBUSY
542    case EBUSY: return "file busy";
543#endif
544#ifdef ECHILD
545    case ECHILD: return "no children";
546#endif
547#ifdef ECHRNG
548    case ECHRNG: return "channel number out of range";
549#endif
550#ifdef ECOMM
551    case ECOMM: return "communication error on send";
552#endif
553#ifdef ECONNABORTED
554    case ECONNABORTED: return "software caused connection abort";
555#endif
556#ifdef ECONNREFUSED
557    case ECONNREFUSED: return "connection refused";
558#endif
559#ifdef ECONNRESET
560    case ECONNRESET: return "connection reset by peer";
561#endif
562#if defined(EDEADLK) && (!defined(EWOULDBLOCK) || (EDEADLK != EWOULDBLOCK))
563    case EDEADLK: return "resource deadlock avoided";
564#endif
565#if defined(EDEADLOCK) && (!defined(EDEADLK) || (EDEADLOCK != EDEADLK))
566    case EDEADLOCK: return "resource deadlock avoided";
567#endif
568#ifdef EDESTADDRREQ
569    case EDESTADDRREQ: return "destination address required";
570#endif
571#ifdef EDIRTY
572    case EDIRTY: return "mounting a dirty fs w/o force";
573#endif
574#ifdef EDOM
575    case EDOM: return "math argument out of range";
576#endif
577#ifdef EDOTDOT
578    case EDOTDOT: return "cross mount point";
579#endif
580#ifdef EDQUOT
581    case EDQUOT: return "disk quota exceeded";
582#endif
583#ifdef EDUPPKG
584    case EDUPPKG: return "duplicate package name";
585#endif
586#ifdef EEXIST
587    case EEXIST: return "file already exists";
588#endif
589#ifdef EFAULT
590    case EFAULT: return "bad address in system call argument";
591#endif
592#ifdef EFBIG
593    case EFBIG: return "file too large";
594#endif
595#ifdef EHOSTDOWN
596    case EHOSTDOWN: return "host is down";
597#endif
598#ifdef EHOSTUNREACH
599    case EHOSTUNREACH: return "host is unreachable";
600#endif
601#if defined(EIDRM) && (!defined(EINPROGRESS) || (EIDRM != EINPROGRESS))
602    case EIDRM: return "identifier removed";
603#endif
604#ifdef EINIT
605    case EINIT: return "initialization error";
606#endif
607#ifdef EINPROGRESS
608    case EINPROGRESS: return "operation now in progress";
609#endif
610#ifdef EINTR
611    case EINTR: return "interrupted system call";
612#endif
613#ifdef EINVAL
614    case EINVAL: return "invalid argument";
615#endif
616#ifdef EIO
617    case EIO: return "I/O error";
618#endif
619#ifdef EISCONN
620    case EISCONN: return "socket is already connected";
621#endif
622#ifdef EISDIR
623    case EISDIR: return "illegal operation on a directory";
624#endif
625#ifdef EISNAME
626    case EISNAM: return "is a name file";
627#endif
628#ifdef ELBIN
629    case ELBIN: return "ELBIN";
630#endif
631#ifdef EL2HLT
632    case EL2HLT: return "level 2 halted";
633#endif
634#ifdef EL2NSYNC
635    case EL2NSYNC: return "level 2 not synchronized";
636#endif
637#ifdef EL3HLT
638    case EL3HLT: return "level 3 halted";
639#endif
640#ifdef EL3RST
641    case EL3RST: return "level 3 reset";
642#endif
643#ifdef ELIBACC
644    case ELIBACC: return "can not access a needed shared library";
645#endif
646#ifdef ELIBBAD
647    case ELIBBAD: return "accessing a corrupted shared library";
648#endif
649#ifdef ELIBEXEC
650    case ELIBEXEC: return "can not exec a shared library directly";
651#endif
652#ifdef ELIBMAX
653    case ELIBMAX: return
654                      "attempting to link in more shared libraries than system limit";
655#endif
656#ifdef ELIBSCN
657    case ELIBSCN: return ".lib section in a.out corrupted";
658#endif
659#ifdef ELNRNG
660    case ELNRNG: return "link number out of range";
661#endif
662#if defined(ELOOP) && (!defined(ENOENT) || (ELOOP != ENOENT))
663    case ELOOP: return "too many levels of symbolic links";
664#endif
665#ifdef EMFILE
666    case EMFILE: return "too many open files";
667#endif
668#ifdef EMLINK
669    case EMLINK: return "too many links";
670#endif
671#ifdef EMSGSIZE
672    case EMSGSIZE: return "message too long";
673#endif
674#ifdef EMULTIHOP
675    case EMULTIHOP: return "multihop attempted";
676#endif
677#ifdef ENAMETOOLONG
678    case ENAMETOOLONG: return "file name too long";
679#endif
680#ifdef ENAVAIL
681    case ENAVAIL: return "not available";
682#endif
683#ifdef ENET
684    case ENET: return "ENET";
685#endif
686#ifdef ENETDOWN
687    case ENETDOWN: return "network is down";
688#endif
689#ifdef ENETRESET
690    case ENETRESET: return "network dropped connection on reset";
691#endif
692#ifdef ENETUNREACH
693    case ENETUNREACH: return "network is unreachable";
694#endif
695#ifdef ENFILE
696    case ENFILE: return "file table overflow";
697#endif
698#ifdef ENOANO
699    case ENOANO: return "anode table overflow";
700#endif
701#if defined(ENOBUFS) && (!defined(ENOSR) || (ENOBUFS != ENOSR))
702    case ENOBUFS: return "no buffer space available";
703#endif
704#ifdef ENOCSI
705    case ENOCSI: return "no CSI structure available";
706#endif
707#if defined(ENODATA) && (!defined(ECONNREFUSED) || (ENODATA != ECONNREFUSED))
708    case ENODATA: return "no data available";
709#endif
710#ifdef ENODEV
711    case ENODEV: return "no such device";
712#endif
713#ifdef ENOENT
714    case ENOENT: return "no such file or directory";
715#endif
716#ifdef ENOEXEC
717    case ENOEXEC: return "exec format error";
718#endif
719#ifdef ENOLCK
720    case ENOLCK: return "no locks available";
721#endif
722#ifdef ENOLINK
723    case ENOLINK: return "link has be severed";
724#endif
725#ifdef ENOMEM
726    case ENOMEM: return "not enough memory";
727#endif
728#ifdef ENOMSG
729    case ENOMSG: return "no message of desired type";
730#endif
731#ifdef ENONET
732    case ENONET: return "machine is not on the network";
733#endif
734#ifdef ENOPKG
735    case ENOPKG: return "package not installed";
736#endif
737#ifdef ENOPROTOOPT
738    case ENOPROTOOPT: return "bad protocol option";
739#endif
740#ifdef ENOSPC
741    case ENOSPC: return "no space left on device";
742#endif
743#if defined(ENOSR) && (!defined(ENAMETOOLONG) || (ENAMETOOLONG != ENOSR))
744    case ENOSR: return "out of stream resources";
745#endif
746#if defined(ENOSTR) && (!defined(ENOTTY) || (ENOTTY != ENOSTR))
747    case ENOSTR: return "not a stream device";
748#endif
749#ifdef ENOSYM
750    case ENOSYM: return "unresolved symbol name";
751#endif
752#ifdef ENOSYS
753    case ENOSYS: return "function not implemented";
754#endif
755#ifdef ENOTBLK
756    case ENOTBLK: return "block device required";
757#endif
758#ifdef ENOTCONN
759    case ENOTCONN: return "socket is not connected";
760#endif
761#ifdef ENOTDIR
762    case ENOTDIR: return "not a directory";
763#endif
764#if defined(ENOTEMPTY) && (!defined(EEXIST) || (ENOTEMPTY != EEXIST))
765    case ENOTEMPTY: return "directory not empty";
766#endif
767#ifdef ENOTNAM
768    case ENOTNAM: return "not a name file";
769#endif
770#ifdef ENOTSOCK
771    case ENOTSOCK: return "socket operation on non-socket";
772#endif
773#ifdef ENOTSUP
774    case ENOTSUP: return "operation not supported";
775#endif
776#ifdef ENOTTY
777    case ENOTTY: return "inappropriate device for ioctl";
778#endif
779#ifdef ENOTUNIQ
780    case ENOTUNIQ: return "name not unique on network";
781#endif
782#ifdef ENXIO
783    case ENXIO: return "no such device or address";
784#endif
785#if defined(EOPNOTSUPP) &&  (!defined(ENOTSUP) || (ENOTSUP != EOPNOTSUPP))
786    case EOPNOTSUPP: return "operation not supported on socket";
787#endif
788#if defined(EOVERFLOW) && ( !defined(EFBIG) || (EOVERFLOW != EFBIG) ) && ( !defined(EINVAL) || (EOVERFLOW != EINVAL) )
789    case EOVERFLOW: return "file too big";
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 * Tcl_SignalId --
918 *
919 *      Return a textual identifier for a signal number.
920 *
921 * Results:
922 *      This procedure returns a machine-readable textual identifier that
923 *      corresponds to sig.  The identifier is the same as the #define name in
924 *      signal.h.
925 *
926 * Side effects:
927 *      None.
928 *
929 *----------------------------------------------------------------------
930 */
931
932CONST char *
933Tcl_SignalId(
934     int sig)                   /* Number of signal. */
935{
936    switch (sig) {
937#ifdef SIGABRT
938    case SIGABRT: return "SIGABRT";
939#endif
940#ifdef SIGALRM
941    case SIGALRM: return "SIGALRM";
942#endif
943#ifdef SIGBUS
944    case SIGBUS: return "SIGBUS";
945#endif
946#ifdef SIGCHLD
947    case SIGCHLD: return "SIGCHLD";
948#endif
949#if defined(SIGCLD) && (!defined(SIGCHLD) || (SIGCLD != SIGCHLD))
950    case SIGCLD: return "SIGCLD";
951#endif
952#ifdef SIGCONT
953    case SIGCONT: return "SIGCONT";
954#endif
955#if defined(SIGEMT) && (!defined(SIGXCPU) || (SIGEMT != SIGXCPU))
956    case SIGEMT: return "SIGEMT";
957#endif
958#ifdef SIGFPE
959    case SIGFPE: return "SIGFPE";
960#endif
961#ifdef SIGHUP
962    case SIGHUP: return "SIGHUP";
963#endif
964#ifdef SIGILL
965    case SIGILL: return "SIGILL";
966#endif
967#ifdef SIGINT
968    case SIGINT: return "SIGINT";
969#endif
970#ifdef SIGIO
971    case SIGIO: return "SIGIO";
972#endif
973#if defined(SIGIOT) && (!defined(SIGABRT) || (SIGIOT != SIGABRT))
974    case SIGIOT: return "SIGIOT";
975#endif
976#ifdef SIGKILL
977    case SIGKILL: return "SIGKILL";
978#endif
979#if defined(SIGLOST) && (!defined(SIGIOT) || (SIGLOST != SIGIOT)) && (!defined(SIGURG) || (SIGLOST != SIGURG)) && (!defined(SIGPROF) || (SIGLOST != SIGPROF)) && (!defined(SIGIO) || (SIGLOST != SIGIO))
980    case SIGLOST: return "SIGLOST";
981#endif
982#ifdef SIGPIPE
983    case SIGPIPE: return "SIGPIPE";
984#endif
985#if defined(SIGPOLL) && (!defined(SIGIO) || (SIGPOLL != SIGIO))
986    case SIGPOLL: return "SIGPOLL";
987#endif
988#ifdef SIGPROF
989    case SIGPROF: return "SIGPROF";
990#endif
991#if defined(SIGPWR) && (!defined(SIGXFSZ) || (SIGPWR != SIGXFSZ)) && (!defined(SIGLOST) || (SIGPWR != SIGLOST))
992    case SIGPWR: return "SIGPWR";
993#endif
994#ifdef SIGQUIT
995    case SIGQUIT: return "SIGQUIT";
996#endif
997#ifdef SIGSEGV
998    case SIGSEGV: return "SIGSEGV";
999#endif
1000#ifdef SIGSTOP
1001    case SIGSTOP: return "SIGSTOP";
1002#endif
1003#ifdef SIGSYS
1004    case SIGSYS: return "SIGSYS";
1005#endif
1006#ifdef SIGTERM
1007    case SIGTERM: return "SIGTERM";
1008#endif
1009#ifdef SIGTRAP
1010    case SIGTRAP: return "SIGTRAP";
1011#endif
1012#ifdef SIGTSTP
1013    case SIGTSTP: return "SIGTSTP";
1014#endif
1015#ifdef SIGTTIN
1016    case SIGTTIN: return "SIGTTIN";
1017#endif
1018#ifdef SIGTTOU
1019    case SIGTTOU: return "SIGTTOU";
1020#endif
1021#if defined(SIGURG) && (!defined(SIGIO) || (SIGURG != SIGIO))
1022    case SIGURG: return "SIGURG";
1023#endif
1024#if defined(SIGUSR1) && (!defined(SIGIO) || (SIGUSR1 != SIGIO))
1025    case SIGUSR1: return "SIGUSR1";
1026#endif
1027#if defined(SIGUSR2) && (!defined(SIGURG) || (SIGUSR2 != SIGURG))
1028    case SIGUSR2: return "SIGUSR2";
1029#endif
1030#ifdef SIGVTALRM
1031    case SIGVTALRM: return "SIGVTALRM";
1032#endif
1033#ifdef SIGWINCH
1034    case SIGWINCH: return "SIGWINCH";
1035#endif
1036#ifdef SIGXCPU
1037    case SIGXCPU: return "SIGXCPU";
1038#endif
1039#ifdef SIGXFSZ
1040    case SIGXFSZ: return "SIGXFSZ";
1041#endif
1042    }
1043    return "unknown signal";
1044}
1045
1046/*
1047 *----------------------------------------------------------------------
1048 *
1049 * Tcl_SignalMsg --
1050 *
1051 *      Return a human-readable message describing a signal.
1052 *
1053 * Results:
1054 *      This procedure returns a string describing sig that should make sense
1055 *      to a human.  It may not be easy for a machine to parse.
1056 *
1057 * Side effects:
1058 *      None.
1059 *
1060 *----------------------------------------------------------------------
1061 */
1062
1063CONST char *
1064Tcl_SignalMsg(
1065     int sig)                   /* Number of signal. */
1066{
1067    switch (sig) {
1068#ifdef SIGABRT
1069    case SIGABRT: return "SIGABRT";
1070#endif
1071#ifdef SIGALRM
1072    case SIGALRM: return "alarm clock";
1073#endif
1074#ifdef SIGBUS
1075    case SIGBUS: return "bus error";
1076#endif
1077#ifdef SIGCHLD
1078    case SIGCHLD: return "child status changed";
1079#endif
1080#if defined(SIGCLD) && (!defined(SIGCHLD) || (SIGCLD != SIGCHLD))
1081    case SIGCLD: return "child status changed";
1082#endif
1083#ifdef SIGCONT
1084    case SIGCONT: return "continue after stop";
1085#endif
1086#if defined(SIGEMT) && (!defined(SIGXCPU) || (SIGEMT != SIGXCPU))
1087    case SIGEMT: return "EMT instruction";
1088#endif
1089#ifdef SIGFPE
1090    case SIGFPE: return "floating-point exception";
1091#endif
1092#ifdef SIGHUP
1093    case SIGHUP: return "hangup";
1094#endif
1095#ifdef SIGILL
1096    case SIGILL: return "illegal instruction";
1097#endif
1098#ifdef SIGINT
1099    case SIGINT: return "interrupt";
1100#endif
1101#ifdef SIGIO
1102    case SIGIO: return "input/output possible on file";
1103#endif
1104#if defined(SIGIOT) && (!defined(SIGABRT) || (SIGABRT != SIGIOT))
1105    case SIGIOT: return "IOT instruction";
1106#endif
1107#ifdef SIGKILL
1108    case SIGKILL: return "kill signal";
1109#endif
1110#if defined(SIGLOST) && (!defined(SIGIOT) || (SIGLOST != SIGIOT)) && (!defined(SIGURG) || (SIGLOST != SIGURG)) && (!defined(SIGPROF) || (SIGLOST != SIGPROF)) && (!defined(SIGIO) || (SIGLOST != SIGIO))
1111    case SIGLOST: return "resource lost";
1112#endif
1113#ifdef SIGPIPE
1114    case SIGPIPE: return "write on pipe with no readers";
1115#endif
1116#if defined(SIGPOLL) && (!defined(SIGIO) || (SIGPOLL != SIGIO))
1117    case SIGPOLL: return "input/output possible on file";
1118#endif
1119#ifdef SIGPROF
1120    case SIGPROF: return "profiling alarm";
1121#endif
1122#if defined(SIGPWR) && (!defined(SIGXFSZ) || (SIGPWR != SIGXFSZ)) && (!defined(SIGLOST) || (SIGPWR != SIGLOST))
1123    case SIGPWR: return "power-fail restart";
1124#endif
1125#ifdef SIGQUIT
1126    case SIGQUIT: return "quit signal";
1127#endif
1128#ifdef SIGSEGV
1129    case SIGSEGV: return "segmentation violation";
1130#endif
1131#ifdef SIGSTOP
1132    case SIGSTOP: return "stop";
1133#endif
1134#ifdef SIGSYS
1135    case SIGSYS: return "bad argument to system call";
1136#endif
1137#ifdef SIGTERM
1138    case SIGTERM: return "software termination signal";
1139#endif
1140#ifdef SIGTRAP
1141    case SIGTRAP: return "trace trap";
1142#endif
1143#ifdef SIGTSTP
1144    case SIGTSTP: return "stop signal from tty";
1145#endif
1146#ifdef SIGTTIN
1147    case SIGTTIN: return "background tty read";
1148#endif
1149#ifdef SIGTTOU
1150    case SIGTTOU: return "background tty write";
1151#endif
1152#if defined(SIGURG) && (!defined(SIGIO) || (SIGURG != SIGIO))
1153    case SIGURG: return "urgent I/O condition";
1154#endif
1155#if defined(SIGUSR1) && (!defined(SIGIO) || (SIGUSR1 != SIGIO))
1156    case SIGUSR1: return "user-defined signal 1";
1157#endif
1158#if defined(SIGUSR2) && (!defined(SIGURG) || (SIGUSR2 != SIGURG))
1159    case SIGUSR2: return "user-defined signal 2";
1160#endif
1161#ifdef SIGVTALRM
1162    case SIGVTALRM: return "virtual time alarm";
1163#endif
1164#ifdef SIGWINCH
1165    case SIGWINCH: return "window changed";
1166#endif
1167#ifdef SIGXCPU
1168    case SIGXCPU: return "exceeded CPU time limit";
1169#endif
1170#ifdef SIGXFSZ
1171    case SIGXFSZ: return "exceeded file size limit";
1172#endif
1173    }
1174    return "unknown signal";
1175}
1176
1177/*
1178 * Local Variables:
1179 * mode: c
1180 * c-basic-offset: 4
1181 * fill-column: 78
1182 * End:
1183 */
Note: See TracBrowser for help on using the repository browser.