[ELDK] kill an entire process group
Wolfgang Denk
wd at denx.de
Mon Aug 4 22:36:49 CEST 2008
In message <48971BCF.8705.1721342 at g.modugno.elettronika.it> you wrote:
>
> I wrote a small C program killpg that uses kill() function to send
> the same signal to all the child processes, by passing -pid (a
> negative number) to the function.
That means you send the signal to all processes in the process group.
This implies that there is a process group in the first place.
> When I use the NFS development system, my killpg program works well
> and I can kill the parent and all the child processes.
In the NFS envrionment you use standard SYSV init, standard login and
standard bash.
> When I copy killpg executable to my target system (based on SELF
> ramdisk), kill() function returns with an error, ESRCH (pid argument
> doesn't correspond to a real pid).
In the SELF envrionment you use BusyBox init, login, and shell.
> libc libraries are the same in my target and nfs development systems.
> What could cause the different behaviour?
The shell. The Busybox shell obviously does not create a process group
at all.
> Can someone suggest me a better method to kill parent and all the
> child processes?
If you don't want to create the process group and the processes
yoruself, then you probably might ant to use a real shell (bash).
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
When dreams become more important than reality, you give up travel,
building, creating; you even forget how to repair the machines left
behind by your ancestors. You just sit living and reliving other
lives left behind in the thought records.
-- Vina, "The Menagerie" ("The Cage"), stardate unknown
More information about the eldk
mailing list