kill.2 (2010 09)
k
kill(2) kill(2)
NAME
kill(), raise() - send a signal to a process or a group of processes
SYNOPSIS
#include <signal.h>
int kill(pid_t pid, int sig);
int raise(int sig);
DESCRIPTION
The kill() system call sends a signal to a process or a group of processes, as specified by pid . The sig-
nal to be sent is specified by sig and is either one from the list given in
signal() or 0.
The
raise() system call sends a signal to the executing process or thread. The signal to be sent is
specified by sig and is either one from the list given in
signal() or 0. In a single-threaded process the
effect of the
raise() function is equivalent to calling
kill(getpid(), sig);
.
When used in a multithreaded program, the
raise() function sends the signal specified by sig to the
executing thread. The effect of the
raise() function is equivalent to calling
pthread_kill (pthread_self(), sig);
.
If 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 pid .
The real or effective user ID of the sending process must match the real or saved user ID of the receiving
process unless the sending process has appropriate privileges.
As a single special case, the continue signal
SIGCONT can be sent to any process that is a member of the
same session as the sending process.
The value
KILL_ALL_OTHERS
is defined in the file <sys/signal.h> and is guaranteed not to be the
ID of any process in the system or the negation of the ID of any process in the system.
If pid is greater than zero and not equal to
KILL_ALL_OTHERS
, sig is sent to the process whose process
ID is equal to pid. pid can equal
1 unless sig is SIGKILL or SIGSTOP.
If pid is
0, sig is sent to all processes excluding special system processes whose process group ID is equal
to the process group ID of the sender.
If pid is
-1 and the sending process does not have the appropriate privileges, sig is sent to all processes
excluding special system processes whose real or saved user ID is equal to the real or effective user ID of
the sender.
If pid is
-1 and the effective user ID of the sender is a user who has appropriate privileges, sig is sent to
all processes excluding special system processes.
If pid is
KILL_ALL_OTHERS, kill() behaves much as when pid is equal to -1, except that sig is not
sent to the calling process.
If pid is negative but not
-1 or KILL_ALL_OTHERS, sig is sent to all processes (excluding special system
processes) whose process group ID is equal to the absolute value of pid, and whose real and/or effective
user ID meets the constraints described above for matching user IDs.
Security Restrictions
Some or all of the actions associated with this system call are subject to compartmental restrictions. See
compartments (5) for more information about compartmentalization on systems that support that feature.
Compartmental restrictions can be overridden if the process possesses the
PRIV_COMMALLOWED
privilege (COMMALLOWED). Processes owned by the superuser may not have this privilege. Processes
owned by any user may have this privilege, depending on system configuration.
Some or all of the actions associated with this system call require the
PRIV_OWNER (OWNER) and/or the
PRIV_REBOOT (REBOOT) privileges. Processes owned by the superuser will have these privileges.
Processes owned by other users may have privilege(s), depending on system configuration. See
privileges (5) for more information about privileged access on systems that support fine-grained privileges.
HP-UX 11i Version 3: September 2010 − 1 − Hewlett-Packard Company 1