1sysexits.h(3head) sysexits.h(3head)
2
3
4
6 sysexits.h - exit codes for programs
7
9 Standard C library (libc)
10
12 #include <sysexits.h>
13
14 #define EX_OK 0 /* successful termination */
15
16 #define EX__BASE 64 /* base value for error messages */
17
18 #define EX_USAGE 64 /* command line usage error */
19 #define EX_DATAERR 65 /* data format error */
20 #define EX_NOINPUT 66 /* cannot open input */
21 #define EX_NOUSER 67 /* addressee unknown */
22 #define EX_NOHOST 68 /* host name unknown */
23 #define EX_UNAVAILABLE 69 /* service unavailable */
24 #define EX_SOFTWARE 70 /* internal software error */
25 #define EX_OSERR 71 /* system error (e.g., can't fork) */
26 #define EX_OSFILE 72 /* critical OS file missing */
27 #define EX_CANTCREAT 73 /* can't create (user) output file */
28 #define EX_IOERR 74 /* input/output error */
29 #define EX_TEMPFAIL 75 /* temp failure; user is invited to retry
30 */
31 #define EX_PROTOCOL 76 /* remote error in protocol */
32 #define EX_NOPERM 77 /* permission denied */
33 #define EX_CONFIG 78 /* configuration error */
34
35 #define EX__MAX ... /* maximum listed value */
36
38 A few programs exit with the following error codes.
39
40 The successful exit is always indicated by a status of 0, or EX_OK
41 (equivalent to EXIT_SUCCESS from <stdlib.h>). Error numbers begin at
42 EX__BASE to reduce the possibility of clashing with other exit statuses
43 that random programs may already return. The meaning of the code is
44 approximately as follows:
45
46 EX_USAGE
47 The command was used incorrectly, e.g., with the wrong number of
48 arguments, a bad flag, bad syntax in a parameter, or whatever.
49
50 EX_DATAERR
51 The input data was incorrect in some way. This should only be
52 used for user's data and not system files.
53
54 EX_NOINPUT
55 An input file (not a system file) did not exist or was not read‐
56 able. This could also include errors like "No message" to a
57 mailer (if it cared to catch it).
58
59 EX_NOUSER
60 The user specified did not exist. This might be used for mail
61 addresses or remote logins.
62
63 EX_NOHOST
64 The host specified did not exist. This is used in mail ad‐
65 dresses or network requests.
66
67 EX_UNAVAILABLE
68 A service is unavailable. This can occur if a support program
69 or file does not exist. This can also be used as a catch-all
70 message when something you wanted to do doesn't work, but you
71 don't know why.
72
73 EX_SOFTWARE
74 An internal software error has been detected. This should be
75 limited to non-operating system related errors if possible.
76
77 EX_OSERR
78 An operating system error has been detected. This is intended
79 to be used for such things as "cannot fork", "cannot create
80 pipe", or the like. It includes things like getuid(2) returning
81 a user that does not exist in the passwd(5) file.
82
83 EX_OSFILE
84 Some system file (e.g., /etc/passwd, /etc/utmp, etc.) does not
85 exist, cannot be opened, or has some sort of error (e.g., syntax
86 error).
87
88 EX_CANTCREAT
89 A (user specified) output file cannot be created.
90
91 EX_IOERR
92 An error occurred while doing I/O on some file.
93
94 EX_TEMPFAIL
95 Temporary failure, indicating something that is not really an
96 error. For example that a mailer could not create a connection,
97 and the request should be reattempted later.
98
99 EX_PROTOCOL
100 The remote system returned something that was "not possible"
101 during a protocol exchange.
102
103 EX_OSFILE
104 You did not have sufficient permission to perform the operation.
105 This is not intended for file system problems, which should use
106 EX_NOINPUT or EX_CANTCREAT, but rather for higher level permis‐
107 sions.
108
109 EX_CONFIG
110 Something was found in an unconfigured or misconfigured state.
111
112 The numerical values corresponding to the symbolical ones are given in
113 parenthesis for easy reference.
114
116 BSD.
117
119 The <sysexits.h> file appeared in 4.0BSD for use by the deliverymail
120 utility, later renamed to sendmail(8).
121
123 The choice of an appropriate exit value is often ambiguous.
124
126 err(3), error(3), exit(3)
127
128
129
130Linux man-pages 6.04 2023-03-30 sysexits.h(3head)