1 .\" $NetBSD: sysexits.3,v 1.2 2005/10/03 19:16:35 wiz Exp $
3 .\" Copyright (c) 1996 Joerg Wunsch
5 .\" All rights reserved.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
16 .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
17 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 .\" $FreeBSD: src/share/man/man3/sysexits.3,v 1.16 2005/06/30 13:13:49 hmp Exp $
35 .Nd preferable exit codes for programs
39 It is not a good practice to call
41 with arbitrary values to indicate a failure condition when ending
43 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.
54 The meaning of the codes is
55 approximately as follows:
56 .Bl -tag -width "EX_UNAVAILABLEXX(XX)"
58 The command was used incorrectly, e.g., with the wrong number of
59 arguments, a bad flag, a bad syntax in a parameter, or whatever.
60 .It Dv EX_DATAERR Pq 65
61 The input data was incorrect in some way.
62 This should only be used
63 for user's data and not system files.
64 .It Dv EX_NOINPUT Pq 66
65 An input file (not a system file) did not exist or was not readable.
66 This could also include errors like
68 to a mailer (if it cared to catch it).
69 .It Dv EX_NOUSER Pq 67
70 The user specified did not exist.
71 This might be used for mail
72 addresses or remote logins.
73 .It Dv EX_NOHOST Pq 68
74 The host specified did not exist.
75 This is used in mail addresses or
77 .It Dv EX_UNAVAILABLE Pq 69
78 A service is unavailable.
79 This can occur if a support program or file
81 This can also be used as a catchall message when
82 something you wanted to do does not work, but you do not know why.
83 .It Dv EX_SOFTWARE Pq 70
84 An internal software error has been detected.
85 This should be limited
86 to non-operating system related errors as possible.
88 An operating system error has been detected.
89 This is intended to be
90 used for such things as
92 .Dq cannot create pipe ,
94 It includes things like getuid returning a user that
95 does not exist in the passwd file.
96 .It Dv EX_OSFILE Pq 72
97 Some system file (e.g.,
100 etc.) does not exist, cannot be opened, or has some sort of error
101 (e.g., syntax error).
102 .It Dv EX_CANTCREAT Pq 73
103 A (user specified) output file cannot be created.
104 .It Dv EX_IOERR Pq 74
105 An error occurred while doing I/O on some file.
106 .It Dv EX_TEMPFAIL Pq 75
107 Temporary failure, indicating something that is not really an error.
108 In sendmail, this means that a mailer (e.g.) could not create a
109 connection, and the request should be reattempted later.
110 .It Dv EX_PROTOCOL Pq 76
111 The remote system returned something that was
113 during a protocol exchange.
114 .It Dv EX_NOPERM Pq 77
115 You did not have sufficient permission to perform the operation.
117 is not intended for file system problems, which should use
121 but rather for higher level permissions.
122 .It Dv EX_CONFIG Pq 78
123 Something was found in an unconfigured or misconfigured state.
126 The numerical values corresponding to the symbolical ones are given in
127 parenthesis for easy reference.
134 file appeared somewhere after
141 This manual page was written by
143 after the comments in
146 The choice of an appropriate exit value is often ambiguous.