[Swan-dev] use vfork/exec

Paul Wouters paul at nohats.ca
Fri Oct 16 23:44:23 UTC 2015

On Sat, 17 Oct 2015, David McCullough wrote:

> Just remember that with vfork and the code in question,  the parent is
> blocked until after the exec, so the sleep does nothing but slow the whole
> process down by 1 second :-)

Funny. Seems I introduced it in commit 1987ac98f where I claim:

     * sleep 1s in the addconn thread on startup

     It seems on my laptop, things start too fast and pluto isn't ready
     yet to accept connections to load.

Although I just removed it now and it seems fine.

> Also,  IIRC "exit" is not vfork safe,  _exit() should be used instead.

We do use _exit() although we passed it 42 :)

>> BTW, if there's code lurking that is turning a process into a daemon
>> (fork/fork/exec) is one technique; then that should be changed to just
>> call daemon().

The code I talked about was written in python, see contrib/updown-example/example-terminate.py


More information about the Swan-dev mailing list