120023Smckusick.\" Copyright (c) 1980 Regents of the University of California. 2*47208Scael.\" All rights reserved. 320023Smckusick.\" 4*47208Scael.\" %sccs.include.redist.man% 520023Smckusick.\" 6*47208Scael.\" @(#)_exit.2 6.5 (Berkeley) 03/10/91 7*47208Scael.\" 8*47208Scael.Dt EXIT 2 9*47208Scael.Dd 10*47208Scael.Os BSD 4 11*47208Scael.Sh NAME 12*47208Scael.Nm _exit 13*47208Scael.Nd terminate the calling process 14*47208Scael.Sh SYNOPSIS 15*47208Scael.Fd #include <unistd.h> 16*47208Scael.Ft void volatile 17*47208Scael.Fn _exit "int status" 18*47208Scael.Sh DESCRIPTION 19*47208ScaelThe 20*47208Scael.Fn _exit 21*47208Scaelfunction 2220024Smckusickterminates a process with the following consequences: 23*47208Scael.Bl -bullet 24*47208Scael.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. 28*47208Scael.It 29*47208ScaelIf the parent process of the calling process has an outstanding 30*47208Scael.Xr wait 31*47208Scaelcall 32*47208Scaelor is interested in the 33*47208Scael.Dv SIGCHLD 34*47208Scaelsignal, 35*47208Scaelit is notified of the calling process's termination and 36*47208Scaelthe 37*47208Scael.Em status 38*47208Scaelarea is set as defined by 39*47208Scael.Xr wait 2 . 40*47208Scael.It 41*47208ScaelThe parent process-ID of all of the calling process's existing child 42*47208Scaelprocesses are set to 1; the initialization process 43*47208Scael(see the DEFINITIONS section of 44*47208Scael.Xr intro 2 ) 45*47208Scaelinherits each of these processes. 46*47208ScaelAny stopped children are restarted with a hangup signal 47*47208Scael.Pq Dv SIGHUP . 48*47208Scael.El 49*47208Scael.Pp 5020024SmckusickMost C programs call the library routine 51*47208Scael.Xr exit 3 , 52*47208Scaelwhich flushes buffers, closes streams, unlinks temporary files, etc., 53*47208Scaelbefore 54*47208Scaelcalling 55*47208Scael.Fn _exit . 56*47208Scael.Sh RETURN VALUE 57*47208Scael.Fn _exit 58*47208Scaelcan never return. 59*47208Scael.Sh SEE ALSO 60*47208Scael.Xr fork 2 , 61*47208Scael.Xr sigvec 2 , 62*47208Scael.Xr wait 2 , 63*47208Scael.Xr exit 3 64*47208Scael.Sh HISTORY 65*47208ScaelAn 66*47208Scael.Nm exit 67*47208Scaelfunction call appeared in Version 6 AT&T UNIX. 68