tech-userlevel archive

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

Re: Detecting parent's termination

On Sun, 29 Jan 2012, Emmanuel Dreyfus wrote:
What way do we have to detect parent termination? Linux has a handy but non standard prctl(PR_SET_PDEATHSIG, SIGHUP), do we have something similar?

If you can poll instead of getting notified, then just call getppid(2). The result will change from the actual parent's pid to (pid_t)1 when the parent dies and the child is re-parented to init(8).

--apb (Alan Barrett)

Home | Main Index | Thread Index | Old Index