> Your wishlist bug asked if killall or another program could kill a > process and all its children. I believe /bin/kill with a negative > PID will do just that.
No. Kill with a negative PID affects a process group. Consider this
pstree:
a(23413)-+-b(23414)---cat(23417)
|-b(23415)---cat(23419)
|-b(23416)---cat(23418)
|-b(23420)---cat(23423)
`-b(23421)---cat(23422)
Here, 23413 was started by a shell so 'kill -- -23413' would kill this
entire tree. However, this won't work on 23415; 'kill -- -23415' yields:
bash: kill: (-23415) - No such process
'/bin/kill -- -23415' simply has no effect. Doing an strace of it shows
that it tried to, with this result:
kill(-23415, SIGTERM) = -1 ESRCH (No such process)
Killing 23415 and all of its children (23419 in this case) would involve
doing something similar to what pstree does, then sending the appropriate
signal to each selected process.
signature.asc
Description: This is a digitally signed message part.

