SYNOPSIS
#include <sys/types.h>
#include <signal.h>
int kill(pid_t pid, int sig);
DESCRIPTION
The
For a process to have permission to send a signal to a pid-designated process, the real or effective user ID of the sending process must match the real or saved user ID of the receiving process. The exception is if the sending process has appropriate privileges. The process with ID 0 and the process with ID 1 are special processes. They are referred to as proc0 and proc1, respectively.
- If pid is greater than zero, sig is sent to the process whose process ID is equal to pid.
- If pid is zero, sig is sent to all processes (except an unspecified 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,
kill() sends the signal to all processes whose real user ID is equal to the effective user ID of the sender. - If pid is negative but not -1, sig is sent to all processes (except an unspecified set of system 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 is delivered to the sending process before the
PARAMETERS
RETURN VALUES
If successful,
- EINVAL
-
The value of sig is an invalid or unsupported signal number.
- EPERM
-
The user ID of the sending process is not privileged; its real or effective user ID does not match the real or saved user ID of the receiving process. Or, the process does not have permission to send the signal to any receiving process.
- ESRCH
-
No process or process group can be found that corresponds to the one that pid specifies.
CONFORMANCE
POSIX.1 (1996), with exceptions.
MULTITHREAD SAFETY LEVEL
Async-signal-safe.
PORTING ISSUES
The determination of whether
the sending process has permission to send a signal to the
receiving process ignores any uid or gid settings
that have been specified with calls to
Using
Sending the SIGKILL signal to non-NuTCRACKER Platform processes also
attempts to post a close message to a window owned by the process specified
by pid.
In cases where it is not possible to post this message, or where
the process does not exit in a timely fashion,
Sending any other signal to a non-NuTCRACKER Platform process fails with errno set to EPERM.
AVAILABILITY
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
SEE ALSO
- Functions:
getpgrp() ,getpid() ,killpg() ,setpgrp() ,setsid() ,sigaction() ,signal() ,sigqueue()
PTC MKS Toolkit 10.5 Documentation Build 40.