# class Errno

- Errno
- Exception
- Reference
- Object

##
Overview

Errno wraps and gives access to libc's errno. This is mostly useful when dealing with C libraries.

This class is the exception thrown when errno errors are encountered.

##
Defined in:

##
Constant Summary

E2BIG = `LibC::E2BIG`

  Argument list too long

EACCES = `LibC::EACCES`

  Permission denied

EADDRINUSE = `LibC::EADDRINUSE`

  Address already in use

EADDRNOTAVAIL = `LibC::EADDRNOTAVAIL`

  Can't assign requested address

EAFNOSUPPORT = `LibC::EAFNOSUPPORT`

  Address family not supported by protocol family

EAGAIN = `LibC::EAGAIN`

  Resource temporarily unavailable

EALREADY = `LibC::EALREADY`

  Operation already in progress

EBADF = `LibC::EBADF`

  Bad file descriptor

EBADMSG = `LibC::EBADMSG`

  Bad message

EBUSY = `LibC::EBUSY`

  Device / Resource busy

ECANCELED = `LibC::ECANCELED`

  Operation canceled

ECHILD = `LibC::ECHILD`

  No child processes

ECONNABORTED = `LibC::ECONNABORTED`

  Software caused connection abort

ECONNREFUSED = `LibC::ECONNREFUSED`

  Connection refused

ECONNRESET = `LibC::ECONNRESET`

  Connection reset by peer

EDEADLK = `LibC::EDEADLK`

  Resource deadlock avoided

EDESTADDRREQ = `LibC::EDESTADDRREQ`

  Destination address required

EDOM = `LibC::EDOM`

  Numerical argument out of domain

EDQUOT = `LibC::EDQUOT`

  Disc quota exceeded

EEXIST = `LibC::EEXIST`

  File exists

EFAULT = `LibC::EFAULT`

  Bad address

EFBIG = `LibC::EFBIG`

  File too large

EHOSTDOWN = `LibC::EHOSTDOWN`

  Host is down

EHOSTUNREACH = `LibC::EHOSTUNREACH`

  No route to host

EIDRM = `LibC::EIDRM`

  Identifier removed

EILSEQ = `LibC::EILSEQ`

  Illegal byte sequence

EINPROGRESS = `LibC::EINPROGRESS`

  Operation now in progress

EINTR = `LibC::EINTR`

  Interrupted system call

EINVAL = `LibC::EINVAL`

  Invalid argument

EIO = `LibC::EIO`

  Input/output error

EISCONN = `LibC::EISCONN`

  Socket is already connected

EISDIR = `LibC::EISDIR`

  Is a directory

ELOOP = `LibC::ELOOP`

  Too many levels of symbolic links

EMFILE = `LibC::EMFILE`

  Too many open files

EMLINK = `LibC::EMLINK`

  Too many links

EMSGSIZE = `LibC::EMSGSIZE`

  Message too long

EMULTIHOP = `LibC::EMULTIHOP`

  Reserved

ENAMETOOLONG = `LibC::ENAMETOOLONG`

  File name too long

ENETDOWN = `LibC::ENETDOWN`

  Network is down

ENETRESET = `LibC::ENETRESET`

  Network dropped connection on reset

ENETUNREACH = `LibC::ENETUNREACH`

  Network is unreachable

ENFILE = `LibC::ENFILE`

  Too many open files in system

ENOBUFS = `LibC::ENOBUFS`

  No buffer space available

ENODATA = `LibC::ENODATA`

  No message available on STREAM

ENODEV = `LibC::ENODEV`

  Operation not supported by device

ENOENT = `LibC::ENOENT`

  No such file or directory

ENOEXEC = `LibC::ENOEXEC`

  Exec format error

ENOLCK = `LibC::ENOLCK`

  No locks available

ENOLINK = `LibC::ENOLINK`

  Reserved

ENOMEM = `LibC::ENOMEM`

  Cannot allocate memory

ENOMSG = `LibC::ENOMSG`

  No message of desired type

ENOPROTOOPT = `LibC::ENOPROTOOPT`

  Protocol not available

ENOSPC = `LibC::ENOSPC`

  No space left on device

ENOSR = `LibC::ENOSR`

  No STREAM resources

ENOSTR = `LibC::ENOSTR`

  Not a STREAM

ENOSYS = `LibC::ENOSYS`

  Function not implemented

ENOTBLK = `LibC::ENOTBLK`

  Block device required

ENOTCONN = `LibC::ENOTCONN`

  Socket is not connected

ENOTDIR = `LibC::ENOTDIR`

  Not a directory

ENOTEMPTY = `LibC::ENOTEMPTY`

  Directory not empty

ENOTRECOVERABLE = `LibC::ENOTRECOVERABLE`

  State not recoverable

ENOTSOCK = `LibC::ENOTSOCK`

  Socket operation on non-socket

ENOTTY = `LibC::ENOTTY`

  Inappropriate ioctl for device

ENXIO = `LibC::ENXIO`

  Device not configured

EOPNOTSUPP = `LibC::EOPNOTSUPP`

  Operation not supported on socket

EOVERFLOW = `LibC::EOVERFLOW`

  Value too large to be stored in data type

EOWNERDEAD = `LibC::EOWNERDEAD`

  Previous owner died

EPERM = `LibC::EPERM`

  Operation not permitted

EPFNOSUPPORT = `LibC::EPFNOSUPPORT`

  Protocol family not supported

EPIPE = `LibC::EPIPE`

  Broken pipe

EPROTO = `LibC::EPROTO`

  Protocol error

EPROTONOSUPPORT = `LibC::EPROTONOSUPPORT`

  Protocol not supported

EPROTOTYPE = `LibC::EPROTOTYPE`

  Protocol wrong type for socket

ERANGE = `LibC::ERANGE`

  Result too large

EREMOTE = `LibC::EREMOTE`

  Too many levels of remote in path

EROFS = `LibC::EROFS`

  Read-only file system

ESHUTDOWN = `LibC::ESHUTDOWN`

  Can't send after socket shutdown

ESOCKTNOSUPPORT = `LibC::ESOCKTNOSUPPORT`

  Socket type not supported

ESPIPE = `LibC::ESPIPE`

  Illegal seek

ESRCH = `LibC::ESRCH`

  No such process

ESTALE = `LibC::ESTALE`

  Stale NFS file handle

ETIME = `LibC::ETIME`

  STREAM ioctl timeout

ETIMEDOUT = `LibC::ETIMEDOUT`

  Operation timed out

ETOOMANYREFS = `LibC::ETOOMANYREFS`

  Too many references: can't splice

ETXTBSY = `LibC::ETXTBSY`

  Text file busy

EUSERS = `LibC::EUSERS`

  Too many users

EWOULDBLOCK = `LibC::EWOULDBLOCK`

  Operation would block

EXDEV = `LibC::EXDEV`

  Cross-device link

##
Constructors

- .new(message, errno = Errno.value)

  Creates a new `Errno` with the given message.

##
Class Method Summary

- .value : LibC::Int

  Returns the value of libc's errno.

- .value=(value)

  Sets the value of libc's errno.

##
Instance Method Summary

- #errno : Int32

  Returns the numeric value of errno.

- #errno_message : String

  Returns the message of errno.

### Instance methods inherited from class `Exception`

backtrace backtrace, backtrace? backtrace?, callstack : CallStack? callstack, callstack=(callstack : CallStack?) callstack=, cause : Exception? cause, inspect(io : IO) : Nil inspect, inspect_with_backtrace(io : IO) : Nil
inspect_with_backtrace : String inspect_with_backtrace, message : String? message, to_s(io : IO) : Nil to_s

### Constructor methods inherited from class `Exception`

new(message : String? = nil, cause : Exception? = nil) new

### Instance methods inherited from class `Reference`

==(other : self)
==(other : JSON::Any)
==(other : YAML::Any)
==(other) ==, dup dup, hash(hasher) hash, inspect(io : IO) : Nil inspect, object_id : UInt64 object_id, pretty_print(pp) : Nil pretty_print, same?(other : Reference)
same?(other : Nil) same?, to_s(io : IO) : Nil to_s

### Constructor methods inherited from class `Reference`

new new

### Instance methods inherited from class `Object`

!=(other) !=, !~(other) !~, ==(other) ==, ===(other : JSON::Any)
===(other : YAML::Any)
===(other) ===, =~(other) =~, __crystal_pseudo_! : Bool __crystal_pseudo_!, __crystal_pseudo_as(type : Class) __crystal_pseudo_as, __crystal_pseudo_as?(type : Class) __crystal_pseudo_as?, __crystal_pseudo_is_a?(type : Class) : Bool __crystal_pseudo_is_a?, __crystal_pseudo_nil? : Bool __crystal_pseudo_nil?, __crystal_pseudo_responds_to?(name : Symbol) : Bool __crystal_pseudo_responds_to?, class class, dup dup, hash(hasher)
hash hash, inspect : String
inspect(io : IO) : Nil inspect, itself itself, not_nil! not_nil!, pretty_inspect(width = 79, newline = "\n", indent = 0) : String pretty_inspect, pretty_print(pp : PrettyPrint) : Nil pretty_print, tap(&) tap, to_json(io : IO)
to_json to_json, to_pretty_json(indent : String = " ")
to_pretty_json(io : IO, indent : String = " ") to_pretty_json, to_s : String
to_s(io : IO) : Nil to_s, to_yaml(io : IO)
to_yaml to_yaml, try(&) try, unsafe_as(type : T.class) forall T unsafe_as

### Class methods inherited from class `Object`

from_json(string_or_io, root : String)
from_json(string_or_io) from_json, from_yaml(string_or_io : String | IO) from_yaml

##
Constructor Detail

def self.new(message, errno = Errno.value) #

Creates a new `Errno` with the given message. The message will have concatenated the errno message denoted by errno.

Typical usage:

    err = LibC.some_call
    if err == -1
      raise Errno.new("some_call")
    end

##
Class Method Detail

def self.value : LibC::Int #

Returns the value of libc's errno.

def self.value=(value) #

Sets the value of libc's errno.

##
Instance Method Detail

def errno : Int32 #

Returns the numeric value of errno.

def errno_message : String #

Returns the message of errno.