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