2 % (c) The GRASP/AQUA Project, Glasgow University, 1994
4 \subsection[errno.lc]{GHC Error Number Conversion}
14 char *ghc_errstr = NULL;
18 { return ((StgAddr)ghc_errstr); }
22 { return ((StgInt)ghc_errno); }
26 { return ((StgInt)ghc_errtype); }
29 /* Collect all of the grotty #ifdef's in one place. */
31 void cvtErrno(STG_NO_ARGS)
36 ghc_errno = GHC_E2BIG;
41 ghc_errno = GHC_EACCES;
46 ghc_errno = GHC_EADDRINUSE;
51 ghc_errno = GHC_EADDRNOTAVAIL;
61 ghc_errno = GHC_EAFNOSUPPORT;
66 ghc_errno = GHC_EAGAIN;
71 ghc_errno = GHC_EALREADY;
76 ghc_errno = GHC_EBADF;
81 ghc_errno = GHC_EBADMSG;
86 ghc_errno = GHC_EBADRPC;
91 ghc_errno = GHC_EBUSY;
96 ghc_errno = GHC_ECHILD;
101 ghc_errno = GHC_ECOMM;
106 ghc_errno = GHC_ECONNABORTED;
111 ghc_errno = GHC_ECONNREFUSED;
116 ghc_errno = GHC_ECONNRESET;
121 ghc_errno = GHC_EDEADLK;
126 ghc_errno = GHC_EDESTADDRREQ;
131 ghc_errno = GHC_EDIRTY;
136 ghc_errno = GHC_EDOM;
141 ghc_errno = GHC_EDQUOT;
146 ghc_errno = GHC_EEXIST;
151 ghc_errno = GHC_EFAULT;
156 ghc_errno = GHC_EFBIG;
161 ghc_errno = GHC_EFTYPE;
166 ghc_errno = GHC_EHOSTDOWN;
171 ghc_errno = GHC_EHOSTUNREACH;
176 ghc_errno = GHC_EIDRM;
181 ghc_errno = GHC_EILSEQ;
186 ghc_errno = GHC_EINPROGRESS;
191 ghc_errno = GHC_EINTR;
196 ghc_errno = GHC_EINVAL;
206 ghc_errno = GHC_EISCONN;
211 ghc_errno = GHC_EISDIR;
216 ghc_errno = GHC_ELOOP;
221 ghc_errno = GHC_EMFILE;
226 ghc_errno = GHC_EMLINK;
231 ghc_errno = GHC_EMSGSIZE;
236 ghc_errno = GHC_EMULTIHOP;
241 ghc_errno = GHC_ENAMETOOLONG;
246 ghc_errno = GHC_ENETDOWN;
251 ghc_errno = GHC_ENETRESET;
256 ghc_errno = GHC_ENETUNREACH;
261 ghc_errno = GHC_ENFILE;
266 ghc_errno = GHC_ENOBUFS;
271 ghc_errno = GHC_ENODATA;
276 ghc_errno = GHC_ENODEV;
281 ghc_errno = GHC_ENOENT;
286 ghc_errno = GHC_ENOEXEC;
291 ghc_errno = GHC_ENOLCK;
296 ghc_errno = GHC_ENOLINK;
301 ghc_errno = GHC_ENOMEM;
306 ghc_errno = GHC_ENOMSG;
311 ghc_errno = GHC_ENONET;
316 ghc_errno = GHC_ENOPROTOOPT;
321 ghc_errno = GHC_ENOSPC;
326 ghc_errno = GHC_ENOSR;
331 ghc_errno = GHC_ENOSTR;
336 ghc_errno = GHC_ENOSYS;
341 ghc_errno = GHC_ENOTBLK;
346 ghc_errno = GHC_ENOTCONN;
351 ghc_errno = GHC_ENOTDIR;
354 #ifndef aix_TARGET_OS
355 /* AIX returns EEXIST where 4.3BSD used ENOTEMPTY.
356 * there is an ENOTEMPTY defined as the same as EEXIST, and
357 * therefore it won't work properly on a case statement.
358 * another option is to define _ALL_SOURCE for aix, which
359 * gives a different number for ENOTEMPTY.
360 * I haven't tried that. -- andre.
364 ghc_errno = GHC_ENOTEMPTY;
370 ghc_errno = GHC_ENOTSOCK;
375 ghc_errno = GHC_ENOTTY;
380 ghc_errno = GHC_ENXIO;
385 ghc_errno = GHC_EOPNOTSUPP;
390 ghc_errno = GHC_EPERM;
395 ghc_errno = GHC_EPFNOSUPPORT;
400 ghc_errno = GHC_EPIPE;
405 ghc_errno = GHC_EPROCLIM;
410 ghc_errno = GHC_EPROCUNAVAIL;
415 ghc_errno = GHC_EPROGMISMATCH;
420 ghc_errno = GHC_EPROGUNAVAIL;
425 ghc_errno = GHC_EPROTO;
428 #ifdef EPROTONOSUPPORT
429 case EPROTONOSUPPORT:
430 ghc_errno = GHC_EPROTONOSUPPORT;
435 ghc_errno = GHC_EPROTOTYPE;
440 ghc_errno = GHC_ERANGE;
445 ghc_errno = GHC_EREMCHG;
450 ghc_errno = GHC_EREMOTE;
455 ghc_errno = GHC_EROFS;
460 ghc_errno = GHC_ERPCMISMATCH;
465 ghc_errno = GHC_ERREMOTE;
470 ghc_errno = GHC_ESHUTDOWN;
473 #ifdef ESOCKTNOSUPPORT
474 case ESOCKTNOSUPPORT:
475 ghc_errno = GHC_ESOCKTNOSUPPORT;
480 ghc_errno = GHC_ESPIPE;
485 ghc_errno = GHC_ESRCH;
490 ghc_errno = GHC_ESRMNT;
495 ghc_errno = GHC_ESTALE;
500 ghc_errno = GHC_ETIME;
505 ghc_errno = GHC_ETIMEDOUT;
510 ghc_errno = GHC_ETOOMANYREFS;
515 ghc_errno = GHC_ETXTBSY;
520 ghc_errno = GHC_EUSERS;
526 ghc_errno = GHC_EWOULDBLOCK;
532 ghc_errno = GHC_EXDEV;
542 stdErrno(STG_NO_ARGS)
546 ghc_errtype = ERR_OTHERERROR;
547 ghc_errstr = "unexpected error";
550 ghc_errtype = ERR_OTHERERROR;
551 ghc_errstr = "no error";
553 ghc_errtype = ERR_RESOURCEEXHAUSTED;
554 ghc_errstr = "argument list too long";
557 ghc_errtype = ERR_PERMISSIONDENIED;
558 ghc_errstr = "inadequate access permission";
561 ghc_errtype = ERR_RESOURCEBUSY;
562 ghc_errstr = "address already in use";
564 case GHC_EADDRNOTAVAIL:
565 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
566 ghc_errstr = "address not available";
569 ghc_errtype = ERR_OTHERERROR;
570 ghc_errstr = "RFS advertise error";
572 case GHC_EAFNOSUPPORT:
573 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
574 ghc_errstr = "address family not supported by protocol family";
577 ghc_errtype = ERR_RESOURCEEXHAUSTED;
578 ghc_errstr = "insufficient resources";
581 ghc_errtype = ERR_ALREADYEXISTS;
582 ghc_errstr = "operation already in progress";
585 ghc_errtype = ERR_OTHERERROR;
586 ghc_errstr = "internal error (EBADF)";
589 ghc_errtype = ERR_INAPPROPRIATETYPE;
590 ghc_errstr = "next message has wrong type";
593 ghc_errtype = ERR_OTHERERROR;
594 ghc_errstr = "invalid RPC request or response";
597 ghc_errtype = ERR_RESOURCEBUSY;
598 ghc_errstr = "device busy";
601 ghc_errtype = ERR_NOSUCHTHING;
602 ghc_errstr = "no child processes";
605 ghc_errtype = ERR_RESOURCEVANISHED;
606 ghc_errstr = "no virtual circuit could be found";
608 case GHC_ECONNABORTED:
609 ghc_errtype = ERR_OTHERERROR;
610 ghc_errstr = "aborted connection";
612 case GHC_ECONNREFUSED:
613 ghc_errtype = ERR_NOSUCHTHING;
614 ghc_errstr = "no listener on remote host";
617 ghc_errtype = ERR_RESOURCEVANISHED;
618 ghc_errstr = "connection reset by peer";
621 ghc_errtype = ERR_RESOURCEBUSY;
622 ghc_errstr = "resource deadlock avoided";
624 case GHC_EDESTADDRREQ:
625 ghc_errtype = ERR_INVALIDARGUMENT;
626 ghc_errstr = "destination address required";
629 ghc_errtype = ERR_UNSATISFIEDCONSTRAINTS;
630 ghc_errstr = "file system dirty";
633 ghc_errtype = ERR_INVALIDARGUMENT;
634 ghc_errstr = "argument too large";
637 ghc_errtype = ERR_PERMISSIONDENIED;
638 ghc_errstr = "quota exceeded";
641 ghc_errtype = ERR_ALREADYEXISTS;
642 ghc_errstr = "file already exists";
645 ghc_errtype = ERR_OTHERERROR;
646 ghc_errstr = "internal error (EFAULT)";
649 ghc_errtype = ERR_PERMISSIONDENIED;
650 ghc_errstr = "file too large";
653 ghc_errtype = ERR_INAPPROPRIATETYPE;
654 ghc_errstr = "inappropriate NFS file type or format";
657 ghc_errtype = ERR_NOSUCHTHING;
658 ghc_errstr = "destination host down";
660 case GHC_EHOSTUNREACH:
661 ghc_errtype = ERR_NOSUCHTHING;
662 ghc_errstr = "remote host is unreachable";
665 ghc_errtype = ERR_RESOURCEVANISHED;
666 ghc_errstr = "IPC identifier removed";
669 ghc_errtype = ERR_INVALIDARGUMENT;
670 ghc_errstr = "invalid wide character";
672 case GHC_EINPROGRESS:
673 ghc_errtype = ERR_ALREADYEXISTS;
674 ghc_errstr = "operation now in progress";
677 ghc_errtype = ERR_INTERRUPTED;
678 ghc_errstr = "interrupted system call";
681 ghc_errtype = ERR_INVALIDARGUMENT;
682 ghc_errstr = "invalid argument";
685 ghc_errtype = ERR_HARDWAREFAULT;
686 ghc_errstr = "unknown I/O fault";
689 ghc_errtype = ERR_ALREADYEXISTS;
690 ghc_errstr = "socket is already connected";
693 ghc_errtype = ERR_INAPPROPRIATETYPE;
694 ghc_errstr = "file is a directory";
697 ghc_errtype = ERR_INVALIDARGUMENT;
698 ghc_errstr = "too many symbolic links";
701 ghc_errtype = ERR_RESOURCEEXHAUSTED;
702 ghc_errstr = "process file table full";
705 ghc_errtype = ERR_RESOURCEEXHAUSTED;
706 ghc_errstr = "too many links";
709 ghc_errtype = ERR_RESOURCEEXHAUSTED;
710 ghc_errstr = "message too long";
713 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
714 ghc_errstr = "multi-hop RFS request";
716 case GHC_ENAMETOOLONG:
717 ghc_errtype = ERR_INVALIDARGUMENT;
718 ghc_errstr = "filename too long";
721 ghc_errtype = ERR_RESOURCEVANISHED;
722 ghc_errstr = "network is down";
725 ghc_errtype = ERR_RESOURCEVANISHED;
726 ghc_errstr = "remote host rebooted; connection lost";
728 case GHC_ENETUNREACH:
729 ghc_errtype = ERR_NOSUCHTHING;
730 ghc_errstr = "remote network is unreachable";
733 ghc_errtype = ERR_RESOURCEEXHAUSTED;
734 ghc_errstr = "system file table full";
737 ghc_errtype = ERR_RESOURCEEXHAUSTED;
738 ghc_errstr = "no buffer space available";
741 ghc_errtype = ERR_NOSUCHTHING;
742 ghc_errstr = "no message on the stream head read queue";
745 ghc_errtype = ERR_NOSUCHTHING;
746 ghc_errstr = "no such device";
749 ghc_errtype = ERR_NOSUCHTHING;
750 ghc_errstr = "no such file or directory";
753 ghc_errtype = ERR_INVALIDARGUMENT;
754 ghc_errstr = "not an executable file";
757 ghc_errtype = ERR_RESOURCEEXHAUSTED;
758 ghc_errstr = "no file locks available";
761 ghc_errtype = ERR_RESOURCEVANISHED;
762 ghc_errstr = "RFS link has been severed";
765 ghc_errtype = ERR_RESOURCEEXHAUSTED;
766 ghc_errstr = "not enough virtual memory";
769 ghc_errtype = ERR_NOSUCHTHING;
770 ghc_errstr = "no message of desired type";
773 ghc_errtype = ERR_NOSUCHTHING;
774 ghc_errstr = "host is not on a network";
776 case GHC_ENOPROTOOPT:
777 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
778 ghc_errstr = "operation not supported by protocol";
781 ghc_errtype = ERR_RESOURCEEXHAUSTED;
782 ghc_errstr = "no space left on device";
785 ghc_errtype = ERR_RESOURCEEXHAUSTED;
786 ghc_errstr = "out of stream resources";
789 ghc_errtype = ERR_INVALIDARGUMENT;
790 ghc_errstr = "not a stream device";
793 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
794 ghc_errstr = "function not implemented";
797 ghc_errtype = ERR_INVALIDARGUMENT;
798 ghc_errstr = "not a block device";
801 ghc_errtype = ERR_INVALIDARGUMENT;
802 ghc_errstr = "socket is not connected";
805 ghc_errtype = ERR_INAPPROPRIATETYPE;
806 ghc_errstr = "not a directory";
809 ghc_errtype = ERR_UNSATISFIEDCONSTRAINTS;
810 ghc_errstr = "directory not empty";
813 ghc_errtype = ERR_INVALIDARGUMENT;
814 ghc_errstr = "not a socket";
817 ghc_errtype = ERR_ILLEGALOPERATION;
818 ghc_errstr = "inappropriate ioctl for device";
821 ghc_errtype = ERR_NOSUCHTHING;
822 ghc_errstr = "no such device or address";
825 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
826 ghc_errstr = "operation not supported on socket";
829 ghc_errtype = ERR_PERMISSIONDENIED;
830 ghc_errstr = "privileged operation";
832 case GHC_EPFNOSUPPORT:
833 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
834 ghc_errstr = "protocol family not supported";
837 ghc_errtype = ERR_RESOURCEVANISHED;
838 ghc_errstr = "broken pipe";
841 ghc_errtype = ERR_PERMISSIONDENIED;
842 ghc_errstr = "too many processes";
844 case GHC_EPROCUNAVAIL:
845 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
846 ghc_errstr = "unimplemented RPC procedure";
848 case GHC_EPROGMISMATCH:
849 ghc_errtype = ERR_PROTOCOLERROR;
850 ghc_errstr = "unsupported RPC program version";
852 case GHC_EPROGUNAVAIL:
853 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
854 ghc_errstr = "RPC program unavailable";
857 ghc_errtype = ERR_PROTOCOLERROR;
858 ghc_errstr = "error in streams protocol";
860 case GHC_EPROTONOSUPPORT:
861 ghc_errtype = ERR_PROTOCOLERROR;
862 ghc_errstr = "protocol not supported";
865 ghc_errtype = ERR_PROTOCOLERROR;
866 ghc_errstr = "wrong protocol for socket";
869 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
870 ghc_errstr = "result too large";
873 ghc_errtype = ERR_RESOURCEVANISHED;
874 ghc_errstr = "remote address changed";
877 ghc_errtype = ERR_ILLEGALOPERATION;
878 ghc_errstr = "too many levels of remote in path";
881 ghc_errtype = ERR_PERMISSIONDENIED;
882 ghc_errstr = "read-only file system";
884 case GHC_ERPCMISMATCH:
885 ghc_errtype = ERR_PROTOCOLERROR;
886 ghc_errstr = "RPC version is wrong";
889 ghc_errtype = ERR_ILLEGALOPERATION;
890 ghc_errstr = "object is remote";
893 ghc_errtype = ERR_ILLEGALOPERATION;
894 ghc_errstr = "can't send after socket shutdown";
896 case GHC_ESOCKTNOSUPPORT:
897 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
898 ghc_errstr = "socket type not supported";
901 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
902 ghc_errstr = "can't seek on a pipe";
905 ghc_errtype = ERR_NOSUCHTHING;
906 ghc_errstr = "no such process";
909 ghc_errtype = ERR_UNSATISFIEDCONSTRAINTS;
910 ghc_errstr = "RFS resources still mounted by remote host(s)";
913 ghc_errtype = ERR_RESOURCEVANISHED;
914 ghc_errstr = "stale NFS file handle";
917 ghc_errtype = ERR_TIMEEXPIRED;
918 ghc_errstr = "timer expired";
921 ghc_errtype = ERR_TIMEEXPIRED;
922 ghc_errstr = "connection timed out";
924 case GHC_ETOOMANYREFS:
925 ghc_errtype = ERR_RESOURCEEXHAUSTED;
926 ghc_errstr = "too many references; can't splice";
929 ghc_errtype = ERR_RESOURCEBUSY;
930 ghc_errstr = "text file in-use";
933 ghc_errtype = ERR_RESOURCEEXHAUSTED;
934 ghc_errstr = "quota table full";
936 case GHC_EWOULDBLOCK:
937 ghc_errtype = ERR_OTHERERROR;
938 ghc_errstr = "operation would block";
941 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
942 ghc_errstr = "can't make a cross-device link";