On Sat, 09 Mar 2013 14:24:49 -0500, Lars T. Kyllingstad
<pub...@kyllingen.net> wrote:
My guess is that select() uses more or less the same mechanism as
close() for checking FD validity, and thus would gain us nothing.
Yeah, I was hoping select would flag each "non-valid" file descriptor in
fd_errors, and do it all in an internal loop in the kernel instead of
going back and forth between user space and kernel space.
But I don't think it does that. It just errors the whole function on the
first invalid descriptor it sees.
Go with your workaround, sounds reasonable. I agree that 100us pales in
comparison to launching a program. Perhaps an option to disable this
behavior should be available in Config. It certainly is possible with the
F_CLOEXEC flag to manually do what needs to be done.
-Steve