The error code macros are defined in the header file `errno.h'. All of them expand into integer constant values. Some of these error codes can't occur on the GNU system, but they can occur using the GNU library on other systems.
You can choose to have functions resume after a signal that is handled, rather than failing with EINTR
; see Interrupted Primitives.
exec
functions (see Executing a File) occupy too much memory space. This condition never arises in the GNU system.
exec
functions; see Executing a File.
link
(see Hard Links) but also when you rename a file with rename
(see Renaming Files).
In BSD and GNU, the number of open files is controlled by a resource limit that can usually be increased. If you get this error, you might want to increase the RLIMIT_NOFILE
limit or make it unlimited; see Limits on Resources.
rename
can cause this error if the file being renamed already has as many links as it can take (see Renaming Files).
SIGPIPE
signal; this signal terminates the program if not handled or blocked. Thus, your program will never actually see EPIPE
unless it has handled or blocked SIGPIPE
.
EWOULDBLOCK
is another name for EAGAIN
; they are always the same in the GNU C library. This error can happen in a few different situations:
An operation that would block was attempted on an object that has non-blocking mode selected. Trying the same operation again will block until some external condition makes it possible to read, write, or connect (whatever the operation). You can use select
to find out when the operation will be possible; see Waiting for I/O.
Portability Note: In older Unix many systems, this condition was indicated by EWOULDBLOCK
, which was a distinct error code different from EAGAIN
. To make your program portable, you should check for both codes and treat them the same.
A temporary resource shortage made an operation impossible. fork
can return this error. It indicates that the shortage is expected to pass, so your program can try the call again later and it may succeed. It is probably a good idea to delay for a few seconds before trying it again, to allow time for other processes to release scarce resources. Such shortages are usually fairly serious and affect the whole system, so usually an interactive program should report the error to the user and return to its command loop.
EAGAIN
(above). The values are always the same, on every operating system.
C libraries in many older Unix systems have EWOULDBLOCK
as a separate error code.
connect
; see Connecting) never return EAGAIN
. Instead, they return EINPROGRESS
to indicate that the operation has begun and will take some time. Attempts to manipulate the object before the call completes return EALREADY
.
ENOMEM
; you may get one or the other from network operations.
EDESTADDRREQ
instead.
connect
.
PATH_MAX
; see Limits for Files) or host name too long (in gethostname
or sethostname
; see Host Identification).
On some systems chmod
returns this error if you try to set the sticky bit on a non-directory file; see Setting Permissions.
term
protocol return this error for certain operations when the caller is not in the foreground process group of the terminal. Users do not usually see this error because functions such as read
and write
translate it into a SIGTTIN
or SIGTTOU
signal. See Job Control, for information on process groups and these signals.