]> git.saurik.com Git - apple/xnu.git/blob - bsd/sys/errno.h
f54b8e5cea023a30fb985ca39cd104b55d4c3008
[apple/xnu.git] / bsd / sys / errno.h
1 /*
2 * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23 /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
24 /*
25 * Copyright (c) 1982, 1986, 1989, 1993
26 * The Regents of the University of California. All rights reserved.
27 * (c) UNIX System Laboratories, Inc.
28 * All or some portions of this file are derived from material licensed
29 * to the University of California by American Telephone and Telegraph
30 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
31 * the permission of UNIX System Laboratories, Inc.
32 *
33 * Redistribution and use in source and binary forms, with or without
34 * modification, are permitted provided that the following conditions
35 * are met:
36 * 1. Redistributions of source code must retain the above copyright
37 * notice, this list of conditions and the following disclaimer.
38 * 2. Redistributions in binary form must reproduce the above copyright
39 * notice, this list of conditions and the following disclaimer in the
40 * documentation and/or other materials provided with the distribution.
41 * 3. All advertising materials mentioning features or use of this software
42 * must display the following acknowledgement:
43 * This product includes software developed by the University of
44 * California, Berkeley and its contributors.
45 * 4. Neither the name of the University nor the names of its contributors
46 * may be used to endorse or promote products derived from this software
47 * without specific prior written permission.
48 *
49 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
50 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
51 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
52 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59 * SUCH DAMAGE.
60 *
61 * @(#)errno.h 8.5 (Berkeley) 1/21/94
62 */
63
64 #ifndef _SYS_ERRNO_H_
65 #define _SYS_ERRNO_H_
66
67 #if !defined(KERNEL) && !defined(KERNEL_PRIVATE)
68 #include <sys/cdefs.h>
69 __BEGIN_DECLS
70 extern int * __error(void);
71 #define errno (*__error())
72 __END_DECLS
73 #endif
74
75 /*
76 * Error codes
77 */
78
79 #define EPERM 1 /* Operation not permitted */
80 #define ENOENT 2 /* No such file or directory */
81 #define ESRCH 3 /* No such process */
82 #define EINTR 4 /* Interrupted system call */
83 #define EIO 5 /* Input/output error */
84 #define ENXIO 6 /* Device not configured */
85 #define E2BIG 7 /* Argument list too long */
86 #define ENOEXEC 8 /* Exec format error */
87 #define EBADF 9 /* Bad file descriptor */
88 #define ECHILD 10 /* No child processes */
89 #define EDEADLK 11 /* Resource deadlock avoided */
90 /* 11 was EAGAIN */
91 #define ENOMEM 12 /* Cannot allocate memory */
92 #define EACCES 13 /* Permission denied */
93 #define EFAULT 14 /* Bad address */
94 #ifndef _POSIX_C_SOURCE
95 #define ENOTBLK 15 /* Block device required */
96 #endif
97 #define EBUSY 16 /* Device busy */
98 #define EEXIST 17 /* File exists */
99 #define EXDEV 18 /* Cross-device link */
100 #define ENODEV 19 /* Operation not supported by device */
101 #define ENOTDIR 20 /* Not a directory */
102 #define EISDIR 21 /* Is a directory */
103 #define EINVAL 22 /* Invalid argument */
104 #define ENFILE 23 /* Too many open files in system */
105 #define EMFILE 24 /* Too many open files */
106 #define ENOTTY 25 /* Inappropriate ioctl for device */
107 #define ETXTBSY 26 /* Text file busy */
108 #define EFBIG 27 /* File too large */
109 #define ENOSPC 28 /* No space left on device */
110 #define ESPIPE 29 /* Illegal seek */
111 #define EROFS 30 /* Read-only file system */
112 #define EMLINK 31 /* Too many links */
113 #define EPIPE 32 /* Broken pipe */
114
115 /* math software */
116 #define EDOM 33 /* Numerical argument out of domain */
117 #define ERANGE 34 /* Result too large */
118
119 /* non-blocking and interrupt i/o */
120 #define EAGAIN 35 /* Resource temporarily unavailable */
121 #define EWOULDBLOCK EAGAIN /* Operation would block */
122 #define EINPROGRESS 36 /* Operation now in progress */
123 #define EALREADY 37 /* Operation already in progress */
124
125 /* ipc/network software -- argument errors */
126 #define ENOTSOCK 38 /* Socket operation on non-socket */
127 #define EDESTADDRREQ 39 /* Destination address required */
128 #define EMSGSIZE 40 /* Message too long */
129 #define EPROTOTYPE 41 /* Protocol wrong type for socket */
130 #define ENOPROTOOPT 42 /* Protocol not available */
131 #define EPROTONOSUPPORT 43 /* Protocol not supported */
132 #ifndef _POSIX_C_SOURCE
133 #define ESOCKTNOSUPPORT 44 /* Socket type not supported */
134 #endif /* ! _POSIX_C_SOURCE */
135 #define ENOTSUP 45 /* Operation not supported */
136 #if !__DARWIN_UNIX03 && !defined(KERNEL)
137 /*
138 * This is the same for binary and source copmpatability, unless compiling
139 * the kernel itself, or compiling __DARWIN_UNIX03; if compiling for the
140 * kernel, the correct value will be returned. If compiling non-POSIX
141 * source, the kernel return value will be converted by a stub in libc, and
142 * if compiling source with __DARWIN_UNIX03, the conversion in libc is not
143 * done, and the caller gets the expected (discrete) value.
144 */
145 #define EOPNOTSUPP ENOTSUP /* Operation not supported on socket */
146 #endif /* !__DARWIN_UNIX03 && !KERNEL */
147
148 #ifndef _POSIX_C_SOURCE
149 #define EPFNOSUPPORT 46 /* Protocol family not supported */
150 #endif /* _POSIX_C_SOURCE */
151 #define EAFNOSUPPORT 47 /* Address family not supported by protocol family */
152 #define EADDRINUSE 48 /* Address already in use */
153 #define EADDRNOTAVAIL 49 /* Can't assign requested address */
154
155 /* ipc/network software -- operational errors */
156 #define ENETDOWN 50 /* Network is down */
157 #define ENETUNREACH 51 /* Network is unreachable */
158 #define ENETRESET 52 /* Network dropped connection on reset */
159 #define ECONNABORTED 53 /* Software caused connection abort */
160 #define ECONNRESET 54 /* Connection reset by peer */
161 #define ENOBUFS 55 /* No buffer space available */
162 #define EISCONN 56 /* Socket is already connected */
163 #define ENOTCONN 57 /* Socket is not connected */
164 #ifndef _POSIX_C_SOURCE
165 #define ESHUTDOWN 58 /* Can't send after socket shutdown */
166 #define ETOOMANYREFS 59 /* Too many references: can't splice */
167 #endif /* _POSIX_C_SOURCE */
168 #define ETIMEDOUT 60 /* Operation timed out */
169 #define ECONNREFUSED 61 /* Connection refused */
170
171 #define ELOOP 62 /* Too many levels of symbolic links */
172 #define ENAMETOOLONG 63 /* File name too long */
173
174 /* should be rearranged */
175 #ifndef _POSIX_C_SOURCE
176 #define EHOSTDOWN 64 /* Host is down */
177 #endif /* _POSIX_C_SOURCE */
178 #define EHOSTUNREACH 65 /* No route to host */
179 #define ENOTEMPTY 66 /* Directory not empty */
180
181 /* quotas & mush */
182 #ifndef _POSIX_C_SOURCE
183 #define EPROCLIM 67 /* Too many processes */
184 #define EUSERS 68 /* Too many users */
185 #endif /* _POSIX_C_SOURCE */
186 #define EDQUOT 69 /* Disc quota exceeded */
187
188 /* Network File System */
189 #define ESTALE 70 /* Stale NFS file handle */
190 #ifndef _POSIX_C_SOURCE
191 #define EREMOTE 71 /* Too many levels of remote in path */
192 #define EBADRPC 72 /* RPC struct is bad */
193 #define ERPCMISMATCH 73 /* RPC version wrong */
194 #define EPROGUNAVAIL 74 /* RPC prog. not avail */
195 #define EPROGMISMATCH 75 /* Program version wrong */
196 #define EPROCUNAVAIL 76 /* Bad procedure for program */
197 #endif /* _POSIX_C_SOURCE */
198
199 #define ENOLCK 77 /* No locks available */
200 #define ENOSYS 78 /* Function not implemented */
201
202 #ifndef _POSIX_C_SOURCE
203 #define EFTYPE 79 /* Inappropriate file type or format */
204 #define EAUTH 80 /* Authentication error */
205 #define ENEEDAUTH 81 /* Need authenticator */
206
207 /* Intelligent device errors */
208 #define EPWROFF 82 /* Device power is off */
209 #define EDEVERR 83 /* Device error, e.g. paper out */
210 #endif /* _POSIX_C_SOURCE */
211
212 #define EOVERFLOW 84 /* Value too large to be stored in data type */
213
214 /* Program loading errors */
215 #ifndef _POSIX_C_SOURCE
216 #define EBADEXEC 85 /* Bad executable */
217 #define EBADARCH 86 /* Bad CPU type in executable */
218 #define ESHLIBVERS 87 /* Shared library version mismatch */
219 #define EBADMACHO 88 /* Malformed Macho file */
220 #endif /* _POSIX_C_SOURCE */
221
222 #define ECANCELED 89 /* Operation canceled */
223
224 #define EIDRM 90 /* Identifier removed */
225 #define ENOMSG 91 /* No message of desired type */
226 #define EILSEQ 92 /* Illegal byte sequence */
227 #ifndef _POSIX_C_SOURCE
228 #define ENOATTR 93 /* Attribute not found */
229 #endif /* _POSIX_C_SOURCE */
230
231 #define EBADMSG 94 /* Bad message */
232 #define EMULTIHOP 95 /* Reserved */
233 #define ENODATA 96 /* No message available on STREAM */
234 #define ENOLINK 97 /* Reserved */
235 #define ENOSR 98 /* No STREAM resources */
236 #define ENOSTR 99 /* Not a STREAM */
237 #define EPROTO 100 /* Protocol error */
238 #define ETIME 101 /* STREAM ioctl timeout */
239
240 #if __DARWIN_UNIX03 || defined(KERNEL)
241 /* This value is only discrete when compiling __DARWIN_UNIX03, or KERNEL */
242 #define EOPNOTSUPP 102 /* Operation not supported on socket */
243 #endif /* __DARWIN_UNIX03 || KERNEL */
244
245 #ifndef _POSIX_C_SOURCE
246 #define ELAST 102 /* Must be equal largest errno */
247 #endif /* _POSIX_C_SOURCE */
248
249 #ifdef KERNEL
250 /* pseudo-errors returned inside kernel to modify return to process */
251 #define ERESTART (-1) /* restart syscall */
252 #define EJUSTRETURN (-2) /* don't modify regs, just return */
253 #endif
254 #endif /* _SYS_ERRNO_H_ */