Killing a process and all of its descendants
morningcoffee.io
Killing a process and all of its descendants
1–10 of 76 posts
Re: Killing a process and all of its descendants
#2Re: Killing a process and all of its descendants
#3Re: Killing a process and all of its descendants
#4Even waiting for a process to exit is surprisingly hard (impossible?) in Linux, unless it's your child.
wait [-fn] [jobspec or pid …]
https://www.gnu.org/software/bash/manual/html_node/Job-Contr...Re: Killing a process and all of its descendants
#5Even waiting for a process to exit is surprisingly hard (impossible?) in Linux, unless it's your child.
Re: Killing a process and all of its descendants
#6Re: Killing a process and all of its descendants
#7Even waiting for a process to exit is surprisingly hard (impossible?) in Linux, unless it's your child.
Not anymore: b53b0b9d9a613c418057f6cb921c2f40a6f78c24 (pidfd: add polling support)
https://github.com/torvalds/linux/commit/b53b0b9d9a613c41805...
Re: Killing a process and all of its descendants
#8Even waiting for a process to exit is surprisingly hard (impossible?) in Linux, unless it's your child.
Re: Killing a process and all of its descendants
#9This is why cgroups were invented. They solve this problem. Start a process in its own cgroup, and you can later confidently kill the process and all of its descendants. Container "technologies" use cgroups extensively, as does systemd service management.
Re: Killing a process and all of its descendants
#10Even waiting for a process to exit is surprisingly hard (impossible?) in Linux, unless it's your child.
That is getting considerably easier with the addition of pidfds, though: https://lwn.net/SubscriberLink/794707/93ffb35438fd3710/