开发者

Relocating /proc/proc_id/ kind of directories in linux

开发者 https://www.devze.com 2023-01-06 12:57 出处:网络
I am writing a daemon in c++ on linux which would launch many processes. I\'m considering a scenario when the d开发者_StackOverflow中文版aemon itself

I am writing a daemon in c++ on linux which would launch many processes. I'm considering a scenario when the d开发者_StackOverflow中文版aemon itself is killed. On restarting the daemon, I would like to kill all other processes launched by this daemon. Ideally I would like all the processes created by this daemon to die if it is killed. I'm considering a scenario when daemon dies after creating the process and without writing onto the log file.

I was wondering if I could use /proc/proc_id/ kind of directories. But in this case I would like these directories to be created somewhere in my home directory. So, that I just scan them and kill these processes. Is it possible ? Or if there is any other solution.

Note: I do not have the access to the source code of any of the child process.


From the kill(2) man page:

   If pid is less than -1, then sig is sent to every process in  the  pro-
   cess group whose ID is -pid.
0

精彩评论

暂无评论...
验证码 换一张
取 消