VMS Help  —  CRTL  kill
    Sends a signal to the process specified by a process ID.

    Format

      #include  <signal.h>

      int kill  (int pid, int sig);

1  –  Arguments

 pid

    The process ID.

 sig

    The signal code.

2  –  Description

    The kill function is restricted to C and C++ programs that
    include the main function.

    The kill function sends a signal to a process, as if the process
    had called raise. If the signal is not trapped or ignored by the
    target program, the program exits.

    OpenVMS VAX and Alpha implement different rules about what
    process you are allowed to send signals to. A program always has
    privileges to send a signal to a child started with vfork/exec.
    For other processes, the results are determined by the OpenVMS
    security model for your system.

    Because of an OpenVMS restriction, the kill function cannot
    deliver a signal to a target process that runs an image installed
    with privileges.

    Unless you have system privileges, the sending and receiving
    processes must have the same user identification code (UIC).

    On OpenVMS systems before Version 7.0, kill treats a signal value
    of 0 as if SIGKILL were specified.

    For OpenVMS Version 7.0 and higher systems, if you include
    <stdlib.h> and compile with the _POSIX_EXIT feature-test macro
    set, then:

    o  If the signal value is 0, kill validates the process ID but
       does not send any signals.

    o  If the process ID is not valid, kill returns -1 and sets errno
       to ESRCH.

3  –  Return Values

    0                  Indicates that kill was successfully queued.
    -1                 Indicates errors. The receiving process may
                       have a different UIC and you are not a system
                       user, or the receiving process does not exist.
Close Help