Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

wait for another process dying

0 views
Skip to first unread message

Lothar Scholz

unread,
Jul 9, 2004, 8:51:57 PM7/9/04
to
I must observe if another process dies that is not part of the
parent/child process tree, so i can't wait for SIGCHLD.

Any API for this ?

If i must poll how do i know if the process-id still represents the
same process and is not a recyclet one after the observable process
died ?

Kasper Dupont

unread,
Jul 10, 2004, 4:58:10 AM7/10/04
to
Lothar Scholz wrote:
>
> I must observe if another process dies that is not part of the
> parent/child process tree, so i can't wait for SIGCHLD.
>
> Any API for this ?

http://www.daimi.au.dk/~kasperd/comp.os.linux.development.faq.html#waitnotchild

>
> If i must poll how do i know if the process-id still represents the
> same process and is not a recyclet one after the observable process
> died ?

You can check the starttime of the process. If the
starttime has changed it means the pid was recycled.

--
Kasper Dupont -- der bruger for meget tid paa usenet.
I'd rather be a hammer than a nail.

Josef Moellers

unread,
Jul 12, 2004, 3:15:16 AM7/12/04
to
Kasper Dupont wrote:
> Lothar Scholz wrote:
>
>>I must observe if another process dies that is not part of the
>>parent/child process tree, so i can't wait for SIGCHLD.
>>
>>Any API for this ?
>
>
> http://www.daimi.au.dk/~kasperd/comp.os.linux.development.faq.html#waitnotchild
>
>
>>If i must poll how do i know if the process-id still represents the
>>same process and is not a recyclet one after the observable process
>>died ?
>
>
> You can check the starttime of the process. If the
> starttime has changed it means the pid was recycled.
>

Or Lothar can check the command line in /proc/<pid>/cmdline to match the
original program's.

--
Josef Möllers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett

Kasper Dupont

unread,
Jul 13, 2004, 10:58:28 AM7/13/04
to
Josef Moellers wrote:
>
> Or Lothar can check the command line in /proc/<pid>/cmdline to match the
> original program's.

That is another option. Which one is most reliable?
which one is most portable?

0 new messages