[Swan-dev] use vfork/exec

David McCullough ucdevel at gmail.com
Fri Oct 16 23:52:11 UTC 2015

Paul Wouters wrote the following:
> 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 :)

Well you still need an exit code,  and 42 is a good one.

> >>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


David McCullough,  ucdevel at gmail.com,   Ph: 0410 560 763

More information about the Swan-dev mailing list