Seth Woolley's Man Viewer

errno(3) - errno, errno - number of last error - man 3 errno

([section] manual, -k keyword, -K [section] search, -f whatis)
man plain no title

ERRNO(3)                       Library functions                      ERRNO(3)



NAME
       errno - number of last error(8,n)

SYNOPSIS
       #include <errno.h>

       extern int errno;

DESCRIPTION
       The  integer  errno is set(7,n,1 builtins) by system calls (and some library functions)
       to indicate what went wrong.  Its value is significant  only  when  the
       call  returned  an error(8,n) (usually -1), and a library function that does
       succeed is allowed to change errno.

       Sometimes, when -1 is also a legal return value one has to  zero  errno
       before the call in(1,8) order to detect possible errors.

       errno  is  defined  by  the ISO C standard to be a modifiable lvalue of
       type int, and must not be explicitly declared; errno may  be  a  macro.
       errno  is  thread-local;  setting  it in(1,8) one thread does not affect its
       value in(1,8) any other thread.

       Valid error(8,n) numbers are all non-zero; errno is never set(7,n,1 builtins) to zero by any
       library  function.   All the error(8,n) names specified by POSIX.1 must have
       distinct values.

       POSIX.1 (2001 edition) lists the following symbolic  error(8,n)  names.   Of
       these,  EDOM  and  ERANGE are in(1,8) the ISO C standard.  ISO C Amendment 1
       defines the additional error(8,n) number EILSEQ for coding errors in(1,8)  multi-
       byte or wide characters.


       E2BIG  Arg list too long

       EACCES Permission denied

       EADDRINUSE
              Address in(1,8) use

       EADDRNOTAVAIL
              Address not available

       EAFNOSUPPORT
              Address family not supported

       EAGAIN Resource temporarily unavailable

       EALREADY
              Connection already in(1,8) progress

       EBADF  Bad file(1,n) descriptor

       EBADMSG
              Bad message

       EBUSY  Resource busy

       ECANCELED
              Operation canceled

       ECHILD No child processes

       ECONNABORTED
              Connection aborted

       ECONNREFUSED
              Connection refused

       ECONNRESET
              Connection reset(1,7,1 tput)

       EDEADLK
              Resource deadlock avoided

       EDESTADDRREQ
              Destination address required

       EDOM   Domain error(8,n)

       EDQUOT Reserved

       EEXIST File exists

       EFAULT Bad address

       EFBIG  File too large

       EHOSTUNREACH
              Host is unreachable

       EIDRM  Identifier removed

       EILSEQ Illegal byte sequence

       EINPROGRESS
              Operation in(1,8) progress

       EINTR  Interrupted function call

       EINVAL Invalid argument

       EIO    Input/output error(8,n)

       EISCONN
              Socket is connected

       EISDIR Is a directory

       ELOOP  Too many levels of symbolic links

       EMFILE Too many open(2,3,n) files

       EMLINK Too many links

       EMSGSIZE
              Inappropriate message buffer length

       EMULTIHOP
              Reserved

       ENAMETOOLONG
              Filename too long

       ENETDOWN
              Network is down

       ENETRESET
              Connection aborted by network

       ENETUNREACH
              Network unreachable

       ENFILE Too many open(2,3,n) files in(1,8) system

       ENOBUFS
              No buffer space available

       ENODATA
              No message is available on the STREAM head read(2,n,1 builtins) queue(1,3)

       ENODEV No such device

       ENOENT No such file(1,n) or directory

       ENOEXEC
              Exec format error(8,n)

       ENOLCK No locks available

       ENOLINK
              Reserved

       ENOMEM Not enough space

       ENOMSG No message of the desired type

       ENOPROTOOPT
              Protocol not available

       ENOSPC No space left on device

       ENOSR  No STREAM resources

       ENOSTR Not a STREAM

       ENOSYS Function not implemented

       ENOTCONN
              The socket(2,7,n) is not connected

       ENOTDIR
              Not a directory

       ENOTEMPTY
              Directory not empty

       ENOTSOCK
              Not a socket(2,7,n)

       ENOTSUP
              Not supported

       ENOTTY Inappropriate I/O control operation

       ENXIO  No such device or address

       EOPNOTSUPP
              Operation not supported on socket(2,7,n)

       EOVERFLOW
              Value too large to be stored in(1,8) data type

       EPERM  Operation not permitted

       EPIPE  Broken pipe(2,8)

       EPROTO Protocol error(8,n)

       EPROTONOSUPPORT
              Protocol not supported

       EPROTOTYPE
              Protocol wrong type for socket(2,7,n)

       ERANGE Result too large

       EROFS  Read-only file(1,n) system

       ESPIPE Invalid seek

       ESRCH  No such process

       ESTALE Reserved

       ETIME  STREAM ioctl() timeout(1,3x,3x cbreak)

       ETIMEDOUT
              Operation timed out

       ETXTBSY
              Test file(1,n) busy

       EWOULDBLOCK
              Operation would block (may be same value as EAGAIN)

       EXDEV  Improper link(1,2)

NOTE
       A common mistake is to do

              if(3,n) (somecall() == -1) {
                  printf(1,3,1 builtins)("somecall() failed\n");
                  if(3,n) (errno == ...) { ... }
              }

       where  errno  no longer needs to have the value it had upon return from
       somecall().  If the value of errno should be preserved across a library
       call, it must be saved:

              if(3,n) (somecall() == -1) {
                  int errsv = errno;
                  printf(1,3,1 builtins)("somecall() failed\n");
                  if(3,n) (errsv == ...) { ... }
              }


SEE ALSO
       perror(1,3)(3), strerror(3)



                                  2002-10-05                          ERRNO(3)

References for this manual (incoming links)