Child processes problem(how to kill)

Child processes problem(how to kill)

Post by xie.. » Thu, 22 Jan 1998 04:00:00



Hi, there,

I am a new one in Unix programming.
I have a question like this:

I try to kill a process. This process may or may not have children. How
can I find out all the children's PID and kill them (in C language)?

Thanks in advance.
Min

 
 
 

Child processes problem(how to kill)

Post by xie.. » Thu, 22 Jan 1998 04:00:00


Hi, there,

I am a new one in Unix programming.
I have a question like this:

I try to kill a process. This process may or may not have children. How
can I find out all the children's PID and kill them (in C language)?

Thanks in advance.
Min

 
 
 

Child processes problem(how to kill)

Post by Glenn Wes » Thu, 22 Jan 1998 04:00:00



> Hi, there,

> I am a new one in Unix programming.
> I have a question like this:

> I try to kill a process. This process may or may not have children. How
> can I find out all the children's PID and kill them (in C language)?

If the children are still members of the parent's process group (and the
parent is the process group leader), kill (<some signal>, -<parent
process id>); where <some signal> is something like SIGTERM.  The parent
process id needs to be negated to signify that the signal should be sent
to all processes in the given process group.
Quote:

> Thanks in advance.
> Min