luaposix 36.2.1 Reference

# Module `posix.errno`

System error codes and messages.

Usually, you'll be able to work with the error messages returned as the second value from failed calls directly, without having to manually save and stringify the system messages as you would in C. For completeness, the functions are still available here.

## Functions

errno ([n=current errno]) | Describe an error code/and or read `errno`
set_errno (n) | Set errno.

## Constants

posix.errno | Error constants.

## Functions

errno ([n=current errno])
  Describe an error code/and or read `errno`

  ### Parameters:

  - n int optional error code (default current errno)

  ### Returns:

  1. description
  2. error code

  ### See also:

  - strerror(3)

  ### Usage:

      local strerr, nerr = posix.errno ()

set_errno (n)
  Set errno.

  ### Parameters:

  - n int error code

  ### See also:

  errno(3)

  ### Usage:

      posix.errno (posix.EBADF)

## Constants

posix.errno
  Error constants. Any constants not available in the underlying system will be `nil` valued.

  If you find one of the luaposix APIs returns an error code not listed here, please raise an issue here, stating the symbolic name of the constant (from `/usr/include/errno.h` or equivalent).

  ### Fields:

  - E2BIG int argument list too long
  - EACCES int permission denied
  - EADDRINUSE int address already in use
  - EADDRNOTAVAIL int can't assign requested address
  - EAFNOSUPPORT int address family not supported by protocol family
  - EAGAIN int resource temporarily unavailable
  - EALREADY int operation already in progress
  - EBADF int bad file descriptor
  - EBADMSG int bad message
  - EBUSY int resource busy
  - ECANCELED int operation canceled
  - ECHILD int no child processes
  - ECONNABORTED int software caused connection abort
  - ECONNREFUSED int connection refused
  - ECONNRESET int connection reset by peer
  - EDEADLK int resource deadlock avoided
  - EDESTADDRREQ int destination address required
  - EDOM int numerical argument out of domain
  - EEXIST int file exists
  - EFAULT int bad address
  - EFBIG int file too large
  - EHOSTUNREACH int no route to host
  - EIDRM int identifier removed
  - EILSEQ int illegal byte sequence
  - EINPROGRESS int operation now in progress
  - EINTR int interrupted system call
  - EINVAL int invalid argument
  - EIO int input/output error
  - EISCONN int socket is already connected
  - EISDIR int is a directory
  - ELOOP int too many levels of symbolic links
  - EMFILE int too many open files
  - EMLINK int too many links
  - EMSGSIZE int message too long
  - ENAMETOOLONG int file name too long
  - ENETDOWN int network is down
  - ENETRESET int network dropped connection on reset
  - ENETUNREACH int network is unreachable
  - ENFILE int too many open files in system
  - ENOBUFS int no buffer space available
  - ENODEV int operation not supported by device
  - ENOENT int no such file or directory
  - ENOEXEC int exec format error
  - ENOLCK int no locks available
  - ENOMEM int cannot allocate memory
  - ENOMSG int no message of desired type
  - ENOPROTOOPT int protocol not available
  - ENOSPC int no space left on device
  - ENOSYS int function not implemented
  - ENOTCONN int socket is not connected
  - ENOTDIR int not a directory
  - ENOTEMPTY int directory not empty
  - ENOTSOCK int socket operation on non-socket
  - ENOTSUP int operation not supported
  - ENOTTY int inappropriate ioctl for device
  - ENXIO int device not configured
  - EOPNOTSUPP int operation not supported on socket
  - EOVERFLOW int value too large to be stored in data type
  - EPERM int operation not permitted
  - EPIPE int broken pipe
  - EPROTO int protocol error
  - EPROTONOSUPPORT int protocol not supported
  - EPROTOTYPE int protocol wrong type for socket
  - ERANGE int result too large
  - EROFS int read-only file system
  - ESPIPE int illegal seek
  - ESRCH int no such process
  - ETIMEDOUT int operation timed out
  - ETXTBSY int text file busy
  - EWOULDBLOCK int operation would block
  - EXDEV int cross-device link

  ### Usage:

      -- Print errno constants supported on this host.
      for name, value in pairs (require "posix.errno") do
        if type (value) == "number" then
          print (name, value)
        end
      end

generated by LDoc 1.5.0 Last updated 2023-06-16 20:19:12