| SYSEXITS(3) | Library Functions Manual | SYSEXITS(3) |
sysexits —
preferable exit codes for programs
#include
<sysexits.h>
It is not a good practice to call
exit(3) with arbitrary values to
indicate a failure condition when ending a program. In addition to the two
standard constants in
<stdlib.h>,
EXIT_SUCCESS and
EXIT_FAILURE, the header
<sysexits.h> defines few
exit codes that can be used as a parameter to the
exit(3) function. By using these
constants the caller of the process can get a rough estimation about the
failure class without looking up the source code.
The successful exit is always indicated by a status of 0, or
EX_OK. Error numbers begin at
EX__BASE to reduce the possibility of clashing with
other exit statuses that random programs may already return. The meaning of
the codes is approximately as follows:
EX_USAGE
(64)EX_DATAERR
(65)EX_NOINPUT
(66)EX_NOUSER
(67)EX_NOHOST
(68)EX_UNAVAILABLE
(69)EX_SOFTWARE
(70)EX_OSERR
(71)EX_OSFILE
(72)EX_CANTCREAT
(73)EX_IOERR
(74)EX_TEMPFAIL
(75)EX_PROTOCOL
(76)EX_NOPERM
(77)EX_NOINPUT or
EX_CANTCREAT, but rather for higher level
permissions.EX_CONFIG
(78)The numerical values corresponding to the symbolical ones are given in parenthesis for easy reference.
The <sysexits.h>
header appeared somewhere after 4.3BSD. The manual
page for it appeared in NetBSD 4.0.
This manual page was written by Jörg
Wunsch after the comments in
<sysexits.h>.
The choice of an appropriate exit value is often ambiguous.
| March 25, 2010 | NetBSD 11.0 |