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