Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ kill(2) — NEWS-os 5.0.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

getpid(2)

intro(2)

setpgrp(2)

signal(2)

getsid(2)

send(2)

sigaction(2)

kill(1)



kill(2)                   SYSTEM CALLS                    kill(2)



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

SYNOPSIS
     #include <sys/types.h>
     #include <signal.h>

     int kill (pidt 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 [see signal(5)], or 0.  If sig is 0  (the  null  sig-
     nal),  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  [from  exec(2)]  user ID of the
     receiving process unless the effective user ID of the  send-
     ing  process is superuser, [see intro(2)], or sig is SIGCONT
     and the sending process has  the  same  session  ID  as  the
     receiving process.

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

     If pid is greater than 0, sig will be sent  to  the  process
     whose process ID is equal to pid.  pid may equal 1.

     If pid is negative but not (pidt)-1, sig will  be  sent  to
     all  processes  whose process group ID is equal to the abso-
     lute value of pid and for which the process  has  permission
     to send a signal.

     If pid is 0, sig will be sent  to  all  processes  excluding
     proc0  and proc1 whose process group ID is equal to the pro-
     cess group ID of the sender.  Permission is needed to send a
     signal to process groups.

     If pid is (pidt)-1 and the effective user ID of the  sender
     is  not superuser, sig will be sent to all processes exclud-
     ing proc0 and proc1 whose real  user  ID  is  equal  to  the
     effective user ID of the sender.

     If pid is (pidt)-1 and the effective user ID of the  sender
     is  superuser,  sig  will be sent to all processes excluding
     proc0 and proc1.





                                                                1





kill(2)                   SYSTEM CALLS                    kill(2)



     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 (pidt)1 (i.e., pid
                    specifies proc1).

     ESRCH          No process or  process  group  can  be  found
                    corresponding to that specified by pid.

     EPERM          The user ID of the  sending  process  is  not
                    privileged, and its real or effective user ID
                    does not match the real or saved user  ID  of
                    the  receiving  process, and the calling pro-
                    cess is not sending SIGCONT to a process that
                    shares the same session ID.

SEE ALSO
     getpid(2), intro(2), setpgrp(2), signal(2), getsid(2),  sig-
     send(2), sigaction(2).
     kill(1) in the User's Reference Manual.

NOTES
     sigsend  is  a  more  versatile  way  to  send  signals   to
     processes.  The user is encouraged to use sigsend instead of
     kill.

DIAGNOSTICS
     Upon successful completion, a value of 0 is returned.   Oth-
     erwise,  a value of -1 is returned and errno is set to indi-
     cate the error.























                                                                2



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