Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Dec 2013 09:38:34 -0800 (PST)
From:      Unga <>
To:        "" <>
Subject:   Having every daemon put itself into the background is bad software design
Message-ID:  <>

Next in thread | Raw E-Mail | Index | Archive | Help

Dr. D. J. Bernstein says "Having every daemon put itself into the background
is bad software design." in .

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?

Any idea?

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.

Best regards
From owner-freebsd-questions@FreeBSD.ORG  Tue Dec  3 17:46:41 2013
Return-Path: <owner-freebsd-questions@FreeBSD.ORG>
Received: from (
 (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by (Postfix) with ESMTPS id 56B11729
 for <>; Tue,  3 Dec 2013 17:46:41 +0000 (UTC)
Received: from (
 (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits))
 (No client certificate requested)
 by (Postfix) with ESMTPS id 209CE1511
 for <>; Tue,  3 Dec 2013 17:46:41 +0000 (UTC)
Received: by with SMTP id o6so15189948oag.5
 for <>; Tue, 03 Dec 2013 09:46:40 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20120113;
 :content-type; bh=WFIkhmARo2Mh/vw7pxXapoNxJhYSBR+XV/zBMbPrQ3U=;
MIME-Version: 1.0
X-Received: by with SMTP id pg14mr1920419oeb.66.1386092800196;
 Tue, 03 Dec 2013 09:46:40 -0800 (PST)
Received: by with HTTP; Tue, 3 Dec 2013 09:46:40 -0800 (PST)
In-Reply-To: <44r49tg8uv.fsf@lowell-desk.lan>
References: <>
Date: Wed, 4 Dec 2013 02:46:40 +0900
Message-ID: <>
Subject: Re: local ports collection
From: till plewe <>
To: FreeBSD-Questions <>
Content-Type: text/plain; charset=UTF-8
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: User questions <>
List-Unsubscribe: <>, 
List-Archive: <>;
List-Post: <>
List-Help: <>
List-Subscribe: <>, 
X-List-Received-Date: Tue, 03 Dec 2013 17:46:41 -0000

Thanks for the answer. DESTDIR was supposed to be DISTDIR (typo).
Setting SU_CMD was the hint I needed. Now it seems adjusting ldconfig
is the only thing left to do. pkg installed without problems.

On Wed, Dec 4, 2013 at 2:08 AM, Lowell Gilbert
<> wrote:
> till plewe <> writes:
>> I would like to use the ports tree to install and manage packages inside my
>> home directory. I tried setting:
> Don't use DESTDIR; it doesn't do what you think it does.
> [What did you think it did anyway, and why?]
>> to directories within my home directory but then I get error messages like
>> $ make build
>> ===>  Creating some important subdirectories
>> mount_nullfs: Operation not permitted
>> when trying to build/install ports.
>> Any suggestions on how to use ports completely avoiding root?
>> (I rented space on a server and have permission to install binaries
>> but do not have root access)
> You'll probably have to change SU_CMD as well.
> Something like "su $USER -c" should do it.
> And you may need to bootstrap the pkg(8) command somehow.
> Good luck.

Want to link to this message? Use this URL: <>