nmh-workers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [nmh-workers] closefds() _before_ fork?


From: Ralph Corderoy
Subject: Re: [nmh-workers] closefds() _before_ fork?
Date: Tue, 23 Apr 2019 13:10:46 +0100

Hi,

David wrote:
> Ken wrote:
> > I suggest we simply remove closefds() completely.
...
> Ralph's suggestion of looking for only open fds addresses the
> suboptimality of closefds(), though only for systems that use /proc.

That was just meant as a temporary debugging aid to see what was
sneaking through.  :-)

I agree with the general principle that if we open it, we track it, and
then close it so it doesn't reach the child, typically with O_CLOEXEC or
FD_CLOEXEC.  Calling close(2) lots of times based on getdtablesize(3)
can take a while.  screen(1) had a bug recently where it was taking ages
trying to close almost 512 Ki of them.
https://lists.archlinux.org/pipermail/arch-general/2019-March/046214.html

I don't think there's any multi-threading in nmh so we just have what's
open at the time of fork(2) to deal with.

-- 
Cheers, Ralph.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]