Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ exit(S) — OpenDesktop Software Development System 3.0.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

acct(S)

Intro(S)

plock(S)

semop(S)

signal(S)

sigset(S)

wait(S)


 exit(S)                        6 January 1993                        exit(S)


 Name

    exit, _exit - terminate process

 Syntax


    cc  . . .  -lc


    #include  <stdlib.h>

    void exit (status)
    int status;

    void _exit (status)
    int status;


 Description

    The exit system call terminates the calling process with the following
    consequences:

    All of the file descriptors open in the calling process are closed.

    If the parent process of the calling process is executing a wait, it is
    notified of the calling process's termination and the low order eight
    bits (that is, bits 0377) of status are made available to it (see
    wait(S)).

    If the parent process of the calling process is not executing a wait, the
    calling process is transformed into a zombie process.  A zombie process
    is a process that only occupies a slot in the process table.  It has no
    other space allocated either in user or kernel space.  The process table
    slot that it occupies is partially overlaid with time accounting informa-
    tion (see <sys/proc.h>) to be used by times.

    The parent process ID of all of the calling processes' existing child
    processes and zombie processes is set to 1.  This means the initializa-
    tion process (see Intro(S)) inherits each of these processes.

    Each attached shared memory segment is detached and the value of
    shmnattach in the data structure associated with its shared memory iden-
    tifier is decremented by 1.

    For each semaphore for which the calling process has set a semadj value
    (see semop(S)), that semadj value is added to the semval of the specified
    semaphore.

    If the process has a process, text, or data lock, an unlock is performed
    (see plock(S)).

    An accounting record is written on the accounting file if the system's
    accounting routine is enabled (see acct(S)).

    If the process ID, tty group ID, and process group ID of the calling pro-
    cess are equal, the SIGHUP signal is sent to each process that has a pro-
    cess group ID equal to that of the calling process.

    A death of child signal is sent to the parent.

    The C function exit may cause cleanup actions before the process exits.
    The function exit circumvents all cleanup.

 See also

    acct(S), Intro(S), plock(S), semop(S), signal(S), sigset(S), wait(S)

 Diagnostics

    None.  There can be no return from an exit system call.

 Standards conformance

    exit is conformant with:
    X/Open Portability Guide, Issue 3, 1989;
    IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C
    Language] (ISO/IEC 9945-1);
    and NIST FIPS 151-1.

    exit is conformant with:
    X/Open Portability Guide, Issue 3, 1989;
    ANSI X3.159-1989 Programming Language -- C;
    IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C
    Language] (ISO/IEC 9945-1);
    and NIST FIPS 151-1.


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