EKPD daemon in /usr/local/etc/rc.d getting killed before login

Jarrod jofsama at yahoo.com
Thu Feb 9 00:29:29 PST 2006


Dear All,

Please tell me if this post should have gone elsewhere.

The story goes, in brief, like this:

* I have an EPSON PM-730C inkjet printer. Possibly not available outside 
Japan.

* I found and installed the port: /usr/ports/print/pips730 in order to 
manage the printer's settings (resolution, quality, paper-type, etc.)

* This port has, among other things, a daemon called "ekpd" which sits 
between lpd and the physical port and is responsible for filtering the 
output appropriately.

* The port installs a startup script "ekpd.sh", in /usr/local/etc/rc.d 
by default, which can be enabled with the flag "ekpd_enable="YES"" in 
/etc/rc.conf.

The problem was that the daemon would start ok (trace statements proved 
this), but then terminate as soon as the login prompt came up.

Trace statements in the script file and in the ekpd executable file 
itself, eventually led me to discover that the daemon was somehow being 
killed off (or dying) once the /etc/rc system had finished booting FreeBSD.

Looking around at some of the system daemons I ended up taking a leaf 
out of lpd.c and changing the daemon's startup code from doing a regular 
"fork()" to doing a "daemon(0, 0)" call instead.

At this stage it looks like the problem is solved.

My question is: Is there some documentation or warning somewhere which 
would have aided me in resolving this problem?

I read all the material I could find on the rc.d system and but I didn't 
see anything that suggested just doing a regular fork() would get you in 
trouble. I assume the problem has something to do with why the 
"daemon()" function exists in the first place?

Is there any possibility that there could be a check somewhere in the rc 
system or ports system to prevent programs that don't call "daemon()" to 
initialize from being installed in rc.d?

Thanks in advance for any and all feedback.

Yours Sincerely,
Jarrod.






More information about the freebsd-rc mailing list