xref: /dragonfly/share/man/man3/sysexits.3 (revision 2cd2d2b5)
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: src/share/man/man3/sysexits.3,v 1.5.2.3 2001/12/17 11:30:11 ru Exp $
27.\" $DragonFly: src/share/man/man3/sysexits.3,v 1.2 2003/06/17 04:36:58 dillon 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
39According to
40.Xr style 9 ,
41it is not a good practice to call
42.Xr exit 3
43with arbitrary values to indicate a failure condition when ending
44a program.  Instead, 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.  The meaning of the codes is
55approximately as follows:
56.Bl -tag -width "EX_UNAVAILABLEXX(XX)"
57.It Sy 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 Sy EX_DATAERR Pq 65
61The input data was incorrect in some way.  This should only be used
62for user's data and not system files.
63.It Sy EX_NOINPUT Pq 66
64An input file (not a system file) did not exist or was not readable.
65This could also include errors like
66.Dq \&No message
67to a mailer (if it cared to catch it).
68.It Sy EX_NOUSER Pq 67
69The user specified did not exist.  This might be used for mail
70addresses or remote logins.
71.It Sy EX_NOHOST Pq 68
72The host specified did not exist.  This is used in mail addresses or
73network requests.
74.It Sy EX_UNAVAILABLE Pq 69
75A service is unavailable.  This can occur if a support program or file
76does not exist.  This can also be used as a catchall message when
77something you wanted to do doesn't work, but you don't know why.
78.It Sy EX_SOFTWARE Pq 70
79An internal software error has been detected.  This should be limited
80to non-operating system related errors as possible.
81.It Sy EX_OSERR Pq 71
82An operating system error has been detected.  This is intended to be
83used for such things as
84.Dq cannot fork ,
85.Dq cannot create pipe ,
86or the like.  It 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/utmp ,
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.  This
108is 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 exit 3 ,
121.Xr style 9
122.Sh HISTORY
123The
124.Nm
125file appeared somewhere after
126.Bx 4.3 .
127.Sh AUTHORS
128This man page has been written by
129.An J\(:org Wunsch
130after the comments in
131.Pa <sysexits.h> .
132.Sh BUGS
133The choice of an appropriate exit value is often ambiguous.
134