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