xref: /dragonfly/sys/sys/errno.h (revision 1aeeca56)
1 /*-
2  * Copyright (c) 1982, 1986, 1989, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  * (c) UNIX System Laboratories, Inc.
5  * All or some portions of this file are derived from material licensed
6  * to the University of California by American Telephone and Telegraph
7  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8  * the permission of UNIX System Laboratories, Inc.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. Neither the name of the University nor the names of its contributors
19  *    may be used to endorse or promote products derived from this software
20  *    without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32  * SUCH DAMAGE.
33  *
34  *	@(#)errno.h	8.5 (Berkeley) 1/21/94
35  * $FreeBSD: src/sys/sys/errno.h,v 1.28 2005/04/02 12:33:28 das Exp $
36  */
37 
38 #ifndef _SYS_ERRNO_H_
39 #define	_SYS_ERRNO_H_
40 
41 #include <sys/cdefs.h>
42 
43 #if (!defined(_KERNEL) || defined(_KERNEL_VIRTUAL)) && !defined(_STANDALONE)
44 __BEGIN_DECLS
45 extern __thread int	errno;
46 
47 int * __errno_location(void);		/* For language bindings only */
48 __END_DECLS
49 
50 /*
51  * Some python parsers unable to parse such __error() inline.
52  */
53 #ifdef __WANT_NO_INLINED___ERROR
54 #define	errno		(* __errno_location())
55 #else
56 static __inline int *__error(void)
57 {
58 	return (&errno);
59 }
60 #define	errno		(* __error())
61 #endif
62 #endif
63 
64 #define	EPERM		1		/* Operation not permitted */
65 #define	ENOENT		2		/* No such file or directory */
66 #define	ESRCH		3		/* No such process */
67 #define	EINTR		4		/* Interrupted system call */
68 #define	EIO		5		/* Input/output error */
69 #define	ENXIO		6		/* Device not configured */
70 #define	E2BIG		7		/* Argument list too long */
71 #define	ENOEXEC		8		/* Exec format error */
72 #define	EBADF		9		/* Bad file descriptor */
73 #define	ECHILD		10		/* No child processes */
74 #define	EDEADLK		11		/* Resource deadlock avoided */
75 					/* 11 was EAGAIN */
76 #define	ENOMEM		12		/* Cannot allocate memory */
77 #define	EACCES		13		/* Permission denied */
78 #define	EFAULT		14		/* Bad address */
79 #if __BSD_VISIBLE
80 #define	ENOTBLK		15		/* Block device required */
81 #endif /* __BSD_VISIBLE */
82 #define	EBUSY		16		/* Device busy */
83 #define	EEXIST		17		/* File exists */
84 #define	EXDEV		18		/* Cross-device link */
85 #define	ENODEV		19		/* Operation not supported by device */
86 #define	ENOTDIR		20		/* Not a directory */
87 #define	EISDIR		21		/* Is a directory */
88 #define	EINVAL		22		/* Invalid argument */
89 #define	ENFILE		23		/* Too many open files in system */
90 #define	EMFILE		24		/* Too many open files */
91 #define	ENOTTY		25		/* Inappropriate ioctl for device */
92 #define	ETXTBSY		26		/* Text file busy */
93 #define	EFBIG		27		/* File too large */
94 #define	ENOSPC		28		/* No space left on device */
95 #define	ESPIPE		29		/* Illegal seek */
96 #define	EROFS		30		/* Read-only filesystem */
97 #define	EMLINK		31		/* Too many links */
98 #define	EPIPE		32		/* Broken pipe */
99 
100 /* math software */
101 #define	EDOM		33		/* Numerical argument out of domain */
102 #define	ERANGE		34		/* Result too large */
103 
104 /* non-blocking and interrupt i/o */
105 #define	EAGAIN		35		/* Resource temporarily unavailable */
106 #define	EWOULDBLOCK	EAGAIN		/* Operation would block */
107 #define	EINPROGRESS	36		/* Operation now in progress */
108 #define	EALREADY	37		/* Operation already in progress */
109 
110 /* ipc/network software -- argument errors */
111 #define	ENOTSOCK	38		/* Socket operation on non-socket */
112 #define	EDESTADDRREQ	39		/* Destination address required */
113 #define	EMSGSIZE	40		/* Message too long */
114 #define	EPROTOTYPE	41		/* Protocol wrong type for socket */
115 #define	ENOPROTOOPT	42		/* Protocol not available */
116 #define	EPROTONOSUPPORT	43		/* Protocol not supported */
117 #if __BSD_VISIBLE
118 #define	ESOCKTNOSUPPORT	44		/* Socket type not supported */
119 #endif /*__BSD_VISIBLE */
120 #define	EOPNOTSUPP	45		/* Operation not supported */
121 #define	ENOTSUP		EOPNOTSUPP	/* Operation not supported */
122 #if __BSD_VISIBLE
123 #define	EPFNOSUPPORT	46		/* Protocol family not supported */
124 #endif /* __BSD_VISIBLE */
125 #define	EAFNOSUPPORT	47		/* Address family not supported by protocol family */
126 #define	EADDRINUSE	48		/* Address already in use */
127 #define	EADDRNOTAVAIL	49		/* Can't assign requested address */
128 
129 /* ipc/network software -- operational errors */
130 #define	ENETDOWN	50		/* Network is down */
131 #define	ENETUNREACH	51		/* Network is unreachable */
132 #define	ENETRESET	52		/* Network dropped connection on reset */
133 #define	ECONNABORTED	53		/* Software caused connection abort */
134 #define	ECONNRESET	54		/* Connection reset by peer */
135 #define	ENOBUFS		55		/* No buffer space available */
136 #define	EISCONN		56		/* Socket is already connected */
137 #define	ENOTCONN	57		/* Socket is not connected */
138 #if __BSD_VISIBLE
139 #define	ESHUTDOWN	58		/* Can't send after socket shutdown */
140 #define	ETOOMANYREFS	59		/* Too many references: can't splice */
141 #endif /* __BSD_VISIBLE */
142 #define	ETIMEDOUT	60		/* Operation timed out */
143 #define	ECONNREFUSED	61		/* Connection refused */
144 
145 #define	ELOOP		62		/* Too many levels of symbolic links */
146 #define	ENAMETOOLONG	63		/* File name too long */
147 
148 /* should be rearranged */
149 #define	EHOSTDOWN	64		/* Host is down */
150 #define	EHOSTUNREACH	65		/* No route to host */
151 #define	ENOTEMPTY	66		/* Directory not empty */
152 
153 /* quotas & mush */
154 #if __BSD_VISIBLE
155 #define	EPROCLIM	67		/* Too many processes */
156 #define	EUSERS		68		/* Too many users */
157 #endif /* __BSD_VISIBLE */
158 #define	EDQUOT		69		/* Disc quota exceeded */
159 
160 /* Network File System */
161 #define	ESTALE		70		/* Stale NFS file handle */
162 #if __BSD_VISIBLE
163 #define	EREMOTE		71		/* Too many levels of remote in path */
164 #define	EBADRPC		72		/* RPC struct is bad */
165 #define	ERPCMISMATCH	73		/* RPC version wrong */
166 #define	EPROGUNAVAIL	74		/* RPC prog. not avail */
167 #define	EPROGMISMATCH	75		/* Program version wrong */
168 #define	EPROCUNAVAIL	76		/* Bad procedure for program */
169 #endif /* __BSD_VISIBLE */
170 
171 #define	ENOLCK		77		/* No locks available */
172 #define	ENOSYS		78		/* Function not implemented */
173 
174 #if __BSD_VISIBLE
175 #define	EFTYPE		79		/* Inappropriate file type or format */
176 #define	EAUTH		80		/* Authentication error */
177 #define	ENEEDAUTH	81		/* Need authenticator */
178 #endif /* __BSD_VISIBLE */
179 #define	EIDRM		82		/* Identifier removed */
180 #define	ENOMSG		83		/* No message of desired type */
181 #define	EOVERFLOW	84		/* Value too large to be stored in data type */
182 #define	ECANCELED	85		/* Operation canceled */
183 #define	EILSEQ		86		/* Illegal byte sequence */
184 #if __BSD_VISIBLE
185 #define	ENOATTR		87		/* Attribute not found */
186 #define	EDOOFUS		88		/* Programming error */
187 #endif /* __BSD_VISIBLE */
188 
189 #define	EBADMSG		89		/* Bad message */
190 #define	EMULTIHOP	90		/* Multihop attempted */
191 #define	ENOLINK		91		/* Link has been severed */
192 #define	EPROTO		92		/* Protocol error */
193 
194 #if __BSD_VISIBLE
195 #define	ENOMEDIUM	93		/* linux */
196 #endif
197 
198 #define	ENOTRECOVERABLE	94		/* State not recoverable */
199 #define	EOWNERDEAD	95		/* Previous owner died */
200 
201 /* Error numbers 96 to 98 (inclusive) are unused. */
202 
203 #if __BSD_VISIBLE
204 #define	EASYNC		99		/* XXX */
205 
206 #define	ELAST		99		/* Must be equal largest errno */
207 #endif /* __BSD_VISIBLE */
208 
209 #if defined(_KERNEL) || defined(_KERNEL_STRUCTURES)
210 /* pseudo-errors returned inside kernel to modify return to process */
211 #define	ERESTART	(-1)		/* restart syscall */
212 #define	EJUSTRETURN	(-2)		/* don't modify regs, just return */
213 #define	ENOIOCTL	(-3)		/* ioctl not handled by this layer */
214 #define	EMOUNTEXIT	(-4)		/* mfs: mountpoint released via vfs_start */
215 #endif
216 
217 #endif
218