Having every daemon put itself into the background is bad software design
unga888 at yahoo.com
Tue Dec 3 17:41:29 UTC 2013
Dr. D. J. Bernstein says "Having every daemon put itself into the background
is bad software design." in http://cr.yp.to/daemontools/faq/create.html .
That is, is it possible to write a daemon to run in foreground and automatically started at system boot up (via /etc/rc.conf)?
Can someone provide a sample in C?
Does he means after fork(2), the parent continue to run? Can such a program started via the /etc/rc.conf without a terminal attached?
Btw, I got in to this problem by trying to use DJB's daemontools to supervise my server running on FreeBSD. But it creates zombie processes and spawn quite fast. In my daemons, after fork(2), parent returns.
More information about the freebsd-questions