2 % (c) The GRASP/AQUA Project, Glasgow University, 1994
4 \subsection[errno.lc]{GHC Error Number Conversion}
14 char *ghc_errstr = NULL;
16 /* Collect all of the grotty #ifdef's in one place. */
18 void cvtErrno(STG_NO_ARGS)
23 ghc_errno = GHC_E2BIG;
28 ghc_errno = GHC_EACCES;
33 ghc_errno = GHC_EADDRINUSE;
38 ghc_errno = GHC_EADDRNOTAVAIL;
48 ghc_errno = GHC_EAFNOSUPPORT;
53 ghc_errno = GHC_EAGAIN;
58 ghc_errno = GHC_EALREADY;
63 ghc_errno = GHC_EBADF;
68 ghc_errno = GHC_EBADMSG;
73 ghc_errno = GHC_EBADRPC;
78 ghc_errno = GHC_EBUSY;
83 ghc_errno = GHC_ECHILD;
88 ghc_errno = GHC_ECOMM;
93 ghc_errno = GHC_ECONNABORTED;
98 ghc_errno = GHC_ECONNREFUSED;
103 ghc_errno = GHC_ECONNRESET;
108 ghc_errno = GHC_EDEADLK;
113 ghc_errno = GHC_EDESTADDRREQ;
118 ghc_errno = GHC_EDIRTY;
123 ghc_errno = GHC_EDOM;
128 ghc_errno = GHC_EDQUOT;
133 ghc_errno = GHC_EEXIST;
138 ghc_errno = GHC_EFAULT;
143 ghc_errno = GHC_EFBIG;
148 ghc_errno = GHC_EFTYPE;
153 ghc_errno = GHC_EHOSTDOWN;
158 ghc_errno = GHC_EHOSTUNREACH;
163 ghc_errno = GHC_EIDRM;
168 ghc_errno = GHC_EILSEQ;
173 ghc_errno = GHC_EINPROGRESS;
178 ghc_errno = GHC_EINTR;
183 ghc_errno = GHC_EINVAL;
193 ghc_errno = GHC_EISCONN;
198 ghc_errno = GHC_EISDIR;
203 ghc_errno = GHC_ELOOP;
208 ghc_errno = GHC_EMFILE;
213 ghc_errno = GHC_EMLINK;
218 ghc_errno = GHC_EMSGSIZE;
223 ghc_errno = GHC_EMULTIHOP;
228 ghc_errno = GHC_ENAMETOOLONG;
233 ghc_errno = GHC_ENETDOWN;
238 ghc_errno = GHC_ENETRESET;
243 ghc_errno = GHC_ENETUNREACH;
248 ghc_errno = GHC_ENFILE;
253 ghc_errno = GHC_ENOBUFS;
258 ghc_errno = GHC_ENODATA;
263 ghc_errno = GHC_ENODEV;
268 ghc_errno = GHC_ENOENT;
273 ghc_errno = GHC_ENOEXEC;
278 ghc_errno = GHC_ENOLCK;
283 ghc_errno = GHC_ENOLINK;
288 ghc_errno = GHC_ENOMEM;
293 ghc_errno = GHC_ENOMSG;
298 ghc_errno = GHC_ENONET;
303 ghc_errno = GHC_ENOPROTOOPT;
308 ghc_errno = GHC_ENOSPC;
313 ghc_errno = GHC_ENOSR;
318 ghc_errno = GHC_ENOSTR;
323 ghc_errno = GHC_ENOSYS;
328 ghc_errno = GHC_ENOTBLK;
333 ghc_errno = GHC_ENOTCONN;
338 ghc_errno = GHC_ENOTDIR;
341 #ifndef aix_TARGET_OS
342 /* AIX returns EEXIST where 4.3BSD used ENOTEMPTY.
343 * there is an ENOTEMPTY defined as the same as EEXIST, and
344 * therefore it won't work properly on a case statement.
345 * another option is to define _ALL_SOURCE for aix, which
346 * gives a different number for ENOTEMPTY.
347 * I haven't tried that. -- andre.
351 ghc_errno = GHC_ENOTEMPTY;
357 ghc_errno = GHC_ENOTSOCK;
362 ghc_errno = GHC_ENOTTY;
367 ghc_errno = GHC_ENXIO;
372 ghc_errno = GHC_EOPNOTSUPP;
377 ghc_errno = GHC_EPERM;
382 ghc_errno = GHC_EPFNOSUPPORT;
387 ghc_errno = GHC_EPIPE;
392 ghc_errno = GHC_EPROCLIM;
397 ghc_errno = GHC_EPROCUNAVAIL;
402 ghc_errno = GHC_EPROGMISMATCH;
407 ghc_errno = GHC_EPROGUNAVAIL;
412 ghc_errno = GHC_EPROTO;
415 #ifdef EPROTONOSUPPORT
416 case EPROTONOSUPPORT:
417 ghc_errno = GHC_EPROTONOSUPPORT;
422 ghc_errno = GHC_EPROTOTYPE;
427 ghc_errno = GHC_ERANGE;
432 ghc_errno = GHC_EREMCHG;
437 ghc_errno = GHC_EREMOTE;
442 ghc_errno = GHC_EROFS;
447 ghc_errno = GHC_ERPCMISMATCH;
452 ghc_errno = GHC_ERREMOTE;
457 ghc_errno = GHC_ESHUTDOWN;
460 #ifdef ESOCKTNOSUPPORT
461 case ESOCKTNOSUPPORT:
462 ghc_errno = GHC_ESOCKTNOSUPPORT;
467 ghc_errno = GHC_ESPIPE;
472 ghc_errno = GHC_ESRCH;
477 ghc_errno = GHC_ESRMNT;
482 ghc_errno = GHC_ESTALE;
487 ghc_errno = GHC_ETIME;
492 ghc_errno = GHC_ETIMEDOUT;
497 ghc_errno = GHC_ETOOMANYREFS;
502 ghc_errno = GHC_ETXTBSY;
507 ghc_errno = GHC_EUSERS;
513 ghc_errno = GHC_EWOULDBLOCK;
519 ghc_errno = GHC_EXDEV;
529 stdErrno(STG_NO_ARGS)
533 ghc_errtype = ERR_OTHERERROR;
534 ghc_errstr = "unexpected error";
537 ghc_errtype = ERR_OTHERERROR;
538 ghc_errstr = "no error";
540 ghc_errtype = ERR_RESOURCEEXHAUSTED;
541 ghc_errstr = "argument list too long";
544 ghc_errtype = ERR_PERMISSIONDENIED;
545 ghc_errstr = "inadequate access permission";
548 ghc_errtype = ERR_RESOURCEBUSY;
549 ghc_errstr = "address already in use";
551 case GHC_EADDRNOTAVAIL:
552 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
553 ghc_errstr = "address not available";
556 ghc_errtype = ERR_OTHERERROR;
557 ghc_errstr = "RFS advertise error";
559 case GHC_EAFNOSUPPORT:
560 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
561 ghc_errstr = "address family not supported by protocol family";
564 ghc_errtype = ERR_RESOURCEEXHAUSTED;
565 ghc_errstr = "insufficient resources";
568 ghc_errtype = ERR_ALREADYEXISTS;
569 ghc_errstr = "operation already in progress";
572 ghc_errtype = ERR_OTHERERROR;
573 ghc_errstr = "internal error (EBADF)";
576 ghc_errtype = ERR_INAPPROPRIATETYPE;
577 ghc_errstr = "next message has wrong type";
580 ghc_errtype = ERR_OTHERERROR;
581 ghc_errstr = "invalid RPC request or response";
584 ghc_errtype = ERR_RESOURCEBUSY;
585 ghc_errstr = "device busy";
588 ghc_errtype = ERR_NOSUCHTHING;
589 ghc_errstr = "no child processes";
592 ghc_errtype = ERR_RESOURCEVANISHED;
593 ghc_errstr = "no virtual circuit could be found";
595 case GHC_ECONNABORTED:
596 ghc_errtype = ERR_OTHERERROR;
597 ghc_errstr = "aborted connection";
599 case GHC_ECONNREFUSED:
600 ghc_errtype = ERR_NOSUCHTHING;
601 ghc_errstr = "no listener on remote host";
604 ghc_errtype = ERR_RESOURCEVANISHED;
605 ghc_errstr = "connection reset by peer";
608 ghc_errtype = ERR_RESOURCEBUSY;
609 ghc_errstr = "resource deadlock avoided";
611 case GHC_EDESTADDRREQ:
612 ghc_errtype = ERR_INVALIDARGUMENT;
613 ghc_errstr = "destination address required";
616 ghc_errtype = ERR_UNSATISFIEDCONSTRAINTS;
617 ghc_errstr = "file system dirty";
620 ghc_errtype = ERR_INVALIDARGUMENT;
621 ghc_errstr = "argument too large";
624 ghc_errtype = ERR_PERMISSIONDENIED;
625 ghc_errstr = "quota exceeded";
628 ghc_errtype = ERR_ALREADYEXISTS;
629 ghc_errstr = "file already exists";
632 ghc_errtype = ERR_OTHERERROR;
633 ghc_errstr = "internal error (EFAULT)";
636 ghc_errtype = ERR_PERMISSIONDENIED;
637 ghc_errstr = "file too large";
640 ghc_errtype = ERR_INAPPROPRIATETYPE;
641 ghc_errstr = "inappropriate NFS file type or format";
644 ghc_errtype = ERR_NOSUCHTHING;
645 ghc_errstr = "destination host down";
647 case GHC_EHOSTUNREACH:
648 ghc_errtype = ERR_NOSUCHTHING;
649 ghc_errstr = "remote host is unreachable";
652 ghc_errtype = ERR_RESOURCEVANISHED;
653 ghc_errstr = "IPC identifier removed";
656 ghc_errtype = ERR_INVALIDARGUMENT;
657 ghc_errstr = "invalid wide character";
659 case GHC_EINPROGRESS:
660 ghc_errtype = ERR_ALREADYEXISTS;
661 ghc_errstr = "operation now in progress";
664 ghc_errtype = ERR_INTERRUPTED;
665 ghc_errstr = "interrupted system call";
668 ghc_errtype = ERR_INVALIDARGUMENT;
669 ghc_errstr = "invalid argument";
672 ghc_errtype = ERR_HARDWAREFAULT;
673 ghc_errstr = "unknown I/O fault";
676 ghc_errtype = ERR_ALREADYEXISTS;
677 ghc_errstr = "socket is already connected";
680 ghc_errtype = ERR_INAPPROPRIATETYPE;
681 ghc_errstr = "file is a directory";
684 ghc_errtype = ERR_INVALIDARGUMENT;
685 ghc_errstr = "too many symbolic links";
688 ghc_errtype = ERR_RESOURCEEXHAUSTED;
689 ghc_errstr = "process file table full";
692 ghc_errtype = ERR_RESOURCEEXHAUSTED;
693 ghc_errstr = "too many links";
696 ghc_errtype = ERR_RESOURCEEXHAUSTED;
697 ghc_errstr = "message too long";
700 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
701 ghc_errstr = "multi-hop RFS request";
703 case GHC_ENAMETOOLONG:
704 ghc_errtype = ERR_INVALIDARGUMENT;
705 ghc_errstr = "filename too long";
708 ghc_errtype = ERR_RESOURCEVANISHED;
709 ghc_errstr = "network is down";
712 ghc_errtype = ERR_RESOURCEVANISHED;
713 ghc_errstr = "remote host rebooted; connection lost";
715 case GHC_ENETUNREACH:
716 ghc_errtype = ERR_NOSUCHTHING;
717 ghc_errstr = "remote network is unreachable";
720 ghc_errtype = ERR_RESOURCEEXHAUSTED;
721 ghc_errstr = "system file table full";
724 ghc_errtype = ERR_RESOURCEEXHAUSTED;
725 ghc_errstr = "no buffer space available";
728 ghc_errtype = ERR_NOSUCHTHING;
729 ghc_errstr = "no message on the stream head read queue";
732 ghc_errtype = ERR_NOSUCHTHING;
733 ghc_errstr = "no such device";
736 ghc_errtype = ERR_NOSUCHTHING;
737 ghc_errstr = "no such file or directory";
740 ghc_errtype = ERR_INVALIDARGUMENT;
741 ghc_errstr = "not an executable file";
744 ghc_errtype = ERR_RESOURCEEXHAUSTED;
745 ghc_errstr = "no file locks available";
748 ghc_errtype = ERR_RESOURCEVANISHED;
749 ghc_errstr = "RFS link has been severed";
752 ghc_errtype = ERR_RESOURCEEXHAUSTED;
753 ghc_errstr = "not enough virtual memory";
756 ghc_errtype = ERR_NOSUCHTHING;
757 ghc_errstr = "no message of desired type";
760 ghc_errtype = ERR_NOSUCHTHING;
761 ghc_errstr = "host is not on a network";
763 case GHC_ENOPROTOOPT:
764 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
765 ghc_errstr = "operation not supported by protocol";
768 ghc_errtype = ERR_RESOURCEEXHAUSTED;
769 ghc_errstr = "no space left on device";
772 ghc_errtype = ERR_RESOURCEEXHAUSTED;
773 ghc_errstr = "out of stream resources";
776 ghc_errtype = ERR_INVALIDARGUMENT;
777 ghc_errstr = "not a stream device";
780 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
781 ghc_errstr = "function not implemented";
784 ghc_errtype = ERR_INVALIDARGUMENT;
785 ghc_errstr = "not a block device";
788 ghc_errtype = ERR_INVALIDARGUMENT;
789 ghc_errstr = "socket is not connected";
792 ghc_errtype = ERR_INAPPROPRIATETYPE;
793 ghc_errstr = "not a directory";
796 ghc_errtype = ERR_UNSATISFIEDCONSTRAINTS;
797 ghc_errstr = "directory not empty";
800 ghc_errtype = ERR_INVALIDARGUMENT;
801 ghc_errstr = "not a socket";
804 ghc_errtype = ERR_ILLEGALOPERATION;
805 ghc_errstr = "inappropriate ioctl for device";
808 ghc_errtype = ERR_NOSUCHTHING;
809 ghc_errstr = "no such device or address";
812 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
813 ghc_errstr = "operation not supported on socket";
816 ghc_errtype = ERR_PERMISSIONDENIED;
817 ghc_errstr = "privileged operation";
819 case GHC_EPFNOSUPPORT:
820 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
821 ghc_errstr = "protocol family not supported";
824 ghc_errtype = ERR_RESOURCEVANISHED;
825 ghc_errstr = "broken pipe";
828 ghc_errtype = ERR_PERMISSIONDENIED;
829 ghc_errstr = "too many processes";
831 case GHC_EPROCUNAVAIL:
832 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
833 ghc_errstr = "unimplemented RPC procedure";
835 case GHC_EPROGMISMATCH:
836 ghc_errtype = ERR_PROTOCOLERROR;
837 ghc_errstr = "unsupported RPC program version";
839 case GHC_EPROGUNAVAIL:
840 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
841 ghc_errstr = "RPC program unavailable";
844 ghc_errtype = ERR_PROTOCOLERROR;
845 ghc_errstr = "error in streams protocol";
847 case GHC_EPROTONOSUPPORT:
848 ghc_errtype = ERR_PROTOCOLERROR;
849 ghc_errstr = "protocol not supported";
852 ghc_errtype = ERR_PROTOCOLERROR;
853 ghc_errstr = "wrong protocol for socket";
856 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
857 ghc_errstr = "result too large";
860 ghc_errtype = ERR_RESOURCEVANISHED;
861 ghc_errstr = "remote address changed";
864 ghc_errtype = ERR_ILLEGALOPERATION;
865 ghc_errstr = "too many levels of remote in path";
868 ghc_errtype = ERR_PERMISSIONDENIED;
869 ghc_errstr = "read-only file system";
871 case GHC_ERPCMISMATCH:
872 ghc_errtype = ERR_PROTOCOLERROR;
873 ghc_errstr = "RPC version is wrong";
876 ghc_errtype = ERR_ILLEGALOPERATION;
877 ghc_errstr = "object is remote";
880 ghc_errtype = ERR_ILLEGALOPERATION;
881 ghc_errstr = "can't send after socket shutdown";
883 case GHC_ESOCKTNOSUPPORT:
884 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
885 ghc_errstr = "socket type not supported";
888 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
889 ghc_errstr = "can't seek on a pipe";
892 ghc_errtype = ERR_NOSUCHTHING;
893 ghc_errstr = "no such process";
896 ghc_errtype = ERR_UNSATISFIEDCONSTRAINTS;
897 ghc_errstr = "RFS resources still mounted by remote host(s)";
900 ghc_errtype = ERR_RESOURCEVANISHED;
901 ghc_errstr = "stale NFS file handle";
904 ghc_errtype = ERR_TIMEEXPIRED;
905 ghc_errstr = "timer expired";
908 ghc_errtype = ERR_TIMEEXPIRED;
909 ghc_errstr = "connection timed out";
911 case GHC_ETOOMANYREFS:
912 ghc_errtype = ERR_RESOURCEEXHAUSTED;
913 ghc_errstr = "too many references; can't splice";
916 ghc_errtype = ERR_RESOURCEBUSY;
917 ghc_errstr = "text file in-use";
920 ghc_errtype = ERR_RESOURCEEXHAUSTED;
921 ghc_errstr = "quota table full";
923 case GHC_EWOULDBLOCK:
924 ghc_errtype = ERR_OTHERERROR;
925 ghc_errstr = "operation would block";
928 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
929 ghc_errstr = "can't make a cross-device link";