annotate _exit.html @ 7330:0eae4b049f93

<oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
author HackBot
date Thu, 31 Mar 2016 09:29:40 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7330
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
2 <html>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
3 <head>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
4 <meta name="generator" content="HTML Tidy, see www.w3.org">
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
5 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
6 <link type="text/css" rel="stylesheet" href="style.css">
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
7 <!-- Generated by The Open Group's rhtm tool v1.2.1 -->
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
8 <!-- Copyright (c) 2001-2004 IEEE and The Open Group, All Rights Reserved -->
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
9 <title>exit</title>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
10 </head>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
11 <body bgcolor="white">
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
12 <script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
13 </script>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
14
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
15 <basefont size="3"> <a name="exit"></a> <a name="tag_03_131"></a><!-- exit -->
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
16 <!--header start-->
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
17 <center><font size="2">The Open Group Base Specifications Issue 6<br>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
18 IEEE Std 1003.1, 2004 Edition<br>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
19 Copyright &copy; 2001-2004 The IEEE and The Open Group, All Rights reserved.</font></center><center><font color="red">A newer edition of this document exists <a href="http://pubs.opengroup.org/onlinepubs/9699919799/" target="_parent">here</a></font></center>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
20
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
21 <!--header end-->
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
22 <hr size="2" noshade>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
23 <h4><a name="tag_03_131_01"></a>NAME</h4>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
24
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
25 <blockquote>exit, _Exit, _exit - terminate a process</blockquote>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
26
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
27 <h4><a name="tag_03_131_02"></a>SYNOPSIS</h4>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
28
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
29 <blockquote class="synopsis">
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
30 <p><code><tt>#include &lt;<a href="../basedefs/stdlib.h.html">stdlib.h</a>&gt;<br>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
31 <br>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
32 void exit(int</tt> <i>status</i><tt>);<br>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
33 void _Exit(int</tt> <i>status</i><tt>);<br>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
34 <br>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
35 <br>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
36 #include &lt;<a href="../basedefs/unistd.h.html">unistd.h</a>&gt;<br>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
37 void _exit(int</tt> <i>status</i><tt>);<br>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
38 </tt></code></p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
39 </blockquote>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
40
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
41 <h4><a name="tag_03_131_03"></a>DESCRIPTION</h4>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
42
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
43 <blockquote>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
44 <p>For <i>exit</i>() and <i>_Exit</i>(): <sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src=
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
45 "../images/opt-start.gif" alt="[Option Start]" border="0"> The functionality described on this reference page is aligned with the
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
46 ISO&nbsp;C standard. Any conflict between the requirements described here and the ISO&nbsp;C standard is unintentional. This volume
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
47 of IEEE&nbsp;Std&nbsp;1003.1-2001 defers to the ISO&nbsp;C standard. <img src="../images/opt-end.gif" alt="[Option End]" border=
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
48 "0"></p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
49
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
50 <p>The value of <i>status</i> may be 0, EXIT_SUCCESS, EXIT_FAILURE, <sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
51 src="../images/opt-start.gif" alt="[Option Start]" border="0"> &nbsp;or any other value, though only the least significant 8 bits
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
52 (that is, <i>status</i> &amp; 0377) shall be available to a waiting parent process. <img src="../images/opt-end.gif" alt=
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
53 "[Option End]" border="0"></p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
54
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
55 <p>The <i>exit</i>() function shall first call all functions registered by <a href="../functions/atexit.html"><i>atexit</i>()</a>,
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
56 in the reverse order of their registration, except that a function is called after any previously registered functions that had
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
57 already been called at the time it was registered. Each function is called as many times as it was registered. If, during the call
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
58 to any such function, a call to the <a href="../functions/longjmp.html"><i>longjmp</i>()</a> function is made that would terminate
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
59 the call to the registered function, the behavior is undefined.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
60
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
61 <p>If a function registered by a call to <a href="../functions/atexit.html"><i>atexit</i>()</a> fails to return, the remaining
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
62 registered functions shall not be called and the rest of the <i>exit</i>() processing shall not be completed. If <i>exit</i>() is
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
63 called more than once, the behavior is undefined.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
64
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
65 <p>The <i>exit</i>() function shall then flush all open streams with unwritten buffered data, close all open streams, and remove
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
66 all files created by <a href="../functions/tmpfile.html"><i>tmpfile</i>()</a>. Finally, control shall be terminated with the
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
67 consequences described below.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
68
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
69 <p><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> The
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
70 <i>_Exit</i>() and <i>_exit</i>() functions shall be functionally equivalent. <img src="../images/opt-end.gif" alt="[Option End]"
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
71 border="0"></p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
72
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
73 <p>The <i>_Exit</i>() <sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt=
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
74 "[Option Start]" border="0"> &nbsp;and <i>_exit</i>() <img src="../images/opt-end.gif" alt="[Option End]" border="0"> functions
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
75 shall not call functions registered with <a href="../functions/atexit.html"><i>atexit</i>()</a> nor any registered signal handlers.
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
76 Whether open streams are flushed or closed, or temporary files are removed is implementation-defined. Finally, the calling process
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
77 is terminated with the consequences described below.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
78
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
79 <p>These functions shall terminate the calling process <sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src=
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
80 "../images/opt-start.gif" alt="[Option Start]" border="0"> &nbsp;with the following consequences: <img src="../images/opt-end.gif"
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
81 alt="[Option End]" border="0"> <basefont size="2"></p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
82
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
83 <dl>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
84 <dt><b>Note:</b></dt>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
85
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
86 <dd>These consequences are all extensions to the ISO&nbsp;C standard and are not further CX shaded. However, XSI extensions are
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
87 shaded.</dd>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
88 </dl>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
89
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
90 <basefont size="3">
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
91
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
92 <ul>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
93 <li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
94 <p>All of the file descriptors, directory streams, <sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src=
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
95 "../images/opt-start.gif" alt="[Option Start]" border="0"> &nbsp;conversion descriptors, and message catalog descriptors <img src=
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
96 "../images/opt-end.gif" alt="[Option End]" border="0"> &nbsp;open in the calling process shall be closed.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
97 </li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
98
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
99 <li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
100 <p>If the parent process of the calling process is executing a <a href="../functions/wait.html"><i>wait</i>()</a> or <a href=
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
101 "../functions/waitpid.html"><i>waitpid</i>()</a>, <sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src=
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
102 "../images/opt-start.gif" alt="[Option Start]" border="0"> &nbsp;and has neither set its SA_NOCLDWAIT flag nor set SIGCHLD to
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
103 SIG_IGN, <img src="../images/opt-end.gif" alt="[Option End]" border="0"> it shall be notified of the calling process' termination
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
104 and the low-order eight bits (that is, bits 0377) of <i>status</i> shall be made available to it. If the parent is not waiting, the
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
105 child's status shall be made available to it when the parent subsequently executes <a href=
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
106 "../functions/wait.html"><i>wait</i>()</a> or <a href="../functions/waitpid.html"><i>waitpid</i>()</a>.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
107
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
108 <p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
109 The semantics of the <a href="../functions/waitid.html"><i>waitid</i>()</a> function shall be equivalent to <a href=
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
110 "../functions/wait.html"><i>wait</i>()</a>. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
111 </li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
112
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
113 <li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
114 <p>If the parent process of the calling process is not executing a <a href="../functions/wait.html"><i>wait</i>()</a> or <a href=
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
115 "../functions/waitpid.html"><i>waitpid</i>()</a>, <sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src=
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
116 "../images/opt-start.gif" alt="[Option Start]" border="0"> &nbsp;and has neither set its SA_NOCLDWAIT flag nor set SIGCHLD to
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
117 SIG_IGN, <img src="../images/opt-end.gif" alt="[Option End]" border="0"> the calling process shall be transformed into a <i>zombie
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
118 process</i>. A <i>zombie process</i> is an inactive process and it shall be deleted at some later time when its parent process
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
119 executes <a href="../functions/wait.html"><i>wait</i>()</a> or <a href="../functions/waitpid.html"><i>waitpid</i>()</a>.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
120
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
121 <p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
122 The semantics of the <a href="../functions/waitid.html"><i>waitid</i>()</a> function shall be equivalent to <a href=
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
123 "../functions/wait.html"><i>wait</i>()</a>. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
124 </li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
125
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
126 <li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
127 <p>Termination of a process does not directly terminate its children. The sending of a SIGHUP signal as described below indirectly
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
128 terminates children in some circumstances.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
129 </li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
130
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
131 <li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
132 <p>Either:</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
133
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
134 <p>If the implementation supports the SIGCHLD signal, a SIGCHLD shall be sent to the parent process.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
135
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
136 <p>Or:</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
137
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
138 <p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
139 If the parent process has set its SA_NOCLDWAIT flag, or set SIGCHLD to SIG_IGN, the status shall be discarded, and the lifetime of
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
140 the calling process shall end immediately. If SA_NOCLDWAIT is set, it is implementation-defined whether a SIGCHLD signal is sent to
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
141 the parent process. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
142 </li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
143
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
144 <li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
145 <p>The parent process ID of all of the calling process' existing child processes and zombie processes shall be set to the process
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
146 ID of an implementation-defined system process. That is, these processes shall be inherited by a special system process.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
147 </li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
148
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
149 <li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
150 <p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
151 Each attached shared-memory segment is detached and the value of <i>shm_nattch</i> (see <a href=
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
152 "../functions/shmget.html"><i>shmget</i>()</a>) in the data structure associated with its shared memory ID shall be decremented by
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
153 1. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
154 </li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
155
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
156 <li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
157 <p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
158 For each semaphore for which the calling process has set a <i>semadj</i> value (see <a href="semop.html"><i>semop</i>()</a> ), that
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
159 value shall be added to the <i>semval</i> of the specified semaphore. <img src="../images/opt-end.gif" alt="[Option End]" border=
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
160 "0"></p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
161 </li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
162
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
163 <li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
164 <p>If the process is a controlling process, the SIGHUP signal shall be sent to each process in the foreground process group of the
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
165 controlling terminal belonging to the calling process.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
166 </li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
167
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
168 <li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
169 <p>If the process is a controlling process, the controlling terminal associated with the session shall be disassociated from the
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
170 session, allowing it to be acquired by a new controlling process.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
171 </li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
172
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
173 <li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
174 <p>If the exit of the process causes a process group to become orphaned, and if any member of the newly-orphaned process group is
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
175 stopped, then a SIGHUP signal followed by a SIGCONT signal shall be sent to each process in the newly-orphaned process group.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
176 </li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
177
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
178 <li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
179 <p><sup>[<a href="javascript:open_code('SEM')">SEM</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
180 All open named semaphores in the calling process shall be closed as if by appropriate calls to <a href=
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
181 "../functions/sem_close.html"><i>sem_close</i>()</a>. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
182 </li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
183
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
184 <li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
185 <p><sup>[<a href="javascript:open_code('ML')">ML</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> Any
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
186 memory locks established by the process via calls to <a href="../functions/mlockall.html"><i>mlockall</i>()</a> or <a href=
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
187 "../functions/mlock.html"><i>mlock</i>()</a> shall be removed. If locked pages in the address space of the calling process are also
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
188 mapped into the address spaces of other processes and are locked by those processes, the locks established by the other processes
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
189 shall be unaffected by the call by this process to <i>_Exit</i>() or <i>_exit</i>(). <img src="../images/opt-end.gif" alt=
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
190 "[Option End]" border="0"></p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
191 </li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
192
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
193 <li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
194 <p><sup>[<a href="javascript:open_code('MF')">MF|SHM</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
195 Memory mappings that were created in the process shall be unmapped before the process is destroyed. <img src=
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
196 "../images/opt-end.gif" alt="[Option End]" border="0"></p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
197 </li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
198
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
199 <li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
200 <p><sup>[<a href="javascript:open_code('TYM')">TYM</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
201 Any blocks of typed memory that were mapped in the calling process shall be unmapped, as if <a href=
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
202 "../functions/munmap.html"><i>munmap</i>()</a> was implicitly called to unmap them. <img src="../images/opt-end.gif" alt=
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
203 "[Option End]" border="0"></p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
204 </li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
205
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
206 <li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
207 <p><sup>[<a href="javascript:open_code('MSG')">MSG</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
208 All open message queue descriptors in the calling process shall be closed as if by appropriate calls to <a href=
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
209 "../functions/mq_close.html"><i>mq_close</i>()</a>. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
210 </li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
211
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
212 <li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
213 <p><sup>[<a href="javascript:open_code('AIO')">AIO</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
214 Any outstanding cancelable asynchronous I/O operations may be canceled. Those asynchronous I/O operations that are not canceled
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
215 shall complete as if the <i>_Exit</i>() or <i>_exit</i>() operation had not yet occurred, but any associated signal notifications
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
216 shall be suppressed. The <i>_Exit</i>() or <i>_exit</i>() operation may block awaiting such I/O completion. Whether any I/O is
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
217 canceled, and which I/O may be canceled upon <i>_Exit</i>() or <i>_exit</i>(), is implementation-defined. <img src=
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
218 "../images/opt-end.gif" alt="[Option End]" border="0"></p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
219 </li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
220
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
221 <li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
222 <p>Threads terminated by a call to <i>_Exit</i>() or <i>_exit</i>() shall not invoke their cancellation cleanup handlers or
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
223 per-thread data destructors.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
224 </li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
225
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
226 <li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
227 <p><sup>[<a href="javascript:open_code('TRC')">TRC</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
228 If the calling process is a trace controller process, any trace streams that were created by the calling process shall be shut down
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
229 as described by the <a href="../functions/posix_trace_shutdown.html"><i>posix_trace_shutdown</i>()</a> function, and any process'
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
230 mapping of trace event names to trace event type identifiers built for these trace streams may be deallocated. <img src=
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
231 "../images/opt-end.gif" alt="[Option End]" border="0"></p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
232 </li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
233 </ul>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
234 </blockquote>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
235
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
236 <h4><a name="tag_03_131_04"></a>RETURN VALUE</h4>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
237
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
238 <blockquote>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
239 <p>These functions do not return.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
240 </blockquote>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
241
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
242 <h4><a name="tag_03_131_05"></a>ERRORS</h4>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
243
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
244 <blockquote>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
245 <p>No errors are defined.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
246 </blockquote>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
247
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
248 <hr>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
249 <div class="box"><em>The following sections are informative.</em></div>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
250
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
251 <h4><a name="tag_03_131_06"></a>EXAMPLES</h4>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
252
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
253 <blockquote>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
254 <p>None.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
255 </blockquote>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
256
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
257 <h4><a name="tag_03_131_07"></a>APPLICATION USAGE</h4>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
258
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
259 <blockquote>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
260 <p>Normally applications should use <i>exit</i>() rather than <i>_Exit</i>() or <i>_exit</i>().</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
261 </blockquote>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
262
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
263 <h4><a name="tag_03_131_08"></a>RATIONALE</h4>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
264
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
265 <blockquote>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
266 <h5><a name="tag_03_131_08_01"></a>Process Termination</h5>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
267
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
268 <p>Early proposals drew a distinction between normal and abnormal process termination. Abnormal termination was caused only by
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
269 certain signals and resulted in implementation-defined &quot;actions&quot;, as discussed below. Subsequent proposals distinguished three
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
270 types of termination: <i>normal termination</i> (as in the current specification), <i>simple abnormal termination</i>, and
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
271 <i>abnormal termination with actions</i>. Again the distinction between the two types of abnormal termination was that they were
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
272 caused by different signals and that implementation-defined actions would result in the latter case. Given that these actions were
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
273 completely implementation-defined, the early proposals were only saying when the actions could occur and how their occurrence could
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
274 be detected, but not what they were. This was of little or no use to conforming applications, and thus the distinction is not made
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
275 in this volume of IEEE&nbsp;Std&nbsp;1003.1-2001.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
276
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
277 <p>The implementation-defined actions usually include, in most historical implementations, the creation of a file named <b>core</b>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
278 in the current working directory of the process. This file contains an image of the memory of the process, together with
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
279 descriptive information about the process, perhaps sufficient to reconstruct the state of the process at the receipt of the
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
280 signal.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
281
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
282 <p>There is a potential security problem in creating a <b>core</b> file if the process was set-user-ID and the current user is not
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
283 the owner of the program, if the process was set-group-ID and none of the user's groups match the group of the program, or if the
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
284 user does not have permission to write in the current directory. In this situation, an implementation either should not create a
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
285 <b>core</b> file or should make it unreadable by the user.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
286
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
287 <p>Despite the silence of this volume of IEEE&nbsp;Std&nbsp;1003.1-2001 on this feature, applications are advised not to create
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
288 files named <b>core</b> because of potential conflicts in many implementations. Some implementations use a name other than
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
289 <b>core</b> for the file; for example, by appending the process ID to the filename.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
290
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
291 <h5><a name="tag_03_131_08_02"></a>Terminating a Process</h5>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
292
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
293 <p>It is important that the consequences of process termination as described occur regardless of whether the process called
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
294 <i>_exit</i>() (perhaps indirectly through <i>exit</i>()) or instead was terminated due to a signal or for some other reason. Note
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
295 that in the specific case of <i>exit</i>() this means that the <i>status</i> argument to <i>exit</i>() is treated in the same way
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
296 as the <i>status</i> argument to <i>_exit</i>().</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
297
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
298 <p>A language other than C may have other termination primitives than the C-language <i>exit</i>() function, and programs written
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
299 in such a language should use its native termination primitives, but those should have as part of their function the behavior of
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
300 <i>_exit</i>() as described. Implementations in languages other than C are outside the scope of this version of this volume of
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
301 IEEE&nbsp;Std&nbsp;1003.1-2001, however.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
302
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
303 <p>As required by the ISO&nbsp;C standard, using <b>return</b> from <i>main</i>() has the same behavior (other than with respect to
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
304 language scope issues) as calling <i>exit</i>() with the returned value. Reaching the end of the <i>main</i>() function has the
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
305 same behavior as calling <i>exit</i>(0).</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
306
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
307 <p>A value of zero (or EXIT_SUCCESS, which is required to be zero) for the argument <i>status</i> conventionally indicates
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
308 successful termination. This corresponds to the specification for <i>exit</i>() in the ISO&nbsp;C standard. The convention is
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
309 followed by utilities such as <a href="../utilities/make.html"><i>make</i></a> and various shells, which interpret a zero status
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
310 from a child process as success. For this reason, applications should not call <i>exit</i>(0) or <i>_exit</i>(0) when they
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
311 terminate unsuccessfully; for example, in signal-catching functions.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
312
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
313 <p>Historically, the implementation-defined process that inherits children whose parents have terminated without waiting on them is
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
314 called <i>init</i> and has a process ID of 1.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
315
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
316 <p>The sending of a SIGHUP to the foreground process group when a controlling process terminates corresponds to somewhat different
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
317 historical implementations. In System V, the kernel sends a SIGHUP on termination of (essentially) a controlling process. In 4.2
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
318 BSD, the kernel does not send SIGHUP in a case like this, but the termination of a controlling process is usually noticed by a
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
319 system daemon, which arranges to send a SIGHUP to the foreground process group with the <i>vhangup</i>() function. However, in 4.2
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
320 BSD, due to the behavior of the shells that support job control, the controlling process is usually a shell with no other processes
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
321 in its process group. Thus, a change to make <i>_exit</i>() behave this way in such systems should not cause problems with existing
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
322 applications.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
323
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
324 <p>The termination of a process may cause a process group to become orphaned in either of two ways. The connection of a process
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
325 group to its parent(s) outside of the group depends on both the parents and their children. Thus, a process group may be orphaned
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
326 by the termination of the last connecting parent process outside of the group or by the termination of the last direct descendant
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
327 of the parent process(es). In either case, if the termination of a process causes a process group to become orphaned, processes
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
328 within the group are disconnected from their job control shell, which no longer has any information on the existence of the process
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
329 group. Stopped processes within the group would languish forever. In order to avoid this problem, newly orphaned process groups
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
330 that contain stopped processes are sent a SIGHUP signal and a SIGCONT signal to indicate that they have been disconnected from
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
331 their session. The SIGHUP signal causes the process group members to terminate unless they are catching or ignoring SIGHUP. Under
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
332 most circumstances, all of the members of the process group are stopped if any of them are stopped.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
333
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
334 <p>The action of sending a SIGHUP and a SIGCONT signal to members of a newly orphaned process group is similar to the action of 4.2
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
335 BSD, which sends SIGHUP and SIGCONT to each stopped child of an exiting process. If such children exit in response to the SIGHUP,
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
336 any additional descendants receive similar treatment at that time. In this volume of IEEE&nbsp;Std&nbsp;1003.1-2001, the signals
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
337 are sent to the entire process group at the same time. Also, in this volume of IEEE&nbsp;Std&nbsp;1003.1-2001, but not in 4.2 BSD,
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
338 stopped processes may be orphaned, but may be members of a process group that is not orphaned; therefore, the action taken at
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
339 <i>_exit</i>() must consider processes other than child processes.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
340
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
341 <p>It is possible for a process group to be orphaned by a call to <a href="../functions/setpgid.html"><i>setpgid</i>()</a> or <a
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
342 href="../functions/setsid.html"><i>setsid</i>()</a>, as well as by process termination. This volume of
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
343 IEEE&nbsp;Std&nbsp;1003.1-2001 does not require sending SIGHUP and SIGCONT in those cases, because, unlike process termination,
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
344 those cases are not caused accidentally by applications that are unaware of job control. An implementation can choose to send
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
345 SIGHUP and SIGCONT in those cases as an extension; such an extension must be documented as required in <a href=
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
346 "../basedefs/signal.h.html"><i>&lt;signal.h&gt;</i></a>.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
347
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
348 <p>The ISO/IEC&nbsp;9899:1999 standard adds the <i>_Exit</i>() function that results in immediate program termination without
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
349 triggering signals or <a href="../functions/atexit.html"><i>atexit</i>()</a>-registered functions. In
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
350 IEEE&nbsp;Std&nbsp;1003.1-2001, this is equivalent to the <i>_exit</i>() function.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
351 </blockquote>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
352
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
353 <h4><a name="tag_03_131_09"></a>FUTURE DIRECTIONS</h4>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
354
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
355 <blockquote>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
356 <p>None.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
357 </blockquote>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
358
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
359 <h4><a name="tag_03_131_10"></a>SEE ALSO</h4>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
360
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
361 <blockquote>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
362 <p><a href="atexit.html"><i>atexit</i>()</a>, <a href="close.html"><i>close</i>()</a>, <a href="fclose.html"><i>fclose</i>()</a>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
363 , <a href="longjmp.html"><i>longjmp</i>()</a>, <a href="posix_trace_shutdown.html"><i>posix_trace_shutdown</i>()</a>, <a href=
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
364 "posix_trace_trid_eventid_open.html"><i>posix_trace_trid_eventid_open</i>()</a>, <a href="semop.html"><i>semop</i>()</a>, <a
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
365 href="shmget.html"><i>shmget</i>()</a>, <a href="sigaction.html"><i>sigaction</i>()</a>, <a href="wait.html"><i>wait</i>()</a>,
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
366 <a href="waitid.html"><i>waitid</i>()</a>, <a href="waitpid.html"><i>waitpid</i>()</a>, the Base Definitions volume of
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
367 IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/stdlib.h.html"><i>&lt;stdlib.h&gt;</i></a>, <a href=
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
368 "../basedefs/unistd.h.html"><i>&lt;unistd.h&gt;</i></a></p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
369 </blockquote>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
370
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
371 <h4><a name="tag_03_131_11"></a>CHANGE HISTORY</h4>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
372
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
373 <blockquote>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
374 <p>First released in Issue 1. Derived from Issue 1 of the SVID.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
375 </blockquote>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
376
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
377 <h4><a name="tag_03_131_12"></a>Issue 5</h4>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
378
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
379 <blockquote>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
380 <p>The DESCRIPTION is updated for alignment with the POSIX Realtime Extension and the POSIX Threads Extension.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
381
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
382 <p>Interactions with the SA_NOCLDWAIT flag and SIGCHLD signal are further clarified.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
383
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
384 <p>The values of <i>status</i> from <i>exit</i>() are better described.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
385 </blockquote>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
386
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
387 <h4><a name="tag_03_131_13"></a>Issue 6</h4>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
388
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
389 <blockquote>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
390 <p>Extensions beyond the ISO&nbsp;C standard are marked.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
391
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
392 <p>The DESCRIPTION is updated for alignment with IEEE&nbsp;Std&nbsp;1003.1j-2000 by adding semantics for typed memory.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
393
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
394 <p>The following changes are made for alignment with the ISO/IEC&nbsp;9899:1999 standard:</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
395
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
396 <ul>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
397 <li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
398 <p>The <i>_Exit</i>() function is included.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
399 </li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
400
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
401 <li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
402 <p>The DESCRIPTION is updated.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
403 </li>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
404 </ul>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
405
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
406 <p>The description of tracing semantics is added for alignment with IEEE&nbsp;Std&nbsp;1003.1q-2000.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
407
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
408 <p>References to the <i>wait3</i>() function are removed.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
409
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
410 <p>IEEE&nbsp;Std 1003.1-2001/Cor&nbsp;1-2002, item XSH/TC1/D6/16 is applied, correcting grammar in the DESCRIPTION.</p>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
411 </blockquote>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
412
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
413 <div class="box"><em>End of informative text.</em></div>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
414
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
415 <hr size="2" noshade>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
416 <center><font size="2"><!--footer start-->
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
417 UNIX &reg; is a registered Trademark of The Open Group.<br>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
418 POSIX &reg; is a registered Trademark of The IEEE.<br>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
419 [ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
420 "../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
421 ]</font></center>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
422
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
423 <!--footer end-->
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
424 <hr size="2" noshade>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
425 </body>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
426 </html>
0eae4b049f93 <oerjan> fetch http://pubs.opengroup.org/onlinepubs/009695399/functions/_exit.html
HackBot
parents:
diff changeset
427