This is the mail archive of the 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: [RFC][BZ #14627] Make linux close errno to EINPROGRESS when interrupted in signal.

On Thu, Dec 05, 2013 at 08:58:02PM +0100, Christoph Hellwig wrote:
> On Thu, Dec 05, 2013 at 12:57:49PM -0500, Rich Felker wrote:
> > Note that, for the most part, close on Linux does not return EINTR.
> > The only way it can happen is with certain devices (for testing this
> > issue, I had someone helping me test it write a kernel module for a
> > fake device that always blocks in close and returns EINTR when
> > interrupted) and perhaps custom filesystems. So a change here will not
> > impact most applications.
> Returning EINTR in Linux is incredibly hard.  While the normal ->release
> method that is called on drop of the final reference to a file does return
> an error, it is explicitly ignored.
> A filesystem or character device driver would have to implement the
> special ->flush method that is called on every close method to be able
> to return an error, and returning EINTR from that is discouraged.  I
> wouldn't mind adding a check to enforce that either.

If EINTR from close essentially doesn't show up in the wild on Linux,
I think the proposed change in glibc to replace it with EINPROGRESS
would essentially be just a safety against (dangerous!) double-close
bugs in correct POSIX applications due to strange devices slipping an
EINTR through. I'm still strongly in favor of adding it (or a
replacement with 0/success).


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