kill
#include <signal.h>
The kill() system call can be used to send any signal to any process group or process.
int kill(pid_t pid, int sig);
PARAMETERS
-pid
- pid > 0
: signal sig is sent to the process with the ID specified by pid.
- pid == 0
: sig is sent to every process in the process group of the calling process.
- pid == -1
: sig is sent to every process for which the calling process has permission to send signals, except for process 1 (init).
- pid < -1
: sig is sent to every process in the process group whose ID is -pid.
-sig
- sig == 0
: no signal is sent, but existence and permission checks are still performed.
⏩ this can be used to check for the existence of a process ID or process group ID that the caller is permitted to signal.
RETURN VALUE
: On success (at least one signal was sent), 0 is returned.
On error, -1 is returned, and errno is set to indicate the error.
📖 kill