From: Ian Campbell Subject: Re: [PATCH v2] xl: track child processes for the benefit of libxl Date: Tue, 22 May 2012 13:13:49 +0100 Message-ID: <1337688829.10118.89.camel@zakaz.uk.xensource.com> References: <20406.37918.733921.594303@mariner.uk.xensource.com> <1337675069.10118.11.camel@zakaz.uk.xensource.com> <20411.30135.659467.276549@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20411.30135.659467.276549@mariner.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 Jackson Cc: Roger Pau Monne , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On Tue, 2012-05-22 at 12:17 +0100, Ian Jackson wrote: > Ian Campbell writes ("Re: [PATCH v2] xl: track child processes for the benefit of libxl"): > > On Fri, 2012-05-18 at 19:25 +0100, Ian Jackson wrote: > > > +pid_t xl_waitpid(xlchildnum child, int *status, int flags) > > > +{ > > > + xlchild *ch = &children[child]; > > > + pid_t got = ch->pid; > > > + assert(got); > > > + if (ch->reaped) { > > > + *status = ch->status; > > > + ch->pid = 0; > > > + return got; > > > + } > > > + for (;;) { > > > + got = waitpid(ch->pid, status, flags); > > > > Is it always the case that xl has at most one child? > > I don't think it is necessarily the case. > > > Because if not then we may reap the wrong one here. > > No, the whole point of waitpid is that you get to specify which child > to reap. Unless I'm missing something ? No I was, for some reason I thought we were waiting for any child here. You can safely ignore this comment ;-) Ian.