Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ kill(2) — AIX/RT 2.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

getpid, getpgrp, getppid

setpgrp

signal

kill

     kill

Purpose

     Sends a signal to a process or to a group of processes.

Syntax

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

Description

     The kill  system call sends  the signal specified  by the
     sig parameter to the process or  group of processes spec-
     ified  by the  pid parameter.  (For information  on valid
     signals, see  "signal.") If the  sig parameter is  0 (the
     null signal),  error checking is performed  but no signal
     is sent.  This can be used to check the validity of pid.

     To send a signal to another  process, at least one of the
     following must be true:

     o   Either  the real  or  the effective  user  ID of  the
         sending process matches the real or effective user ID
         of the receiving process.
     o   The  effective  user ID  of  the  sending process  is
         superuser.

     The  processes that  have the  process  IDs 0  and 1  are
     special processes  and are sometimes referred  to here as
     proc0 and proc1, respectively.

     If the pid parameter is greater than 0, the signal speci-
     fied by  the sig parameter  is sent to the  process whose
     process ID is equal to the value of the pid parameter.

     If the pid parameter is  equal to 0, the signal specified
     by the  sig parameter  is sent to  all of  the processes,
     excluding  proc0 and  proc1,  whose process  group ID  is
     equal to the process group ID of the sender.

     If the  pid parameter  is equal to  -1 and  the effective
     user ID of the sender is not superuser, the signal speci-
     fied by  the sig parameter  is sent  to all of  the proc-
     esses, excluding proc0  and proc1, whose real  user ID is
     equal to the effective user ID of the sender.

     If the  pid parameter  is equal to  -1 and  the effective
     user ID of the sender  is superuser, the signal specified
     by the  sig parameter  is sent to  all of  the processes,
     excluding proc0 and proc1.

     If the pid  parameter is negative but not  -1, the signal
     specified  by the  sig parameter  is sent  to all  of the

     processes whose process group ID is equal to the absolute
     value of the pid parameter.

Return Value

     Upon successful  completion, kill  returns a value  of 0.
     If kill fails, a value of -1 is returned and errno is set
     to indicate the error.

Diagnostics

     The kill system  call fails and no signal is  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
                superuser, and  the real or effective  user ID
                does not  match the real or  effective user ID
                of the receiving process.

Related Information

     In  this book:   "getpid, getpgrp,  getppid,"  "setpgrp,"
     and "signal."

     The kill command in  AIX Operating System Commands Refer-
     ence.

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