LWN.net Logo

File descriptor handling changes in 2.6.27

File descriptor handling changes in 2.6.27

Posted Mar 2, 2011 19:22 UTC (Wed) by gps (subscriber, #45638)
In reply to: File descriptor handling changes in 2.6.27 by jlokier
Parent article: File descriptor handling changes in 2.6.27

But you can't do that... When a program has fork()ed but has not yet called exec() the only system calls it can make are async-signal-safe system calls. opendir() and readdir() are not on that list. Linux is left with no way to close all open file descriptors other than calling close() on all _possible_ file descriptors (a real slow pain in the ass when your max fd limit is in the millions) in between the fork() and exec() to deal with ones that may not have been opened with CLOEXEC.

See
http://www.opengroup.org/onlinepubs/009695399/functions/f... and http://www.opengroup.org/onlinepubs/009695399/functions/x...


(Log in to post comments)

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