[ELDK] kill an entire process group
Giuseppe Modugno
g.modugno at elettronika.it
Mon Aug 4 15:10:07 CEST 2008
Dear all,
I'm using ELDK4.1 for arm platform and I'd like to kill a shell
script with all the child processes the script had launched.
For example, if my script example.sh is:
---
#!/bin/sh
sleep 100
---
I want to kill the processes example.sh and sleep launched by
example.sh.
The usual kill command kills only example.sh, parent process.
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.
When I use the NFS development system, my killpg program works well
and I can kill the parent and all the child processes.
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).
libc libraries are the same in my target and nfs development systems.
What could cause the different behaviour?
Can someone suggest me a better method to kill parent and all the
child processes?
More information about the eldk
mailing list