/[dtapublic]/projs/trunk/shared_source/tcl_base/tclposixstr.c
ViewVC logotype

Contents of /projs/trunk/shared_source/tcl_base/tclposixstr.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 42 - (show annotations) (download)
Fri Oct 14 01:50:00 2016 UTC (8 years, 2 months ago) by dashley
File MIME type: text/plain
File size: 29254 byte(s)
Move shared source code to commonize.
1 /* $Header: /cvsroot/esrg/sfesrg/esrgpcpj/shared/tcl_base/tclposixstr.c,v 1.1.1.1 2001/06/13 04:45:10 dtashley Exp $ */
2
3 /*
4 * tclPosixStr.c --
5 *
6 * This file contains procedures that generate strings
7 * corresponding to various POSIX-related codes, such
8 * as errno and signals.
9 *
10 * Copyright (c) 1991-1994 The Regents of the University of California.
11 * Copyright (c) 1994-1996 Sun Microsystems, Inc.
12 *
13 * See the file "license.terms" for information on usage and redistribution
14 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 *
16 * RCS: @(#) $Id: tclposixstr.c,v 1.1.1.1 2001/06/13 04:45:10 dtashley Exp $
17 */
18
19 #include "tclInt.h"
20 #include "tclPort.h"
21
22 /*
23 *----------------------------------------------------------------------
24 *
25 * Tcl_ErrnoId --
26 *
27 * Return a textual identifier for the current errno value.
28 *
29 * Results:
30 * This procedure returns a machine-readable textual identifier
31 * that corresponds to the current errno value (e.g. "EPERM").
32 * The identifier is the same as the #define name in errno.h.
33 *
34 * Side effects:
35 * None.
36 *
37 *----------------------------------------------------------------------
38 */
39
40 char *
41 Tcl_ErrnoId()
42 {
43 switch (errno) {
44 #ifdef E2BIG
45 case E2BIG: return "E2BIG";
46 #endif
47 #ifdef EACCES
48 case EACCES: return "EACCES";
49 #endif
50 #ifdef EADDRINUSE
51 case EADDRINUSE: return "EADDRINUSE";
52 #endif
53 #ifdef EADDRNOTAVAIL
54 case EADDRNOTAVAIL: return "EADDRNOTAVAIL";
55 #endif
56 #ifdef EADV
57 case EADV: return "EADV";
58 #endif
59 #ifdef EAFNOSUPPORT
60 case EAFNOSUPPORT: return "EAFNOSUPPORT";
61 #endif
62 #ifdef EAGAIN
63 case EAGAIN: return "EAGAIN";
64 #endif
65 #ifdef EALIGN
66 case EALIGN: return "EALIGN";
67 #endif
68 #if defined(EALREADY) && (!defined(EBUSY) || (EALREADY != EBUSY ))
69 case EALREADY: return "EALREADY";
70 #endif
71 #ifdef EBADE
72 case EBADE: return "EBADE";
73 #endif
74 #ifdef EBADF
75 case EBADF: return "EBADF";
76 #endif
77 #ifdef EBADFD
78 case EBADFD: return "EBADFD";
79 #endif
80 #ifdef EBADMSG
81 case EBADMSG: return "EBADMSG";
82 #endif
83 #ifdef EBADR
84 case EBADR: return "EBADR";
85 #endif
86 #ifdef EBADRPC
87 case EBADRPC: return "EBADRPC";
88 #endif
89 #ifdef EBADRQC
90 case EBADRQC: return "EBADRQC";
91 #endif
92 #ifdef EBADSLT
93 case EBADSLT: return "EBADSLT";
94 #endif
95 #ifdef EBFONT
96 case EBFONT: return "EBFONT";
97 #endif
98 #ifdef EBUSY
99 case EBUSY: return "EBUSY";
100 #endif
101 #ifdef ECHILD
102 case ECHILD: return "ECHILD";
103 #endif
104 #ifdef ECHRNG
105 case ECHRNG: return "ECHRNG";
106 #endif
107 #ifdef ECOMM
108 case ECOMM: return "ECOMM";
109 #endif
110 #ifdef ECONNABORTED
111 case ECONNABORTED: return "ECONNABORTED";
112 #endif
113 #ifdef ECONNREFUSED
114 case ECONNREFUSED: return "ECONNREFUSED";
115 #endif
116 #ifdef ECONNRESET
117 case ECONNRESET: return "ECONNRESET";
118 #endif
119 #if defined(EDEADLK) && (!defined(EWOULDBLOCK) || (EDEADLK != EWOULDBLOCK))
120 case EDEADLK: return "EDEADLK";
121 #endif
122 #if defined(EDEADLOCK) && (!defined(EDEADLK) || (EDEADLOCK != EDEADLK))
123 case EDEADLOCK: return "EDEADLOCK";
124 #endif
125 #ifdef EDESTADDRREQ
126 case EDESTADDRREQ: return "EDESTADDRREQ";
127 #endif
128 #ifdef EDIRTY
129 case EDIRTY: return "EDIRTY";
130 #endif
131 #ifdef EDOM
132 case EDOM: return "EDOM";
133 #endif
134 #ifdef EDOTDOT
135 case EDOTDOT: return "EDOTDOT";
136 #endif
137 #ifdef EDQUOT
138 case EDQUOT: return "EDQUOT";
139 #endif
140 #ifdef EDUPPKG
141 case EDUPPKG: return "EDUPPKG";
142 #endif
143 #ifdef EEXIST
144 case EEXIST: return "EEXIST";
145 #endif
146 #ifdef EFAULT
147 case EFAULT: return "EFAULT";
148 #endif
149 #ifdef EFBIG
150 case EFBIG: return "EFBIG";
151 #endif
152 #ifdef EHOSTDOWN
153 case EHOSTDOWN: return "EHOSTDOWN";
154 #endif
155 #ifdef EHOSTUNREACH
156 case EHOSTUNREACH: return "EHOSTUNREACH";
157 #endif
158 #if defined(EIDRM) && (!defined(EINPROGRESS) || (EIDRM != EINPROGRESS))
159 case EIDRM: return "EIDRM";
160 #endif
161 #ifdef EINIT
162 case EINIT: return "EINIT";
163 #endif
164 #ifdef EINPROGRESS
165 case EINPROGRESS: return "EINPROGRESS";
166 #endif
167 #ifdef EINTR
168 case EINTR: return "EINTR";
169 #endif
170 #ifdef EINVAL
171 case EINVAL: return "EINVAL";
172 #endif
173 #ifdef EIO
174 case EIO: return "EIO";
175 #endif
176 #ifdef EISCONN
177 case EISCONN: return "EISCONN";
178 #endif
179 #ifdef EISDIR
180 case EISDIR: return "EISDIR";
181 #endif
182 #ifdef EISNAME
183 case EISNAM: return "EISNAM";
184 #endif
185 #ifdef ELBIN
186 case ELBIN: return "ELBIN";
187 #endif
188 #ifdef EL2HLT
189 case EL2HLT: return "EL2HLT";
190 #endif
191 #ifdef EL2NSYNC
192 case EL2NSYNC: return "EL2NSYNC";
193 #endif
194 #ifdef EL3HLT
195 case EL3HLT: return "EL3HLT";
196 #endif
197 #ifdef EL3RST
198 case EL3RST: return "EL3RST";
199 #endif
200 #ifdef ELIBACC
201 case ELIBACC: return "ELIBACC";
202 #endif
203 #ifdef ELIBBAD
204 case ELIBBAD: return "ELIBBAD";
205 #endif
206 #ifdef ELIBEXEC
207 case ELIBEXEC: return "ELIBEXEC";
208 #endif
209 #ifdef ELIBMAX
210 case ELIBMAX: return "ELIBMAX";
211 #endif
212 #ifdef ELIBSCN
213 case ELIBSCN: return "ELIBSCN";
214 #endif
215 #ifdef ELNRNG
216 case ELNRNG: return "ELNRNG";
217 #endif
218 #if defined(ELOOP) && (!defined(ENOENT) || (ELOOP != ENOENT))
219 case ELOOP: return "ELOOP";
220 #endif
221 #ifdef EMFILE
222 case EMFILE: return "EMFILE";
223 #endif
224 #ifdef EMLINK
225 case EMLINK: return "EMLINK";
226 #endif
227 #ifdef EMSGSIZE
228 case EMSGSIZE: return "EMSGSIZE";
229 #endif
230 #ifdef EMULTIHOP
231 case EMULTIHOP: return "EMULTIHOP";
232 #endif
233 #ifdef ENAMETOOLONG
234 case ENAMETOOLONG: return "ENAMETOOLONG";
235 #endif
236 #ifdef ENAVAIL
237 case ENAVAIL: return "ENAVAIL";
238 #endif
239 #ifdef ENET
240 case ENET: return "ENET";
241 #endif
242 #ifdef ENETDOWN
243 case ENETDOWN: return "ENETDOWN";
244 #endif
245 #ifdef ENETRESET
246 case ENETRESET: return "ENETRESET";
247 #endif
248 #ifdef ENETUNREACH
249 case ENETUNREACH: return "ENETUNREACH";
250 #endif
251 #ifdef ENFILE
252 case ENFILE: return "ENFILE";
253 #endif
254 #ifdef ENOANO
255 case ENOANO: return "ENOANO";
256 #endif
257 #if defined(ENOBUFS) && (!defined(ENOSR) || (ENOBUFS != ENOSR))
258 case ENOBUFS: return "ENOBUFS";
259 #endif
260 #ifdef ENOCSI
261 case ENOCSI: return "ENOCSI";
262 #endif
263 #if defined(ENODATA) && (!defined(ECONNREFUSED) || (ENODATA != ECONNREFUSED))
264 case ENODATA: return "ENODATA";
265 #endif
266 #ifdef ENODEV
267 case ENODEV: return "ENODEV";
268 #endif
269 #ifdef ENOENT
270 case ENOENT: return "ENOENT";
271 #endif
272 #ifdef ENOEXEC
273 case ENOEXEC: return "ENOEXEC";
274 #endif
275 #ifdef ENOLCK
276 case ENOLCK: return "ENOLCK";
277 #endif
278 #ifdef ENOLINK
279 case ENOLINK: return "ENOLINK";
280 #endif
281 #ifdef ENOMEM
282 case ENOMEM: return "ENOMEM";
283 #endif
284 #ifdef ENOMSG
285 case ENOMSG: return "ENOMSG";
286 #endif
287 #ifdef ENONET
288 case ENONET: return "ENONET";
289 #endif
290 #ifdef ENOPKG
291 case ENOPKG: return "ENOPKG";
292 #endif
293 #ifdef ENOPROTOOPT
294 case ENOPROTOOPT: return "ENOPROTOOPT";
295 #endif
296 #ifdef ENOSPC
297 case ENOSPC: return "ENOSPC";
298 #endif
299 #if defined(ENOSR) && (!defined(ENAMETOOLONG) || (ENAMETOOLONG != ENOSR))
300 case ENOSR: return "ENOSR";
301 #endif
302 #if defined(ENOSTR) && (!defined(ENOTTY) || (ENOTTY != ENOSTR))
303 case ENOSTR: return "ENOSTR";
304 #endif
305 #ifdef ENOSYM
306 case ENOSYM: return "ENOSYM";
307 #endif
308 #ifdef ENOSYS
309 case ENOSYS: return "ENOSYS";
310 #endif
311 #ifdef ENOTBLK
312 case ENOTBLK: return "ENOTBLK";
313 #endif
314 #ifdef ENOTCONN
315 case ENOTCONN: return "ENOTCONN";
316 #endif
317 #ifdef ENOTDIR
318 case ENOTDIR: return "ENOTDIR";
319 #endif
320 #if defined(ENOTEMPTY) && (!defined(EEXIST) || (ENOTEMPTY != EEXIST))
321 case ENOTEMPTY: return "ENOTEMPTY";
322 #endif
323 #ifdef ENOTNAM
324 case ENOTNAM: return "ENOTNAM";
325 #endif
326 #ifdef ENOTSOCK
327 case ENOTSOCK: return "ENOTSOCK";
328 #endif
329 #ifdef ENOTSUP
330 case ENOTSUP: return "ENOTSUP";
331 #endif
332 #ifdef ENOTTY
333 case ENOTTY: return "ENOTTY";
334 #endif
335 #ifdef ENOTUNIQ
336 case ENOTUNIQ: return "ENOTUNIQ";
337 #endif
338 #ifdef ENXIO
339 case ENXIO: return "ENXIO";
340 #endif
341 #if defined(EOPNOTSUPP) && (!defined(ENOTSUP) || (ENOTSUP != EOPNOTSUPP))
342 case EOPNOTSUPP: return "EOPNOTSUPP";
343 #endif
344 #ifdef EPERM
345 case EPERM: return "EPERM";
346 #endif
347 #if defined(EPFNOSUPPORT) && (!defined(ENOLCK) || (ENOLCK != EPFNOSUPPORT))
348 case EPFNOSUPPORT: return "EPFNOSUPPORT";
349 #endif
350 #ifdef EPIPE
351 case EPIPE: return "EPIPE";
352 #endif
353 #ifdef EPROCLIM
354 case EPROCLIM: return "EPROCLIM";
355 #endif
356 #ifdef EPROCUNAVAIL
357 case EPROCUNAVAIL: return "EPROCUNAVAIL";
358 #endif
359 #ifdef EPROGMISMATCH
360 case EPROGMISMATCH: return "EPROGMISMATCH";
361 #endif
362 #ifdef EPROGUNAVAIL
363 case EPROGUNAVAIL: return "EPROGUNAVAIL";
364 #endif
365 #ifdef EPROTO
366 case EPROTO: return "EPROTO";
367 #endif
368 #ifdef EPROTONOSUPPORT
369 case EPROTONOSUPPORT: return "EPROTONOSUPPORT";
370 #endif
371 #ifdef EPROTOTYPE
372 case EPROTOTYPE: return "EPROTOTYPE";
373 #endif
374 #ifdef ERANGE
375 case ERANGE: return "ERANGE";
376 #endif
377 #if defined(EREFUSED) && (!defined(ECONNREFUSED) || (EREFUSED != ECONNREFUSED))
378 case EREFUSED: return "EREFUSED";
379 #endif
380 #ifdef EREMCHG
381 case EREMCHG: return "EREMCHG";
382 #endif
383 #ifdef EREMDEV
384 case EREMDEV: return "EREMDEV";
385 #endif
386 #ifdef EREMOTE
387 case EREMOTE: return "EREMOTE";
388 #endif
389 #ifdef EREMOTEIO
390 case EREMOTEIO: return "EREMOTEIO";
391 #endif
392 #ifdef EREMOTERELEASE
393 case EREMOTERELEASE: return "EREMOTERELEASE";
394 #endif
395 #ifdef EROFS
396 case EROFS: return "EROFS";
397 #endif
398 #ifdef ERPCMISMATCH
399 case ERPCMISMATCH: return "ERPCMISMATCH";
400 #endif
401 #ifdef ERREMOTE
402 case ERREMOTE: return "ERREMOTE";
403 #endif
404 #ifdef ESHUTDOWN
405 case ESHUTDOWN: return "ESHUTDOWN";
406 #endif
407 #ifdef ESOCKTNOSUPPORT
408 case ESOCKTNOSUPPORT: return "ESOCKTNOSUPPORT";
409 #endif
410 #ifdef ESPIPE
411 case ESPIPE: return "ESPIPE";
412 #endif
413 #ifdef ESRCH
414 case ESRCH: return "ESRCH";
415 #endif
416 #ifdef ESRMNT
417 case ESRMNT: return "ESRMNT";
418 #endif
419 #ifdef ESTALE
420 case ESTALE: return "ESTALE";
421 #endif
422 #ifdef ESUCCESS
423 case ESUCCESS: return "ESUCCESS";
424 #endif
425 #if defined(ETIME) && (!defined(ELOOP) || (ETIME != ELOOP))
426 case ETIME: return "ETIME";
427 #endif
428 #if defined(ETIMEDOUT) && (!defined(ENOSTR) || (ETIMEDOUT != ENOSTR))
429 case ETIMEDOUT: return "ETIMEDOUT";
430 #endif
431 #ifdef ETOOMANYREFS
432 case ETOOMANYREFS: return "ETOOMANYREFS";
433 #endif
434 #ifdef ETXTBSY
435 case ETXTBSY: return "ETXTBSY";
436 #endif
437 #ifdef EUCLEAN
438 case EUCLEAN: return "EUCLEAN";
439 #endif
440 #ifdef EUNATCH
441 case EUNATCH: return "EUNATCH";
442 #endif
443 #ifdef EUSERS
444 case EUSERS: return "EUSERS";
445 #endif
446 #ifdef EVERSION
447 case EVERSION: return "EVERSION";
448 #endif
449 #if defined(EWOULDBLOCK) && (!defined(EAGAIN) || (EWOULDBLOCK != EAGAIN))
450 case EWOULDBLOCK: return "EWOULDBLOCK";
451 #endif
452 #ifdef EXDEV
453 case EXDEV: return "EXDEV";
454 #endif
455 #ifdef EXFULL
456 case EXFULL: return "EXFULL";
457 #endif
458 }
459 return "unknown error";
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
485 char *
486 Tcl_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 protocol 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 * Tcl_SignalId --
918 *
919 * Return a textual identifier for a signal number.
920 *
921 * Results:
922 * This procedure returns a machine-readable textual identifier
923 * that corresponds to sig. The identifier is the same as the
924 * #define name in signal.h.
925 *
926 * Side effects:
927 * None.
928 *
929 *----------------------------------------------------------------------
930 */
931
932 char *
933 Tcl_SignalId(sig)
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))
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
1055 * make sense to a human. It may not be easy for a machine
1056 * to parse.
1057 *
1058 * Side effects:
1059 * None.
1060 *
1061 *----------------------------------------------------------------------
1062 */
1063
1064 char *
1065 Tcl_SignalMsg(sig)
1066 int sig; /* Number of signal. */
1067 {
1068 switch (sig) {
1069 #ifdef SIGABRT
1070 case SIGABRT: return "SIGABRT";
1071 #endif
1072 #ifdef SIGALRM
1073 case SIGALRM: return "alarm clock";
1074 #endif
1075 #ifdef SIGBUS
1076 case SIGBUS: return "bus error";
1077 #endif
1078 #ifdef SIGCHLD
1079 case SIGCHLD: return "child status changed";
1080 #endif
1081 #if defined(SIGCLD) && (!defined(SIGCHLD) || (SIGCLD != SIGCHLD))
1082 case SIGCLD: return "child status changed";
1083 #endif
1084 #ifdef SIGCONT
1085 case SIGCONT: return "continue after stop";
1086 #endif
1087 #if defined(SIGEMT) && (!defined(SIGXCPU) || (SIGEMT != SIGXCPU))
1088 case SIGEMT: return "EMT instruction";
1089 #endif
1090 #ifdef SIGFPE
1091 case SIGFPE: return "floating-point exception";
1092 #endif
1093 #ifdef SIGHUP
1094 case SIGHUP: return "hangup";
1095 #endif
1096 #ifdef SIGILL
1097 case SIGILL: return "illegal instruction";
1098 #endif
1099 #ifdef SIGINT
1100 case SIGINT: return "interrupt";
1101 #endif
1102 #ifdef SIGIO
1103 case SIGIO: return "input/output possible on file";
1104 #endif
1105 #if defined(SIGIOT) && (!defined(SIGABRT) || (SIGABRT != SIGIOT))
1106 case SIGIOT: return "IOT instruction";
1107 #endif
1108 #ifdef SIGKILL
1109 case SIGKILL: return "kill signal";
1110 #endif
1111 #if defined(SIGLOST) && (!defined(SIGIOT) || (SIGLOST != SIGIOT)) && (!defined(SIGURG) || (SIGLOST != SIGURG)) && (!defined(SIGPROF) || (SIGLOST != SIGPROF)) && (!defined(SIGIO) || (SIGLOST != SIGIO))
1112 case SIGLOST: return "resource lost";
1113 #endif
1114 #ifdef SIGPIPE
1115 case SIGPIPE: return "write on pipe with no readers";
1116 #endif
1117 #if defined(SIGPOLL) && (!defined(SIGIO) || (SIGPOLL != SIGIO))
1118 case SIGPOLL: return "input/output possible on file";
1119 #endif
1120 #ifdef SIGPROF
1121 case SIGPROF: return "profiling alarm";
1122 #endif
1123 #if defined(SIGPWR) && (!defined(SIGXFSZ) || (SIGPWR != SIGXFSZ))
1124 case SIGPWR: return "power-fail restart";
1125 #endif
1126 #ifdef SIGQUIT
1127 case SIGQUIT: return "quit signal";
1128 #endif
1129 #ifdef SIGSEGV
1130 case SIGSEGV: return "segmentation violation";
1131 #endif
1132 #ifdef SIGSTOP
1133 case SIGSTOP: return "stop";
1134 #endif
1135 #ifdef SIGSYS
1136 case SIGSYS: return "bad argument to system call";
1137 #endif
1138 #ifdef SIGTERM
1139 case SIGTERM: return "software termination signal";
1140 #endif
1141 #ifdef SIGTRAP
1142 case SIGTRAP: return "trace trap";
1143 #endif
1144 #ifdef SIGTSTP
1145 case SIGTSTP: return "stop signal from tty";
1146 #endif
1147 #ifdef SIGTTIN
1148 case SIGTTIN: return "background tty read";
1149 #endif
1150 #ifdef SIGTTOU
1151 case SIGTTOU: return "background tty write";
1152 #endif
1153 #if defined(SIGURG) && (!defined(SIGIO) || (SIGURG != SIGIO))
1154 case SIGURG: return "urgent I/O condition";
1155 #endif
1156 #if defined(SIGUSR1) && (!defined(SIGIO) || (SIGUSR1 != SIGIO))
1157 case SIGUSR1: return "user-defined signal 1";
1158 #endif
1159 #if defined(SIGUSR2) && (!defined(SIGURG) || (SIGUSR2 != SIGURG))
1160 case SIGUSR2: return "user-defined signal 2";
1161 #endif
1162 #ifdef SIGVTALRM
1163 case SIGVTALRM: return "virtual time alarm";
1164 #endif
1165 #ifdef SIGWINCH
1166 case SIGWINCH: return "window changed";
1167 #endif
1168 #ifdef SIGXCPU
1169 case SIGXCPU: return "exceeded CPU time limit";
1170 #endif
1171 #ifdef SIGXFSZ
1172 case SIGXFSZ: return "exceeded file size limit";
1173 #endif
1174 }
1175 return "unknown signal";
1176 }
1177
1178
1179 /* $History: tclposixstr.c $
1180 *
1181 * ***************** Version 1 *****************
1182 * User: Dtashley Date: 1/02/01 Time: 1:36a
1183 * Created in $/IjuScripter, IjuConsole/Source/Tcl Base
1184 * Initial check-in.
1185 */
1186
1187 /* End of TCLPOSIXSTR.C */

dashley@gmail.com
ViewVC Help
Powered by ViewVC 1.1.25