What does errno 4 (EINTR) in Any mean?

 
Could be also:
ConstantTypeOS
ERROR_TOO_MANY_OPEN_FILESWin32 errorWindows
KERN_INVALID_ARGUMENTKern returnMac
ippStsInvZeroIntel Ipp StatusAny
INVALID_DATA_ACCESS_TRAPBugCheck CodeWindows
Previous Next
ESRCH EIO

EINTR

Meaning and context of EINTR

If a signal handler runs while a system call or library function is blocked, one of two things happens:

  • The call is automatically restarted after the signal handler returns.
  • The call fails with EINTR.

Which behavior occurs depends on the interface and on whether the signal handler was installed with SA_RESTART. Details vary across UNIX systems; the examples below describe Linux behavior.

For the following Linux interfaces, a blocked call is generally restarted after the signal handler returns when SA_RESTART applies; otherwise it can fail with EINTR:

  • read(2), readv(2), write(2), writev(2), and ioctl(2) on “slow” devices such as terminals, pipes, or sockets. If some data was transferred before interruption, the call normally returns the transferred byte count instead. Local disk I/O is not considered slow in this sense.
  • open(2) when the open can block, for example when opening a FIFO.
  • wait(2), wait3(2), wait4(2), waitid(2), and waitpid(2).
  • Socket calls including accept(2), connect(2), recv(2), recvfrom(2), recvmmsg(2), recvmsg(2), send(2), sendto(2), and sendmsg(2), subject to timeout-specific behavior.
  • File-locking calls such as flock(2) and the F_SETLKW/F_OFD_SETLKW operations of fcntl(2).
  • POSIX message-queue calls including mq_receive(3), mq_timedreceive(3), mq_send(3), and mq_timedsend(3).
  • futex(2) waits, including FUTEX_WAIT and FUTEX_WAIT_BITSET.
  • getrandom(2).
  • POSIX synchronization calls such as pthread_mutex_lock(3), pthread_cond_wait(3), sem_wait(3), and sem_timedwait(3), according to the platform and interface contract.
  • Reads from an inotify(7) file descriptor on supported Linux versions.

Solaris behavior

EINTR is errno value 4 in the current AllStat Solaris data, with the recorded meaning “Interrupted system call”. Save errno immediately after the failed function because logging, allocation, cleanup, or another library call can overwrite the thread-local value.

Call-specific evidence

  • Record the exact system or library call, return value, descriptor or pathname, open flags, process credentials, resource controls, and whether the descriptor was nonblocking.
  • Use the Solaris manual page for the failing call to determine which argument or kernel state can produce EINTR; the portable errno name alone is not enough.
  • For retryable interruptions, follow the API's documented restart or retry rules instead of spinning. For invalid state or permissions encountered around the same operation, correct that separate condition first.

When comparing this errno across operating systems, keep the symbolic name and numeric value separately. Solaris and other UNIX implementations can assign different numbers or apply different restart rules under the same broad POSIX category.

Official references


Looking for a different code? Search another status or error code.