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

176 lines
3.5 KiB
Groff

'\"macro stdmacro
.if n .pH g2.kill @(#)kill 30.3 of 1/25/86
.TH KILL 2
.SH NAME
kill \- send a signal to a process or a group of processes
.Op c p a
.SH C SYNOPSIS
.B "#include <sys/types.h>"
.br
.B "#include <signal.h>"
.sp
.B "int kill (pid_t pid, int sig);"
.Op
.Op f
.SH FORTRAN SYNOPSIS
.B "integer function kill (pid, sig)"
.Op
.SH DESCRIPTION
.I kill\^
sends a signal
to a process or a group of processes.
The process or group of
processes to which the signal is to be sent is specified by
.IR pid .
The signal that is to be sent is specified by
.I sig\^
and is either one from the list given in
.IR signal (2),
or 0.
If
.I sig\^
is 0 (the null signal), error checking is performed but no signal is
actually sent.
This can be used to check the validity of
.IR pid .
.PP
The real or effective user
.SM ID
of the sending process must match the real, saved, or effective user
.SM ID
of the receiving process, unless the effective user
.SM ID
of the sending process is super-user.
An exception to this is the signal
.SM
.BR SIGCONT ,
which may be sent to any descendant, or any process
in the same session (having the same session \s-1ID\s+1)
as the current process.
.PP
The processes with a process
.SM ID
of 0 and a process
.SM ID
of 1 are special processes [see
.IR intro (2)]
and will be referred to below as
.IR proc0 " and " proc1 ,
respectively.
.PP
If
.I pid\^
is greater than zero,
.I sig\^
will be sent to the process whose process
.SM ID
is equal to
.IR pid .
.I Pid\^
may equal 1.
.PP
If
.I pid\^
is 0,
.I sig\^
will be sent to all processes excluding
.IR proc0 " and " proc1
whose process group
.SM ID
is equal to the process group
.SM ID
of the sender.
.PP
If
.I pid\^
is \-1 and the effective user
.SM ID
of the sender is not super-user,
.I sig\^
will be sent to all processes excluding
.IR proc0 " and " proc1
whose real user
.SM ID
is equal to the effective user
.SM ID
of the sender.
.PP
If
.I pid\^
is \-1 and the effective user
.SM ID
of the sender is super-user,
.I sig\^
will be sent to all processes excluding
.IR proc0 " and " proc1.
.PP
If
.I pid\^
is negative but not \-1,
.I sig\^
will be sent to all processes whose process group
.SM ID
is equal to the absolute value of
.IR pid .
.PP
If the value of
.I pid
causes
.I sig
to be generated for the sending process, and if
.I sig
is not blocked for the calling thread and if no other thread has
.I sig
unblocked or is waiting in a
.I sigwait
function for
.IR sig ,
either
.I sig
or at least one pending unblocked signal shall be delivered to the
calling thread before the
.IR kill ()
function returns.
.PP
.I kill\^
will fail and no signal will be sent if one or more of the following are true:
.TP 15
.TP
\%[EINVAL]
.I Sig\^
is not a valid signal number.
.TP
\%[EPERM]
\f2Sig\f1 is \s-1SIGKILL\s+1 and \f2pid\f1 is 1 (proc1).
.TP
\%[ESRCH]
No process can be found corresponding to that specified by
.IR pid .
.TP
\%[ESRCH]
The process group was given as 0 but the sending process
does not have a process group.
.TP
\%[EPERM]
The user
.SM ID
of the sending process
is not super-user, and its real or effective user
.SM ID
does not match the real, saved, or effective user
.SM ID
of the receiving process.
.SH SEE ALSO
kill(1),
exec(2), getpid(2), setpgrp(2), setsid(2), signal(2), sigset(2), sigaction(2), sigprocmask(2),
sigqueue(3), sigwait(3),
sigvec(3B), sigblock(3B), sigsetmask(3B), killpg(3B), pthread_kill(3P)
.SH DIAGNOSTIC
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.
.\" @(#)kill.2 6.2 of 9/6/83
.Ee
'\".so /pubs/tools/origin.att