xref: /openbsd/share/man/man3/sysexits.3 (revision 76d0caae)
1.\"
2.\" Copyright (c) 1987, 1993
3.\"	The Regents of the University of California.  All rights reserved.
4.\" Copyright (c) 1996 Joerg Wunsch
5.\"
6.\" All rights reserved.
7.\"
8.\" Redistribution and use in source and binary forms, with or without
9.\" modification, are permitted provided that the following conditions
10.\" are met:
11.\" 1. Redistributions of source code must retain the above copyright
12.\"    notice, this list of conditions and the following disclaimer.
13.\" 2. Redistributions in binary form must reproduce the above copyright
14.\"    notice, this list of conditions and the following disclaimer in the
15.\"    documentation and/or other materials provided with the distribution.
16.\"
17.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
18.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
21.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27.\"
28.\" $OpenBSD: sysexits.3,v 1.13 2017/04/11 17:01:11 schwarze Exp $
29.\" $FreeBSD: src/share/man/man3/sysexits.3,v 1.4.2.1 1999/08/29 16:45:41 peter Exp $
30.\"
31.Dd $Mdocdate: April 11 2017 $
32.Dt SYSEXITS 3
33.Os
34.Sh NAME
35.Nm sysexits
36.Nd exit codes for programs
37.Sh SYNOPSIS
38.In sysexits.h
39.Sh DESCRIPTION
40A few programs exit with the following non-portable error codes.
41Do not use them.
42.Pp
43The successful exit is always indicated by a status of 0, or
44.Dv EX_OK .
45Error numbers begin at
46.Dv EX__BASE
47to reduce the possibility of clashing with other exit statuses that
48random programs may already return.
49The meaning of the code is approximately as follows:
50.Bl -tag -width "EX_UNAVAILABLEXX(XX)"
51.It Dv EX_USAGE Pq 64
52The command was used incorrectly, e.g., with the wrong number of
53arguments, a bad flag, bad syntax in a parameter, or whatever.
54.It Dv EX_DATAERR Pq 65
55The input data was incorrect in some way.
56This should only be used for user's data and not system files.
57.It Dv EX_NOINPUT Pq 66
58An input file (not a system file) did not exist or was not readable.
59This could also include errors like
60.Dq \&No message
61to a mailer (if it cared to catch it).
62.It Dv EX_NOUSER Pq 67
63The user specified did not exist.
64This might be used for mail addresses or remote logins.
65.It Dv EX_NOHOST Pq 68
66The host specified did not exist.
67This is used in mail addresses or network requests.
68.It Dv EX_UNAVAILABLE Pq 69
69A service is unavailable.
70This can occur if a support program or file does not exist.
71This can also be used as a catch-all message when something you wanted
72to do doesn't work, but you don't know why.
73.It Dv EX_SOFTWARE Pq 70
74An internal software error has been detected.
75This should be limited to non-operating system related errors if possible.
76.It Dv EX_OSERR Pq 71
77An operating system error has been detected.
78This is intended to be used for such things as
79.Dq cannot fork ,
80or
81.Dq cannot create pipe .
82It includes things like
83.Xr getuid 2
84returning a user that does not exist in the passwd file.
85.It Dv EX_OSFILE Pq 72
86Some system file (e.g.,
87.Pa /etc/passwd ,
88.Pa /var/run/utmp )
89does not exist, cannot be opened, or has some sort of error
90(e.g., syntax error).
91.It Dv EX_CANTCREAT Pq 73
92A (user specified) output file cannot be created.
93.It Dv EX_IOERR Pq 74
94An error occurred while doing I/O on some file.
95.It Dv EX_TEMPFAIL Pq 75
96Temporary failure, indicating something that is not really an error.
97For example that a mailer could not create a
98connection, and the request should be reattempted later.
99.It Dv EX_PROTOCOL Pq 76
100The remote system returned something that was
101.Dq not possible
102during a protocol exchange.
103.It Dv EX_NOPERM Pq 77
104You did not have sufficient permission to perform the operation.
105This is not intended for file system problems, which should use
106.Dv EX_NOINPUT
107or
108.Dv EX_CANTCREAT ,
109but rather for higher level permissions.
110.It Dv EX_CONFIG Pq 78
111Something was found in an unconfigured or misconfigured state.
112.El
113.Pp
114The numerical values corresponding to the symbolical ones are given in
115parentheses for easy reference.
116.Sh SEE ALSO
117.Xr _exit 2 ,
118.Xr exit 3
119.Sh HISTORY
120The
121.Nm
122file first appeared in
123.Bx 4.0
124for use by the delivermail utility, later renamed to
125.Xr sendmail 8 .
126.Sh AUTHORS
127.An -nosplit
128.An Eric Allman
129invented the
130.Nm
131file in 1980.
132This man page was written by
133.An Joerg Wunsch ,
134based on Eric's original comments found in
135.In sysexits.h .
136.Sh BUGS
137The choice of an appropriate exit value is often ambiguous.
138