xref: /openbsd-src/share/man/man3/sysexits.3 (revision f2da64fbbbf1b03f09f390ab01267c93dfd77c4c)
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.12 2015/12/30 16:41:52 tedu 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: December 30 2015 $
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
40Some programs use defined error codes to distinguish between possible errors.
41However, most programs in
42.Ox
43do not.
44.Pp
45The successful exit is always indicated by a status of 0, or
46.Dv EX_OK .
47Error numbers begin at
48.Dv EX__BASE
49to reduce the possibility of clashing with other exit statuses that
50random programs may already return.
51The meaning of the code is approximately as follows:
52.Bl -tag -width "EX_UNAVAILABLEXX(XX)"
53.It Dv EX_USAGE Pq 64
54The command was used incorrectly, e.g., with the wrong number of
55arguments, a bad flag, bad syntax in a parameter, or whatever.
56.It Dv EX_DATAERR Pq 65
57The input data was incorrect in some way.
58This should only be used for user's data and not system files.
59.It Dv EX_NOINPUT Pq 66
60An input file (not a system file) did not exist or was not readable.
61This could also include errors like
62.Dq \&No message
63to a mailer (if it cared to catch it).
64.It Dv EX_NOUSER Pq 67
65The user specified did not exist.
66This might be used for mail addresses or remote logins.
67.It Dv EX_NOHOST Pq 68
68The host specified did not exist.
69This is used in mail addresses or network requests.
70.It Dv EX_UNAVAILABLE Pq 69
71A service is unavailable.
72This can occur if a support program or file does not exist.
73This can also be used as a catch-all message when something you wanted
74to do doesn't work, but you don't know why.
75.It Dv EX_SOFTWARE Pq 70
76An internal software error has been detected.
77This should be limited to non-operating system related errors if possible.
78.It Dv EX_OSERR Pq 71
79An operating system error has been detected.
80This is intended to be used for such things as
81.Dq cannot fork ,
82or
83.Dq cannot create pipe .
84It includes things like
85.Xr getuid 2
86returning a user that does not exist in the passwd file.
87.It Dv EX_OSFILE Pq 72
88Some system file (e.g.,
89.Pa /etc/passwd ,
90.Pa /var/run/utmp )
91does not exist, cannot be opened, or has some sort of error
92(e.g., syntax error).
93.It Dv EX_CANTCREAT Pq 73
94A (user specified) output file cannot be created.
95.It Dv EX_IOERR Pq 74
96An error occurred while doing I/O on some file.
97.It Dv EX_TEMPFAIL Pq 75
98Temporary failure, indicating something that is not really an error.
99For example that a mailer could not create a
100connection, and the request should be reattempted later.
101.It Dv EX_PROTOCOL Pq 76
102The remote system returned something that was
103.Dq not possible
104during a protocol exchange.
105.It Dv EX_NOPERM Pq 77
106You did not have sufficient permission to perform the operation.
107This is not intended for file system problems, which should use
108.Dv EX_NOINPUT
109or
110.Dv EX_CANTCREAT ,
111but rather for higher level permissions.
112.It Dv EX_CONFIG Pq 78
113Something was found in an unconfigured or misconfigured state.
114.El
115.Pp
116The numerical values corresponding to the symbolical ones are given in
117parentheses for easy reference.
118.Sh SEE ALSO
119.Xr _exit 2 ,
120.Xr exit 3
121.Sh HISTORY
122The
123.Nm
124file first appeared in
125.Bx 4.0
126for use by the delivermail utility, later renamed to
127.Xr sendmail 8 .
128.Sh AUTHORS
129.An -nosplit
130.An Eric Allman
131invented the
132.Nm
133file in 1980.
134This man page was written by
135.An Joerg Wunsch ,
136based on Eric's original comments found in
137.In sysexits.h .
138.Sh BUGS
139The choice of an appropriate exit value is often ambiguous.
140