_exit(3)
π _exit(3) β bestie, we're leaving. immediately. β¨
okay so this is the manual page for _exit and _Exit (yes that's a real name, no I will not be taking questions), part of the Library Functions Manual. It lives in the Standard C library β that's libc, and you link it with -lc. π«Ά
πΈ NAME πΈ
_exit, _Exit β terminate the calling process π
Like. that's it. that's the whole thing. the process said "I'm done" and meant it.
π LIBRARY π
Standard C library β libc, -lc.
β¨ SYNOPSIS β¨
#include <unistd.h>
[[noreturn]] void _exit(int status);
#include <stdlib.h>
[[noreturn]] void _Exit(int status);
π Feature Test Macro Requirements for glibc π
(peep feature_test_macros(7) for the deets)
_Exit():
_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
π¦ DESCRIPTION π¦
So _exit() terminates the calling process β and bestie, when I say terminate, I mean "immediately". No vibe check, no goodbye text, no nothing. π«’
Here's the whole rundown of what happens:
- Any open file descriptors belonging to the process? Closed. done. πͺ
- Any children of the process? They get inherited by
init(1)β or by the nearest "subreaper" process, which is defined through the use of theprctl(2)PR_SET_CHILD_SUBREAPERoperation. π - The process's parent gets sent a
SIGCHLDsignal. mom gets the notification fr fr π£
The value status & 0xFF is returned to the parent process as the process's exit status, and it can be collected by the parent using one of the wait(2) family of calls.
And _Exit()? It is equivalent to _exit(). literally the same girl, different font. π
π RETURN VALUE π
These functions do not return.
That's not a bug. That's the whole point. there is no return era. π«
π STANDARDS π
_exit()β POSIX.1-2024._Exit()β C11, POSIX.1-2024.
π HISTORY π
_exit()β 4.3BSD, SVr4, POSIX.1-1988._Exit()β C99, POSIX.1-2001.
Up to glibc 2.3, these functions invoked exit(2). Since glibc 2.3, they invoke exit_group(2), in order to terminate all of the threads in a process. yes queen, the entire group chat is leaving. π
π NOTES π
If you wanna read a whole discussion on the effects of an exit, the transmission of exit status, zombie processes, signals sent, and so on β go see exit(3). π§
So the tea: _exit() is like exit(3), but here's the plot twist β it does NOT call any functions registered with atexit(3) or on_exit(3). π«
Also, open stdio(3) streams are not flushed. all that buffered stuff? gone. bye. π
On the other hand, _exit() does close open file descriptors, and this may cause an unknown delay, waiting for pending output to finish. π΄
If the delay is undesired, it may be useful to call functions like tcflush(3) before calling _exit(). π‘
And whether any pending I/O is canceled, and which pending I/O may be canceled upon _exit(), is implementation-dependent. translation: it depends, don't @ me. π
no cap β if you needed your atexit(3) handlers or your flushed stdio streams, this is NOT the function for you. this one leaves without saying goodbye. π
π«Ά SEE ALSO π«Ά
execve(2), exit(2), exit_group(2), fork(2), kill(2), wait(2), wait4(2), waitpid(2), atexit(3), exit(3), on_exit(3), termios(7)
this page came from Linux man-pages 6.20, dated 2026-07-02, and it's the _exit(3) era. periodt. π
β¨
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: Linux-man-pages-copyleft
- Copyright 1992, Drew Eckhardt <drew@cs.colorado.edu>
- Copyright 1993, Ian Jackson <iwj10@cus.cam.ac.uk>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms