nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] O_CLOEXEC

2014-11-12 11:05:46
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

_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>