2 * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
4 * $Id: errno.c,v 1.1 1998/04/10 10:54:18 simonm Exp $
6 * GHC Error Number Conversion
15 char *ghc_errstr = NULL;
17 /* Collect all of the grotty #ifdef's in one place. */
24 ghc_errno = GHC_E2BIG;
29 ghc_errno = GHC_EACCES;
34 ghc_errno = GHC_EADDRINUSE;
39 ghc_errno = GHC_EADDRNOTAVAIL;
49 ghc_errno = GHC_EAFNOSUPPORT;
54 ghc_errno = GHC_EAGAIN;
59 ghc_errno = GHC_EALREADY;
64 ghc_errno = GHC_EBADF;
69 ghc_errno = GHC_EBADMSG;
74 ghc_errno = GHC_EBADRPC;
79 ghc_errno = GHC_EBUSY;
84 ghc_errno = GHC_ECHILD;
89 ghc_errno = GHC_ECOMM;
94 ghc_errno = GHC_ECONNABORTED;
99 ghc_errno = GHC_ECONNREFUSED;
104 ghc_errno = GHC_ECONNRESET;
109 ghc_errno = GHC_EDEADLK;
114 ghc_errno = GHC_EDESTADDRREQ;
119 ghc_errno = GHC_EDIRTY;
124 ghc_errno = GHC_EDOM;
129 ghc_errno = GHC_EDQUOT;
134 ghc_errno = GHC_EEXIST;
139 ghc_errno = GHC_EFAULT;
144 ghc_errno = GHC_EFBIG;
149 ghc_errno = GHC_EFTYPE;
154 ghc_errno = GHC_EHOSTDOWN;
159 ghc_errno = GHC_EHOSTUNREACH;
164 ghc_errno = GHC_EIDRM;
169 ghc_errno = GHC_EILSEQ;
174 ghc_errno = GHC_EINPROGRESS;
179 ghc_errno = GHC_EINTR;
184 ghc_errno = GHC_EINVAL;
194 ghc_errno = GHC_EISCONN;
199 ghc_errno = GHC_EISDIR;
204 ghc_errno = GHC_ELOOP;
209 ghc_errno = GHC_EMFILE;
214 ghc_errno = GHC_EMLINK;
219 ghc_errno = GHC_EMSGSIZE;
224 ghc_errno = GHC_EMULTIHOP;
229 ghc_errno = GHC_ENAMETOOLONG;
234 ghc_errno = GHC_ENETDOWN;
239 ghc_errno = GHC_ENETRESET;
244 ghc_errno = GHC_ENETUNREACH;
249 ghc_errno = GHC_ENFILE;
254 ghc_errno = GHC_ENOBUFS;
259 ghc_errno = GHC_ENODATA;
264 ghc_errno = GHC_ENODEV;
269 ghc_errno = GHC_ENOENT;
274 ghc_errno = GHC_ENOEXEC;
279 ghc_errno = GHC_ENOLCK;
284 ghc_errno = GHC_ENOLINK;
289 ghc_errno = GHC_ENOMEM;
294 ghc_errno = GHC_ENOMSG;
299 ghc_errno = GHC_ENONET;
304 ghc_errno = GHC_ENOPROTOOPT;
309 ghc_errno = GHC_ENOSPC;
314 ghc_errno = GHC_ENOSR;
319 ghc_errno = GHC_ENOSTR;
324 ghc_errno = GHC_ENOSYS;
329 ghc_errno = GHC_ENOTBLK;
334 ghc_errno = GHC_ENOTCONN;
339 ghc_errno = GHC_ENOTDIR;
342 #ifndef aix_TARGET_OS
343 /* AIX returns EEXIST where 4.3BSD used ENOTEMPTY.
344 * there is an ENOTEMPTY defined as the same as EEXIST, and
345 * therefore it won't work properly on a case statement.
346 * another option is to define _ALL_SOURCE for aix, which
347 * gives a different number for ENOTEMPTY.
348 * I haven't tried that. -- andre.
352 ghc_errno = GHC_ENOTEMPTY;
358 ghc_errno = GHC_ENOTSOCK;
363 ghc_errno = GHC_ENOTTY;
368 ghc_errno = GHC_ENXIO;
373 ghc_errno = GHC_EOPNOTSUPP;
378 ghc_errno = GHC_EPERM;
383 ghc_errno = GHC_EPFNOSUPPORT;
388 ghc_errno = GHC_EPIPE;
393 ghc_errno = GHC_EPROCLIM;
398 ghc_errno = GHC_EPROCUNAVAIL;
403 ghc_errno = GHC_EPROGMISMATCH;
408 ghc_errno = GHC_EPROGUNAVAIL;
413 ghc_errno = GHC_EPROTO;
416 #ifdef EPROTONOSUPPORT
417 case EPROTONOSUPPORT:
418 ghc_errno = GHC_EPROTONOSUPPORT;
423 ghc_errno = GHC_EPROTOTYPE;
428 ghc_errno = GHC_ERANGE;
433 ghc_errno = GHC_EREMCHG;
438 ghc_errno = GHC_EREMOTE;
443 ghc_errno = GHC_EROFS;
448 ghc_errno = GHC_ERPCMISMATCH;
453 ghc_errno = GHC_ERREMOTE;
458 ghc_errno = GHC_ESHUTDOWN;
461 #ifdef ESOCKTNOSUPPORT
462 case ESOCKTNOSUPPORT:
463 ghc_errno = GHC_ESOCKTNOSUPPORT;
468 ghc_errno = GHC_ESPIPE;
473 ghc_errno = GHC_ESRCH;
478 ghc_errno = GHC_ESRMNT;
483 ghc_errno = GHC_ESTALE;
488 ghc_errno = GHC_ETIME;
493 ghc_errno = GHC_ETIMEDOUT;
498 ghc_errno = GHC_ETOOMANYREFS;
503 ghc_errno = GHC_ETXTBSY;
508 ghc_errno = GHC_EUSERS;
514 ghc_errno = GHC_EWOULDBLOCK;
520 ghc_errno = GHC_EXDEV;
534 ghc_errtype = ERR_OTHERERROR;
535 ghc_errstr = "unexpected error";
538 ghc_errtype = ERR_OTHERERROR;
539 ghc_errstr = "no error";
541 ghc_errtype = ERR_RESOURCEEXHAUSTED;
542 ghc_errstr = "argument list too long";
545 ghc_errtype = ERR_PERMISSIONDENIED;
546 ghc_errstr = "inadequate access permission";
549 ghc_errtype = ERR_RESOURCEBUSY;
550 ghc_errstr = "address already in use";
552 case GHC_EADDRNOTAVAIL:
553 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
554 ghc_errstr = "address not available";
557 ghc_errtype = ERR_OTHERERROR;
558 ghc_errstr = "RFS advertise error";
560 case GHC_EAFNOSUPPORT:
561 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
562 ghc_errstr = "address family not supported by protocol family";
565 ghc_errtype = ERR_RESOURCEEXHAUSTED;
566 ghc_errstr = "insufficient resources";
569 ghc_errtype = ERR_ALREADYEXISTS;
570 ghc_errstr = "operation already in progress";
573 ghc_errtype = ERR_OTHERERROR;
574 ghc_errstr = "internal error (EBADF)";
577 ghc_errtype = ERR_INAPPROPRIATETYPE;
578 ghc_errstr = "next message has wrong type";
581 ghc_errtype = ERR_OTHERERROR;
582 ghc_errstr = "invalid RPC request or response";
585 ghc_errtype = ERR_RESOURCEBUSY;
586 ghc_errstr = "device busy";
589 ghc_errtype = ERR_NOSUCHTHING;
590 ghc_errstr = "no child processes";
593 ghc_errtype = ERR_RESOURCEVANISHED;
594 ghc_errstr = "no virtual circuit could be found";
596 case GHC_ECONNABORTED:
597 ghc_errtype = ERR_OTHERERROR;
598 ghc_errstr = "aborted connection";
600 case GHC_ECONNREFUSED:
601 ghc_errtype = ERR_NOSUCHTHING;
602 ghc_errstr = "no listener on remote host";
605 ghc_errtype = ERR_RESOURCEVANISHED;
606 ghc_errstr = "connection reset by peer";
609 ghc_errtype = ERR_RESOURCEBUSY;
610 ghc_errstr = "resource deadlock avoided";
612 case GHC_EDESTADDRREQ:
613 ghc_errtype = ERR_INVALIDARGUMENT;
614 ghc_errstr = "destination address required";
617 ghc_errtype = ERR_UNSATISFIEDCONSTRAINTS;
618 ghc_errstr = "file system dirty";
621 ghc_errtype = ERR_INVALIDARGUMENT;
622 ghc_errstr = "argument too large";
625 ghc_errtype = ERR_PERMISSIONDENIED;
626 ghc_errstr = "quota exceeded";
629 ghc_errtype = ERR_ALREADYEXISTS;
630 ghc_errstr = "file already exists";
633 ghc_errtype = ERR_OTHERERROR;
634 ghc_errstr = "internal error (EFAULT)";
637 ghc_errtype = ERR_PERMISSIONDENIED;
638 ghc_errstr = "file too large";
641 ghc_errtype = ERR_INAPPROPRIATETYPE;
642 ghc_errstr = "inappropriate NFS file type or format";
645 ghc_errtype = ERR_NOSUCHTHING;
646 ghc_errstr = "destination host down";
648 case GHC_EHOSTUNREACH:
649 ghc_errtype = ERR_NOSUCHTHING;
650 ghc_errstr = "remote host is unreachable";
653 ghc_errtype = ERR_RESOURCEVANISHED;
654 ghc_errstr = "IPC identifier removed";
657 ghc_errtype = ERR_INVALIDARGUMENT;
658 ghc_errstr = "invalid wide character";
660 case GHC_EINPROGRESS:
661 ghc_errtype = ERR_ALREADYEXISTS;
662 ghc_errstr = "operation now in progress";
665 ghc_errtype = ERR_INTERRUPTED;
666 ghc_errstr = "interrupted system call";
669 ghc_errtype = ERR_INVALIDARGUMENT;
670 ghc_errstr = "invalid argument";
673 ghc_errtype = ERR_HARDWAREFAULT;
674 ghc_errstr = "unknown I/O fault";
677 ghc_errtype = ERR_ALREADYEXISTS;
678 ghc_errstr = "socket is already connected";
681 ghc_errtype = ERR_INAPPROPRIATETYPE;
682 ghc_errstr = "file is a directory";
685 ghc_errtype = ERR_INVALIDARGUMENT;
686 ghc_errstr = "too many symbolic links";
689 ghc_errtype = ERR_RESOURCEEXHAUSTED;
690 ghc_errstr = "process file table full";
693 ghc_errtype = ERR_RESOURCEEXHAUSTED;
694 ghc_errstr = "too many links";
697 ghc_errtype = ERR_RESOURCEEXHAUSTED;
698 ghc_errstr = "message too long";
701 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
702 ghc_errstr = "multi-hop RFS request";
704 case GHC_ENAMETOOLONG:
705 ghc_errtype = ERR_INVALIDARGUMENT;
706 ghc_errstr = "filename too long";
709 ghc_errtype = ERR_RESOURCEVANISHED;
710 ghc_errstr = "network is down";
713 ghc_errtype = ERR_RESOURCEVANISHED;
714 ghc_errstr = "remote host rebooted; connection lost";
716 case GHC_ENETUNREACH:
717 ghc_errtype = ERR_NOSUCHTHING;
718 ghc_errstr = "remote network is unreachable";
721 ghc_errtype = ERR_RESOURCEEXHAUSTED;
722 ghc_errstr = "system file table full";
725 ghc_errtype = ERR_RESOURCEEXHAUSTED;
726 ghc_errstr = "no buffer space available";
729 ghc_errtype = ERR_NOSUCHTHING;
730 ghc_errstr = "no message on the stream head read queue";
733 ghc_errtype = ERR_NOSUCHTHING;
734 ghc_errstr = "no such device";
737 ghc_errtype = ERR_NOSUCHTHING;
738 ghc_errstr = "no such file or directory";
741 ghc_errtype = ERR_INVALIDARGUMENT;
742 ghc_errstr = "not an executable file";
745 ghc_errtype = ERR_RESOURCEEXHAUSTED;
746 ghc_errstr = "no file locks available";
749 ghc_errtype = ERR_RESOURCEVANISHED;
750 ghc_errstr = "RFS link has been severed";
753 ghc_errtype = ERR_RESOURCEEXHAUSTED;
754 ghc_errstr = "not enough virtual memory";
757 ghc_errtype = ERR_NOSUCHTHING;
758 ghc_errstr = "no message of desired type";
761 ghc_errtype = ERR_NOSUCHTHING;
762 ghc_errstr = "host is not on a network";
764 case GHC_ENOPROTOOPT:
765 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
766 ghc_errstr = "operation not supported by protocol";
769 ghc_errtype = ERR_RESOURCEEXHAUSTED;
770 ghc_errstr = "no space left on device";
773 ghc_errtype = ERR_RESOURCEEXHAUSTED;
774 ghc_errstr = "out of stream resources";
777 ghc_errtype = ERR_INVALIDARGUMENT;
778 ghc_errstr = "not a stream device";
781 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
782 ghc_errstr = "function not implemented";
785 ghc_errtype = ERR_INVALIDARGUMENT;
786 ghc_errstr = "not a block device";
789 ghc_errtype = ERR_INVALIDARGUMENT;
790 ghc_errstr = "socket is not connected";
793 ghc_errtype = ERR_INAPPROPRIATETYPE;
794 ghc_errstr = "not a directory";
797 ghc_errtype = ERR_UNSATISFIEDCONSTRAINTS;
798 ghc_errstr = "directory not empty";
801 ghc_errtype = ERR_INVALIDARGUMENT;
802 ghc_errstr = "not a socket";
805 ghc_errtype = ERR_ILLEGALOPERATION;
806 ghc_errstr = "inappropriate ioctl for device";
809 ghc_errtype = ERR_NOSUCHTHING;
810 ghc_errstr = "no such device or address";
813 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
814 ghc_errstr = "operation not supported on socket";
817 ghc_errtype = ERR_PERMISSIONDENIED;
818 ghc_errstr = "privileged operation";
820 case GHC_EPFNOSUPPORT:
821 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
822 ghc_errstr = "protocol family not supported";
825 ghc_errtype = ERR_RESOURCEVANISHED;
826 ghc_errstr = "broken pipe";
829 ghc_errtype = ERR_PERMISSIONDENIED;
830 ghc_errstr = "too many processes";
832 case GHC_EPROCUNAVAIL:
833 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
834 ghc_errstr = "unimplemented RPC procedure";
836 case GHC_EPROGMISMATCH:
837 ghc_errtype = ERR_PROTOCOLERROR;
838 ghc_errstr = "unsupported RPC program version";
840 case GHC_EPROGUNAVAIL:
841 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
842 ghc_errstr = "RPC program unavailable";
845 ghc_errtype = ERR_PROTOCOLERROR;
846 ghc_errstr = "error in streams protocol";
848 case GHC_EPROTONOSUPPORT:
849 ghc_errtype = ERR_PROTOCOLERROR;
850 ghc_errstr = "protocol not supported";
853 ghc_errtype = ERR_PROTOCOLERROR;
854 ghc_errstr = "wrong protocol for socket";
857 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
858 ghc_errstr = "result too large";
861 ghc_errtype = ERR_RESOURCEVANISHED;
862 ghc_errstr = "remote address changed";
865 ghc_errtype = ERR_ILLEGALOPERATION;
866 ghc_errstr = "too many levels of remote in path";
869 ghc_errtype = ERR_PERMISSIONDENIED;
870 ghc_errstr = "read-only file system";
872 case GHC_ERPCMISMATCH:
873 ghc_errtype = ERR_PROTOCOLERROR;
874 ghc_errstr = "RPC version is wrong";
877 ghc_errtype = ERR_ILLEGALOPERATION;
878 ghc_errstr = "object is remote";
881 ghc_errtype = ERR_ILLEGALOPERATION;
882 ghc_errstr = "can't send after socket shutdown";
884 case GHC_ESOCKTNOSUPPORT:
885 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
886 ghc_errstr = "socket type not supported";
889 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
890 ghc_errstr = "can't seek on a pipe";
893 ghc_errtype = ERR_NOSUCHTHING;
894 ghc_errstr = "no such process";
897 ghc_errtype = ERR_UNSATISFIEDCONSTRAINTS;
898 ghc_errstr = "RFS resources still mounted by remote host(s)";
901 ghc_errtype = ERR_RESOURCEVANISHED;
902 ghc_errstr = "stale NFS file handle";
905 ghc_errtype = ERR_TIMEEXPIRED;
906 ghc_errstr = "timer expired";
909 ghc_errtype = ERR_TIMEEXPIRED;
910 ghc_errstr = "connection timed out";
912 case GHC_ETOOMANYREFS:
913 ghc_errtype = ERR_RESOURCEEXHAUSTED;
914 ghc_errstr = "too many references; can't splice";
917 ghc_errtype = ERR_RESOURCEBUSY;
918 ghc_errstr = "text file in-use";
921 ghc_errtype = ERR_RESOURCEEXHAUSTED;
922 ghc_errstr = "quota table full";
924 case GHC_EWOULDBLOCK:
925 ghc_errtype = ERR_OTHERERROR;
926 ghc_errstr = "operation would block";
929 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
930 ghc_errstr = "can't make a cross-device link";