内容简介
#include <signal.h>int killpg(int%uA0pgrp, int%uA0sig)
描述
killpg() sends the signal%uA0sig%uA0to the process group%uA0pgrp. See%uA0signal(7) for a list of signals. If%uA0pgrp%uA0is 0,%uA0killpg() sends the signal to the sending process’s process group.(POSIX says: If%uA0pgrp%uA0is less than or equal to 1, the behaviour is undefined.)
For a process to have permission to send a signal it must either be privileged (under Linux: have the%uA0CAP_KILLꃊpability), 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.
返回值
On success, zero is returned. On error, -1 is returned, and%uA0errno%uA0is set appropriately.错误
标签 | 描述 |
---|---|
EINVAL | Sig%uA0is not a valid signal number. |
EPERM | The process does not have permission to send the signal to any of the target processes. |
ESRCH | No process can be found in the process group specified by%uA0pgrp. |
ESRCH | The process group was given as 0 but the sending process does not have a process group. |