System error codes

This topic provides a complete list of errors and their names as defined in <errno.h>. Because the Interix subsystem does not necessarily use the same error numbers used in traditional systems, you should always use the symbolic names defined in <errno.h>

Almost all of the system calls can return an error number in the external variable errno, which is defined in <errno.h>. When a system call detects an error, it returns an integer value indicating failure (usually -1) and sets the variable errno accordingly. Successful calls never set errno. Once set, errno remains until another error occurs. It should only be examined after an error.

When a system call returns -1, the calling function can interpret the failure and take action accordingly. Since a number of system calls overload the meanings of these error numbers, the meanings must be interpreted according to the type and circumstances of the call.

According to POSIX, a system can return error codes other than those listed here; a conforming application should be prepared to deal with other unknown error codes.

The following list is sorted in alphabetical order by symbolic name:

Error Description
[E2BIG] Arg list too long. The number of bytes used for the argument and environment list of the new process exceeded the current limit of {ARG_MAX} in <limits.h>.
[EACCES] Permission denied. An attempt was made to access a file in a way forbidden by its file-access permissions.
[EADDRINUSE] Address already in use. Normally, each address can only be used once.
[EADDRNOTAVAIL] Address cannot be assigned. Normally results from an attempt to create a socket with an address not on this computer.
[EAFNOSUPPORT] Address family not supported by protocol family. The address was incompatible with the requested protocol.
[EAGAIN] | [EWOULDBLOCK] Resource temporarily unavailable. This is a temporary condition; later calls to the same routine might complete normally.
[EALREADY] Operation already in progress. An operation was attempted on a non-blocking object that already had an operation in progress.
[EBADF] Bad file descriptor. A file-descriptor argument was out of range, referred to no open file, or a read (write) request was made to a file that was only open for writing (reading).
[EBUSY] Resource busy. An attempt to use a system resource that was in use at the time and in a manner that would have conflicted with the request.
[ECHILD] No child processes. A wait() or waitpid() function was executed by a process that had no existing or unwaited-for child processes.
[ECONNABORTED] Software caused connection abort. A connection abort was caused internal to your host computer.
[ECONNREFUSED] Connection refused. No connection could be made because the target computer actively refused it. This usually results from trying to connect to a service that is inactive on the foreign host.
[ECONNRESET] Connection reset by peer. A connection was forcibly closed by a peer. This normally results from a loss of the connection on the remote socket due to a time-out or a reboot.
[EDEADLK] | [EDEADLOCK] Resource deadlock avoided. An attempt was made to lock a system resource that would have resulted in a deadlock situation.
[EDESTADDRREQ] Destination address required. An operation on a socket requires a destination address.
[EDOM] Numerical argument out of domain. A numerical input argument was outside the defined domain of the mathematical function.
[EDQUOT] Disk quota exceeded. Because the user’s quota of disk space was exhausted, one of the following failed: a write operation to an ordinary file, the creation of a directory, or the creation of a directory entry.
[EEXIST] File exists. An existing file was mentioned in an inappropriate context, for instance, as the new link name in a link() function.
[EFAULT] Bad address. The system detected an invalid address when attempting to use an argument of a call.
[EFBIG] File too large. The size of a file exceeded the maximum size, defined for Windows NT and Windows 2000 as 232–1 bytes.
[EFTYPE] Inappropriate file type or format. An operation was attempted on a file whose type or format would not support it.
[EHOSTDOWN] Host is down. A socket operation failed because the destination host was down.
[EHOSTNOTFOUND] Host could not be found. A socket operation was attempted to a host that could not be located.
[EHOSTUNREACH] No route to host. A socket operation was attempted to an unreachable host.
[EIDRM] IPC object has been deleted. The interprocess communication (IPC) identifier passed to an IPC call is invalid because it has been or is being deleted. This is most common with shared memory segments that have been marked for deletion but which have not yet been detached from all processes; the error occurs when the IPC identifier is used to try to attach. The timing window for the same error is much smaller with message queues and semaphore sets, so the error is much less likely to occur.
[EILSEQ] Invalid multi-byte character. The call contained an multi-byte character that was invalid in the current locale.
[EINPROGRESS] Operation now in progress. An operation that takes a long time to complete, such as a connect(), was attempted on a non-blocking object.
[EINTR] Interrupted function call. An asynchronous signal, such as SIGINT, was caught by the process during the execution of an interruptible function. If the signal handler performs a normal return, the interrupted function call will seem to have returned the error condition.
[EINVAL] Invalid argument. An invalid argument was supplied. For example, specifying an undefined signal to a signal() or kill() function.
[EIO] Input/output error. Some physical input or output error occurred. This error will not be reported until a subsequent operation on the same file descriptor and might be lost (overwritten) by any subsequent errors.
[EISCONN] Socket is already connected. A connect request was made on an already connected socket, or a sendto or sendmsg request on a connected socket specified a destination when already connected.
[EISDIR] Is a directory. An attempt was made to open a directory with write mode specified.
[ELOOP] Too many levels of symbolic links. A path name lookup involved more than eight levels of symbolic links. This number is defined as MAXSYMLINKS in <limits.h>.
[EMFILE] Too many open files. The number of files open exceeds {OPEN_MAX}.
[EMLINK] Too many links. The maximum allowable hard links to a single file has been exceeded. The limit depends upon the file system; a POSIX-conformant file system supports at least eight. You can check the maximum number of links allowed on the system with the command getconf LINK_MAX.
[EMSGSIZE] Message too long. The message sent on a socket was too long for an internal buffer or another limit.
[ENAMETOOLONG] File name too long. File name exceeded {PATH_MAX} or a component of a file name exceeded {NAME_MAX}. For truly portable software, it might not be safe to rely on hard-coded values of {NAME_MAX} and {PATH_MAX}. On a networked system, the values can change, depending on the file system. A safer way to check for the values on the current file system is to use pathconf() or fpathconf() before constructing a file name.
[ENETDOWN] Network is down. A socket operation encountered a dead network.
[ENETRESET] Network dropped connection on reset. The host you were connected to failed and rebooted.
[ENETUNREACH] Network is unreachable. A socket operation was attempted to an unreachable network.
[ENFILE] Too many open files in system. Maximum number of file descriptors allowable on the system has been reached. A request for an open cannot be satisfied until at least one has been closed.
[ENOBUFS] No buffer space available. An operation on a socket or pipe was not performed because the system lacked sufficient buffer space or because a queue was full.
[ENODATA] No message available. No data message was available.
[ENODEV] Operation not supported by device. An attempt was made to apply an inappropriate function to a device. For example, an attempt was made to read from a write-only device, such as a printer.
[ENOENT] No such file or directory. A component of a specified path name did not exist, or the path name was an empty string.
[ENOEXEC] Exec format error. A request was made to execute a file that, although it has the appropriate permissions, was not in the format required for an executable file.
[ENOLCK] No locks available. No locks were available.
[ENOMEM] Cannot allocate memory. The new process image required more memory than was allowed by the hardware or by system-imposed memory management constraints.
[ENOMSG] No message of the desired type. An IPC message queue error. The msgget() call was invoked in non-blocking mode and there were no messages in the queue.
[ENOPROTOOPT] Protocol not available. A bad option or level was specified for getsockopt() or setsockopt().
[ENOSPC] Device out of space. A write() operation to an ordinary file, the creation of a directory, or the creation of a directory entry failed because no more disk blocks were available on the file system. It can also mean that the allocation of a file serial number for a newly created file failed because no more numbers were available on the file system.
[ENOSYS] Function not implemented. Attempted a system call that was not available on this system.
[ENOTBLK] Not a block device. A block device operation was attempted on a non-block device or file.
[ENOTCONN] Socket is not connected. An request to send or receive data was disallowed because the socket was not connected and (when sending on a datagram socket) no address was supplied.
[ENOTDIR] Not a directory. A component of the specified path name existed but was not a directory when a directory was expected.
[ENOTEMPTY] Directory not empty. An operation, such as an unlink, was attempted on a directory that was not empty.
[ENOTSOCK] Not a socket. A socket function was attempted on a descriptor that was not a socket.
[ENOTTY] Inappropriate I/O control operation for device. A control function was attempted for a file or special device for which the operation was inappropriate.
[ENXIO] No such device or address. Input or output on a special file referred to a device that did not exist, or made a request beyond the limits of the device. This error can also occur when, for example, a tape is not online or no disk is loaded in a drive.
[EOPNOTSUPP] Operation not supported on socket. The type of socket (either address family or protocol) does not support the operation.
[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 resources.
[EPFNOSUPPORT] Protocol family not supported. The protocol family has not been configured, or no implementation for it exists.
[EPIPE] Broken pipe. A write operation on a socket, pipe, or first-in-first-out (FIFO) for which there is no process to read the data.
[EPROCLIM] Too many processes. The operation would cause the system to exceed the limit on the number of processes.
[EPROTONOSUPPORT] Protocol not supported. The system does not support the specified protocol.
[EPROTOTYPE] Protocol wrong for socket. The requested protocol does not support the semantics of the socket.
[ERANGE] Numerical result out of range. A numerical result of the function was too large to fit in the available space (perhaps exceeded precision).
[EROFS] Read-only file system. An attempt was made to modify a file or directory on a file system that was read-only at the time.
[ESHUTDOWN] Cannot send after socket shutdown. A request to send data was disallowed because the socket had already been shut down.
[ESOCKTNOSUPPORT] Socket type not supported. The system does not support the specified socket type.
[ESPIPE] Illegal seek. An lseek() function was issued on a socket, pipe, or FIFO.
[ESRCH] No such process. No process could be found corresponding to that specified by the given process identifier (PID).
[ETIMEDOUT] Operation timed out. A connect or send request failed because the connected party did not properly respond after a period of time. The time-out period is dependent on the communication protocol.
[ETOOMANYREFS] Too many references. Because there were too many references, the system could not splice (System V).
[ETXTBUSY]|[ETXTBSY] Unknown error. In the Interix subsystem, this is an unknown error. Traditionally, it means that an attempt was made to execute a pure-procedure program that is currently open for writing, or an attempt was made to open for writing a pure-procedure program while it was being executed.
[EUSERS] Too many users. Traditionally, this means that the quota system ran out of table entries. Because Winsock does not produce this error, and the Interix socket implementation is based on Winsock, this error is unlikely to appear.
[EWINPATH] Can’t map pathname to Windows namespace. The current working directory cannot be translated to a Windows path name, and the value of the current working directory was required to complete the translation.
[EXDEV] Improper link. A hard link to a file on another file system was attempted.