70 lines
1.3 KiB
Groff
70 lines
1.3 KiB
Groff
.TH KILL 2
|
|
.UC 4
|
|
.SH NAME
|
|
kill \- kill a process.
|
|
.SH SYNOPSIS
|
|
.nf
|
|
.B #include <unistd.h>
|
|
.B int kill (int pid, int sig) ;
|
|
.fi
|
|
.SH DESCRIPTION
|
|
.B kill()
|
|
can be used to send any signal to any process group or process.
|
|
Normally, signal
|
|
.B SIGKILL
|
|
or 9 is used, or
|
|
.B SIGHUP.
|
|
.PP
|
|
If
|
|
.I pid
|
|
is positive, then signal
|
|
.I sig
|
|
is sent to
|
|
.I pid.
|
|
In this case, 0 is returned on success, or the error condition from
|
|
.B send_sig()
|
|
is returned.
|
|
.PP
|
|
If
|
|
.I pid
|
|
= -1, then
|
|
.I sig
|
|
is sent to every process except for the first one,
|
|
from higher numbers in the proc table to lower.
|
|
In this case, 0 is returned on success,
|
|
or the last error condition from
|
|
.B send_sig()
|
|
is returned.
|
|
.PP
|
|
If
|
|
.I pid
|
|
< -1, then
|
|
.I sif
|
|
is sent to every process in the process group
|
|
.I -pid.
|
|
In this case, the number of processes the signal was sent to is returned,
|
|
or a negative value for failure.
|
|
.SH ERRORS
|
|
.B -EINVAL
|
|
is returned if an invalid signal is sent.
|
|
.PP
|
|
.B -ESRCH
|
|
is returned if the pid or process group does not exist.
|
|
.PP
|
|
.B -EPERM
|
|
is returned if euid of the process calling
|
|
.B kill()
|
|
is not equal to euid of
|
|
.I pid,
|
|
unless the superuser called
|
|
.B kill().
|
|
.PP
|
|
.SH FILES
|
|
linux/kernel/exit.c
|
|
.br
|
|
/usr/include/linux/sys.h
|
|
.br
|
|
/usr/include/unistd.h
|
|
.SH SEE ALSO
|
|
_exit(2), exit(3), signal(2)
|