[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nmh-workers] O_CLOEXEC
From: |
Ken Hornstein |
Subject: |
Re: [Nmh-workers] O_CLOEXEC |
Date: |
Wed, 12 Nov 2014 12:05:32 -0500 |
>As part of the audit, it would be really nice to wrap all open()
>calls so we can take care of this in one place. We could then
>easily autoconf check for O_CLOEXEC if desired. We wrap the
>alloc family and that's been very helpful.
You know, if I had my druthers I'd rather just write the code to use the
older but more widely supported fcntl() call to set FD_CLOEXEC; that
would avoid an autoconf test and make Lyndon happier :-) Also, it looks
like O_CLOEXEC is not actually part of POSIX? There are also a bunch
of calls to fopen() and for that we'd need to use fcntl() there.
>> >(Is 255 fixed? File descriptors can run far higher on some systems, and
>> >closing them all can take time, e.g. Apache used to suffer from this.
>> >The BSDs added http://manned.org/closefrom.2 to lessen the calls, but it
>> >still tramples willy-nilly.)
>>
>> It looks like it's based on OPEN_MAX ... which is kind of bogus.
>
>All of that is funneled through one function, closefds(), so
>easy to fix (remove in this case).
Hopefully closefds() can just go away?
--Ken