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