Re: [PATCH v2 0/7] CLONE_FD: Task exit notification via file descriptor

From: Thiago Macieira
Date: Mon Mar 16 2015 - 20:50:06 EST


On Monday 16 March 2015 16:29:49 josh@xxxxxxxxxxxxxxxx wrote:
> > A child without CLONE_AUTOREAP should be wait()able. If it gets wait()ed
> > before the clonefd is read, the clonefd() will return a 0 read. If it
> > gets
> > read before wait, then wait() reaps another child or returns -ECHILD.
> > That's no different than two threads doing simultaneous wait() on the
> > same child.
> Hrm? That isn't the semantics we implemented; you'll *always* get an
> exit notification via the clonefd if you have it open, with or without
> autoreap and whether or not a wait has occurred yet. And reading from
> the clonefd does not serve as a wait; if you don't pass CLONE_AUTOREAP,
> you'll still need to wait on the process.

Ah, I see what you're saying. Ok, I stand corrected: a child without
CLONE_AUTOREAP must be wait()ed on and whoever waits on it will get
information. In addition to that, the information is available on the clonefd
and it can happen at any time, before or after the wait().

In the case of an orphaned child, the file descriptor will close, that's all.
No modification is necessary to init.

--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/