killpg(2) — System Calls
NAME
killpg − Sends a signal to a process group
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
#include <sys/types.h>
#include <signal.h> int killpg(
pid_t process_grp,
int signal);
PARAMETERS
process_grpSpecifies the process group.
signalSpecifies the signal. If the signal parameter is a value of 0 (zero, the null signal), error checking is performed but no signal is sent. This parameter can be used to check the validity of the process parameter.
DESCRIPTION
The killpg() function sends the signal specified by the signal parameter to the group of processes specified by the process_grp parameter.
The process sending the signal must have the same effective user ID as the members of the process group, or the sending process must belong to the superuser. The continue signal, SIGCONT, is a special case: it may be sent to any process that is a descendent of the current process.
RETURN VALUES
Upon successful completion, the killpg() function returns a value of 0 (zero). Otherwise, a value of -1 is returned, and errno is set to indicate the error.
ERRORS
If any of the following conditions occurs, the kill() function sets errno to the corresponding value:
[EINVAL]The signal parameter is not a valid signal number.
[ESRCH]No process can be found in process_grp.
[ESRCH]The process group was given as 0 (zero), but the sending process does not have a process group.
[EPERM]The real or saved user ID does not match the real or effective user ID of the receiving process, the calling process does not have the appropriate privilege, and the process is not sending a SIGCONT signal to one of its session’s processes.
RELATED INFORMATION
Functions: getpid(2), kill(2), setpgid(2), sigaction(2), sigvec(2).