[PATCH] prevent retries on fclose/fflush after write errors

Johannes Stezenbach js at sig21.net
Wed Mar 14 13:26:06 UTC 2012


On Tue, Mar 13, 2012 at 10:58:33AM -0400, Rich Felker wrote:
> On Tue, Mar 13, 2012 at 10:30:10AM +0100, Laurent Bercot wrote:
> 
> >  Why not simply let the user set SA_RESTART in the sigaction() call?
> > see http://www.skarnet.org/software/skalibs/libstddjb/safewrappers.html
> 
> I know of no modern system where this kind of bogus EINTR happens
> (SIGSTOP, etc.). Even the proprietary unices fixed it before Linux
> did, but they've all been fixed for a long time now. I agree the
> standard should be more explicit on this; failure to be explicit, if
> you interpret it literally, makes interrupting signals unusable since
> you have to wrap all your syscalls with loops and make them behave as
> if the signal was a restarting one..

FWIW, Michael Kerrisk's book "The Linux Programming Interface"
lists a number of syscalls which can return EINTR after resume
from SIGSTOP.  Normal read() is not one of them, but e.g. read() from
inotify fd is.  I would also expect that some character devices
do not implement restarting for read() and write(), if just
because ERESTARTSYS etc. are not sufficiently documented.

Also, the system calls for which SA_RESTART is effective seems
to change over time, e.g. before 2.6.22 futex(),
sem_wait and sem_timedwait() did not observe SA_RESTART.
(There's about a page listing various syscall's behaviour
with SA_RESTART in TLPI book.)


Johannes


More information about the uClibc mailing list