BSD 4_3 release
[unix-history] / usr / man / man2 / exit.2
index 3c0c541..2b4b8f6 100644 (file)
@@ -1,39 +1,49 @@
-.TH EXIT 2 
+.\" Copyright (c) 1980 Regents of the University of California.
+.\" All rights reserved.  The Berkeley software License Agreement
+.\" specifies the terms and conditions for redistribution.
+.\"
+.\"    @(#)exit.2      6.4 (Berkeley) 5/22/86
+.\"
+.TH EXIT 2 "May 22, 1986"
+.UC 4
 .SH NAME
 .SH NAME
-exit \- terminate process
+_exit \- terminate a process
 .SH SYNOPSIS
 .SH SYNOPSIS
-.B exit(status)
-.br
-.B int status;
-.PP
-.B _exit(status)
-.br
-.B int status;
+.nf
+.ft B
+_exit(status)
+int status;
+.fi
 .SH DESCRIPTION
 .SH DESCRIPTION
-.I Exit
-is the normal means of terminating a process.
-.I Exit
-closes all the process's files and notifies the parent process
-if it is executing a
-.IR wait .
-The low-order 8 bits of 
-.I status
-are available to the parent process.
+.I _exit
+terminates a process with the following consequences:
+.in +5n
 .PP
 .PP
-This call can never return.
+All of the descriptors open in the calling process are closed.
+This may entail delays, for example, waiting for output to drain;
+a process in this state may not be killed, as it is already dying.
 .PP
 .PP
-The C function
-.I exit
-may cause cleanup actions before the
-final `sys exit'.
-The function
-.I _exit
-circumvents all cleanup.
+If the parent process of the calling process is executing a
+.I wait
+or is interested in the SIGCHLD signal,
+then it is notified of the calling process's termination and
+the low-order eight bits of \fIstatus\fP are made available to it;
+see
+.IR wait (2).
+.PP
+The parent process ID of all of the calling process's existing child
+processes are also set to 1.  This means that the initialization process
+(see 
+.IR intro (2))
+inherits each of these processes as well.
+Any stopped children are restarted with a hangup signal (SIGHUP).
+.in -5n
+.PP
+Most C programs call the library routine
+.IR exit (3),
+which performs cleanup actions in the standard I/O library before
+calling \fI_exit\fP\|.
+.SH "RETURN VALUE"
+This call never returns.
 .SH "SEE ALSO"
 .SH "SEE ALSO"
-wait(2)
-.SH ASSEMBLER
-(exit = 1.)
-.br
-(status in r0)
-.br
-.B sys exit
+fork(2), sigvec(2), wait(2), exit(3)