2 .\" Copyright (c) 1996 Joerg Wunsch
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
15 .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
16 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
19 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 .Nd preferable exit codes for programs
36 .Fd #include <sysexits.h>
40 it is not a good practice to call
42 with arbitrary values to indicate a failure condition when ending
43 a program. Instead, the pre-defined exit codes from
45 should be used, so the caller of the process can get a rough
46 estimation about the failure class without looking up the source code.
48 The successful exit is always indicated by a status of 0, or
50 Error numbers begin at
52 to reduce the possibility of clashing with other exit statuses that
53 random programs may already return. The meaning of the codes is
54 approximately as follows:
55 .Bl -tag -width "EX_UNAVAILABLEXX(XX)"
57 The command was used incorrectly, e.g., with the wrong number of
58 arguments, a bad flag, a bad syntax in a parameter, or whatever.
59 .It Sy EX_DATAERR Pq 65
60 The input data was incorrect in some way. This should only be used
61 for user's data and not system files.
62 .It Sy EX_NOINPUT Pq 66
63 An input file (not a system file) did not exist or was not readable.
64 This could also include errors like
66 to a mailer (if it cared to catch it).
67 .It Sy EX_NOUSER Pq 67
68 The user specified did not exist. This might be used for mail
69 addresses or remote logins.
70 .It Sy EX_NOHOST Pq 68
71 The host specified did not exist. This is used in mail addresses or
73 .It Sy EX_UNAVAILABLE Pq 69
74 A service is unavailable. This can occur if a support program or file
75 does not exist. This can also be used as a catchall message when
76 something you wanted to do doesn't work, but you don't know why.
77 .It Sy EX_SOFTWARE Pq 70
78 An internal software error has been detected. This should be limited
79 to non-operating system related errors as possible.
81 An operating system error has been detected. This is intended to be
82 used for such things as
84 .Dq cannot create pipe ,
85 or the like. It includes things like getuid returning a user that
86 does not exist in the passwd file.
87 .It Sy EX_OSFILE Pq 72
88 Some system file (e.g.,
91 etc.) does not exist, cannot be opened, or has some sort of error
93 .It Sy EX_CANTCREAT Pq 73
94 A (user specified) output file cannot be created.
96 An error occurred while doing I/O on some file.
97 .It Sy EX_TEMPFAIL Pq 75
98 Temporary failure, indicating something that is not really an error.
99 In sendmail, this means that a mailer (e.g.) could not create a
100 connection, and the request should be reattempted later.
101 .It Sy EX_PROTOCOL Pq 76
102 The remote system returned something that was
104 during a protocol exchange.
105 .It Sy EX_NOPERM Pq 77
106 You did not have sufficient permission to perform the operation. This
107 is not intended for file system problems, which should use
111 but rather for higher level permissions.
112 .It Sy EX_CONFIG Pq 78
113 Something was found in an unconfigured or misconfigured state.
116 The numerical values corresponding to the symbolical ones are given in
117 parenthesis for easy reference.
124 file appeared somewhere after
127 This man page has been written by
130 after the comments in
133 The choice of an appropriate exit value is often ambiguous.