IPB
>  Man Pages > Unix > Solaris 10 11/06 > Section 2 > exit man page

exit man page

Section 2 - Solaris 10 11/06 Man Pages

Other operating system man pages available here


Advanced Search

Hopefully, this page is exactly what you are looking for, but if not, you can always find further assistance on Unix/Linux Forum!





System Calls                                              exit(2)



NAME
     exit, _Exit, _exit - terminate process

SYNOPSIS
     #include <stdlib.h>

     void exit(int status);

     void _Exit(int status);

     #include <unistd.h>

     void _exit(int status);

DESCRIPTION
     The exit() function first calls all functions registered  by
     atexit(3C),  in  the  reverse  order  of their registration,
     except that  a  function  is  called  after  any  previously
     registered  functions  that  had  already been called at the
     time it was registered. Each  function  is  called  as  many
     times  as it was registered. If, during the call to any such
     function, a call to the longjmp(3C) function  is  made  that
     would  terminate  the  call  to the registered function, the
     behavior is undefined.

     If a function registered by a call to  atexit(3C)  fails  to
     return,  the  remaining  registered functions are not called
     and the rest of the exit() processing is not  completed.  If
     exit() is called more than once, the effects are undefined.

     The exit() function  then  flushes  all  open  streams  with
     unwritten  buffered  data,  closes  all  open  streams,  and
     removes all files created by tmpfile(3C).

     The  _Exit()  and   _exit()   functions   are   functionally
     equivalent.  They  do  not  call  functions  registered with
     atexit(), do not call any registered signal handlers, and do
     not flush open streams.

     The _exit(), _Exit(), and  exit()  functions  terminate  the
     calling process with the following consequences:

       o  All of the file descriptors, directory streams, conver-
          sion descriptors and message catalogue descriptors open
          in the calling process are closed.

       o  If the parent process of the calling process is execut-
          ing  a  wait(3C), wait3(3C), waitid(2), or waitpid(3C),
          and has neither  set  its  SA_NOCLDWAIT  flag  nor  set
          SIGCHLD  to  SIG_IGN,  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



SunOS 5.10          Last change: 10 Dec 2003                    1






System Calls                                              exit(2)



          it.  If the parent is not waiting, the  child's  status
          will  be  made  available  to it when the parent subse-
          quently executes wait(), wait3(),  waitid(),  or  wait-
          pid().

       o  If the parent process of the  calling  process  is  not
          executing  a  wait(),  wait3(), waitid(), or waitpid(),
          and has not set its SA_NOCLDWAIT flag, or  set  SIGCHLD
          to  SIG_IGN,  the calling process is transformed into a
          zombie process. A zombie process is an inactive process
          and  it  will  be  deleted  at some later time when its
          parent process executes wait(), wait3(),  waitid(),  or
          waitpid(). A zombie process 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
          information  (see  <sys/proc.h>)  to  be  used  by  the
          times(2) function.

       o  Termination of a process does  not  directly  terminate
          its  children.  The  sending  of  a  SIGHUP  signal  as
          described below indirectly terminates children in  some
          circumstances.

       o  A SIGCHLD will be sent to the parent process.

       o  The parent process ID of all of the  calling  process's
          existing child processes and zombie processes is set to
          1. That is, these processes are inherited by  the  ini-
          tialization process (see intro(2)).

       o  Each mapped memory object is unmapped.

       o  Each attached shared-memory segment is detached and the
          value  of shm_nattch (see shmget(2)) in the data struc-
          ture associated with its shared  memory  ID  is  decre-
          mented by 1.

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

       o  If the process is a  controlling  process,  the  SIGHUP
          signal  will  be sent to each process in the foreground
          process group of the controlling terminal belonging  to
          the calling process.

       o  If the process is a controlling process,  the  control-
          ling terminal associated with the session is disassoci-
          ated from the session, allowing it to be acquired by  a
          new controlling process.




SunOS 5.10          Last change: 10 Dec 2003                    2






System Calls                                              exit(2)



       o  If the exit of the process causes a  process  group  to
          become  orphaned,  and  if  any  member  of  the newly-
          orphaned process group is stopped, then a SIGHUP signal
          followed  by a SIGCONT signal will be sent to each pro-
          cess in the newly-orphaned process group.

       o  If the parent process has set its SA_NOCLDWAIT flag, or
          set  SIGCHLD  to SIG_IGN, the status will be discarded,
          and the  lifetime  of  the  calling  process  will  end
          immediately.

       o  If the process has process,  text  or  data  locks,  an
          UNLOCK is performed (see plock(3C) and memcntl(2)).

       o  All open named semaphores in the process are closed  as
          if  by  appropriate  calls  to sem_close(3RT). All open
          message queues in the  process  are  closed  as  if  by
          appropriate  calls  to  mq_close(3RT).  Any outstanding
          asynchronous I/O operations may be cancelled.

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

       o  An  extended  accounting  record  is  written  to   the
          extended   process  accounting  file  if  the  system's
          extended process accounting facility  is  enabled  (see
          acctadm(1M)).

       o  If the current process is the last process  within  its
          task  and  if  the  system's  extended  task accounting
          facility is  enabled  (see  acctadm(1M)),  an  extended
          accounting  record  is  written  to  the  extended task
          accounting file.


RETURN VALUES
     These functions do not return.

ERRORS
     No errors are defined.

USAGE
     Normally applications should use exit() rather than _exit().

ATTRIBUTES
     See attributes(5) for descriptions of the  following  attri-
     butes:







SunOS 5.10          Last change: 10 Dec 2003                    3






System Calls                                              exit(2)



     ____________________________________________________________
    |       ATTRIBUTE TYPE        |       ATTRIBUTE VALUE       |
    |_____________________________|_____________________________|
    | Interface Stability         | Standard                    |
    |_____________________________|_____________________________|
    | MT-Level                    | See below.                  |
    |_____________________________|_____________________________|


     The _exit() and _Exit() functions are Async-Signal-Safe.

SEE ALSO
     acctadm(1M),  intro(2),   acct(2),   close(2),   memcntl(2),
     semop(2),   shmget(2),  sigaction(2),  times(2),  waitid(2),
     atexit(3C),    fclose(3C),     mq_close(3RT),     plock(3C),
     signal.h(3HEAD),     tmpfile(3C),    wait(3C),    wait3(3C),
     waitpid(3C), attributes(5), standards(5)






































SunOS 5.10          Last change: 10 Dec 2003                    4





Man(1) output converted with man2html and wrapped by fishsponge

This page was generated on Wed Sep 12 21:37:21 GMT 2007

Your favourite pages:

No pages logged yet.
Trying to save cookie...

Top 10 most popular pages:

sqlite3 man page (4765 hits)
(openSUSE 10.2)

adv_cap_autoneg man page (4617 hits)
(Solaris 10 11_06)

CPAN man page (4352 hits)
(Suse Linux 10.1)

ssh man page (4196 hits)
(Suse Linux 10.1)

svn man page (3410 hits)
(FreeBSD 6.2)

startproc man page (1957 hits)
(Suse Linux 10.1)

pprosetup man page (1745 hits)
(Solaris 10 11_06)

netcat man page (1697 hits)
(Suse Linux 10.1)

signal man page (1686 hits)
(Suse Linux 10.1)

ssh-socks5-proxy-connect man page (1661 hits)
(Solaris 10 11_06)

Useful Links

Go Back

Visitor Statistics


Valid XHTML 1.0 Transitional     Valid CSS!

Partners: Cambridge Plus :: Pyrenees Area :: PIC Project Development :: <Link Available>
Unix Man Pages / Linux Man Pages :: HiFi Forum :: SIP VoIP Phone & Provider Reviews :: UNIX/Linux Forum Archives

More info on advertising on Unix/Linux Forum