1KILL(2)                       System Calls Manual                      KILL(2)
2
3
4

NAME

6       kill - send signal to a process
7

SYNOPSIS

9       kill(pid, sig)
10       int pid, sig;
11

DESCRIPTION

13       Kill sends the signal sig to a process, specified by the process number
14       pid.  Sig may be one of the signals specified in sigvec(2), or  it  may
15       be  0, in which case error checking is performed but no signal is actu‐
16       ally sent.  This can be used to check the validity of pid.
17
18       The sending and receiving processes must have the same  effective  user
19       ID,  otherwise  this  call  is  restricted to the super-user.  A single
20       exception is the signal SIGCONT,  which  may  always  be  sent  to  any
21       descendant of the current process.
22
23       If  the process number is 0, the signal is sent to all processes in the
24       sender's process group; this is a variant of killpg(2).
25
26       If the process number is -1 and the user is the super-user, the  signal
27       is  broadcast  universally  except  to system processes and the process
28       sending the signal.  If the process number is -1 and the  user  is  not
29       the  super-user,  the  signal is broadcast universally to all processes
30       with the same uid as the user except the process  sending  the  signal.
31       No error is returned if any process could be signaled.
32
33       For  compatibility with System V, if the process number is negative but
34       not -1, the signal is sent to all processes whose process group  ID  is
35       equal  to  the absolute value of the process number.  This is a variant
36       of killpg(2).
37
38       Processes may send signals to themselves.
39

RETURN VALUE

41       Upon successful completion, a value of 0  is  returned.   Otherwise,  a
42       value of -1 is returned and errno is set to indicate the error.
43

ERRORS

45       Kill  will  fail  and  no  signal  will be sent if any of the following
46       occur:
47
48       [EINVAL]       Sig is not a valid signal number.
49
50       [ESRCH]        No process can be found corresponding to that  specified
51                      by pid.
52
53       [ESRCH]        The  process  id  was given as 0 but the sending process
54                      does not have a process group.
55
56       [EPERM]        The sending process is not the super-user and its effec‐
57                      tive user id does not match the effective user-id of the
58                      receiving process.  When signaling a process group, this
59                      error was returned if any members of the group could not
60                      be signaled.
61

SEE ALSO

63       getpid(2), getpgrp(2), killpg(2), sigvec(2)
64
65
66
674th Berkeley Distribution        May 14, 1986                          KILL(2)
Impressum