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