LWN.net Logo

File descriptor handling changes in 2.6.27

File descriptor handling changes in 2.6.27

Posted Aug 7, 2008 6:48 UTC (Thu) by njs (guest, #40338)
In reply to: File descriptor handling changes in 2.6.27 by quotemstr
Parent article: File descriptor handling changes in 2.6.27

So it sounds like you're arguing that close-on-exec should be the default -- and if backwards
compatibility forbids it *actually* being default, then we should write code in such a way
that it becomes the default.  I tend to agree.  The original argument that I was responding
to, though, was suggesting that it didn't much matter if close-on-exec were broken, which
seems like the opposite of your point...


(Log in to post comments)

File descriptor handling changes in 2.6.27

Posted Aug 15, 2008 17:27 UTC (Fri) by sethml (subscriber, #8471) [Link]

How about a call similar to closefrom(), but which takes a list of fds not to close, and
closes 
all fds but those in the list?  This avoids the brain-dead assumptions about fd ordering which

closefrom() makes, but makes it easy to leave just a select few fds open for the child.  As
the 
parent comment points out, any code which relies on leaving fds other than stdout/stdin/
stderr open for the child probably knows exactly which fds the child will need.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds