waitpid for a non child process

waitpid for a non child process

Post by dave michael kenned » Thu, 15 Mar 2001 06:50:55



is there a version of waitpid() that will sit and wait until a child of a
different process has ded/exited?

thanks again

Dave Kennedy
Champaign Underwater Hockey

 
 
 

waitpid for a non child process

Post by Kaz Kylhe » Thu, 15 Mar 2001 09:57:47


On Tue, 13 Mar 2001 15:50:55 -0600, dave michael kennedy


>is there a version of waitpid() that will sit and wait until a child of a
>different process has ded/exited?

No.

 
 
 

waitpid for a non child process

Post by Benoit Mordele » Thu, 15 Mar 2001 18:44:36


Kaz Kylheku a crit :

> On Tue, 13 Mar 2001 15:50:55 -0600, dave michael kennedy

> >is there a version of waitpid() that will sit and wait until a child of a
> >different process has ded/exited?

> No.

maybe you could write your own function that regularly calls stat(2) on
/proc/<pid> in order to know if the process is still alive. but you
won't get any exit code like this. this may also be a non portable
solution.

ben

 
 
 

waitpid for a non child process

Post by ChromeDom » Fri, 16 Mar 2001 13:24:32



> Kaz Kylheku a crit :

> > On Tue, 13 Mar 2001 15:50:55 -0600, dave michael kennedy

> > >is there a version of waitpid() that will sit and wait until a child of a
> > >different process has ded/exited?

> > No.

> maybe you could write your own function that regularly calls stat(2) on
> /proc/<pid> in order to know if the process is still alive. but you
> won't get any exit code like this. this may also be a non portable
> solution.

> ben

Why not call kill with a signal of zero?  That should be portable.

Gene

--
Homo Sapiens is a goal, not a description.

 
 
 

waitpid for a non child process

Post by Kaz Kylhe » Sat, 17 Mar 2001 00:33:06


On Thu, 15 Mar 2001 09:33:39 +0100, Benoit Mordelet


>what is it supposed to do ? according to kill(2) man page, it should
>return EINVAL in errno because 0 isn't a valid signal (the first one,
>SIGHUP, is 1) and that's all.

Read that bit of text just above the RETURN VALUE section.
 
 
 

waitpid for a non child process

Post by Benoit Mordele » Fri, 16 Mar 2001 17:33:39


ChromeDome a crit :


> > Kaz Kylheku a crit :

> > > On Tue, 13 Mar 2001 15:50:55 -0600, dave michael kennedy

> > > >is there a version of waitpid() that will sit and wait until a child of a
> > > >different process has ded/exited?

> > > No.

> > maybe you could write your own function that regularly calls stat(2) on
> > /proc/<pid> in order to know if the process is still alive. but you
> > won't get any exit code like this. this may also be a non portable
> > solution.

> > ben

> Why not call kill with a signal of zero?  That should be portable.

what is it supposed to do ? according to kill(2) man page, it should
return EINVAL in errno because 0 isn't a valid signal (the first one,
SIGHUP, is 1) and that's all.

ben

 
 
 

waitpid for a non child process

Post by Benoit Mordele » Sat, 17 Mar 2001 01:31:18


Kaz Kylheku a crit :

> On Thu, 15 Mar 2001 09:33:39 +0100, Benoit Mordelet

> >what is it supposed to do ? according to kill(2) man page, it should
> >return EINVAL in errno because 0 isn't a valid signal (the first one,
> >SIGHUP, is 1) and that's all.

> Read that bit of text just above the RETURN VALUE section.

ok, sorry for the noise I made here. I initially read the french
translation of this man page, which surprisingly doesn't contain that
line. (at least in the version provided with redhat)

ben