import unix.*;

errno() = __error()^;

alias EPERM           = 1;               /* Operation not permitted */
alias ENOENT          = 2;               /* No such file or directory */
alias ESRCH           = 3;               /* No such process */
alias EINTR           = 4;               /* Interrupted system call */
alias EIO             = 5;               /* Input/output error */
alias ENXIO           = 6;               /* Device not configured */
alias E2BIG           = 7;               /* Argument list too long */
alias ENOEXEC         = 8;               /* Exec format error */
alias EBADF           = 9;               /* Bad file descriptor */
alias ECHILD          = 10;              /* No child processes */
alias EDEADLK         = 11;              /* Resource deadlock avoided */
                                        /* 11 was EAGAIN */
alias ENOMEM          = 12;              /* Cannot allocate memory */
alias EACCES          = 13;              /* Permission denied */
alias EFAULT          = 14;              /* Bad address */

alias ENOTBLK         = 15;              /* Block device required */

alias EBUSY           = 16;              /* Device / Resource busy */
alias EEXIST          = 17;              /* File exists */
alias EXDEV           = 18;              /* Cross-device link */
alias ENODEV          = 19;              /* Operation not supported by device */
alias ENOTDIR         = 20;              /* Not a directory */
alias EISDIR          = 21;              /* Is a directory */
alias EINVAL          = 22;              /* Invalid argument */
alias ENFILE          = 23;              /* Too many open files in system */
alias EMFILE          = 24;              /* Too many open files */
alias ENOTTY          = 25;              /* Inappropriate ioctl for device */
alias ETXTBSY         = 26;              /* Text file busy */
alias EFBIG           = 27;              /* File too large */
alias ENOSPC          = 28;              /* No space left on device */
alias ESPIPE          = 29;              /* Illegal seek */
alias EROFS           = 30;              /* Read-only file system */
alias EMLINK          = 31;              /* Too many links */
alias EPIPE           = 32;              /* Broken pipe */

/* math software */
alias EDOM            = 33;              /* Numerical argument out of domain */
alias ERANGE          = 34;              /* Result too large */

/* non-blocking and interrupt i/o */
alias EAGAIN          = 35;              /* Resource temporarily unavailable */
alias EWOULDBLOCK     = EAGAIN;          /* Operation would block */
alias EINPROGRESS     = 36;              /* Operation now in progress */
alias EALREADY        = 37;              /* Operation already in progress */

/* ipc/network software -- argument errors */
alias ENOTSOCK        = 38;              /* Socket operation on non-socket */
alias EDESTADDRREQ    = 39;              /* Destination address required */
alias EMSGSIZE        = 40;              /* Message too long */
alias EPROTOTYPE      = 41;              /* Protocol wrong type for socket */
alias ENOPROTOOPT     = 42;              /* Protocol not available */
alias EPROTONOSUPPORT = 43;              /* Protocol not supported */

alias ESOCKTNOSUPPORT = 44;              /* Socket type not supported */

alias ENOTSUP         = 45;              /* Operation not supported */

alias EPFNOSUPPORT    = 46;              /* Protocol family not supported */

alias EAFNOSUPPORT    = 47;              /* Address family not supported by protocol family */
alias EADDRINUSE      = 48;              /* Address already in use */
alias EADDRNOTAVAIL   = 49;              /* Can't assign requested address */

/* ipc/network software -- operational errors */
alias ENETDOWN        = 50;              /* Network is down */
alias ENETUNREACH     = 51;              /* Network is unreachable */
alias ENETRESET       = 52;              /* Network dropped connection on reset */
alias ECONNABORTED    = 53;              /* Software caused connection abort */
alias ECONNRESET      = 54;              /* Connection reset by peer */
alias ENOBUFS         = 55;              /* No buffer space available */
alias EISCONN         = 56;              /* Socket is already connected */
alias ENOTCONN        = 57;              /* Socket is not connected */

alias ESHUTDOWN       = 58;              /* Can't send after socket shutdown */
alias ETOOMANYREFS    = 59;              /* Too many references: can't splice */

alias ETIMEDOUT       = 60;              /* Operation timed out */
alias ECONNREFUSED    = 61;              /* Connection refused */

alias ELOOP           = 62;              /* Too many levels of symbolic links */
alias ENAMETOOLONG    = 63;              /* File name too long */

/* should be rearranged */

alias EHOSTDOWN       = 64;              /* Host is down */

alias EHOSTUNREACH    = 65;              /* No route to host */
alias ENOTEMPTY       = 66;              /* Directory not empty */

/* quotas & mush */

alias EPROCLIM        = 67;              /* Too many processes */
alias EUSERS          = 68;              /* Too many users */

alias EDQUOT          = 69;              /* Disc quota exceeded */

/* Network File System */
alias ESTALE          = 70;              /* Stale NFS file handle */

alias EREMOTE         = 71;              /* Too many levels of remote in path */
alias EBADRPC         = 72;              /* RPC struct is bad */
alias ERPCMISMATCH    = 73;              /* RPC version wrong */
alias EPROGUNAVAIL    = 74;              /* RPC prog. not avail */
alias EPROGMISMATCH   = 75;              /* Program version wrong */
alias EPROCUNAVAIL    = 76;              /* Bad procedure for program */


alias ENOLCK          = 77;              /* No locks available */
alias ENOSYS          = 78;              /* Function not implemented */


alias EFTYPE          = 79;              /* Inappropriate file type or format */
alias EAUTH           = 80;              /* Authentication error */
alias ENEEDAUTH       = 81;              /* Need authenticator */

/* Intelligent device errors */
alias EPWROFF         = 82;      /* Device power is off */
alias EDEVERR         = 83;      /* Device error, e.g. paper out */


alias EOVERFLOW       = 84;              /* Value too large to be stored in data type */

/* Program loading errors */

alias EBADEXEC        = 85;      /* Bad executable */
alias EBADARCH        = 86;      /* Bad CPU type in executable */
alias ESHLIBVERS      = 87;      /* Shared library version mismatch */
alias EBADMACHO       = 88;      /* Malformed Macho file */


alias ECANCELED       = 89;              /* Operation canceled */

alias EIDRM           = 90;              /* Identifier removed */
alias ENOMSG          = 91;              /* No message of desired type */   
alias EILSEQ          = 92;              /* Illegal byte sequence */

alias ENOATTR         = 93;              /* Attribute not found */


alias EBADMSG         = 94;              /* Bad message */
alias EMULTIHOP       = 95;              /* Reserved */
alias ENODATA         = 96;              /* No message available on STREAM */
alias ENOLINK         = 97;              /* Reserved */
alias ENOSR           = 98;              /* No STREAM resources */
alias ENOSTR          = 99;              /* Not a STREAM */
alias EPROTO          = 100;             /* Protocol error */
alias ETIME           = 101;             /* STREAM ioctl timeout */


/* This value is only discrete when compiling __DARWIN_UNIX03, or KERNEL */
alias EOPNOTSUPP      = 102;             /* Operation not supported on socket */


alias ENOPOLICY       = 103;             /* No such policy registered */


alias ELAST           = 103;             /* Must be equal largest errno */

