EXIT(3)                    Linux Programmer's Manual                   EXIT(3)

       exit - cause normal process termination

       #include <stdlib.h>

       void exit(int status);


       as many times as it was registered.

       tmpfile(3) are removed.

       The  C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE,
       termination, respectively.

       The exit() function does not return.

       For  an  explanation  of  the  terms  used  in  this  section,  see at-

       |Interface | Attribute     | Value               |
       |exit()    | Thread safety | MT-Unsafe race:exit |
       The exit() function uses a global variable that is not protected, so it
       is not thread-safe.


       The  behavior  is  undefined  if  one of the functions registered using
       a  call  to execve(2) removes registrations created using atexit(3) and

       The use of EXIT_SUCCESS and EXIT_FAILURE is slightly more portable  (to
       non-UNIX  environments) than the use of 0 and some nonzero value like 1


       process.  There are three cases:

       o  If  the  parent has set SA_NOCLDWAIT, or has set the SIGCHLD handler
          to SIG_IGN, the status is discarded and the child dies immediately.

       o  If the parent was waiting on the child, it is notified of  the  exit
          status and the child dies immediately.

       o  Otherwise, the child becomes a "zombie" process: most of the process
          resources are recycled, but a slot  containing  minimal  information
          about  the child process (termination status, resource usage statis-
          tics) is retained in process table.  This allows the parent to  sub-
          sequently  use waitpid(2) (or similar) to learn the termination sta-
          tus of the child; at that point the zombie process slot is released.

       If the implementation supports the SIGCHLD signal, this signal is  sent
       whether a SIGCHLD signal is sent.

   Signals sent to other processes
       If the exiting process is a session leader and its controlling terminal
       foreground process group of this controlling terminal is sent a  SIGHUP
       signal,  and  the terminal is disassociated from this session, allowing
       it to be acquired by a new controlling process.

       orphaned process groups.

       Except in the above cases, where the signalled processes may  be  chil-
       dren  of  the terminating process, termination of a process does not in
       general cause a signal to be sent to children of  that  process.   How-
       ever,  a process can use the prctl(2) PR_SET_PDEATHSIG operation to ar-
       range that it receives a signal if its parent terminates.

       on_exit(3), tmpfile(3)

       description of the project, information about reporting bugs,  and  the
       latest     version     of     this    page,    can    be    found    at

Linux                             2017-09-15                           EXIT(3)

Man(1) output converted with man2html
list of all man pages