Skip to content

Instantly share code, notes, and snippets.

@nelsonsar
Created February 11, 2015 01:59
Show Gist options
  • Save nelsonsar/549f7167aa2091afafa5 to your computer and use it in GitHub Desktop.
Save nelsonsar/549f7167aa2091afafa5 to your computer and use it in GitHub Desktop.
Posix error codes as class of constants. From here: http://fxr.watson.org/fxr/source/sys/errno.h
<?php
class PosixErrorCode
{
const EPERM = 1; /* Operation not permitted */
const ENOENT = 2; /* No such file or directory */
const ESRCH = 3; /* No such process */
const EINTR = 4; /* Interrupted system call */
const EIO = 5; /* Input/output error */
const ENXIO = 6; /* Device not configured */
const E2BIG = 7; /* Argument list too long */
const ENOEXEC = 8; /* Exec format error */
const EBADF = 9; /* Bad file descriptor */
const ECHILD = 10; /* No child processes */
const EDEADLK = 11; /* Resource deadlock avoided */
const ENOMEM = 12; /* Cannot allocate memory */
const EACCES = 13; /* Permission denied */
const EFAULT = 14; /* Bad address */
const ENOTBLK = 15; /* Block device required */
const EBUSY = 16; /* Device busy */
const EEXIST = 17; /* File exists */
const EXDEV = 18; /* Cross-device link */
const ENODEV = 19; /* Operation not supported by device */
const ENOTDIR = 20; /* Not a directory */
const EISDIR = 21; /* Is a directory */
const EINVAL = 22; /* Invalid argument */
const ENFILE = 23; /* Too many open files in system */
const EMFILE = 24; /* Too many open files */
const ENOTTY = 25; /* Inappropriate ioctl for device */
const ETXTBSY = 26; /* Text file busy */
const EFBIG = 27; /* File too large */
const ENOSPC = 28; /* No space left on device */
const ESPIPE = 29; /* Illegal seek */
const EROFS = 30; /* Read-only filesystem */
const EMLINK = 31; /* Too many links */
const EPIPE = 32; /* Broken pipe */
const EDOM = 33; /* Numerical argument out of domain */
const ERANGE = 34; /* Result too large */
const EAGAIN = 35; /* Resource temporarily unavailable */
const EWOULDBLOCK = 35; /* Resource temporarily unavailable */
const EINPROGRESS = 36; /* Operation now in progress */
const EALREADY = 37; /* Operation already in progress */
const ENOTSOCK = 38; /* Socket operation on non-socket */
const EDESTADDRREQ = 39; /* Destination address required */
const EMSGSIZE = 40; /* Message too long */
const EPROTOTYPE = 41; /* Protocol wrong type for socket */
const ENOPROTOOPT = 42; /* Protocol not available */
const EPROTONOSUPPORT = 43; /* Protocol not supported */
const ESOCKTNOSUPPORT = 44; /* Socket type not supported */
const EOPNOTSUPP = 45; /* Operation not supported */
const ENOTSUP = 45; /* Operation not supported */
const EPFNOSUPPORT = 46; /* Protocol family not supported */
const EAFNOSUPPORT = 47; /* Address family not supported by protocol family */
const EADDRINUSE = 48; /* Address already in use */
const EADDRNOTAVAIL = 49; /* Can't assign requested address */
const ENETDOWN = 50; /* Network is down */
const ENETUNREACH = 51; /* Network is unreachable */
const ENETRESET = 52; /* Network dropped connection on reset */
const ECONNABORTED = 53; /* Software caused connection abort */
const ECONNRESET = 54; /* Connection reset by peer */
const ENOBUFS = 55; /* No buffer space available */
const EISCONN = 56; /* Socket is already connected */
const ENOTCONN = 57; /* Socket is not connected */
const ESHUTDOWN = 58; /* Can't send after socket shutdown */
const ETOOMANYREFS = 59; /* Too many references: can't splice */
const ETIMEDOUT = 60; /* Operation timed out */
const ECONNREFUSED = 61; /* Connection refused */
const ELOOP = 62; /* Too many levels of symbolic links */
const ENAMETOOLONG = 63; /* File name too long */
const EHOSTDOWN = 64; /* Host is down */
const EHOSTUNREACH = 65; /* No route to host */
const ENOTEMPTY = 66; /* Directory not empty */
const EPROCLIM = 67; /* Too many processes */
const EUSERS = 68; /* Too many users */
const EDQUOT = 69; /* Disc quota exceeded */
const ESTALE = 70; /* Stale NFS file handle */
const EREMOTE = 71; /* Too many levels of remote in path */
const EBADRPC = 72; /* RPC struct is bad */
const ERPCMISMATCH = 73; /* RPC version wrong */
const EPROGUNAVAIL = 74; /* RPC prog. not avail */
const EPROGMISMATCH = 75; /* Program version wrong */
const EPROCUNAVAIL = 76; /* Bad procedure for program */
const ENOLCK = 77; /* No locks available */
const ENOSYS = 78; /* Function not implemented */
const EFTYPE = 79; /* Inappropriate file type or format */
const EAUTH = 80; /* Authentication error */
const ENEEDAUTH = 81; /* Need authenticator */
const EIDRM = 82; /* Identifier removed */
const ENOMSG = 83; /* No message of desired type */
const EOVERFLOW = 84; /* Value too large to be stored in data type */
const ECANCELED = 85; /* Operation canceled */
const EILSEQ = 86; /* Illegal byte sequence */
const ENOATTR = 87; /* Attribute not found */
const EDOOFUS = 88; /* Programming error */
const EBADMSG = 89; /* Bad message */
const EMULTIHOP = 90; /* Multihop attempted */
const ENOLINK = 91; /* Link has been severed */
const EPROTO = 92; /* Protocol error */
const ENOTCAPABLE = 93; /* Capabilities insufficient */
const ECAPMODE = 94; /* Not permitted in capability mode */
const ENOTRECOVERABLE = 95; /* State not recoverable */
const EOWNERDEAD = 96; /* Previous owner died */
const ELAST = 96; /* Must be equal largest errno */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment