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