bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Retrying close() after error on Linux !?


From: Eric Blake
Subject: Re: Retrying close() after error on Linux !?
Date: Wed, 14 Mar 2018 12:36:36 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

On 03/14/2018 12:30 PM, Eric Blake wrote:
On 03/14/2018 12:09 PM, Bruno Haible wrote:

Here's what POSIX has to say:
http://austingroupbugs.net/view.php?id=529#c1200

Glad to see that this has been addressed in POSIX.



I think we'll need to fall back to a #if based on platforms.

If I'm reading the POSIX bug correctly, HPUX is the only system where fds are left open on EINTR.  Seems like a reasonable enough #if when coupled with good comments pointing back to the POSIX discussion.

One other possible alternative: instead of calling close(fd) on a random unknown fd, and worrying about the non-portability of EINTR behavior when that fd is something that takes a long time to close, you could use dup2()'s semantics to replace the original fd with something known to be safe to close (for example, closing an fd open on /dev/null doesn't have the risk of EINTR like you would have with closing an fd open on a pty or tape device).

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]