up | Inhaltsverzeichniss | Kommentar

Manual page for KILL(2V)

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

SYNOPSIS

#include <signal.h>

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

SYSTEM V SYNOPSIS

#include <signal.h>

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

DESCRIPTION

kill() sends the signal sig 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. sig may be one of the signals specified in sigvec.2 or it may be 0, in which case error checking is performed but no signal is actually sent. This can be used to check the validity of pid or the existence of process pid.

The real or effective user ID of the sending process must match the real or saved set-user ID of the receiving process, unless the effective user ID of the sending process is super-user. A single exception is the signal SIGCONT, which may always be sent to any member of the same session as the current process.

In the following discussion, ``system processes'' are processes, such as processes 0 and 2, that are not running a regular user program.

If pid is greater than zero, the signal is sent to the process whose process ID is equal to pid. pid may equal 1.

If pid is 0, the signal is sent to all processes, except system processes and process 1, whose process group ID is equal to the process group ID of the sender; this is a variant of killpg.2

If pid is -1 and the effective user ID of the sender is not super-user, the signal is sent to all processes, except system processes, process 1, and the process sending the signal, whose real or saved set-user ID matches the real or effective ID of the sender.

If pid is -1 and the effective user ID of the sender is super-user, the signal is sent to all processes except system processes, process 1, and the process sending the signal.

If pid is negative but not -1, the signal is sent to all processes, except system processes, process 1, and the process sending the signal, whose process group ID is equal to the absolute value of pid; this is a variant of killpg.2

Processes may send signals to themselves.

SYSTEM V DESCRIPTION

If a signal is sent to a group of processes (as with, if pid is 0 or negative), and if the process sending the signal is a member of that group, the signal is sent to that process as well.

The signal SIGKILL cannot be sent to process 1.

RETURN VALUES

kill() returns:

0
on success.
-1
on failure and sets errno to indicate the error.

ERRORS

kill() will fail and no signal will be sent if any of the following occur:

EINVAL
sig was not a valid signal number.
EPERM
The effective user ID of the sending process was not super-user, and neither its real nor effective user ID matched the real or saved set-user ID of the receiving process.
ESRCH
No process could be found corresponding to that specified by pid.

SYSTEM V ERRORS

kill() will also fail, and no signal will be sent, if the following occurs:

EINVAL
sig is SIGKILL and pid is 1.

SEE ALSO

getpid.2v killpg.2 getpgrp.2v sigvec.2 termio.4


index | Inhaltsverzeichniss | Kommentar

Created by unroff & hp-tools. © somebody (See intro for details). All Rights Reserved. Last modified 11/5/97