Terminate all child process in LInux
I am developing a sandbox on linux. And now i am confused terminating all
process in the sandbox. My sandbox works as follows: At first only one
process run in the sandbox. Then it can create several child process. And
child process will create their subprocess also. And parent process may
exit at some time before its children exited. At last sandbox will
terminate all the process.
I used to do this by using killall or pkill -u with a unique user attached
to the sandbox.But it seems doesn't work on the program which uses fork()
fastly.
Then I search for the source code of pkill and realized that pkill is lose
of atomicity.
So how could i achieve my goal ?
No comments:
Post a Comment