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