]>
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. */
492 case SIGABRT
: return "SIGABRT";
495 case SIGALRM
: return "SIGALRM";
498 case SIGBUS
: return "SIGBUS";
501 case SIGCHLD
: return "SIGCHLD";
503 #if defined(SIGCLD) && (!defined(SIGCHLD) || (SIGCLD != SIGCHLD))
504 case SIGCLD
: return "SIGCLD";
507 case SIGCONT
: return "SIGCONT";
509 #if defined(SIGEMT) && (!defined(SIGXCPU) || (SIGEMT != SIGXCPU))
510 case SIGEMT
: return "SIGEMT";
513 case SIGFPE
: return "SIGFPE";
516 case SIGHUP
: return "SIGHUP";
519 case SIGILL
: return "SIGILL";
522 case SIGINT
: return "SIGINT";
525 case SIGIO
: return "SIGIO";
527 #if defined(SIGIOT) && (!defined(SIGABRT) || (SIGIOT != SIGABRT))
528 case SIGIOT
: return "SIGIOT";
531 case SIGKILL
: return "SIGKILL";
533 #if defined(SIGLOST) && (!defined(SIGIOT) || (SIGLOST != SIGIOT))
534 case SIGLOST
: return "SIGLOST";
537 case SIGPIPE
: return "SIGPIPE";
539 #if defined(SIGPOLL) && (!defined(SIGIO) || (SIGPOLL != SIGIO))
540 case SIGPOLL
: return "SIGPOLL";
543 case SIGPROF
: return "SIGPROF";
545 #if defined(SIGPWR) && (!defined(SIGXFSZ) || (SIGPWR != SIGXFSZ))
546 case SIGPWR
: return "SIGPWR";
549 case SIGQUIT
: return "SIGQUIT";
552 case SIGSEGV
: return "SIGSEGV";
555 case SIGSTOP
: return "SIGSTOP";
558 case SIGSYS
: return "SIGSYS";
561 case SIGTERM
: return "SIGTERM";
564 case SIGTRAP
: return "SIGTRAP";
567 case SIGTSTP
: return "SIGTSTP";
570 case SIGTTIN
: return "SIGTTIN";
573 case SIGTTOU
: return "SIGTTOU";
576 case SIGURG
: return "SIGURG";
579 case SIGUSR1
: return "SIGUSR1";
582 case SIGUSR2
: return "SIGUSR2";
585 case SIGVTALRM
: return "SIGVTALRM";
588 case SIGWINCH
: return "SIGWINCH";
591 case SIGXCPU
: return "SIGXCPU";
594 case SIGXFSZ
: return "SIGXFSZ";
597 return "unknown signal";
601 *----------------------------------------------------------------------
605 * Return a human-readable message describing a signal.
608 * This procedure returns a string describing sig that should
609 * make sense to a human. It may not be easy for a machine
615 *----------------------------------------------------------------------
620 int sig
; /* Number of signal. */
624 case SIGABRT
: return "SIGABRT";
627 case SIGALRM
: return "alarm clock";
630 case SIGBUS
: return "bus error";
633 case SIGCHLD
: return "child status changed";
635 #if defined(SIGCLD) && (!defined(SIGCHLD) || (SIGCLD != SIGCHLD))
636 case SIGCLD
: return "child status changed";
639 case SIGCONT
: return "continue after stop";
641 #if defined(SIGEMT) && (!defined(SIGXCPU) || (SIGEMT != SIGXCPU))
642 case SIGEMT
: return "EMT instruction";
645 case SIGFPE
: return "floating-point exception";
648 case SIGHUP
: return "hangup";
651 case SIGILL
: return "illegal instruction";
654 case SIGINT
: return "interrupt";
657 case SIGIO
: return "input/output possible on file";
659 #if defined(SIGIOT) && (!defined(SIGABRT) || (SIGABRT != SIGIOT))
660 case SIGIOT
: return "IOT instruction";
663 case SIGKILL
: return "kill signal";
665 #if defined(SIGLOST) && (!defined(SIGIOT) || (SIGLOST != SIGIOT))
666 case SIGLOST
: return "resource lost";
669 case SIGPIPE
: return "write on pipe with no readers";
671 #if defined(SIGPOLL) && (!defined(SIGIO) || (SIGPOLL != SIGIO))
672 case SIGPOLL
: return "input/output possible on file";
675 case SIGPROF
: return "profiling alarm";
677 #if defined(SIGPWR) && (!defined(SIGXFSZ) || (SIGPWR != SIGXFSZ))
678 case SIGPWR
: return "power-fail restart";
681 case SIGQUIT
: return "quit signal";
684 case SIGSEGV
: return "segmentation violation";
687 case SIGSTOP
: return "stop";
690 case SIGSYS
: return "bad argument to system call";
693 case SIGTERM
: return "software termination signal";
696 case SIGTRAP
: return "trace trap";
699 case SIGTSTP
: return "stop signal from tty";
702 case SIGTTIN
: return "background tty read";
705 case SIGTTOU
: return "background tty write";
708 case SIGURG
: return "urgent I/O condition";
711 case SIGUSR1
: return "user-defined signal 1";
714 case SIGUSR2
: return "user-defined signal 2";
717 case SIGVTALRM
: return "virtual time alarm";
720 case SIGWINCH
: return "window changed";
723 case SIGXCPU
: return "exceeded CPU time limit";
726 case SIGXFSZ
: return "exceeded file size limit";
729 return "unknown signal";