]>
cvs.zerfleddert.de Git - micropolis/blob - src/tcl/tclunxst.c
4 * This file contains procedures that generate strings
5 * corresponding to various UNIX-related codes, such
6 * as errno and signals.
8 * Copyright 1991 Regents of the University of California
9 * Permission to use, copy, modify, and distribute this
10 * software and its documentation for any purpose and without
11 * fee is hereby granted, provided that this copyright
12 * notice appears in all copies. The University of California
13 * makes no representations about the suitability of this
14 * software for any purpose. It is provided "as is" without
15 * express or implied warranty.
19 static char rcsid
[] = "$Header: /user6/ouster/tcl/RCS/tclUnixStr.c,v 1.12 92/04/30 15:51:15 ouster Exp $ SPRITE (Berkeley)";
26 *----------------------------------------------------------------------
30 * Return a textual identifier for the current errno value.
33 * This procedure returns a machine-readable textual identifier
34 * that corresponds to the current errno value (e.g. "EPERM").
35 * The identifier is the same as the #define name in errno.h.
40 *----------------------------------------------------------------------
48 case E2BIG
: return "E2BIG";
51 case EACCES
: return "EACCES";
54 case EADDRINUSE
: return "EADDRINUSE";
57 case EADDRNOTAVAIL
: return "EADDRNOTAVAIL";
60 case EADV
: return "EADV";
63 case EAFNOSUPPORT
: return "EAFNOSUPPORT";
66 case EAGAIN
: return "EAGAIN";
69 case EALIGN
: return "EALIGN";
72 case EALREADY
: return "EALREADY";
75 case EBADE
: return "EBADE";
78 case EBADF
: return "EBADF";
81 case EBADFD
: return "EBADFD";
84 case EBADMSG
: return "EBADMSG";
87 case EBADR
: return "EBADR";
90 case EBADRPC
: return "EBADRPC";
93 case EBADRQC
: return "EBADRQC";
96 case EBADSLT
: return "EBADSLT";
99 case EBFONT
: return "EBFONT";
102 case EBUSY
: return "EBUSY";
105 case ECHILD
: return "ECHILD";
108 case ECHRNG
: return "ECHRNG";
111 case ECOMM
: return "ECOMM";
114 case ECONNABORTED
: return "ECONNABORTED";
117 case ECONNREFUSED
: return "ECONNREFUSED";
120 case ECONNRESET
: return "ECONNRESET";
122 #if defined(EDEADLK) && (!defined(EWOULDBLOCK) || (EDEADLK != EWOULDBLOCK))
123 case EDEADLK
: return "EDEADLK";
127 case EDEADLOCK
: return "EDEADLOCK";
131 case EDESTADDRREQ
: return "EDESTADDRREQ";
134 case EDIRTY
: return "EDIRTY";
137 case EDOM
: return "EDOM";
140 case EDOTDOT
: return "EDOTDOT";
143 case EDQUOT
: return "EDQUOT";
146 case EDUPPKG
: return "EDUPPKG";
149 case EEXIST
: return "EEXIST";
152 case EFAULT
: return "EFAULT";
155 case EFBIG
: return "EFBIG";
158 case EHOSTDOWN
: return "EHOSTDOWN";
161 case EHOSTUNREACH
: return "EHOSTUNREACH";
164 case EIDRM
: return "EIDRM";
167 case EINIT
: return "EINIT";
170 case EINPROGRESS
: return "EINPROGRESS";
173 case EINTR
: return "EINTR";
176 case EINVAL
: return "EINVAL";
179 case EIO
: return "EIO";
182 case EISCONN
: return "EISCONN";
185 case EISDIR
: return "EISDIR";
188 case EISNAM
: return "EISNAM";
191 case ELBIN
: return "ELBIN";
194 case EL2HLT
: return "EL2HLT";
197 case EL2NSYNC
: return "EL2NSYNC";
200 case EL3HLT
: return "EL3HLT";
203 case EL3RST
: return "EL3RST";
206 case ELIBACC
: return "ELIBACC";
209 case ELIBBAD
: return "ELIBBAD";
212 case ELIBEXEC
: return "ELIBEXEC";
215 case ELIBMAX
: return "ELIBMAX";
218 case ELIBSCN
: return "ELIBSCN";
221 case ELNRNG
: return "ELNRNG";
224 case ELOOP
: return "ELOOP";
227 case EMFILE
: return "EMFILE";
230 case EMLINK
: return "EMLINK";
233 case EMSGSIZE
: return "EMSGSIZE";
236 case EMULTIHOP
: return "EMULTIHOP";
239 case ENAMETOOLONG
: return "ENAMETOOLONG";
242 case ENAVAIL
: return "ENAVAIL";
245 case ENET
: return "ENET";
248 case ENETDOWN
: return "ENETDOWN";
251 case ENETRESET
: return "ENETRESET";
254 case ENETUNREACH
: return "ENETUNREACH";
257 case ENFILE
: return "ENFILE";
260 case ENOANO
: return "ENOANO";
262 #if defined(ENOBUFS) && (!defined(ENOSR) || (ENOBUFS != ENOSR))
263 case ENOBUFS
: return "ENOBUFS";
266 case ENOCSI
: return "ENOCSI";
269 case ENODATA
: return "ENODATA";
272 case ENODEV
: return "ENODEV";
275 case ENOENT
: return "ENOENT";
278 case ENOEXEC
: return "ENOEXEC";
281 case ENOLCK
: return "ENOLCK";
284 case ENOLINK
: return "ENOLINK";
287 case ENOMEM
: return "ENOMEM";
290 case ENOMSG
: return "ENOMSG";
293 case ENONET
: return "ENONET";
296 case ENOPKG
: return "ENOPKG";
299 case ENOPROTOOPT
: return "ENOPROTOOPT";
302 case ENOSPC
: return "ENOSPC";
305 case ENOSR
: return "ENOSR";
308 case ENOSTR
: return "ENOSTR";
311 case ENOSYM
: return "ENOSYM";
314 case ENOSYS
: return "ENOSYS";
317 case ENOTBLK
: return "ENOTBLK";
320 case ENOTCONN
: return "ENOTCONN";
323 case ENOTDIR
: return "ENOTDIR";
325 #if defined(ENOTEMPTY) && (!defined(EEXIST) || (ENOTEMPTY != EEXIST))
326 case ENOTEMPTY
: return "ENOTEMPTY";
329 case ENOTNAM
: return "ENOTNAM";
332 case ENOTSOCK
: return "ENOTSOCK";
335 case ENOTTY
: return "ENOTTY";
338 case ENOTUNIQ
: return "ENOTUNIQ";
342 case ENXIO
: return "ENXIO";
346 case EOPNOTSUPP
: return "EOPNOTSUPP";
350 case EPERM
: return "EPERM";
354 case EPFNOSUPPORT
: return "EPFNOSUPPORT";
357 case EPIPE
: return "EPIPE";
360 case EPROCLIM
: return "EPROCLIM";
363 case EPROCUNAVAIL
: return "EPROCUNAVAIL";
366 case EPROGMISMATCH
: return "EPROGMISMATCH";
369 case EPROGUNAVAIL
: return "EPROGUNAVAIL";
372 case EPROTO
: return "EPROTO";
374 #ifdef EPROTONOSUPPORT
375 case EPROTONOSUPPORT
: return "EPROTONOSUPPORT";
378 case EPROTOTYPE
: return "EPROTOTYPE";
381 case ERANGE
: return "ERANGE";
383 #if defined(EREFUSED) && (!defined(ECONNREFUSED) || (EREFUSED != ECONNREFUSED))
384 case EREFUSED
: return "EREFUSED";
387 case EREMCHG
: return "EREMCHG";
390 case EREMDEV
: return "EREMDEV";
393 case EREMOTE
: return "EREMOTE";
396 case EREMOTEIO
: return "EREMOTEIO";
398 #ifdef EREMOTERELEASE
399 case EREMOTERELEASE
: return "EREMOTERELEASE";
402 case EROFS
: return "EROFS";
405 case ERPCMISMATCH
: return "ERPCMISMATCH";
408 case ERREMOTE
: return "ERREMOTE";
411 case ESHUTDOWN
: return "ESHUTDOWN";
413 #ifdef ESOCKTNOSUPPORT
414 case ESOCKTNOSUPPORT
: return "ESOCKTNOSUPPORT";
417 case ESPIPE
: return "ESPIPE";
420 case ESRCH
: return "ESRCH";
423 case ESRMNT
: return "ESRMNT";
426 case ESTALE
: return "ESTALE";
429 case ESUCCESS
: return "ESUCCESS";
432 case ETIME
: return "ETIME";
435 case ETIMEDOUT
: return "ETIMEDOUT";
438 case ETOOMANYREFS
: return "ETOOMANYREFS";
441 case ETXTBSY
: return "ETXTBSY";
444 case EUCLEAN
: return "EUCLEAN";
447 case EUNATCH
: return "EUNATCH";
450 case EUSERS
: return "EUSERS";
453 case EVERSION
: return "EVERSION";
455 #if defined(EWOULDBLOCK) && (!defined(EAGAIN) || (EWOULDBLOCK != EAGAIN))
456 case EWOULDBLOCK
: return "EWOULDBLOCK";
459 case EXDEV
: return "EXDEV";
462 case EXFULL
: return "EXFULL";
465 return "unknown error";
469 *----------------------------------------------------------------------
473 * Return a textual identifier for a signal number.
476 * This procedure returns a machine-readable textual identifier
477 * that corresponds to sig. The identifier is the same as the
478 * #define name in signal.h.
483 *----------------------------------------------------------------------
488 int sig
/* Number of signal. */
493 case SIGABRT
: return "SIGABRT";
496 case SIGALRM
: return "SIGALRM";
499 case SIGBUS
: return "SIGBUS";
502 case SIGCHLD
: return "SIGCHLD";
504 #if defined(SIGCLD) && (!defined(SIGCHLD) || (SIGCLD != SIGCHLD))
505 case SIGCLD
: return "SIGCLD";
508 case SIGCONT
: return "SIGCONT";
510 #if defined(SIGEMT) && (!defined(SIGXCPU) || (SIGEMT != SIGXCPU))
511 case SIGEMT
: return "SIGEMT";
514 case SIGFPE
: return "SIGFPE";
517 case SIGHUP
: return "SIGHUP";
520 case SIGILL
: return "SIGILL";
523 case SIGINT
: return "SIGINT";
526 case SIGIO
: return "SIGIO";
528 #if defined(SIGIOT) && (!defined(SIGABRT) || (SIGIOT != SIGABRT))
529 case SIGIOT
: return "SIGIOT";
532 case SIGKILL
: return "SIGKILL";
534 #if defined(SIGLOST) && (!defined(SIGIOT) || (SIGLOST != SIGIOT)) && (!defined(SIGPWR) || (SIGLOST != SIGPWR))
535 case SIGLOST
: return "SIGLOST";
538 case SIGPIPE
: return "SIGPIPE";
540 #if defined(SIGPOLL) && (!defined(SIGIO) || (SIGPOLL != SIGIO))
541 case SIGPOLL
: return "SIGPOLL";
544 case SIGPROF
: return "SIGPROF";
546 #if defined(SIGPWR) && (!defined(SIGXFSZ) || (SIGPWR != SIGXFSZ))
547 case SIGPWR
: return "SIGPWR";
550 case SIGQUIT
: return "SIGQUIT";
553 case SIGSEGV
: return "SIGSEGV";
556 case SIGSTOP
: return "SIGSTOP";
559 case SIGSYS
: return "SIGSYS";
562 case SIGTERM
: return "SIGTERM";
565 case SIGTRAP
: return "SIGTRAP";
568 case SIGTSTP
: return "SIGTSTP";
571 case SIGTTIN
: return "SIGTTIN";
574 case SIGTTOU
: return "SIGTTOU";
577 case SIGURG
: return "SIGURG";
580 case SIGUSR1
: return "SIGUSR1";
583 case SIGUSR2
: return "SIGUSR2";
586 case SIGVTALRM
: return "SIGVTALRM";
589 case SIGWINCH
: return "SIGWINCH";
592 case SIGXCPU
: return "SIGXCPU";
595 case SIGXFSZ
: return "SIGXFSZ";
598 return "unknown signal";
602 *----------------------------------------------------------------------
606 * Return a human-readable message describing a signal.
609 * This procedure returns a string describing sig that should
610 * make sense to a human. It may not be easy for a machine
616 *----------------------------------------------------------------------
621 int sig
/* Number of signal. */
626 case SIGABRT
: return "SIGABRT";
629 case SIGALRM
: return "alarm clock";
632 case SIGBUS
: return "bus error";
635 case SIGCHLD
: return "child status changed";
637 #if defined(SIGCLD) && (!defined(SIGCHLD) || (SIGCLD != SIGCHLD))
638 case SIGCLD
: return "child status changed";
641 case SIGCONT
: return "continue after stop";
643 #if defined(SIGEMT) && (!defined(SIGXCPU) || (SIGEMT != SIGXCPU))
644 case SIGEMT
: return "EMT instruction";
647 case SIGFPE
: return "floating-point exception";
650 case SIGHUP
: return "hangup";
653 case SIGILL
: return "illegal instruction";
656 case SIGINT
: return "interrupt";
659 case SIGIO
: return "input/output possible on file";
661 #if defined(SIGIOT) && (!defined(SIGABRT) || (SIGABRT != SIGIOT))
662 case SIGIOT
: return "IOT instruction";
665 case SIGKILL
: return "kill signal";
667 #if defined(SIGLOST) && (!defined(SIGIOT) || (SIGLOST != SIGIOT)) && (!defined(SIGPWR) || (SIGLOST != SIGPWR))
668 case SIGLOST
: return "resource lost";
671 case SIGPIPE
: return "write on pipe with no readers";
673 #if defined(SIGPOLL) && (!defined(SIGIO) || (SIGPOLL != SIGIO))
674 case SIGPOLL
: return "input/output possible on file";
677 case SIGPROF
: return "profiling alarm";
679 #if defined(SIGPWR) && (!defined(SIGXFSZ) || (SIGPWR != SIGXFSZ))
680 case SIGPWR
: return "power-fail restart";
683 case SIGQUIT
: return "quit signal";
686 case SIGSEGV
: return "segmentation violation";
689 case SIGSTOP
: return "stop";
692 case SIGSYS
: return "bad argument to system call";
695 case SIGTERM
: return "software termination signal";
698 case SIGTRAP
: return "trace trap";
701 case SIGTSTP
: return "stop signal from tty";
704 case SIGTTIN
: return "background tty read";
707 case SIGTTOU
: return "background tty write";
710 case SIGURG
: return "urgent I/O condition";
713 case SIGUSR1
: return "user-defined signal 1";
716 case SIGUSR2
: return "user-defined signal 2";
719 case SIGVTALRM
: return "virtual time alarm";
722 case SIGWINCH
: return "window changed";
725 case SIGXCPU
: return "exceeded CPU time limit";
728 case SIGXFSZ
: return "exceeded file size limit";
731 return "unknown signal";