Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

acct(2)

atexit(2)

intro(2)

setpgrp(2)

setpgid(2)

sigaction(2)

signal(2)

times(2)

wait(2)

wait2(2)

waitpid(2)



  exit(2)                             CLIX                             exit(2)



  NAME

    exit, _exit - Terminates a process

  LIBRARY

    Standard C Library (libc.a)

  SYNOPSIS

    void exit(
      int status );

    void _exit(
      int status );

  PARAMETERS

    status   Indicates the status of the process.

  DESCRIPTION

    The exit() function terminates the calling process with the following
    consequences:

    ⊕  All file and socket descriptors open in the calling process are closed.

    ⊕  If the parent process is not running a wait() or waitpid() function
       when the child process terminates, it may still do so later on, and the
       child's status will be returned to it at that time.  Meanwhile, the
       child process is transformed into a zombie process.  A zombie process
       is a process that occupies a slot in the process table, but has no
       other space allocated to it either in user or kernel space.

    ⊕  Terminating a process by exiting does not terminate its child
       processes.  The parent process ID of all child processes and zombie
       child processes belonging to the calling process is set to the process
       ID of the initialization process, 1.  The init process thus inherits
       each of these processes.

    ⊕  Each attached shared memory segment is detached and the value of
       shm_nattach in the data structure associated with the segment's shared
       memory identifier is decremented by 1.

    ⊕  For each semaphore for which the calling process has set a semadj value
       (see the semop() function), 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 the plock() function.)




  2/94 - Intergraph Corporation                                              1






  exit(2)                             CLIX                             exit(2)



    ⊕  An accounting record is written on the accounting file if the system
       accounting routine is enabled.  (See the acct() function.)

    ⊕  If the process is a controlling process, the SIGHUP signal is sent to
       each process that has a process group ID equal to that of the calling
       process.

    ⊕  If a child or sibling of the calling process was stopped due to a stop
       signal (see the signal() function), the child or sibling will be sent
       the SIGCONT and SIGHUP signals.

    ⊕  A death of child signal is sent to the parent.

    ⊕  If the calling process is a process group leader (see the setpgrp() or
       setpgid() function) and has a controlling terminal with a tty group ID
       that does not match the caller's process group ID, the signal SIGHUP
       will be sent to each process that has a process group ID equal to the
       tty group ID or the caller's process group ID.

    ⊕  If the calling process is a process group leader that has a controlling
       terminal, read and write permission will be removed for all processes
       that have this controlling terminal open.

    ⊕  Any outstanding XIO requests will be canceled and the associated
       resources will be deallocated.

    ⊕  Any areas of memory locked using the vlock() function will be unlocked.

    ⊕  The C exit() function may cause cleanup actions before the process
       exits.  The _exit() function circumvents all cleanup.

  EXAMPLES

    To terminate the calling process with the normal exit status 0:

    exit(0);


  RETURN VALUES

    The exit() and _exit() functions do not return.

  RELATED INFORMATION

    Functions:  acct(2), atexit(2), intro(2), setpgrp(2), setpgid(2),
    sigaction(2), signal(2), times(2), wait(2), wait2(2), waitpid(2)








  2                                              Intergraph Corporation - 2/94




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