CINXE.COM

_exit

<html> <head> <title>_exit</title> <META NAME="KEYWORDS" CONTENT="_exit"> </head> <body BGCOLOR="#ffffff" LINK="#0000ff" VLINK="#0000ff" ALINK="#0000ff" TEXT="#000000"> <center> <h1><b>_exit</b></h1></center> <PRE> <STRONG><A HREF="/man2/_EXIT">_EXIT(2)</A></STRONG> Linux Programmer's Manual <STRONG><A HREF="/man2/_EXIT">_EXIT(2)</A></STRONG> NAME _exit, _Exit - terminate the calling process SYNOPSIS #include &lt;unistd.h&gt; void _exit(int status); #include &lt;stdlib.h&gt; void _Exit(int status); Feature Test Macro Requirements for glibc (see <STRONG><A HREF="/man7/feature_test_macros">feature_test_macros(7)</A></STRONG>): _Exit(): _ISOC99_SOURCE || _POSIX_C_SOURCE &gt;= 200112L DESCRIPTION The function _exit() terminates the calling process "immediately". Any open file descriptors belonging to the process are closed. Any chil- dren of the process are inherited by <STRONG><A HREF="/man1/init">init(1)</A></STRONG> (or by the nearest "sub- reaper" process as defined through the use of the <STRONG><A HREF="/man2/prctl">prctl(2)</A></STRONG> PR_SET_CHILD_SUBREAPER operation). The process's parent is sent a SIGCHLD signal. The value status &amp; 0xFF is returned to the parent process as the process's exit status, and can be collected using one of the <STRONG><A HREF="/man2/wait">wait(2)</A></STRONG> family of calls. The function _Exit() is equivalent to _exit(). RETURN VALUE These functions do not return. CONFORMING TO POSIX.1-2001, POSIX.1-2008, SVr4, 4.3BSD. The function _Exit() was in- troduced by C99. NOTES For a discussion on the effects of an exit, the transmission of exit status, zombie processes, signals sent, and so on, see <STRONG><A HREF="/man3/exit">exit(3)</A></STRONG>. The function _exit() is like <STRONG><A HREF="/man3/exit">exit(3)</A></STRONG>, but does not call any functions registered with <STRONG><A HREF="/man3/atexit">atexit(3)</A></STRONG> or <STRONG><A HREF="/man3/on_exit">on_exit(3)</A></STRONG>. Open <STRONG><A HREF="/man3/stdio">stdio(3)</A></STRONG> streams are not flushed. On the other hand, _exit() does close open file descriptors, and this may cause an unknown delay, waiting for pending output to fin- ish. If the delay is undesired, it may be useful to call functions like <STRONG><A HREF="/man3/tcflush">tcflush(3)</A></STRONG> before calling _exit(). Whether any pending I/O is canceled, and which pending I/O may be canceled upon _exit(), is imple- mentation-dependent. C library/kernel differences In glibc up to version 2.3, the _exit() wrapper function invoked the kernel system call of the same name. Since glibc 2.3, the wrapper function invokes <STRONG><A HREF="/man2/exit_group">exit_group(2)</A></STRONG>, in order to terminate all of the threads in a process. SEE ALSO <STRONG><A HREF="/man2/execve">execve(2)</A></STRONG>, <STRONG><A HREF="/man2/exit_group">exit_group(2)</A></STRONG>, <STRONG><A HREF="/man2/fork">fork(2)</A></STRONG>, <STRONG><A HREF="/man2/kill">kill(2)</A></STRONG>, <STRONG><A HREF="/man2/wait">wait(2)</A></STRONG>, <STRONG><A HREF="/man2/wait4">wait4(2)</A></STRONG>, wait- <STRONG><A HREF="/man2/pid">pid(2)</A></STRONG>, <STRONG><A HREF="/man3/atexit">atexit(3)</A></STRONG>, <STRONG><A HREF="/man3/exit">exit(3)</A></STRONG>, <STRONG><A HREF="/man3/on_exit">on_exit(3)</A></STRONG>, <STRONG><A HREF="/man3/termios">termios(3)</A></STRONG> COLOPHON This page is part of release 5.05 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. Linux 2020-02-09 <STRONG><A HREF="/man2/_EXIT">_EXIT(2)</A></STRONG></PRE> <center> <h6>Man Pages Copyright Respective Owners. Site Copyright (C) 1994 - 2025 <a href="http://www.he.net">Hurricane Electric</a>. All Rights Reserved.</h6></center> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10