sysexits.h(3head)

πŸ’… sysexits.h β€” exit codes for programs

okay bestie, pull up a chair πŸͺ‘ because this is the <sysexits.h> page, from section 3head, and honestly? it's the blueprint for ✨how a program tells you what went wrong✨. exit codes, but make them mean something. no more mysterious 1s. periodt.


πŸ“š LIBRARY

Standard C library (libc) 🫢


✨ SYNOPSIS ✨

like, here's the whole vibe, verbatim, no cap:

#include <sysexits.h>
#define EX_OK           0    /* successful termination */

#define EX__BASE        64   /* base value for error messages */

#define EX_USAGE        64   /* command line usage error */
#define EX_DATAERR      65   /* data format error */
#define EX_NOINPUT      66   /* cannot open input */
#define EX_NOUSER       67   /* addressee unknown */
#define EX_NOHOST       68   /* host name unknown */
#define EX_UNAVAILABLE  69   /* service unavailable */
#define EX_SOFTWARE     70   /* internal software error */
#define EX_OSERR        71   /* system error (e.g., can't fork) */
#define EX_OSFILE       72   /* critical OS file missing */
#define EX_CANTCREAT    73   /* can't create (user) output file */
#define EX_IOERR        74   /* input/output error */
#define EX_TEMPFAIL     75   /* temp failure; user is invited to retry
                                */
#define EX_PROTOCOL     76   /* remote error in protocol */
#define EX_NOPERM       77   /* permission denied */
#define EX_CONFIG       78   /* configuration error */

#define EX__MAX         ...  /* maximum listed value */

look at all those little constants πŸŽ€ they're all just macros, they cost you nothing at runtime, and they make your program legible. we love a free glow-up πŸ’–


πŸ¦‹ DESCRIPTION

so, a few programs exit with these following error codes. that's the whole premise. πŸ’

The successful exit is always indicated by a status of 0, aka EX_OK (which is the same thing as EXIT_SUCCESS from <stdlib.h> β€” they're besties, they're literally the same). 😌

Error numbers begin at EX__BASE so there's less chance of clashing with other exit statuses that random programs might already be returning. like, the low numbers were taken, okay?? 😭 so we start at 64 and go up from there. iconic behavior honestly.

The meaning of the code is approximately as follows:

  • EX_USAGE β€” the command was used incorrectly, i.e. wrong number of arguments, a bad flag, bad syntax in a parameter, or whatever. you fumbled the invocation, bestie. πŸ™ˆ
  • EX_DATAERR β€” the input data was incorrect in some way. only use this for the user's data, not for system files. user data problems get user data codes. πŸ’…
  • EX_NOINPUT β€” an input file (not a system file!) didn't exist or wasn't readable. this could also cover errors like "No message" to a mailer (if it even cared to catch it). πŸ‘€
  • EX_NOUSER β€” the user you specified didn't exist. this might be used for mail addresses or remote logins. that person? not real. πŸ’€
  • EX_NOHOST β€” the host you specified didn't exist. this one is used in mail addresses or network requests. πŸ›°οΈ
  • EX_UNAVAILABLE β€” a service is unavailable. happens if a support program or file doesn't exist. this one is also the catch-all for when something you wanted to do just... doesn't work, and you genuinely don't know why. the "idk it's giving broken" code 🫠
  • EX_SOFTWARE β€” an internal software error has been detected. if possible, keep this limited to non-operating-system-related errors. it's a you problem, not a kernel problem, iykyk.
  • EX_OSERR β€” an operating system error has been detected. this is intended for stuff like "cannot fork", "cannot create pipe", or the like. it also includes things like getuid(2) returning a user that doesn't exist in the passwd(5) file. 😡 the OS itself is acting up.
  • EX_OSFILE β€” some system file (e.g. /etc/passwd, /etc/utmp, etc.) doesn't exist, can't be opened, or has some sort of error (e.g. a syntax error). πŸ“ missing/broken system file energy.
  • EX_CANTCREAT β€” a (user-specified) output file cannot be created. the write just isn't writing. 😭
  • EX_IOERR β€” an error occurred while doing I/O on some file. something went sideways mid-read or mid-write. πŸ“
  • EX_TEMPFAIL β€” temporary failure, indicating something that isn't really an error. for example, a mailer couldn't create a connection, and the request should be reattempted later. try again later, it's not you it's the moment ✨
  • EX_PROTOCOL β€” the remote system returned something that was "not possible" during a protocol exchange. the other side said something that literally cannot happen. rude. 😀
  • EX_NOPERM β€” you didn't have sufficient permission to perform the operation. not intended for file system problems β€” those should use EX_NOINPUT or EX_CANTCREAT β€” but rather for higher level permissions. know the difference, bestie. πŸ‘‘
  • EX_CONFIG β€” something was found in an unconfigured or misconfigured state. the config file ate and left no crumbs (complimentary? no. it's broken). 🧚

The numerical values corresponding to the symbolical ones are given in parenthesis for easy reference. like a little cheat sheet, built right in. πŸŽ€


πŸ“ STANDARDS

BSD. πŸ“œ that's it, that's the standard.


πŸ•°οΈ HISTORY

The <sysexits.h> file appeared in 4.0BSD for use by the deliverymail utility, which was later renamed to sendmail(8). so it's genuinely a nepo baby of the mail world πŸ’Œ and it's been serving ever since.


⚠️ CAVEATS

The choice of an appropriate exit value is often ambiguous. 😭 fr fr. you'll be staring at EX_SOFTWARE vs EX_OSERR at 3am like... which one am i. nobody knows. vibe check failed.


πŸ‘€ SEE ALSO


and that's the whole page, bestie β€” go forth and exit meaningfully πŸ’–πŸ¦‹βœ¨

this was sysexits.h(3head) from Linux man-pages 6.20, dated 2026-10-11 🌈 slay, stay iconic, and always #include <sysexits.h> πŸ‘‘πŸ’…

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