unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (SunOS-4.1.3)
Page:
Section:
Apropos / Subsearch:
optional field

EXIT(2V)                                                              EXIT(2V)



NAME
       _exit - terminate a process

SYNOPSIS
       void _exit(status)
       int status;

DESCRIPTION
       _exit() terminates a process with the following consequences:

       All  of  the  descriptors open in the calling process are closed.  This
       may entail delays, for example, waiting for output to drain; a  process
       in this state may not be killed, as it is already dying.

       If  the  parent process of the calling process is executing a wait() or
       waitpid(), or is interested in the SIGCHLD signal, then it is  notified
       of  the  calling  process's termination and the low-order eight bits of
       status are made available to it (see wait(2V)).

       If the parent process of the calling process is not executing a  wait()
       or waitpid(), status is saved for return to the parent process whenever
       the parent process executes an appropriate subsequent wait()  or  wait-
       pid().

       The  parent  process  ID of all of the calling process's existing child
       processes are also set  to  1.   This  means  that  the  initialization
       process  (see  intro(2)) inherits each of these processes as well.  Any
       stopped children are restarted with a hangup signal (SIGHUP).

       If the process is a controlling process, SIGHUP is sent to each process
       in  the  foreground process group of the controlling terminal belonging
       to the calling process, and the controlling  terminal  associated  with
       the  session  is  disassociated  from  the  session,  allowing it to be
       acquired by a new controlling process (see setsid(2V)).

       If _exit() causes a process group to become orphaned, and if any member
       of the newly-orphaned process group is stopped, then SIGHUP followed by
       SIGCONT is sent to each process in  the  newly-orphaned  process  group
       (see setpgid(2V)).

       Each  attached  shared  memory  segment  is  detached  and the value of
       shm_nattach 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  speci-
       fied semaphore.

       If  process  accounting is enabled (see acct(2V)), an accounting record
       is written to the accounting file.

       Most C programs will call the library routine  exit(3)  which  performs
       cleanup actions in the standard I/O library before calling _exit().

RETURN VALUES
       _exit() never returns.

SEE ALSO
       intro(2), acct(2V), fork(2V), semop(2), wait(2V), exit(3)



                                21 January 1990                       EXIT(2V)