1.\" Copyright (c) 1980, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)_exit.2 8.1 (Berkeley) 06/04/93 7.\" 8.Dd 9.Dt EXIT 2 10.Os BSD 4 11.Sh NAME 12.Nm _exit 13.Nd terminate the calling process 14.Sh SYNOPSIS 15.Fd #include <unistd.h> 16.Ft void 17.Fn _exit "int status" 18.Sh DESCRIPTION 19The 20.Fn _exit 21function 22terminates a process with the following consequences: 23.Bl -bullet 24.It 25All of the descriptors open in the calling process are closed. 26This may entail delays, for example, waiting for output to drain; 27a process in this state may not be killed, as it is already dying. 28.It 29If the parent process of the calling process has an outstanding 30.Xr wait 31call 32or catches the 33.Dv SIGCHLD 34signal, 35it is notified of the calling process's termination and 36the 37.Em status 38is set as defined by 39.Xr wait 2 . 40.It 41The parent process-ID of all of the calling process's existing child 42processes are set to 1; the initialization process 43(see the DEFINITIONS section of 44.Xr intro 2 ) 45inherits each of these processes. 46.It 47If the termination of the process causes any process group 48to become orphaned (usually because the parents of all members 49of the group have now exited; see 50.Dq orphaned process group 51in 52.Xr intro 2 ) , 53and if any member of the orphaned group is stopped, 54the 55.Dv SIGHUP 56signal and the 57.Dv SIGCONT 58signal are sent to all members of the newly-orphaned process group. 59.It 60If the process is a controlling process (see 61.Xr intro 2 ) , 62the 63.Dv SIGHUP 64signal is sent to the foreground process group of the controlling terminal, 65and all current access to the controlling terminal is revoked. 66.El 67.Pp 68Most C programs call the library routine 69.Xr exit 3 , 70which flushes buffers, closes streams, unlinks temporary files, etc., 71before 72calling 73.Fn _exit . 74.Sh RETURN VALUE 75.Fn _exit 76can never return. 77.Sh SEE ALSO 78.Xr fork 2 , 79.Xr sigvec 2 , 80.Xr wait 2 , 81.Xr exit 3 82.Sh STANDARDS 83The 84.Nm _exit 85function is defined by 86.St -p1003.1-88 . 87