xref: /freebsd/share/man/man3/sysexits.3 (revision cd0d51baaa4509a1db83251a601d34404d20c990)
1.\"
2.\" Copyright (c) 1996 Joerg Wunsch
3.\"
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
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.
14.\"
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.
25.\"
26.\" $FreeBSD$
27.\"
28.\" "
29.Dd January 21, 2010
30.Dt SYSEXITS 3
31.Os
32.Sh NAME
33.Nm sysexits
34.Nd preferable exit codes for programs
35.Sh SYNOPSIS
36.In sysexits.h
37.Sh DESCRIPTION
38According to
39.Xr style 9 ,
40it is not a good practice to call
41.Xr exit 3
42with arbitrary values to indicate a failure condition when ending
43a program.
44Instead, the pre-defined exit codes from
45.Nm
46should be used, so the caller of the process can get a rough
47estimation about the failure class without looking up the source code.
48.Pp
49The successful exit is always indicated by a status of 0, or
50.Sy EX_OK .
51Error numbers begin at
52.Sy EX__BASE
53to reduce the possibility of clashing with other exit statuses that
54random programs may already return.
55The meaning of the codes is
56approximately as follows:
57.Bl -tag -width "EX_UNAVAILABLEXX(XX)"
58.It Sy EX_USAGE Pq 64
59The command was used incorrectly, e.g., with the wrong number of
60arguments, a bad flag, a bad syntax in a parameter, or whatever.
61.It Sy EX_DATAERR Pq 65
62The input data was incorrect in some way.
63This should only be used
64for user's data and not system files.
65.It Sy EX_NOINPUT Pq 66
66An input file (not a system file) did not exist or was not readable.
67This could also include errors like
68.Dq \&No message
69to a mailer (if it cared to catch it).
70.It Sy EX_NOUSER Pq 67
71The user specified did not exist.
72This might be used for mail
73addresses or remote logins.
74.It Sy EX_NOHOST Pq 68
75The host specified did not exist.
76This is used in mail addresses or
77network requests.
78.It Sy EX_UNAVAILABLE Pq 69
79A service is unavailable.
80This can occur if a support program or file
81does not exist.
82This can also be used as a catchall message when
83something you wanted to do does not work, but you do not know why.
84.It Sy EX_SOFTWARE Pq 70
85An internal software error has been detected.
86This should be limited
87to non-operating system related errors as possible.
88.It Sy EX_OSERR Pq 71
89An operating system error has been detected.
90This is intended to be
91used for such things as
92.Dq cannot fork ,
93.Dq cannot create pipe ,
94or the like.
95It includes things like getuid returning a user that
96does not exist in the passwd file.
97.It Sy EX_OSFILE Pq 72
98Some system file (e.g.,
99.Pa /etc/passwd ,
100.Pa /var/run/utx.active ,
101etc.) does not exist, cannot be opened, or has some sort of error
102(e.g., syntax error).
103.It Sy EX_CANTCREAT Pq 73
104A (user specified) output file cannot be created.
105.It Sy EX_IOERR Pq 74
106An error occurred while doing I/O on some file.
107.It Sy EX_TEMPFAIL Pq 75
108Temporary failure, indicating something that is not really an error.
109In sendmail, this means that a mailer (e.g.) could not create a
110connection, and the request should be reattempted later.
111.It Sy EX_PROTOCOL Pq 76
112The remote system returned something that was
113.Dq not possible
114during a protocol exchange.
115.It Sy EX_NOPERM Pq 77
116You did not have sufficient permission to perform the operation.
117This
118is not intended for file system problems, which should use
119.Sy EX_NOINPUT
120or
121.Sy EX_CANTCREAT ,
122but rather for higher level permissions.
123.It Sy EX_CONFIG Pq 78
124Something was found in an unconfigured or misconfigured state.
125.El
126.Pp
127The numerical values corresponding to the symbolical ones are given in
128parenthesis for easy reference.
129.Sh SEE ALSO
130.Xr err 3 ,
131.Xr exit 3 ,
132.Xr style 9
133.Sh HISTORY
134The
135.Nm
136file appeared somewhere after
137.Bx 4.3 .
138.Sh AUTHORS
139This manual page was written by
140.An J\(:org Wunsch
141after the comments in
142.In sysexits.h .
143.Sh BUGS
144The choice of an appropriate exit value is often ambiguous.
145