How to close all files between fork and exec?

Harald Kirsch kirschh at lionbioscience.com
Thu Jan 18 03:37:46 EST 2001


Russ Allbery <rra at stanford.edu> writes:

> In comp.unix.programmer, Donn Cave <donn at u.washington.edu> writes:
> > Quoth Harald Kirsch <kirschh at lionbioscience.com>:
> 
> >> On some systems there is a constant like OPEN_MAX but I read that on
> >> recent Solaris versions there is no real limit to it.  How do I get
> >> hold of the highest numbered open file descriptor, in particular in
> >> python?
> 
> > Unfortunately it looks to me like no one has ever put getdtablesize()
> > in Python.
> 
> That's probably because the more portable way to do this is to use either
> sysconf(_SC_OPEN_MAX) or getrlimit(RLIMIT_NOFILE, &rl).

Out of curiosity I would like to know what these functions return on
Solaris where, as I heard, there is no real limit. How does a shell
(sh, tcsh) on such Solaris systems close all files of forked/execed
subprocesses. Does Solaris set close-on-exec by default on every file
descriptor opened?

  Harald Kirsch
-- 
----------------+------------------------------------------------------
Harald Kirsch   | kirschh at lionbioscience.com | "How old is the epsilon?"
LION Bioscience | +49 6221 4038 172          |        -- Paul Erdös
       *** Please do not send me copies of your posts. ***



More information about the Python-list mailing list