EXIT_SUCCESS(3const)
π EXIT_SUCCESS β the const girlies of process termination π
okay bestie, so this is EXIT_SUCCESS(3const) β a page from the <pink>3const</pink> corner of the manual, and honestly? it's giving tiny-but-mighty. two constants. that's the whole page. and yet they run the entire exit-code economy. periodt.
β¨ NAME β¨
EXIT_SUCCESS, EXIT_FAILURE β termination status constants π
π LIBRARY π
Standard C library (libc) π«Ά
πΈ SYNOPSIS πΈ
#include <stdlib.h>
#define EXIT_SUCCESS 0
#define EXIT_FAILURE /* nonzero */
like... look at that. EXIT_SUCCESS is literally just 0. no cap. and EXIT_FAILURE is <hotpink>/* nonzero */</hotpink> β the manpage is out here being coy about it, which is honestly iconic behaviour. π¦
π DESCRIPTION π
so here's the vibe: EXIT_SUCCESS and EXIT_FAILURE represent a successful and unsuccessful exit status respectively. that's the whole personality. they're the two moods you can leave a program in.
and you can use them as arguments to the exit(3) function β that's their main character moment, that's their whole reason for existing, and they absolutely ate. π
β STANDARDS β
C11, POSIX.1-2024 π§
π°οΈ HISTORY π°οΈ
the lore, bestie:
EXIT_SUCCESSβC89,POSIX.1-1988β¨EXIT_FAILUREβC89,POSIX.1-1990β¨
not the two of them having different POSIX years. EXIT_SUCCESS was out here first, fr fr. π
π EXAMPLES π
here's the whole thing in context, a cute lil program that opens a file and bails properly if anything goes sideways:
#include <stdio.h>
#include <stdlib.h>
int
main(int argc, char *argv[])
{
FILE *fp;
if (argc != 2) {
fprintf(stderr, "Usage: %s <file>\n", argv[0]);
exit(EXIT_FAILURE);
}
fp = fopen(argv[1], "r");
if (fp == NULL) {
perror(argv[1]);
exit(EXIT_FAILURE);
}
/* Other code omitted */
fclose(fp);
exit(EXIT_SUCCESS);
}
see how it goes? wrong number of args β exit(EXIT_FAILURE). file won't open β exit(EXIT_FAILURE). everything works β fclose(fp) and then exit(EXIT_SUCCESS). sweet and simple, and the /* Other code omitted */ is doing a LOT of heavy lifting in there, love that for it. π
π SEE ALSO π
that's the page!! short, sweet, and lowkey the most-used constants in the whole C library. iykyk. π
with love from the Linux man-pages, version 6.20, dated 2026-02-08 β mwah, go exit cleanly bestie π«Άβ¨
π¦ 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 2022, Thomas Voss <mail@thomasvoss.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms