# module Errno

When an operating system encounters an error, it typically reports the error as an integer error code:

    $ ls nosuch.txt
    ls: cannot access 'nosuch.txt': No such file or directory
    $ echo $? # Code for last error.
    2

When the Ruby interpreter interacts with the operating system and receives such an error code (e.g., `2`), it maps the code to a particular Ruby exception class (e.g., `Errno::ENOENT`):

    File.open('nosuch.txt')
    # => No such file or directory @ rb_sysopen - nosuch.txt (Errno::ENOENT)

Each such class is:

- A nested class in this module, `Errno`.

- A subclass of class `SystemCallError`.

- Associated with an error code.

Thus:

    Errno::ENOENT.superclass # => SystemCallError
    Errno::ENOENT::Errno     # => 2

The names of nested classes are returned by method `Errno.constants`:

    Errno.constants.size         # => 158
    Errno.constants.sort.take(5) # => [:E2BIG, :EACCES, :EADDRINUSE, :EADDRNOTAVAIL, :EADV]

As seen above, the error code associated with each class is available as the value of a constant; the value for a particular class may vary among operating systems. If the class is not needed for the particular operating system, the value is zero:

    Errno::ENOENT::Errno      # => 2
    Errno::ENOTCAPABLE::Errno # => 0

### Constants

E2BIG

  “Argument list too long” error

EACCES

  “Permission denied” error

EADDRINUSE

  “Address already in use” error

EADDRNOTAVAIL

  “Address not available” error

EADV

  “Advertise error” error

EAFNOSUPPORT

  “Address family not supported” error

EAGAIN

  “Resource temporarily unavailable, try again (may be the same value as `EWOULDBLOCK`)” error

EALREADY

  “Connection already in progress” error

EAUTH

  “Authentication error” error

EBADARCH

  “Bad CPU type in executable” error

EBADE

  “Bad exchange” error

EBADEXEC

  “Bad executable” error

EBADF

  “Bad file descriptor” error

EBADFD

  “File descriptor in bad state” error

EBADMACHO

  “Malformed Macho file” error

EBADMSG

  “Bad message” error

EBADR

  “Invalid request descriptor” error

EBADRPC

  “RPC struct is bad” error

EBADRQC

  “Invalid request code” error

EBADSLT

  “Invalid slot” error

EBFONT

  “Bad font file format” error

EBUSY

  “Device or resource busy” error

ECANCELED

  “Operation canceled” error

ECAPMODE

  “Not permitted in capability mode” error

ECHILD

  “No child processes” error

ECHRNG

  “Channel number out of range” error

ECOMM

  “Communication error on send” error

ECONNABORTED

  “Connection aborted” error

ECONNREFUSED

  “Connection refused” error

ECONNRESET

  “Connection reset” error

EDEADLK

  “Resource deadlock avoided” error

EDEADLOCK

  “File locking deadlock error” error

EDESTADDRREQ

  “Destination address required” error

EDEVERR

  “Device error; e.g., printer paper out” error

EDOM

  “Mathematics argument out of domain of function” error

EDOOFUS

  “Improper function use” error

EDOTDOT

  “RFS specific error” error

EDQUOT

  “Disk quota exceeded” error

EEXIST

  “File exists” error

EFAULT

  “Bad address” error

EFBIG

  “File too large” error

EFTYPE

  “Invalid file type or format” error

EHOSTDOWN

  “Host is down” error

EHOSTUNREACH

  “Host is unreachable” error

EHWPOISON

  “Memory page has hardware error” error

EIDRM

  “Identifier removed” error

EILSEQ

  “Invalid or incomplete multibyte or wide character” error

EINPROGRESS

  “Operation in progress” error

EINTR

  “Interrupted function call” error

EINVAL

  “Invalid argument” error

EIO

  “Input/output error” error

EIPSEC

  “IPsec processing failure” error

EISCONN

  “Socket is connected” error

EISDIR

  “Is a directory” error

EISNAM

  “Is a named file type” error

EKEYEXPIRED

  “Key has expired” error

EKEYREJECTED

  “Key was rejected by service” error

EKEYREVOKED

  “Key has been revoked” error

EL2HLT

  “Level 2 halted” error

EL2NSYNC

  “Level 2 not synchronized” error

EL3HLT

  “Level 3 halted” error

EL3RST

  “Level 3 reset” error

ELAST

  “Largest errno value” error

ELIBACC

  “Cannot access a needed shared library” error

ELIBBAD

  “Accessing a corrupted shared library” error

ELIBEXEC

  “Cannot exec a shared library directly” error

ELIBMAX

  “Attempting to link in too many shared libraries” error

ELIBSCN

  “.lib section in a.out corrupted” error

ELNRNG

  “Link number out of range” error

ELOOP

  “Too many levels of symbolic links” error

EMEDIUMTYPE

  “Wrong medium type” error

EMFILE

  “Too many open files” error

EMLINK

  “Too many links” error

EMSGSIZE

  “Message too long” error

EMULTIHOP

  “Multihop attempted” error

ENAMETOOLONG

  “Filename too long” error

ENAVAIL

  “No XENIX semaphores available” error

ENEEDAUTH

  “Need authenticator” error

ENETDOWN

  “Network is down” error

ENETRESET

  “Connection aborted by network” error

ENETUNREACH

  “Network unreachable” error

ENFILE

  “Too many open files in system” error

ENOANO

  “No anode” error

ENOATTR

  “Attribute not found” error

ENOBUFS

  “No buffer space available” error

ENOCSI

  “No CSI structure available” error

ENODATA

  “No data available” error

ENODEV

  “No such device” error

ENOENT

  “No such file or directory” error

ENOEXEC

  “Exec format error” error

ENOKEY

  “Required key not available” error

ENOLCK

  “No locks available” error

ENOLINK

  “Link has been severed” error

ENOMEDIUM

  “No medium found” error

ENOMEM

  “Not enough space/cannot allocate memory” error

ENOMSG

  “No message of the desired type” error

ENONET

  “Machine is not on the network” error

ENOPKG

  “Package not installed” error

ENOPOLICY

  “No such policy” error

ENOPROTOOPT

  “Protocol not available” error

ENOSPC

  “No space left on device” error

ENOSR

  “No STREAM resources” error

ENOSTR

  “Not a STREAM” error

ENOSYS

  “Functionality not implemented” error

ENOTBLK

  “Block device required” error

ENOTCAPABLE

  “Capabilities insufficient” error

ENOTCONN

  “The socket is not connected” error

ENOTDIR

  “Not a directory” error

ENOTEMPTY

  “Directory not empty” error

ENOTNAM

  “Not a XENIX named type file” error

ENOTRECOVERABLE

  “State not recoverable” error

ENOTSOCK

  “Not a socket” error

ENOTSUP

  “Operation not supported” error

ENOTTY

  “Inappropriate I/O control operation” error

ENOTUNIQ

  “Name not unique on network” error

ENXIO

  “No such device or address” error

EOPNOTSUPP

  “Operation not supported on socket” error

EOVERFLOW

  “Value too large to be stored in data type” error

EOWNERDEAD

  “Owner died” error

EPERM

  “Operation not permitted” error

EPFNOSUPPORT

  “Protocol family not supported” error

EPIPE

  “Broken pipe” error

EPROCLIM

  “Too many processes” error

EPROCUNAVAIL

  “Bad procedure for program” error

EPROGMISMATCH

  “Program version wrong” error

EPROGUNAVAIL

  “RPC program isn’t available” error

EPROTO

  “Protocol error” error

EPROTONOSUPPORT

  “Protocol not supported” error

EPROTOTYPE

  “Protocol wrong type for socket” error

EPWROFF

  “Device power is off” error

EQFULL

  “Interface output queue is full” error

ERANGE

  “Result too large” error

EREMCHG

  “Remote address changed” error

EREMOTE

  “Object is remote” error

EREMOTEIO

  “Remote I/O error” error

ERESTART

  “Interrupted system call should be restarted” error

ERFKILL

  “Operation not possible due to RF-kill” error

EROFS

  “Read-only file system” error

ERPCMISMATCH

  “RPC version wrong” error

ESHLIBVERS

  “Shared library version mismatch” error

ESHUTDOWN

  “Cannot send after transport endpoint shutdown” error

ESOCKTNOSUPPORT

  “Socket type not supported” error

ESPIPE

  “Illegal seek” error

ESRCH

  “No such process” error

ESRMNT

  “Server mount error” error

ESTALE

  “Stale file handle” error

ESTRPIPE

  “Streams pipe error” error

ETIME

  “Timer expired” error

ETIMEDOUT

  “Connection timed out” error

ETOOMANYREFS

  cannot splice“ error

ETXTBSY

  “Text file busy” error

EUCLEAN

  “Structure needs cleaning” error

EUNATCH

  “Protocol driver not attached” error

EUSERS

  “Too many users” error

EWOULDBLOCK

  “Operation would block” error

EXDEV

  “Invalid cross-device link” error

EXFULL

  “Exchange full” error

NOERROR

  No error