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 ๐Ÿซถ

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
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms