kill(2) DG/UX 4.30 kill(2)
NAME
kill - Send a signal to a process.
SYNOPSIS
#include <sys/types.h>
#include <signal.h>
int kill (pid, sig)
pid_t pid;
int sig;
DESCRIPTION
The kill() function shall send a signal to a process or a
group of processes specified by pid. The signal to be sent
is specified by sig and is either one from the list given in
<signal.h> or zero. If sig is zero (the null signal), error
checking is performed but no signal is actually sent. The
null signal can be used to check the validity of pid.
For a process to have permission to send a signal to a
process designated by pid, the real or effective user ID of
the sending process must match the real or effective user ID
of the receiving process, unless the sending process has
appropriate privileges. If {_POSIX_SAVED_IDS} is defined,
the saved set-user-ID of the receiving process shall be
checked in place of its effective user ID. If a receiving
process's effective user ID has been altered through use of
the S_ISUID mode bit (see <sys/stat.h>), the implementation
may still permit the application to receive a signal sent by
the parent process or by a process with the same real user
ID.
If pid is greater than zero, sig shall be sent to the
process whose process ID is equal to pid.
If pid is zero, sig shall be sent to all processes
(excluding an implementation-defined set of system
processes) whose process group ID is equal to the process
group ID of the sender, and for which the process has
permission to send a signal.
If pid is -1, the behavior of the kill() function is
unspecified.
If pid is negative, but not -1, sig shall be sent to all
processes whose process group ID is equal to the absolute
value of pid, and for which the process has permission to
send a signal.
If the value of pid causes sig to be generated for the
sending process, and if sig is not blocked, either sig or at
least one pending unblocked signal shall be delivered to the
Licensed material--property of copyright holder(s) Page 1
kill(2) DG/UX 4.30 kill(2)
sending process before the kill() function returns.
If the implementation supports the SIGCONT signal, the user
ID tests described above shall not be applied when sending
SIGCONT to a process that is a member of the same session as
the sending process.
An implementation that provides extended security controls
may impose further implementation-defined restrictions on
the sending of signals, including the null signal. In
particular, the system may deny the existence of some or all
of the processes specified by pid.
The kill() function is successful if the process has
permission to send sig to any of the processes specified by
pid. If the kill() function fails, no signal shall be sent.
RETURNS
Upon successful completion, the function shall return a
value of zero. Otherwise, a value of -1 shall be returned
and errno shall be set to indicate the error.
ERRORS
If any of the following conditions occur, the kill()
function shall return -1 and set errno to the corresponding
value:
[EINVAL]
The value of the sig argument is an invalid or
unsupported signal number.
[EPERM]
The process does not have permission to send the signal
to any receiving process.
[ESRCH]
No process or process group can be found corresponding
to that specified by pid.
SEE ALSO
getpid(2), setsid(2), sigaction(2), <signal.h>
COPYRIGHTS
Portions of this text are reprinted from IEEE Std 1003.1-
1988, Portable Operating System Interface for Computer
Environment, copyright © 1988 by the Institute of Electrical
and Electronics Engineers, Inc., with the permission of the
IEEE Standards Department. To purchase IEEE Standards, call
800/678-IEEE.
In the event of a discrepancy between the electronic and the
original printed version, the original version takes
Licensed material--property of copyright holder(s) Page 2
kill(2) DG/UX 4.30 kill(2)
precedence.
STANDARDS
Since _POSIX_SAVED_IDS is defined in the DG/UX System, the
saved set-user-ID of the receiving process shall be checked
in place of it effective user ID.
If a receiving process's effective user ID has been altered
through the use of the S_ISUID mode bit, the system permits
the application to receive a signal sent by the parent
process or by a process with the same real user ID.
If pid is -1, the behavior of kill() depends on the
effective user ID of the calling process. If that ID is 0
(superuser), the signal will be sent to all processes except
for the initialization process (PID 1). Otherwise, the
signal will be sent to all processes (again excluding init)
whose real user ID is equal to the effective user ID of the
sending process.
There is one special system process that is unaffected by
all calls of the form kill(0, sig). This is the system
initialization process, which has PID 1.
The SIGCONT signal is supported.
The DG/UX System does not provide extended security
controls, so no further restrictions are placed on the
sending of signals.
The signal SIGKILL cannot be successfully sent to the system
initialization process (PID 1).
Licensed material--property of copyright holder(s) Page 3