exit(2)
โจ exit(2) โจ
okay so bestie, we're in the System Calls Manual โ section 2, the syscall zone, not the libc-wrapper zone. this one is about the raw kernel call so keep ur eyes peeled for that distinction, iykyk ๐ซถ
๐ธ NAME ๐ธ
exit โ terminate the calling thread
literally what it says: one thread, gone, bye ๐
๐ LIBRARY ๐
Standard C library โ that's libc, -lc. the classic.
๐ฆ SYNOPSIS ๐ฆ
#include <sys/syscall.h> /* Definition of SYS_* constants */
#include <unistd.h>
[[noreturn]] long syscall(SYS_exit, int status);
note the [[noreturn]] bestie!! the compiler is TELLING you it never comes back. it's giving "don't even try to plan a sequel" energy ๐ญ
๐ฅ DESCRIPTION ๐ฅ
exit() terminates the calling thread. that's the whole gig. one thread, off the board ๐
now here's the part where u gotta pay attention, no cap:
by contrast with _exit(3), the exit() system call terminates only the calling thread. and actions like reparenting child processes or sending SIGCHLD to the parent process โ those are performed only if this is the last thread in the thread group. ๐
so like. if ur thread has siblings still vibing in the same thread group, the whole group-keeping stuff does NOT happen yet. it's not the main character of that moment. it's just one thread clocking out. keep that straight and ur golden โญ
๐ RETURN VALUE ๐
exit() does not return.
that's it. that's the whole section. it does not return. not "usually", not "on error" โ it does not return. u call it, u don't come back, periodt ๐
๐ STANDARDS ๐
Linux. ๐ง
โญ HISTORY โญ
Linux. ๐ง (again. the vibes are consistent.)
๐ซถ SEE ALSO ๐ซถ
exit_group(2)โ the one that takes the whole group down with it ๐_exit(3)exit(3)pthread_exit(3)
if u want the deep lore, go read these. they're all little cousins of this page โจ
and that's the tea, bestie ๐ โ this page came out of Linux man-pages 6.20, and it's dated 2026-06-05. go forth, terminate threads responsibly, and remember: it really does not return ๐
๐ฆ 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