Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Mar 2006 13:39:58 GMT
From:      "Jarrod O'Flaherty" <jofsama@yahoo.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/94690: [PATCH] Daemons in /usr/local/etc/rc.d/ must do "setssid()" call
Message-ID:  <200603191339.k2JDdwoM066981@www.freebsd.org>
Resent-Message-ID: <200603191340.k2JDeIf1088686@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         94690
>Category:       ports
>Synopsis:       [PATCH] Daemons in /usr/local/etc/rc.d/ must do "setssid()" call
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 19 13:40:18 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Jarrod O'Flaherty
>Release:        6.0-RELEASE
>Organization:
www.happyatjamos.com
>Environment:
FreeBSD toshiba.happyatjamos.com 6.0-RELEASE FreeBSD 6.0-RELEASE #6: Tue Jan  3 12:16:16 JST 2006     root@toshiba.happyatjamos.com:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
It seems that daemons installed into /usr/local/etc/rc.d require
a setsid() call in their startup code or they cannot be 
auto-started using the /etc/rc.conf file. 

This was the case with the printing daemon "ekpd" in /ports/print/pips730,
which I installed for my EPSON ink jet.

Although the daemon can be run fine manually, it would not start when
I placed the following in my /etc/rc.conf file:
> ekpd_enable="YES"
> ekpd_flags=""

Trace statements showed that the daemon was terminating at the end of 
FreeBDD's startup, right before the login prompt appeared.

Kind Regards,
Jarrod.
>How-To-Repeat:
I would suggest that other daemons which do not call setsid() (or daemon())
after their fork() will also be killed of at the end of startup.

To verify this try installing /usr/ports/print/pips730 and adding the
above ekpd_enable line to your rc.conf. You should find that the daemon
is killed immediately before the login prompt appears after FreeBSD has
completed booting.

>Fix:
The following patch to the file:
/usr/ports/print/pips730/work/pips730-2.5.2/ekpd/cbtd.c 
fixes the problem.

--- cbtd.c.orig Fri Nov 26 15:47:04 2004
+++ cbtd.c      Sun Mar 19 13:42:30 2006
@@ -98,6 +98,9 @@
                perror ("fork() failtd");
                return 1;
        }
+
+       setsid();
+
 #endif

        cbtd_control ();

---end diff---

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200603191339.k2JDdwoM066981>