KILL(2) — HP-UX
NAME
kill − send a signal to a process or a group of processes
SYNOPSIS
int kill (pid, sig)
int pid, sig;
DESCRIPTION
Kill sends a signal to a process or a group of processes. The process or group of processes to which the signal is to be sent is specified by pid. The signal that is to be sent is specified by sig and is either one from the list given in signal(2), or 0. 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 effective user ID of the sending process is super-user. As a single special case on those systems that support job control, the continue signal SIGCONT can be sent to any process that is a descendant of the current 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 will be 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 will be 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 effective user ID of the sender is not super-user, sig will be sent to all processes excluding special system processes whose real or saved user ID is equal to the real or effective users ID of the sender.
If pid is −1 and the effective user ID of the sender is super-user, sig will be sent to all processes excluding special system processes.
If pid is KILL_ALL_OTHERS the behavior is the same as for pid 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 will be 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 uid meet the constraints described above for matching uids.
ERRORS
Kill will fail and no signal will be sent if one or more of the following are true:
[EINVAL]
Sig is not a valid signal number or zero.
[EINVAL] Sig is SIGKILL or SIGSTOP and pid is 1 (proc1).
[EPERM] The user ID of the sending process is not super-user, and its real or effective user ID does not match the real or effective user ID of the receiving process.
[ESRCH] No process can be found corresponding to that specified by pid.
RETURN VALUE
Upon successful completion, a value of 0 is returned. Otherwise, a value of −1 is returned and errno is set to indicate the error.
HARDWARE DEPENDENCIES
Integral Personal Computer
Normal users have all super-user capabilities.
Series 200, 300, 500
Job control is not supported.
AUTHOR
Kill was developed by HP, AT&T, and the University of California, Berkeley.
SEE ALSO
kill(1), getpid(2), setpgrp(2), signal(2).
Hewlett-Packard Company — Version B.1, May 11, 2021