KILL(2)
NAME
kill − send signal to a process
USAGE
kill(pid, sig)
int pid, sig;
DESCRIPTION
Kill sends the signal sig to the process identified by the process number pid. Sig may be one of the signals specified in sigvec(2), or it may be zero, in which case error checking is performed but no signal is actually sent. The zero signal is used to check the validity of pid.
Both the sending and receiving processes must have the same effective user ID. The only exception is the signal SIGCONT, which kill can always send to any child or grandchild of the current process. In all other cases, this call is restricted to the super-user.
If the process number is zero, the signal is sent to all other processes in the sender’s process group; this is a variant of killpg(2).
If the process number is −1, and the user is the super-user, the signal is broadcast universally, except to system processes and the process sending the signal.
Processes may send signals to themselves.
RETURN VALUE
Upon successful completion, a value of zero is returned. Otherwise, a value of −1 is returned and errno is set to indicate the error.
ERRORS
Kill will fail and no signal will be sent in the following instances:
[EINVAL] Sig is not a valid signal number.
[ESRCH] No process can be found with the specified pid.
[EPERM] The sending process is not the super-user and its effective user ID does not match the effective user-ID of the receiving process.