Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ kill(2) — HP-UX 5.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

kill(1)

getpid(2)

setpgrp(2)

signal(2)

sigvector(2)

KILL(2)

NAME

kill − send a signal to a process or a group of processes

SYNOPSIS

int kill (pid, sig)
int pid, sig;

HP-UX COMPATIBILITY

Level: HP-UX/RUN ONLY

Origin: System V

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 effective user ID of the receiving process, unless the effective user ID of the sending process is super-user. 

The processes with a process ID of 0 and a process ID of 1 are special processes (see glossary(9)) and will be referred to below as proc0 and proc1, respectively. 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 may equal 1. 

If pid is 0, sig will be sent to all processes excluding proc0 and proc1 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 proc0 and proc1 whose real user ID or saved effictive 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 super-user, sig will be sent to all processes excluding proc0 and proc1. 

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 proc0 and proc1) 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.

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 and pid is 1 (proc1). 

­[ESRCH] No process can be found corresponding to that specified by pid.

­[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 saved effective user ID of the receiving process. 

HARDWARE DEPENDENCIES

Series 500:
References to proc0 above are invalid because proc0 does not exist on Series 500. 

Series 200:
A special process known as the pagedaemon has process ID 2. All references to proc0 and proc1 apply to it as well. 

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. 

SEE ALSO

kill(1), getpid(2), setpgrp(2), signal(2), and sigvector(2). 
 
 
 

Hewlett-Packard  —  last mod. May 11, 2021

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026