_exit(3)

πŸ“¦
version 6.20 Β· 2 versions
, in arch rolling, nixpkgs unstable

πŸ’… _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 the prctl(2) PR_SET_CHILD_SUBREAPER operation. πŸ‘‘
  • The process's parent gets sent a SIGCHLD signal. 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
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms