How to close all files between fork and exec?

Mats Wichmann xyzmats at laplaza.org
Fri Jan 19 10:27:31 EST 2001


On 18 Jan 2001 09:13:19 -0800, Russ Allbery <rra at stanford.edu> wrote:

>In comp.unix.programmer, Andrew Gierth <andrew at erlenstar.demon.co.uk> writes:
>>>>>>> "Donn" == Donn Cave <donn at u.washington.edu> writes:
>
>>  Donn> Unfortunately it looks to me like no one has ever put
>>  Donn> getdtablesize() in Python.
>
>> does it have sysconf(_SC_OPEN_MAX)?
>
>BTW, in the pointless portability department, getrlimit returns more
>accurate results than sysconf on some patched Linux kernels (INN therefore
>tries getrlimit first).

There's a chance this could be context-dependent:  sysconf returns
whatever system limit is present from the start, getrlimit responds
with what is available to this process - the answer you're likely to
want (somebody else may have lowered the limits for your process). 

Python has a resource module which implements getrlimit....


Mats Wichmann

(Anti-spam stuff: to reply remove the "xyz" from the
address xyzmats at laplaza.org. Not that it helps much...)



More information about the Python-list mailing list