Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ exit(2) — NEWS-os 5.0.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

acct(2)

intro(2)

plock(2)

semop(2)

sigaction(2)

nal(2)

times(2)

wait(2)

atexit(3C)



exit(2)                   SYSTEM CALLS                    exit(2)



NAME
     exit, exit - terminate process

SYNOPSIS
     #include <stdlib.h>

     void exit(int status);

     #include <unistd.h>

     void exit(int status);

DESCRIPTION
     exit terminates the  calling  process  with  the  following
     consequences:

          All of the file descriptors, directory streams and mes-
          sage  catalogue descriptors open in the calling process
          are closed.

          A SIGCHLD signal  is  sent  to  the  calling  process's
          parent process.

          If the parent process of the calling  process  has  not
          specified the SANOCLDWAIT flag [see sigaction(2)], the
          calling process is transformed  into  a  ``zombie  pro-
          cess.''   A zombie process is a process that only occu-
          pies 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  over-
          laid    with    time    accounting   information   [see
          <sys/proc.h>] to be used by the times system call.

          The parent process ID of all of the  calling  process's
          existing  child  processes  and zombie processes is set
          to 1.   This  means  the  initialization  process  [see
          intro(2)] 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 identifier is decremented by 1.

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

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



                                                                1





exit(2)                   SYSTEM CALLS                    exit(2)



          If the process is a controlling process, SIGHUP is sent
          to the foreground process group of its controlling ter-
          minal and its controlling terminal is deallocated.

          If the calling process has any stopped  children  whose
          process group will be orphaned when the calling process
          exits, or if the calling process is a member of a  pro-
          cess  group that will be orphaned when the calling pro-
          cess exits, that process group will be sent SIGHUP  and
          SIGCONT signals.

     The C  function  exit(3C)  calls  any  functions  registered
     through  the  atexit  function in the reverse order of their
     registration.  The function exit circumvents all such func-
     tions and cleanup.

     The symbols EXITSUCCESS and  EXITFAILURE  are  defined  in
     stdlib.h  and may be used as the value of status to indicate
     successful or unsuccessful termination, respectively.

SEE ALSO
     acct(2), intro(2), plock(2),  semop(2),  sigaction(2),  sig-
     nal(2), times(2), wait(2), atexit(3C).

NOTES
     See signal(2) NOTES.





























                                                                2



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