_ Exit () function instructions
Abstract:This article describes the use of the _ exit () function in the Linux manual page, the use of the _ exit () function to terminate the process.
NAME
_ Exit (), _ Exit ()-terminate the process.
SYNOPSIS
# Include <unistd. h>
Void _ exit (int status );
# Include <stdlib. h>
Void _ Exit (int status );
Feature Test Macro Requirements for glibc (see feature_test_macros (7 )):
_ Exit ():
_ XOPEN_SOURCE> = 600 | _ ISOC99_SOURCE | _ POSIX_C_SOURCE> = 2001_l;
Or cc-std = c99
DESCRIPTION
Call the _ exit () function to terminate the process immediately. All opened file descriptors of the process are closed. The child process of the process will belong to the init process and become the child process of init, and sends the SIGCHLD signal to the parent process.
The termination status is passed to the parent process. Based on the termination status of the child process, the parent process can call the wait () function to process the child process.
Function _ Exit () is equivalent to function _ exit ().
RETURN VALUE
The _ exit () and _ Exit () functions do not return values.
CONFORMING
SVr4, POSIX.1-2001, 4.3BSD. The function _ Exit () was introduced by C99.
NOTES
This article discusses the role of terminating a process, transmission of the termination status, zombie process, and signal sending. For details, see the exit () function.
Function _ exit () is similar to exit (), but the _ exit () function does not call the terminate handler registered by the atexit () and on_exit () functions. whether it clears the IO buffer and deletes temporary files depends on the actual situation. when the _ exit () function is called, disabling the file descriptor may cause an unknown delay and wait for the output to complete. if you do not want latency, you can call the tcflush () function before calling the _ exit () function. The process determines whether to cancel the wait IO.
Before glibc 2.3, the library function _ exit () has the same name as the kernel system call. After glibc 2.3, the library function calls exit_group () to terminate all threads in the process.
END