How to close all files between fork and exec?

Harald Kirsch kirschh at lionbioscience.com
Wed Jan 17 03:29:00 EST 2001


Python has fork/exec. I want to use it. After fork and before exec I
would like the child process to close all files other than 0, 1 and 2
(i.e. standard input/output/error). 

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?

  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