kill(2) DG/UX R4.11MU05 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;
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.
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
described above shall not be applied when sending SIGCONT to a
process that is a member of the same session as the sending process.
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.
ACCESS CONTROL
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 privilege.
On a generic DG/UX system, appropriate privilege is granted by having
an effective UID of 0 (root). See the appropriate_privilege(5) man
page for more information.
On a system with DG/UX information security, appropriate privilege is
granted by having one or more specific capabilities enabled in the
effective capability set of the user. See cap_defaults(5) for the
default capabilities for this command.
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.
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.
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>, cap_defaults(5).
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 its
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 privilege held by
the calling process. If the calling process has appropriate
privilege, 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 signal SIGKILL cannot be successfully sent to the system
initialization process (PID 1).
Licensed material--property of copyright holder(s)