WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] Fix bug #709 by daemonizing blktapctrl and closi

To: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] Fix bug #709 by daemonizing blktapctrl and closing stdin, stdout and stderr
From: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
Date: Tue, 1 Aug 2006 07:57:40 -0400
Cc: Muli Ben-Yehuda <muli@xxxxxxxxxx>, andrew.warfield@xxxxxxxxxxxx, Harry Butterworth <harry@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx, julian.chesterfield@xxxxxxxxxxxx
Delivery-date: Tue, 01 Aug 2006 04:58:17 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <c671f409f8ad68fd919fe083c88a85bd@xxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1154358942.7720.15.camel@xxxxxxxxxxxxxxxxxxxxx> <20060731173158.GA5587@xxxxxxxxxxxx> <1154426496.7694.10.camel@xxxxxxxxxxxxxxxxxxxxx> <20060801100659.GD4774@xxxxxxxxxxxxxxxxxx> <13dc1dfcded4551cbb42f30cbd746242@xxxxxxxxxxxx> <20060801101855.GE4774@xxxxxxxxxxxxxxxxxx> <1154427660.7694.17.camel@xxxxxxxxxxxxxxxxxxxxx> <20060801102709.GF4774@xxxxxxxxxxxxxxxxxx> <c671f409f8ad68fd919fe083c88a85bd@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx

On Aug 1, 2006, at 6:33 AM, Keir Fraser wrote:


On 1 Aug 2006, at 11:27, Muli Ben-Yehuda wrote:

Does it make sense for this to be folded into a common utility
library?

Anil Madhavapeddy pointed out it already is: man 3 daemon.

Cool! I wasn't aware of it. How portable is it? how portable should
the tools be in general?

Ah, that might be a concern, for the Solaris port in particular. daemon() is I think a BSD function ported to Linux. It's not POSIX. Keeping the existing code is uglier but probably more portable.

IMHO, it is better to use a system provided feature that has a large peer review audience than roll our own. There are plenty of portable projects that use this method and fall back to a compatibility library for daemon(3), the OpenSSH project in particular has had to deal with it, I suggest if Solaris needs to borrow any code they borrow it from sshd.

Please also remember that daemons, since they are typically started from the craziest init scripts, should close _all_ file descriptors not explicitly opened or required by the daemon.

    for (i = 0; i < sysconf(_SC_OPEN_MAX); i++) {
        if (i not explicit)
           close(i);
    }

-JX

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel