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