Re: Apache2::SubProcess sucks

Scott Gifford <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
2010/2/20 Torsten Förtsch <[email protected]>
[ ... ]

> - is there a portable way to get all open file descriptors of the current
> process? Under Linux one can readdir(/proc/self/fd). On Darwin I once
> simply
> closed all fds from 0 to 1000. Some systems have getdtablesize(2),
> sometimes
> it is getrlimit. Sometimes you can open /dev/something or
> /proc/self/something
> and read the descriptor table at a certain offset. What the module should
> do
> on Windows I simply don't know.
>

I think just closing stdin and stdout is likely to be enough, or maybe all
file descriptors from 0 to $^F .  The OS will close any others that have the
close-on-exec bit set, and the close-on-exec bit is set by default by Perl's
open function.  Anybody setting this to something different probably
understands the consequences.

----Scott.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.