#include <signal.h>
int killpg(pid_t pgrp, int sig);
killpg() sends the signal sig to the process group pgrp. See signal(5) for a list of signals.
The real or effective user ID of the sending process must match the real or saved set-user ID of the receiving process, unless the effective user ID of the sending process is the privileged user. A single exception is the signal SIGCONT , which may always be sent to any descendant of the current process.
Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and the global variable errno is set to indicate the error.
killpg() will fail and no signal will be sent if any of the following occur: