From owner-freebsd-rc@FreeBSD.ORG Thu Feb 9 08:29:29 2006 Return-Path: X-Original-To: freebsd-rc@freebsd.org Delivered-To: freebsd-rc@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4871E16A422 for ; Thu, 9 Feb 2006 08:29:29 +0000 (GMT) (envelope-from jofsama@yahoo.com) Received: from smtp008.mail.ukl.yahoo.com (smtp008.mail.ukl.yahoo.com [217.12.11.62]) by mx1.FreeBSD.org (Postfix) with SMTP id 3137043D6E for ; Thu, 9 Feb 2006 08:29:21 +0000 (GMT) (envelope-from jofsama@yahoo.com) Received: (qmail 23559 invoked from network); 9 Feb 2006 08:29:20 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Received:Message-ID:Date:From:User-Agent:X-Accept-Language:MIME-Version:To:Subject:Content-Type:Content-Transfer-Encoding; b=KDjGbbqYftBw7rvMwV59JnwYys4s/u8ajUT2GlmloEGzDAku4SXaazSdx2o3+3YAU+5nrveLse3jfsAK8uqp8l9gPd7kdaS71+L+Yd7q/wXDU31rVFDltjuGvJyKps/QY0FcRb1rp6obwqjQWfpAgRkDoZzr2GU8ffFODMqqxFc= ; Received: from unknown (HELO ?192.168.11.3?) (jofsama@220.96.161.57 with plain) by smtp008.mail.ukl.yahoo.com with SMTP; 9 Feb 2006 08:29:20 -0000 Message-ID: <43EAFDB9.9040106@yahoo.com> Date: Thu, 09 Feb 2006 17:30:49 +0900 From: Jarrod User-Agent: Mozilla Thunderbird 1.0.7 (X11/20060107) X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-rc@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: EKPD daemon in /usr/local/etc/rc.d getting killed before login X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Feb 2006 08:29:29 -0000 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.