Hi Eric,

> >> 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.

Early Solaris is definitely in this camp as well.

> > 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).

This is an interesting, creative idea. However, because few people use this
'dup2 as a kind of atomic close' workaround, I fear that it might lead us
into the proximity of OS bugs. Hardly anyone has tested how dup2 works
in the presence of signals and ttys, in the past.

Bruno


Reply via email to