1
0
Files
irix-657m-src/eoe/man/man3b/kill.3b
2022-09-29 17:59:04 +03:00

139 lines
3.4 KiB
Plaintext

'\"macro stdmacro
.\" Copyright (c) 1980 Regents of the University of California.
.\" All rights reserved. The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\" @(#)kill.2 6.5 (Berkeley) 5/14/86
.\"
.TH KILL 3B
.UC 4
.SH NAME
kill \- send signal to a process (4.3BSD)
.SH SYNOPSIS
.B #include <signal.h>
.PP
.B int kill(pid_t pid, int sig);
.PP
To use any of the
.SM BSD
signal routines
(\f2kill\fP(3B), \f2killpg\fP(3B), \f2sigblock\fP(3B), \f2signal\fP(3B),
\f2sigpause\fP(3B), \f2sigsetmask\fP(3B), \f2sigstack\fP(2B), \f2sigvec\fP(3B))
you must either
.IP 1) 3
#define
.SM \f3_BSD_SIGNALS\fP
or
.SM \f3_BSD_COMPAT\fP
before including <\f2signal.h\fP>,
or
.IP 2) 3
specify one of them in the compile
command or makefile:
.Ex
cc -D_BSD_SIGNALS -o prog prog.c
.Ee
.SH DESCRIPTION
.I kill
sends the signal \f2sig\fP
to a process, specified by the process number
.IR pid .
.I Sig
may be one of the signals specified in
.IR sigvec (3B),
or it may be 0, in which case
error checking is performed but no
signal is actually sent.
This can be used to check the validity of
.IR pid .
.PP
The sending and receiving processes must
have the same effective user \s-1ID\s+1, otherwise
this call is restricted to the super-user.
A single exception is the signal
.SM
.BR SIGCONT ,
which may always be sent
to any descendant of the current process.
.PP
If the process number is 0,
the signal is sent to all processes in the
sender's process group; this is a variant of
.IR killpg (3B).
.PP
If the process number is \-1
and the user is the super-user,
the signal is broadcast universally
except to system processes.
If the process number is \-1
and the user is not the super-user,
the signal is broadcast universally to
all processes with the same uid as the user.
No error is returned if any process could be signaled.
.PP
For compatibility with System V,
if the process number is negative but not \-1,
the signal is sent to all processes whose process group
.SM ID
is equal to the absolute value of the process number.
This is a variant of
.IR killpg (3B).
.PP
Processes may send signals to themselves.
.SH "RETURN VALUE
Upon successful completion, a value of 0 is returned.
Otherwise, a value of \-1 is returned and
.I errno
is set to indicate the error.
.br
.ne 10
.SH "ERRORS
.I kill
will fail and no signal will be sent if any of the following
occur:
.TP 15
.SM
\%[EINVAL]
\f2Sig\fP is not a valid signal number.
.TP 15
.SM
\%[ESRCH]
No process can be found corresponding to that specified by \f2pid\fP.
.TP 15
.SM
\%[ESRCH]
The process id was given as 0
but the sending process does not have a process group.
.TP 15
.SM
\%[EPERM]
The sending process is not the super-user and its effective
user
.SM ID
does not match the effective user
.SM ID
of the receiving process.
.SH "SEE ALSO"
getpid(2), getpgrp(2), killpg(3B), sigvec(3B)
.SH "CAVEATS (IRIX)"
.PP
When the process number is \-1, the process sending the signal is
.SM NOT
included in the delivery group. In the IRIX implementation,
the sending process receives the signal, too.
.PP
4.3\s-1BSD\s+1's implementation of kill returns
.SM
.B EPERM
if any members of a process
group can not be signaled (when
.I kill
is invoked with a
.I pid
of 0). The IRIX implementation does not.
.ne 5
.SH "WARNING (IRIX)"
The 4.3\s-1BSD\s+1 and System V signal facilities have different semantics.
Using both facilities in the same program is \f3strongly discouraged\fP
and will result in unpredictable behavior.