由他的 parent 或其他进程终止进程
Process termination by his parent or other processes
唯一的父进程是否可以终止(杀死)他的children?甚至与该特定进程无关的另一个进程也可以杀死它?
哪些进程可以kill具体进程?
任何拥有另一个具有相同用户 ID 的进程的进程 ID 的进程都可以通过向该进程发送 SIGQUIT
信号来终止它
kill(pid, SIGQUIT)
。
您需要包括 <sys/types.h>
<signal.h>
使用这个系统调用。
在man page of kill上注明:
For a process to have permission to send a signal it must either be privileged (under Linux: have the CAP_KILL capability), or the real or effective user ID of the sending process must equal the real or saved set-user-ID of the target process. In the case of SIGCONT it suffices when the sending and receiving processes belong to the same session.
唯一的父进程是否可以终止(杀死)他的children?甚至与该特定进程无关的另一个进程也可以杀死它?
哪些进程可以kill具体进程?
任何拥有另一个具有相同用户 ID 的进程的进程 ID 的进程都可以通过向该进程发送 SIGQUIT
信号来终止它
kill(pid, SIGQUIT)
。
您需要包括 <sys/types.h>
<signal.h>
使用这个系统调用。
在man page of kill上注明:
For a process to have permission to send a signal it must either be privileged (under Linux: have the CAP_KILL capability), or the real or effective user ID of the sending process must equal the real or saved set-user-ID of the target process. In the case of SIGCONT it suffices when the sending and receiving processes belong to the same session.