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

Re: How to write a proper fork hook code?



On Mon, 2015-03-02 at 08:29 +0100, Svante Signell wrote:

> > I hadn't realized in your previous code: contrary to what the variable
> > name suggests, this code is not actually creating an fd, so your fork
> > hook won't find an fd to unlock.  I however don't know what makes you
> > say that the hook is not triggered, so I can't really deduct anything.
> 
> Well the basic problem is of course to detect processes generated by
> fork(2). Seems like iterating over open FDs is not sufficient. Is it
> possible to find those processes having PID 0, generated from fork, e.g.
> with proc_getallpids() ? Or are they getting a PID>0 with subsequent
> calls to exec*?

Seem like using proc_getallpids don't work. I think we need something
like lsof to iterate over all open files + some unique feature of a
child (which?). Is there something similar to lsof available for Hurd?



Reply to: