Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ kill(2) — CX/UX 6.20

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

getpid(2)

setpgrp(2)

signal(2)

kill(1)

kill(2)

NAME

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

SYNOPSIS

#include <sys/types.h>
 
int kill (pid, sig)
pid_t pid;
int 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 effective user ID of the receiving process, unless the effective user ID of the sending process is super-user.  An exception to this restriction is the SIGCONT signal.  The SIGCONT signal may always be sent to any child or grandchild of the current process, or to any process that is a member of the same session as the sending process. 

The classification level of the sending process must match the classification level of the receiving process, unless the effective user ID of the sending process is super-user. (B1 only)

The processes with a process ID of 0, 1, and 2 are special processes (see intro(2)) and will be referred to below as proc0, proc1, and proc2 respectively. 

If pid is greater than zero, 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, proc1, and proc2 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, proc1, and proc2 whose real or effective 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 super-user, sig will be sent to all processes excluding proc0, proc1, and proc2.

If pid is negative but not −1, sig will be sent to all processes whose process group ID is equal to the absolute value of pid.

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. 

­[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 effective user ID of the receiving process or the user does not have the ACC_KILL access vector. (If access vectors are configured)

­[EPERM] The user ID of the sending process is not super-user, and the classification level of the sending process does not match the classification level of the receiving process. (B1 only)

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

getpid(2), setpgrp(2), signal(2). 
kill(1) in the CX/UX User’s Reference Manual. 

CX/UX Programmer’s Reference Manual

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