xref: /csrg-svn/lib/libc/sys/_exit.2 (revision 50541)
120023Smckusick.\" Copyright (c) 1980 Regents of the University of California.
247208Scael.\" All rights reserved.
320023Smckusick.\"
447208Scael.\" %sccs.include.redist.man%
520023Smckusick.\"
6*50541Scael.\"     @(#)_exit.2	6.6 (Berkeley) 07/25/91
747208Scael.\"
8*50541Scael.Dd
947208Scael.Dt EXIT 2
1047208Scael.Os BSD 4
1147208Scael.Sh NAME
1247208Scael.Nm _exit
1347208Scael.Nd terminate the calling process
1447208Scael.Sh SYNOPSIS
1547208Scael.Fd #include <unistd.h>
1647208Scael.Ft void volatile
1747208Scael.Fn _exit "int status"
1847208Scael.Sh DESCRIPTION
1947208ScaelThe
2047208Scael.Fn _exit
2147208Scaelfunction
2220024Smckusickterminates a process with the following consequences:
2347208Scael.Bl -bullet
2447208Scael.It
2520024SmckusickAll of the descriptors open in the calling process are closed.
2628365SanneThis may entail delays, for example, waiting for output to drain;
2728069Skarelsa process in this state may not be killed, as it is already dying.
2847208Scael.It
2947208ScaelIf the parent process of the calling process has an outstanding
3047208Scael.Xr wait
3147208Scaelcall
3247208Scaelor is interested in the
3347208Scael.Dv SIGCHLD
3447208Scaelsignal,
3547208Scaelit is notified of the calling process's termination and
3647208Scaelthe
3747208Scael.Em status
3847208Scaelarea is set as defined by
3947208Scael.Xr wait 2 .
4047208Scael.It
4147208ScaelThe parent process-ID of all of the calling process's existing child
4247208Scaelprocesses are set to 1; the initialization process
4347208Scael(see the DEFINITIONS section of
4447208Scael.Xr intro 2 )
4547208Scaelinherits each of these processes.
4647208ScaelAny stopped children are restarted with a hangup signal
4747208Scael.Pq Dv SIGHUP .
4847208Scael.El
4947208Scael.Pp
5020024SmckusickMost C programs call the library routine
5147208Scael.Xr exit 3 ,
5247208Scaelwhich flushes buffers, closes streams, unlinks temporary files, etc.,
5347208Scaelbefore
5447208Scaelcalling
5547208Scael.Fn _exit .
5647208Scael.Sh RETURN VALUE
5747208Scael.Fn _exit
5847208Scaelcan never return.
5947208Scael.Sh SEE ALSO
6047208Scael.Xr fork 2 ,
6147208Scael.Xr sigvec 2 ,
6247208Scael.Xr wait 2 ,
6347208Scael.Xr exit 3
6447208Scael.Sh HISTORY
6547208ScaelAn
6647208Scael.Nm exit
67*50541Scaelfunction call appeared in
68*50541Scael.At v6 .
69