|
|
1.1 root 1: .\" Copyright (c) 1980 Regents of the University of California.
2: .\" All rights reserved. The Berkeley software License Agreement
3: .\" specifies the terms and conditions for redistribution.
4: .\"
5: .\" @(#)kill.2 6.5 (Berkeley) 5/14/86
6: .\"
7: .TH KILL 2 "May 14, 1986"
8: .UC 4
9: .SH NAME
10: kill \- send signal to a process
11: .SH SYNOPSIS
12: .ft B
13: kill(pid, sig)
14: .br
15: int pid, sig;
16: .SH DESCRIPTION
17: .I Kill
18: sends the signal \fIsig\fP
19: to a process, specified by the process number
20: .IR pid .
21: .I Sig
22: may be one of the signals specified in
23: .IR sigvec (2),
24: or it may be 0, in which case
25: error checking is performed but no
26: signal is actually sent.
27: This can be used to check the validity of
28: .IR pid .
29: .PP
30: The sending and receiving processes must
31: have the same effective user ID, otherwise
32: this call is restricted to the super-user.
33: A single exception is the signal SIGCONT, which may always be sent
34: to any descendant of the current process.
35: .PP
36: If the process number is 0,
37: the signal is sent to all processes in the
38: sender's process group; this is a variant of
39: .IR killpg (2).
40: .PP
41: If the process number is \-1
42: and the user is the super-user,
43: the signal is broadcast universally
44: except to system processes
45: and the process sending the signal.
46: If the process number is \-1
47: and the user is not the super-user,
48: the signal is broadcast universally to
49: all processes with the same uid as the user
50: except the process sending the signal.
51: No error is returned if any process could be signaled.
52: .PP
53: For compatibility with System V,
54: if the process number is negative but not \-1,
55: the signal is sent to all processes whose process group ID
56: is equal to the absolute value of the process number.
57: This is a variant of
58: .IR killpg (2).
59: .PP
60: Processes may send signals to themselves.
61: .SH "RETURN VALUE
62: Upon successful completion, a value of 0 is returned.
63: Otherwise, a value of \-1 is returned and
64: .I errno
65: is set to indicate the error.
66: .SH "ERRORS
67: .I Kill
68: will fail and no signal will be sent if any of the following
69: occur:
70: .TP 15
71: [EINVAL]
72: \fISig\fP is not a valid signal number.
73: .TP 15
74: [ESRCH]
75: No process can be found corresponding to that specified by \fIpid\fP.
76: .TP 15
77: [ESRCH]
78: The process id was given as 0
79: but the sending process does not have a process group.
80: .TP 15
81: [EPERM]
82: The sending process is not the super-user and its effective
83: user id does not match the effective user-id of the receiving process.
84: When signaling a process group, this error was returned if any members
85: of the group could not be signaled.
86: .SH "SEE ALSO"
87: getpid(2), getpgrp(2), killpg(2), sigvec(2)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.