erl -detached doesn't properly detach itself (or does it?)

Daniel Néri daniel.neri@REDACTED
Thu Jan 10 10:04:24 CET 2002


Bengt Kleberg <eleberg@REDACTED> writes:

> > Looking at the source in erlexec.c, I see the fork() calls, but I
> > don't see a setsid() call. My (rusty) recollections of unix process
> > groups is that you need to call setsid() to make sure you don't
> > eventually get a SIGHUP.
> 
> According to Stevens (Advanced UNIX Programing) it is even
> neccessary with a second fork() after the setsid().

>From what I understand, POSIX/SUSv2/Stevens says that SIGHUP is sent
to *stopped* processes when the process group is orphaned.

On Linux, however, there's at least some evidence[*] of a different
interpretation.

On BSD derived systems, one might want to use the daemon(3) function
instead of rolling your own.


Regards,
   --Daniel


[*] http://www.gnu.org/manual/glibc-2.2.3/html_node/libc_566.html

-- 
Daniel Neri                                      mailto:dn@REDACTED
Sigicom AB, Sweden                              http://www.sigicom.com




More information about the erlang-questions mailing list