This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Manual should discourage mixing TEMP_FAILURE_RETRY and close


On Tue, Dec 06, 2016 at 05:42:57PM -0500, Zack Weinberg wrote:
> On 12/06/2016 10:51 AM, Rich Felker wrote:
> >> Also, I took a look at the illumos code base, which presumably does
> >> not differ greatly from historical Solaris on this point. It looks to
> >> me (closef(), closeandsetf()) that also on that system there are paths
> >> in close() where errors are returned but the FD is nevertheless
> >> closed. So it really does seem that POSIX.1 was specifying (and plans
> >> to again specify) behavior that is inconsistent with actual
> >> implementations.
> > 
> > I think you're assuming POSIX is imposing something opposite of what
> > it's doing. The new text has filedes left open _only_ in the case of
> > EINTR. For all other errors it's closed and available for reassignment
> > on subsequent open, etc.
> 
> But that's still wrong!  `fildes` MUST be closed even when EINTR is
> returned.  That's what all existing implementations do (if I understood
> Michael correctly),

It's not. It's what some (roughly half?) of implementations do, and
it's inconsistent with the meaning of EINTR. Read the whole thread, as
this has already been discussed in-depth; repeating it for latecomers
is not useful.

In any case, the practical path forward that avoids the issue entirely
is never generating EINTR at all, so that applications don't have to
deal with it. See https://sourceware.org/bugzilla/show_bug.cgi?id=14627

Rich


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]