From: Ian Jackson Subject: Re: [PATCH 23/24] libxl: child processes cleanups Date: Tue, 24 Apr 2012 15:27:00 +0100 Message-ID: <20374.47156.616718.181384@mariner.uk.xensource.com> References: <1334596686-8479-1-git-send-email-ian.jackson@eu.citrix.com> <1334596686-8479-24-git-send-email-ian.jackson@eu.citrix.com> <1335276732.4347.155.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1335276732.4347.155.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org Ian Campbell writes ("Re: [Xen-devel] [PATCH 23/24] libxl: child processes cleanups"): > On Mon, 2012-04-16 at 18:18 +0100, Ian Jackson wrote: > > Abolish libxl_fork. Its only callers were in xl. Its functionality > > is now moved elsewhere, as follows: ... > > static inline int libxl__ev_child_inuse(libxl__ev_child *childw_out) > > { return childw_out->pid >= 0; } > > > > +/* Useable (only) in the child to once more make the ctx useable for > > + * xenstore operations. > > Specifically "the child" is the middle child of a spawn? Otherwise the > constraint must be something like "before any threads are created in the > new process", or something like that? The fact that raw fork() may be used in the child created by libxl__ev_child_inuse isn't documented. It would be possible to document this but the set of restrictions on the behaviours of the middle child and any resulting grandchildren are rather complex. I think it might be better to draw a veil over this and leave it as a special piece of knowledge implicit in the implementation of libxl__spawn_*. In practice the use of _xenstore_reopen in the middle child is fine provided that the middle child doesn't then fork _and_ then use libxl's xenstore functions in both the middle child and the grandchild. Ian.