Date: Fri, 01 Jun 2001 12:10:35 +1000 From: Gregory Bond <gnb@itga.com.au> To: stable@freebsd.org Subject: Who's HUPing my daemon? Message-ID: <200106010210.MAA26759@lightning.itga.com.au>
next in thread | raw e-mail | index | archive | help
I'm trying to get a daemon running at boot time from rc.d. When the system
boots, the script is run, the daemon is started, and all is fine. Then a few
seconds later, (possibly at the same time that rc finishes and getty is
launched), the daemon gets a SIGHUP and cleans itself up and exits. Running
the start script by hand after logging in works and the daemon stays active
more or less forever as you expect.
Some hackery with ktrace shows that it is a SIGHUP that is killing it, and it
is waiting in select() at the time (which is the expected state).
The relevent code in main() is like this:
if(makedaemon && fork())
exit(0);
openlog("bpalogin",LOG_PID,LOG_DAEMON);
I'm suspicious that just a plain fork() is not enough to disconnect from the
boot sequence but I can't work out what's causing the HUP. Suggestions?
(I suspect replacing the code with
if (makedaemon) daemon(0,0);
will fix it... bloody Linux hackers, no respect for real Unix!)
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200106010210.MAA26759>
