Red Hat Bugzilla – Bug 58824
write(2) can block despite fd being non-blocking
Last modified: 2008-08-01 12:22:52 EDT
Description of problem:
If there is a blocking write to a tty or pipe that is pending completion, then
*all* writes to the same tty or pipe will block. This is true even for fds that
are supposed to be non-blocking!
For pipes and ttys on 2.2 kernels: Always
For ttys on 2.4 and 2.5 kernels: Always
Steps to Reproduce:
Run the test programs from the above URL
The above URL contains a patch to fix this issue for 2.2 and 2.4 kernels. The
2.4 patch applies cleanly and works on 2.5.
Patch looks fine except that the return value might need to be
-EWOULDBLOCK; I'll go hunt the appropriate standards...
SUSv2 only lists EAGAIN for write(); network operations (send(2) etc) may
return either EAGAIN or EWOULDBLOCK.
SUSv2 also states that EWOULDBLOCK may be the same value as EAGAIN, and this is
the case under Linux for all architectures except PA-RISC, where you will find
the following comment in errno.h:
#define EWOULDBLOCK 246 /* Operation would block (Linux returns EAGAIN)
The tty one is fixed in 2.4.18-ac and pushed on to Marcelo
Thanks for the bug report. However, Red Hat no longer maintains this version of
the product. Please upgrade to the latest version and open a new bug if the problem
The Fedora Legacy project (http://fedoralegacy.org/) maintains some older releases,
and if you believe this bug is interesting to them, please report the problem in
the bug tracker at: http://bugzilla.fedora.us/