-- ***************************************************************************** -- $Id: error_s.m4,v 1.2 1993/12/24 15:09:30 courtel Exp $ -- -- Kind: Package specification -- Abstract: Unix error messages interface -- Portable: NO -- Short/rename: ERR -- -- Copyright 1990 - 1993 Centre d'Etudes de la Navigation Aerienne (CENA) -- -- PARADISE is free software; you can redistribute it and/or modify it -- under the terms of the GNU Library General Public License -- as published by the Free Software Foundation; -- -- PARADISE is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- -- You should have received a copy of the GNU Library General Public License -- along with PARADISE; see the file COPYING.LIB. If not, write to -- the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. -- ***************************************************************************** changequote([,])dnl changecom(--)dnl with C_TYPES; package ERROR is -- ************************************************************************** -- OUTLINE : Interface to Unix error messages -- -- EXCEPTIONS : -- CONTAINS TASKS ? : NO -- MODIFICATIONS : -- REFERENCES: Unix manual, part 3 (ERRNO) -- -- CONTENTS : -- - Error codes -- - Procedure LOCK -- - Procedure UNLOCK -- - Function ERRNO -- - Function ERROR_MSG -- - Procedure PERROR -- - Procedure PROPAGATE -- - Exceptions -- ************************************************************************** package C renames C_TYPES; use C; -- For operators -- ************************************************************************** -- List of error codes that may be raised; no complete error list may be -- build, because representation clauses on enumeration type are very tough. -- The exception list, though, should be portable on all systems. -- ************************************************************************** type CODE is ( -- From ; this is *not* portable ENULL, -- Error 0 EPERM, -- Not owner ENOENT, -- No such file or directory ESRCH, -- No such process EINTR, -- Interrupted system call EIO, -- I/O error ENXIO, -- No such device or address E2BIG, -- Arg list too long ENOEXEC, -- Exec format error EBADF, -- Bad file number ECHILD, -- No children EAGAIN, -- No more processes ENOMEM, -- Not enough core EACCES, -- Permission denied EFAULT, -- Bad address ENOTBLK, -- Block device required EBUSY, -- Mount device busy EEXIST, -- File exists EXDEV, -- Cross-device link ENODEV, -- No such device ENOTDIR, -- Not a directory EISDIR, -- Is a directory EINVAL, -- Invalid argument ENFILE, -- File table overflow EMFILE, -- Too many open files ENOTTY, -- Not a typewriter ETXTBSY, -- Text file busy EFBIG, -- File too large ENOSPC, -- No space left on device ESPIPE, -- Illegal seek EROFS, -- Read-only file system EMLINK, -- Too many links EPIPE, -- Broken pipe EDOM, -- Argument too large ERANGE, -- Result too large ifelse(M4SYSTEM,SUNOS,[--!! SunOS EWOULDBLOCK, -- Operation would block EINPROGRESS, -- Operation now in progress EALREADY, -- Operation already in progress ENOTSOCK, -- Socket operation on non-socket EDESTADDRREQ, -- Destination address required EMSGSIZE, -- Message too long EPROTOTYPE, -- Protocol wrong type for socket ENOPROTOOPT, -- Protocol not available EPROTONOSUPPORT, -- Protocol not supported ESOCKTNOSUPPORT, -- Socket type not supported EOPNOTSUPP, -- Operation not supported on socket EPFNOSUPPORT, -- Protocol family not supported EAFNOSUPPORT, -- Address family not supported by protocol family EADDRINUSE, -- Address already in use EADDRNOTAVAIL, -- Can't assign requested address ENETDOWN, -- Network is down ENETUNREACH, -- Network is unreachable ENETRESET, -- Network dropped connection on reset ECONNABORTED, -- Software caused connection abort ECONNRESET, -- Connection reset by peer ENOBUFS, -- No buffer space available EISCONN, -- Socket is already connected ENOTCONN, -- Socket is not connected ESHUTDOWN, -- Can't send after socket shutdown ETOOMANYREFS, -- Too many references: can't splice ETIMEDOUT, -- Connection timed out ECONNREFUSED, -- Connection refused ELOOP, -- Too many levels of symbolic links ENAMETOOLONG, -- File name too long EHOSTDOWN, -- Host is down EHOSTUNREACH, -- No route to host ENOTEMPTY, -- Directory not empty EPROCLIM, -- Too many processes EUSERS, -- Too many users EDQUOT, -- Disc quota exceeded ESTALE, -- Stale NFS file handle EREMOTE, -- Too many levels of remote in path ENOSTR, -- Device is not a stream ETIME, -- Timer expired ENOSR, -- Out of streams resources ENOMSG, -- No message of desired type EBADMSG, -- Trying to read unreadable message EIDRM, -- Identifier removed EDEADLK, -- Deadlock condition. ENOLCK, -- No record locks available. ENONET, -- Machine is not on the network ERREMOTE, -- Object is remote ENOLINK, -- The link has been severed EADV, -- Advertise error ESRMNT, -- Srmount error ECOMM, -- Communication error on send EPROTO, -- Protocol error EMULTIHOP, -- Multihop attempted EDOTDOT, -- Cross mount point (not an error) EREMCHG, -- Remote address changed ],M4SYSTEM,HPUX,[--!! HPUX ENOMSG, -- No message of desired type EIDRM, -- Identifier removed ECHRNG, -- Channel number out of range EL2NSYNC, -- Level 2 not synchronized EL3HLT, -- Level 3 halted EL3RST, -- Level 3 reset ELNRNG, -- Link number out of range EUNATCH, -- Protocol driver not attached ENOCSI, -- No CSI structure available EL2HLT, -- Level 2 halted EDEADLK, -- Deadlock condition ENOLCK, -- No record locks available ENOSTR, -- Device is not a stream ENODATA, -- No data available ETIME, -- Timer expired ENOSR, -- Out of streams resources ENONET, -- Machine is not on the network ENOPKG, -- Package not installed ENOLINK, -- The link has been severed EADV, -- Advertise error ESRMNT, -- Srmount error ECOMM, -- Communication error on send EPROTO, -- Protocol error EMULTIHOP, -- Multihop attempted EDOTDOT, -- Cross mount point (not an error) EBADMSG, -- Trying to read unreadable message EUSERS, -- Too many users EDQUOT, -- Disc quota exceeded ESTALE, -- Stale NFS file handle EREMOTE, -- Too many levels of remote in path EUNEXPECT, -- Unexpected error ENOSYM, -- Symbol does not exist in executable ENOTSOCK, -- Socket operation on non-socket EDESTADDRREQ, -- Destination address required EMSGSIZE, -- Message too long EPROTOTYPE, -- Protocol wrong type for socket ENOPROTOOPT, -- Protocol not available EPROTONOSUPPORT, -- Protocol not supported ESOCKTNOSUPPORT, -- Socket type not supported EOPNOTSUPP, -- Operation not supported on socket EPFNOSUPPORT, -- Protocol family not supported EAFNOSUPPORT, -- Address family not supported by protocol family EADDRINUSE, -- Address already in use EADDRNOTAVAIL, -- Can't assign requested address ENETDOWN, -- Network is down ENETUNREACH, -- Network is unreachable ENETRESET, -- Network dropped connection on reset ECONNABORTED, -- Software caused connection abort ECONNRESET, -- Connection reset by peer ENOBUFS, -- No buffer space available EISCONN, -- Socket is already connected ENOTCONN, -- Socket is not connected ESHUTDOWN, -- Can't send after socket shutdown ETOOMANYREFS, -- Too many references: can't splice ETIMEDOUT, -- Connection timed out ECONNREFUSED, -- Connection refused EREMOTERELEASE, -- Remote peer released connection EHOSTDOWN, -- Host is down EHOSTUNREACH, -- No route to host EALREADY, -- Operation already in progress EINPROGRESS, -- Operation now in progress EWOULDBLOCK, -- Operation would block ENOTEMPTY, -- Directory not empty ENAMETOOLONG, -- File name too long ELOOP, -- Too many levels of symbolic links ])--!! End ENOSYS); -- Function not implemented -- ************************************************************************** -- Error type; the variable ERRNO is set when errors occur but not cleared -- when non-erroneous calls are made -- ************************************************************************** subtype RETURN_VALUES is C.C_INT; FAILURE: constant RETURN_VALUES := -1; -- ************************************************************************** -- Protection of error codes: as ERRNO is a global variable, its content is -- replaced after every new error on a system call. Calling LOCK makes it -- sure that the current task cannot be preempted not interrupted, and -- therefore that the value of ERRNO cannot be changed unexpectedly. UNLOCK -- lets the multi- tasking restart as usual. -- ************************************************************************** procedure LOCK; procedure UNLOCK; -- ************************************************************************** -- Get the last error message -- ************************************************************************** function ERRNO return CODE; -- ************************************************************************** -- Get a short error message, or print it on the standard error, describing -- the last error encountered during a call to a system of library function. -- The PERROR call is equivalent to: DEBUG.ERROR (S & ": " & ERROR_MSG -- (ERROR_NO)). If no error number is given to PERROR, the current value of -- ERRNO is used. -- -- To be of most use, the argument string sent to PERROR should include the -- name of the program that incurred the error. -- ************************************************************************** function ERROR_MSG (ERROR_NO: CODE) return STRING; procedure PERROR (S: in STRING); procedure PERROR (S: in STRING; ERROR_NO: in CODE); -- ************************************************************************** -- Exceptions that may be raised when a system error occurs. As the exception -- list is trying to be portable, some exceptions are associated to an error -- that does not exist on the current system. This way, users can handle -- exceptions that arise on some systems only. -- -- The procedure PROPAGATE raises the appropriate exception for the given -- error code, or for the current value of errno. -- ************************************************************************** procedure PROPAGATE; procedure PROPAGATE (VALUE: in CODE); E_NULL: exception; -- Error 0 (should never happen) E_2BIG: exception; -- Arg list too long E_ACCES: exception; -- Permission denied E_ADDRINUSE: exception; -- Address already in use E_ADDRNOTAVAIL: exception; -- Cannot assign requested address E_ADV: exception; -- Advertise error E_AFNOSUPPORT: exception; -- Address family not supported by protocol E_AGAIN: exception; -- Try again E_ALREADY: exception; -- Operation already in progress E_BADE: exception; -- Invalid exchange E_BADF: exception; -- Bad file number E_BADFD: exception; -- File descriptor in bad state E_BADMSG: exception; -- Not a data message E_BADR: exception; -- Invalid request descriptor E_BADRQC: exception; -- Invalid request code E_BADSLT: exception; -- Invalid slot E_BFONT: exception; -- Bad font file format E_BUSY: exception; -- Device or resource busy E_CHILD: exception; -- No child processes E_CHRNG: exception; -- Channel number out of range E_COMM: exception; -- Communication error on send E_CONNABORTED: exception; -- Software caused connection abort E_CONNREFUSED: exception; -- Connection refused E_CONNRESET: exception; -- Connection reset by peer E_DEADLK: exception; -- Resource deadlock would occur E_DEADLOCK: exception; -- File locking deadlock error E_DESTADDRREQ: exception; -- Destination address required E_DOM: exception; -- Math argument out of domain of func E_DOTDOT: exception; -- RFS specific error E_DQUOT: exception; -- Disc quota exceeded E_EXIST: exception; -- File exists E_FAULT: exception; -- Bad address E_FBIG: exception; -- File too large E_HOSTDOWN: exception; -- Host is down E_HOSTUNREACH: exception; -- No route to host E_IDRM: exception; -- Identifier removed E_ILSEQ: exception; -- Illegal byte sequence E_INPROGRESS: exception; -- Operation now in progress E_INTR: exception; -- Interrupted system call E_INVAL: exception; -- Invalid argument E_IO: exception; -- I/O error E_ISCONN: exception; -- Transport endpoint is already connected E_ISDIR: exception; -- Is a directory E_LOOP: exception; -- Too many levels of symbolic links E_ISNAM: exception; -- Is a named type file E_L2HLT: exception; -- Level 2 halted E_L2NSYNC: exception; -- Level 2 not synchronized E_L3HLT: exception; -- Level 3 halted E_L3RST: exception; -- Level 3 reset E_LIBACC: exception; -- Can not access a needed shared library E_LIBBAD: exception; -- Accessing a corrupted shared library E_LIBEXEC: exception; -- Cannot exec a shared library directly E_LIBMAX: exception; -- Attempting to link in too many shared libraries E_LIBSCN: exception; -- .lib section in a.out corrupted E_LNRNG: exception; -- Link number out of range E_MFILE: exception; -- Too many open files E_MLINK: exception; -- Too many links E_MSGSIZE: exception; -- Message too long E_MULTIHOP: exception; -- Multihop attempted E_NAMETOOLONG: exception; -- File name too long E_NAVAIL: exception; -- No XENIX semaphores available E_NETDOWN: exception; -- Network is down E_NETRESET: exception; -- Network dropped connection because of reset E_NETUNREACH: exception; -- Network is unreachable E_NFILE: exception; -- File table overflow E_NOANO: exception; -- No anode E_NOBUFS: exception; -- No buffer space available E_NOCSI: exception; -- No CSI structure available E_NODATA: exception; -- No data available E_NODEV: exception; -- No such device E_NOENT: exception; -- No such file or directory E_NOEXEC: exception; -- Exec format error E_NOLCK: exception; -- No record locks available. E_NOLINK: exception; -- Link has been severed E_NOMEM: exception; -- Out of memory E_NOMSG: exception; -- No message of desired type E_NONET: exception; -- Machine is not on the network E_NOPKG: exception; -- Package not installed E_NOPROTOOPT: exception; -- Protocol not available E_NOSPC: exception; -- No space left on device E_NOSR: exception; -- Out of streams resources E_NOSTR: exception; -- Device is not a stream E_NOSYM: exception; -- Symbol does not exist in executable E_NOSYS: exception; -- Function not implemented E_NOTBLK: exception; -- Block device required E_NOTCONN: exception; -- Transport endpoint is not connected E_NOTDIR: exception; -- Not a directory E_NOTEMPTY: exception; -- Directory not empty E_NOTNAM: exception; -- Not a XENIX named type file E_NOTSOCK: exception; -- Socket operation on non-socket E_NOTTY: exception; -- Not a typewriter E_NOTUNIQ: exception; -- Name not unique on network E_NXIO: exception; -- No such device or address E_OPNOTSUPP: exception; -- Operation not supported on transport endpoint E_OVERFLOW: exception; -- Value too large for defined data type E_PERM: exception; -- Operation not permitted E_PFNOSUPPORT: exception; -- Protocol family not supported E_PIPE: exception; -- Broken pipe E_PROCLIM: exception; -- Too many processes E_PROTO: exception; -- Protocol error E_PROTONOSUPPORT: exception; -- Protocol not supported E_PROTOTYPE: exception; -- Protocol wrong type for socket E_RANGE: exception; -- Math result not representable E_REMCHG: exception; -- Remote address changed E_REMOTE: exception; -- Object is remote E_REMOTEIO: exception; -- Remote I/O error E_REMOTERELEASE: exception; -- Remote peer released connection E_RESTART: exception; -- Interrupted system call should be restarted E_ROFS: exception; -- Read-only file system E_RREMOTE: exception; -- Object is remote E_SHUTDOWN: exception; -- Can't send after transport endpoint shutdown E_SOCKTNOSUPPORT: exception; -- Socket type not supported E_SPIPE: exception; -- Illegal seek E_SRCH: exception; -- No such process E_SRMNT: exception; -- Srmount error E_STALE: exception; -- Stale NFS file handle E_STRPIPE: exception; -- Streams pipe error E_TIME: exception; -- Timer expired E_TIMEDOUT: exception; -- Connection timed out E_TOOMANYREFS: exception; -- Too many references: can't splice E_TXTBSY: exception; -- Text file busy E_UCLEAN: exception; -- Structure needs cleaning E_UNATCH: exception; -- Protocol driver not attached E_UNEXPECT: exception; -- Unexpected error E_USERS: exception; -- Too many users E_WOULDBLOCK: exception; -- Operation would block E_XDEV: exception; -- Cross-device link E_XFULL: exception; -- Exchange full private for CODE use ( ENULL => 0, EPERM => 1, ENOENT => 2, ESRCH => 3, EINTR => 4, EIO => 5, ENXIO => 6, E2BIG => 7, ENOEXEC => 8, EBADF => 9, ECHILD => 10, EAGAIN => 11, ENOMEM => 12, EACCES => 13, EFAULT => 14, ENOTBLK => 15, EBUSY => 16, EEXIST => 17, EXDEV => 18, ENODEV => 19, ENOTDIR => 20, EISDIR => 21, EINVAL => 22, ENFILE => 23, EMFILE => 24, ENOTTY => 25, ETXTBSY => 26, EFBIG => 27, ENOSPC => 28, ESPIPE => 29, EROFS => 30, EMLINK => 31, EPIPE => 32, EDOM => 33, ERANGE => 34, ifelse(M4SYSTEM,SUNOS,[--!! SunOS EWOULDBLOCK => 35, EINPROGRESS => 36, EALREADY => 37, ENOTSOCK => 38, EDESTADDRREQ => 39, EMSGSIZE => 40, EPROTOTYPE => 41, ENOPROTOOPT => 42, EPROTONOSUPPORT => 43, ESOCKTNOSUPPORT => 44, EOPNOTSUPP => 45, EPFNOSUPPORT => 46, EAFNOSUPPORT => 47, EADDRINUSE => 48, EADDRNOTAVAIL => 49, ENETDOWN => 50, ENETUNREACH => 51, ENETRESET => 52, ECONNABORTED => 53, ECONNRESET => 54, ENOBUFS => 55, EISCONN => 56, ENOTCONN => 57, ESHUTDOWN => 58, ETOOMANYREFS => 59, ETIMEDOUT => 60, ECONNREFUSED => 61, ELOOP => 62, ENAMETOOLONG => 63, EHOSTDOWN => 64, EHOSTUNREACH => 65, ENOTEMPTY => 66, EPROCLIM => 67, EUSERS => 68, EDQUOT => 69, ESTALE => 70, EREMOTE => 71, ENOSTR => 72, ETIME => 73, ENOSR => 74, ENOMSG => 75, EBADMSG => 76, EIDRM => 77, EDEADLK => 78, ENOLCK => 79, ENONET => 80, ERREMOTE => 81, ENOLINK => 82, EADV => 83, ESRMNT => 84, ECOMM => 85, EPROTO => 86, EMULTIHOP => 87, EDOTDOT => 88, EREMCHG => 89, ENOSYS => 90); ],M4SYSTEM,HPUX,[--!! HPUX ENOMSG => 35, EIDRM => 36, ECHRNG => 37, EL2NSYNC => 38, EL3HLT => 39, EL3RST => 40, ELNRNG => 41, EUNATCH => 42, ENOCSI => 43, EL2HLT => 44, EDEADLK => 45, ENOLCK => 46, ENOSTR => 50, ENODATA => 51, ETIME => 52, ENOSR => 53, ENONET => 54, ENOPKG => 55, ENOLINK => 57, EADV => 58, ESRMNT => 59, ECOMM => 60, EPROTO => 61, EMULTIHOP => 64, EDOTDOT => 66, EBADMSG => 67, EUSERS => 68, EDQUOT => 69, ESTALE => 70, EREMOTE => 71, EUNEXPECT => 99, ENOSYM => 215, ENOTSOCK => 216, EDESTADDRREQ => 217, EMSGSIZE => 218, EPROTOTYPE => 219, ENOPROTOOPT => 220, EPROTONOSUPPORT => 221, ESOCKTNOSUPPORT => 222, EOPNOTSUPP => 223, EPFNOSUPPORT => 224, EAFNOSUPPORT => 225, EADDRINUSE => 226, EADDRNOTAVAIL => 227, ENETDOWN => 228, ENETUNREACH => 229, ENETRESET => 230, ECONNABORTED => 231, ECONNRESET => 232, ENOBUFS => 233, EISCONN => 234, ENOTCONN => 235, ESHUTDOWN => 236, ETOOMANYREFS => 237, ETIMEDOUT => 238, ECONNREFUSED => 239, EREMOTERELEASE => 240, EHOSTDOWN => 241, EHOSTUNREACH => 242, EALREADY => 244, EINPROGRESS => 245, EWOULDBLOCK => 246, ENOTEMPTY => 247, ENAMETOOLONG => 248, ELOOP => 249, ENOSYS => 251); ])--!! End for CODE'size use 32; pragma INLINE (LOCK, UNLOCK, ERRNO, ERROR_MSG, PERROR); end ERROR;