]> git.saurik.com Git - apple/xnu.git/blob - bsd/sys/errno.h
xnu-201.42.3.tar.gz
[apple/xnu.git] / bsd / sys / errno.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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.
11 *
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
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
23 /*
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.
31 *
32 * Redistribution and use in source and binary forms, with or without
33 * modification, are permitted provided that the following conditions
34 * are met:
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.
47 *
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
58 * SUCH DAMAGE.
59 *
60 * @(#)errno.h 8.5 (Berkeley) 1/21/94
61 */
62
63 #ifndef _SYS_ERRNO_H_
64 #define _SYS_ERRNO_H_
65
66 #if !defined(KERNEL) && !defined(KERNEL_PRIVATE)
67 #include <sys/cdefs.h>
68 __BEGIN_DECLS
69 extern int * __error __P((void));
70 #define errno (*__error())
71 __END_DECLS
72 #endif
73
74 /*
75 * Error codes
76 */
77
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 */
89 /* 11 was EAGAIN */
90 #define ENOMEM 12 /* Cannot allocate memory */
91 #define EACCES 13 /* Permission denied */
92 #define EFAULT 14 /* Bad address */
93 #ifndef _POSIX_SOURCE
94 #define ENOTBLK 15 /* Block device required */
95 #endif
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 #ifndef _POSIX_SOURCE
107 #define ETXTBSY 26 /* Text file busy */
108 #endif
109 #define EFBIG 27 /* File too large */
110 #define ENOSPC 28 /* No space left on device */
111 #define ESPIPE 29 /* Illegal seek */
112 #define EROFS 30 /* Read-only file system */
113 #define EMLINK 31 /* Too many links */
114 #define EPIPE 32 /* Broken pipe */
115
116 /* math software */
117 #define EDOM 33 /* Numerical argument out of domain */
118 #define ERANGE 34 /* Result too large */
119
120 /* non-blocking and interrupt i/o */
121 #define EAGAIN 35 /* Resource temporarily unavailable */
122 #ifndef _POSIX_SOURCE
123 #define EWOULDBLOCK EAGAIN /* Operation would block */
124 #define EINPROGRESS 36 /* Operation now in progress */
125 #define EALREADY 37 /* Operation already in progress */
126
127 /* ipc/network software -- argument errors */
128 #define ENOTSOCK 38 /* Socket operation on non-socket */
129 #define EDESTADDRREQ 39 /* Destination address required */
130 #define EMSGSIZE 40 /* Message too long */
131 #define EPROTOTYPE 41 /* Protocol wrong type for socket */
132 #define ENOPROTOOPT 42 /* Protocol not available */
133 #define EPROTONOSUPPORT 43 /* Protocol not supported */
134 #define ESOCKTNOSUPPORT 44 /* Socket type not supported */
135 #endif /* ! _POSIX_SOURCE */
136 #define ENOTSUP 45 /* Operation not supported */
137 #ifndef _POSIX_SOURCE
138 #define EOPNOTSUPP ENOTSUP /* Operation not supported */
139 #define EPFNOSUPPORT 46 /* Protocol family not supported */
140 #define EAFNOSUPPORT 47 /* Address family not supported by protocol family */
141 #define EADDRINUSE 48 /* Address already in use */
142 #define EADDRNOTAVAIL 49 /* Can't assign requested address */
143
144 /* ipc/network software -- operational errors */
145 #define ENETDOWN 50 /* Network is down */
146 #define ENETUNREACH 51 /* Network is unreachable */
147 #define ENETRESET 52 /* Network dropped connection on reset */
148 #define ECONNABORTED 53 /* Software caused connection abort */
149 #define ECONNRESET 54 /* Connection reset by peer */
150 #define ENOBUFS 55 /* No buffer space available */
151 #define EISCONN 56 /* Socket is already connected */
152 #define ENOTCONN 57 /* Socket is not connected */
153 #define ESHUTDOWN 58 /* Can't send after socket shutdown */
154 #define ETOOMANYREFS 59 /* Too many references: can't splice */
155 #define ETIMEDOUT 60 /* Operation timed out */
156 #define ECONNREFUSED 61 /* Connection refused */
157
158 #define ELOOP 62 /* Too many levels of symbolic links */
159 #endif /* _POSIX_SOURCE */
160 #define ENAMETOOLONG 63 /* File name too long */
161
162 /* should be rearranged */
163 #ifndef _POSIX_SOURCE
164 #define EHOSTDOWN 64 /* Host is down */
165 #define EHOSTUNREACH 65 /* No route to host */
166 #endif /* _POSIX_SOURCE */
167 #define ENOTEMPTY 66 /* Directory not empty */
168
169 /* quotas & mush */
170 #ifndef _POSIX_SOURCE
171 #define EPROCLIM 67 /* Too many processes */
172 #define EUSERS 68 /* Too many users */
173 #define EDQUOT 69 /* Disc quota exceeded */
174
175 /* Network File System */
176 #define ESTALE 70 /* Stale NFS file handle */
177 #define EREMOTE 71 /* Too many levels of remote in path */
178 #define EBADRPC 72 /* RPC struct is bad */
179 #define ERPCMISMATCH 73 /* RPC version wrong */
180 #define EPROGUNAVAIL 74 /* RPC prog. not avail */
181 #define EPROGMISMATCH 75 /* Program version wrong */
182 #define EPROCUNAVAIL 76 /* Bad procedure for program */
183 #endif /* _POSIX_SOURCE */
184
185 #define ENOLCK 77 /* No locks available */
186 #define ENOSYS 78 /* Function not implemented */
187
188 #ifndef _POSIX_SOURCE
189 #define EFTYPE 79 /* Inappropriate file type or format */
190 #define EAUTH 80 /* Authentication error */
191 #define ENEEDAUTH 81 /* Need authenticator */
192 #endif /* _POSIX_SOURCE */
193
194 /* Intelligent device errors */
195 #define EPWROFF 82 /* Device power is off */
196 #define EDEVERR 83 /* Device error, e.g. paper out */
197
198 #ifndef _POSIX_SOURCE
199 #define EOVERFLOW 84 /* Value too large to be stored in data type */
200
201 /* Program loading errors */
202 #define EBADEXEC 85 /* Bad executable */
203 #define EBADARCH 86 /* Bad CPU type in executable */
204 #define ESHLIBVERS 87 /* Shared library version mismatch */
205 #define EBADMACHO 88 /* Malformed Macho file */
206
207 #define ELAST 88 /* Must be equal largest errno */
208 #endif /* _POSIX_SOURCE */
209
210 #ifdef KERNEL
211 /* pseudo-errors returned inside kernel to modify return to process */
212 #define ERESTART -1 /* restart syscall */
213 #define EJUSTRETURN -2 /* don't modify regs, just return */
214 #endif
215 #endif /* _SYS_ERRNO_H_ */