[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2] xl: track child processes for the benefit of libxl



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 ?

ch->pid the same as children[child].pid which is the pid of the child
we want to wait for, and the previous code has just checked whether we
have reaped it already so we are guaranteed not to reap a new
different child with the same pid and get confused (should such a
thing happen to happen).

> > +typedef struct {
> > +    /* every struct like this must be in XLCHILD_LIST */
> 
> This comment is obsolete now.

Oh yes.

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.