The Open Group Base Specifications Issue 6
IEEE Std 1003.1, 2004 Edition

2.3 Error Numbers

Most functions can provide an error number. The means by which each function provides its error numbers is specified in its description.

Some functions provide the error number in a variable accessed through the symbol errno. The symbol errno, defined by including the <errno.h> header, expands to a modifiable lvalue of type int. It is unspecified whether errno is a macro or an identifier declared with external linkage. If a macro definition is suppressed in order to access an actual object, or a program defines an identifier with the name errno, the behavior is undefined.

The value of errno should only be examined when it is indicated to be valid by a function's return value. No function in this volume of IEEE Std 1003.1-2001 shall set errno to zero. For each thread of a process, the value of errno shall not be affected by function calls or assignments to errno by other threads.

Some functions return an error number directly as the function value. These functions return a value of zero to indicate success.

If more than one error occurs in processing a function call, any one of the possible errors may be returned, as the order of detection is undefined.

Implementations may support additional errors not included in this list, may generate errors included in this list under circumstances other than those described here, or may contain extensions or limitations that prevent some errors from occurring. The ERRORS section on each reference page specifies whether an error shall be returned, or whether it may be returned. Implementations shall not generate a different error number from the ones described here for error conditions described in this volume of IEEE Std 1003.1-2001, but may generate additional errors unless explicitly disallowed for a particular function.

Each implementation shall document, in the conformance document, situations in which each of the optional conditions defined in IEEE Std 1003.1-2001 is detected. The conformance document may also contain statements that one or more of the optional error conditions are not detected.

For functions under the Threads option for which [EINTR] is not listed as a possible error condition in this volume of IEEE Std 1003.1-2001, an implementation shall not return an error code of [EINTR].

The following symbolic names identify the possible error numbers, in the context of the functions specifically defined in this volume of IEEE Std 1003.1-2001; these general descriptions are more precisely defined in the ERRORS sections of the functions that return them. Only these symbolic names should be used in programs, since the actual value of the error number is unspecified. All values listed in this section shall be unique integer constant expressions with type int suitable for use in #if preprocessing directives, except as noted below. The values for all these names shall be found in the <errno.h> header defined in the Base Definitions volume of IEEE Std 1003.1-2001. The actual values are unspecified by this volume of IEEE Std 1003.1-2001.

[E2BIG]
Argument list too long. The sum of the number of bytes used by the new process image's argument list and environment list is greater than the system-imposed limit of {ARG_MAX} bytes.

or:

Lack of space in an output buffer.

or:

Argument is greater than the system-imposed maximum.

[EACCES]
Permission denied. An attempt was made to access a file in a way forbidden by its file access permissions.
[EADDRINUSE]
Address in use. The specified address is in use.
[EADDRNOTAVAIL]
Address not available. The specified address is not available from the local system.
[EAFNOSUPPORT]
Address family not supported. The implementation does not support the specified address family, or the specified address is not a valid address for the address family of the specified socket.
[EAGAIN]
Resource temporarily unavailable. This is a temporary condition and later calls to the same routine may complete normally.
[EALREADY]
Connection already in progress. A connection request is already in progress for the specified socket.
[EBADF]
Bad file descriptor. A file descriptor argument is out of range, refers to no open file, or a read (write) request is made to a file that is only open for writing (reading).
[EBADMSG]
[XSR] [Option Start] Bad message. During a read(), getmsg(), getpmsg(), or ioctl() I_RECVFD request to a STREAMS device, a message arrived at the head of the STREAM that is inappropriate for the function receiving the message.
read()
Message waiting to be read on a STREAM is not a data message.
getmsg() or getpmsg()
A file descriptor was received instead of a control message.
ioctl()
Control or data information was received instead of a file descriptor when I_RECVFD was specified. [Option End]

or:

Bad Message. The implementation has detected a corrupted message.

[EBUSY]
Resource busy. An attempt was made to make use of a system resource that is not currently available, as it is being used by another process in a manner that would have conflicted with the request being made by this process.
[ECANCELED]
Operation canceled. The associated asynchronous operation was canceled before completion.
[ECHILD]
No child process. A wait() or waitpid() function was executed by a process that had no existing or unwaited-for child process.
[ECONNABORTED]
Connection aborted. The connection has been aborted.
[ECONNREFUSED]
Connection refused. An attempt to connect to a socket was refused because there was no process listening or because the queue of connection requests was full and the underlying protocol does not support retransmissions.
[ECONNRESET]
Connection reset. The connection was forcibly closed by the peer.
[EDEADLK]
Resource deadlock would occur. An attempt was made to lock a system resource that would have resulted in a deadlock situation.
[EDESTADDRREQ]
Destination address required. No bind address was established.
[EDOM]
Domain error. An input argument is outside the defined domain of the mathematical function (defined in the ISO C standard).
[EDQUOT]
Reserved.
[EEXIST]
File exists. An existing file was mentioned in an inappropriate context; for example, as a new link name in the link() function.
[EFAULT]
Bad address. The system detected an invalid address in attempting to use an argument of a call. The reliable detection of this error cannot be guaranteed, and when not detected may result in the generation of a signal, indicating an address violation, which is sent to the process.
[EFBIG]
File too large. The size of a file would exceed the maximum file size of an implementation or offset maximum established in the corresponding file description.
[EHOSTUNREACH]
Host is unreachable. The destination host cannot be reached (probably because the host is down or a remote router cannot reach it).
[EIDRM]
Identifier removed. Returned during XSI interprocess communication if an identifier has been removed from the system.
[EILSEQ]
Illegal byte sequence. A wide-character code has been detected that does not correspond to a valid character, or a byte sequence does not form a valid wide-character code (defined in the ISO C standard).
[EINPROGRESS]
Operation in progress. This code is used to indicate that an asynchronous operation has not yet completed.

or:

O_NONBLOCK is set for the socket file descriptor and the connection cannot be immediately established.

[EINTR]
Interrupted function call. An asynchronous signal was caught by the process during the execution of an interruptible function. If the signal handler performs a normal return, the interrupted function call may return this condition (see the Base Definitions volume of IEEE Std 1003.1-2001, <signal.h>).
[EINVAL]
Invalid argument. Some invalid argument was supplied; for example, specifying an undefined signal in a signal() function or a kill() function.
[EIO]
Input/output error. Some physical input or output error has occurred. This error may be reported on a subsequent operation on the same file descriptor. Any other error-causing operation on the same file descriptor may cause the [EIO] error indication to be lost.
[EISCONN]
Socket is connected. The specified socket is already connected.
[EISDIR]
Is a directory. An attempt was made to open a directory with write mode specified.
[ELOOP]
Symbolic link loop. A loop exists in symbolic links encountered during pathname resolution. This error may also be returned if more than {SYMLOOP_MAX} symbolic links are encountered during pathname resolution.
[EMFILE]
Too many open files. An attempt was made to open more than the maximum number of file descriptors allowed in this process.
[EMLINK]
Too many links. An attempt was made to have the link count of a single file exceed {LINK_MAX}.
[EMSGSIZE]
Message too large. A message sent on a transport provider was larger than an internal message buffer or some other network limit.

or:

Inappropriate message buffer length.

[EMULTIHOP]
Reserved.
[ENAMETOOLONG]
Filename too long. The length of a pathname exceeds {PATH_MAX}, or a pathname component is longer than {NAME_MAX}. This error may also occur when pathname substitution, as a result of encountering a symbolic link during pathname resolution, results in a pathname string the size of which exceeds {PATH_MAX}.
[ENETDOWN]
Network is down. The local network interface used to reach the destination is down.
[ENETRESET]
The connection was aborted by the network.
[ENETUNREACH]
Network unreachable. No route to the network is present.
[ENFILE]
Too many files open in system. Too many files are currently open in the system. The system has reached its predefined limit for simultaneously open files and temporarily cannot accept requests to open another one.
[ENOBUFS]
No buffer space available. Insufficient buffer resources were available in the system to perform the socket operation.
[ENODATA]
[XSR] [Option Start]
No message available. No message is available on the STREAM head read queue. [Option End]
[ENODEV]
No such device. An attempt was made to apply an inappropriate function to a device; for example, trying to read a write-only device such as a printer.
[ENOENT]
No such file or directory. A component of a specified pathname does not exist, or the pathname is an empty string.
[ENOEXEC]
Executable file format error. A request is made to execute a file that, although it has the appropriate permissions, is not in the format required by the implementation for executable files.
[ENOLCK]
No locks available. A system-imposed limit on the number of simultaneous file and record locks has been reached and no more are currently available.
[ENOLINK]
Reserved.
[ENOMEM]
Not enough space. The new process image requires more memory than is allowed by the hardware or system-imposed memory management constraints.
[ENOMSG]
No message of the desired type. The message queue does not contain a message of the required type during XSI interprocess communication.
[ENOPROTOOPT]
Protocol not available. The protocol option specified to setsockopt() is not supported by the implementation.
[ENOSPC]
No space left on a device. During the write() function on a regular file or when extending a directory, there is no free space left on the device.
[ENOSR]
[XSR] [Option Start]
No STREAM resources. Insufficient STREAMS memory resources are available to perform a STREAMS-related function. This is a temporary condition; it may be recovered from if other processes release resources. [Option End]
[ENOSTR]
[XSR] [Option Start]
Not a STREAM. A STREAM function was attempted on a file descriptor that was not associated with a STREAMS device. [Option End]
[ENOSYS]
Function not implemented. An attempt was made to use a function that is not available in this implementation.
[ENOTCONN]
Socket not connected. The socket is not connected.
[ENOTDIR]
Not a directory. A component of the specified pathname exists, but it is not a directory, when a directory was expected.
[ENOTEMPTY]
Directory not empty. A directory other than an empty directory was supplied when an empty directory was expected.
[ENOTSOCK]
Not a socket. The file descriptor does not refer to a socket.
[ENOTSUP]
Not supported. The implementation does not support this feature of the Realtime Option Group.
[ENOTTY]
Inappropriate I/O control operation. A control function has been attempted for a file or special file for which the operation is inappropriate.
[ENXIO]
No such device or address. Input or output on a special file refers to a device that does not exist, or makes a request beyond the capabilities of the device. It may also occur when, for example, a tape drive is not on-line.
[EOPNOTSUPP]
Operation not supported on socket. The type of socket (address family or protocol) does not support the requested operation.
[EOVERFLOW]
Value too large to be stored in data type. An operation was attempted which would generate a value that is outside the range of values that can be represented in the relevant data type or that are allowed for a given data item.
[EPERM]
Operation not permitted. An attempt was made to perform an operation limited to processes with appropriate privileges or to the owner of a file or other resource.
[EPIPE]
Broken pipe. A write was attempted on a socket, pipe, or FIFO for which there is no process to read the data.
[EPROTO]
Protocol error. Some protocol error occurred. This error is device-specific, but is generally not related to a hardware failure.
[EPROTONOSUPPORT]
Protocol not supported. The protocol is not supported by the address family, or the protocol is not supported by the implementation.
[EPROTOTYPE]
Protocol wrong type for socket. The socket type is not supported by the protocol.
[ERANGE]
Result too large or too small. The result of the function is too large (overflow) or too small (underflow) to be represented in the available space (defined in the ISO C standard).
[EROFS]
Read-only file system. An attempt was made to modify a file or directory on a file system that is read-only.
[ESPIPE]
Invalid seek. An attempt was made to access the file offset associated with a pipe or FIFO.
[ESRCH]
No such process. No process can be found corresponding to that specified by the given process ID.
[ESTALE]
Reserved.
[ETIME]
[XSR] [Option Start]
STREAM ioctl() timeout. The timer set for a STREAMS ioctl() call has expired. The cause of this error is device-specific and could indicate either a hardware or software failure, or a timeout value that is too short for the specific operation. The status of the ioctl() operation is unspecified. [Option End]
[ETIMEDOUT]
Connection timed out. The connection to a remote machine has timed out. If the connection timed out during execution of the function that reported this error (as opposed to timing out prior to the function being called), it is unspecified whether the function has completed some or all of the documented behavior associated with a successful completion of the function.

or:

Operation timed out. The time limit associated with the operation was exceeded before the operation completed.

[ETXTBSY]
Text file busy. An attempt was made to execute a pure-procedure program that is currently open for writing, or an attempt has been made to open for writing a pure-procedure program that is being executed.
[EWOULDBLOCK]
Operation would block. An operation on a socket marked as non-blocking has encountered a situation such as no data available that otherwise would have caused the function to suspend execution.

A conforming implementation may assign the same values for [EWOULDBLOCK] and [EAGAIN].

[EXDEV]
Improper link. A link to a file on another file system was attempted.

2.3.1 Additional Error Numbers

Additional implementation-defined error numbers may be defined in <errno.h>.


UNIX ® is a registered Trademark of The Open Group.
POSIX ® is a registered Trademark of The IEEE.
[ Main Index | XBD | XCU | XSH | XRAT ]