kill(2) DG/UX 5.4.2 kill(2)
NAME
kill - send a signal to a process
SYNOPSIS
#include <sys/types.h>
#include <signal.h>
int kill (pid, sig)
pidt pid;
int sig;
where:
pid An integer (positive, negative, or zero) indicating a process
or a group of processes to be sent the signal
sig A signal number that is either one from the list given in
<signal.h> or zero
DESCRIPTION
The kill() function sends a specified signal to a specified process
or group of processes. 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 sending process
before the kill() function returns.
If the implementation supports the SIGCONT signal, the user ID tests
Licensed material--property of copyright holder(s) 1
kill(2) DG/UX 5.4.2 kill(2)
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.
RETURN VALUE
0 Successful completion.
-1 An error occurred. errno is set to indicate the error.
DIAGNOSTICS
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 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
Licensed material--property of copyright holder(s) 2
kill(2) DG/UX 5.4.2 kill(2)
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) 3