xref: /freebsd/cddl/lib/libdtrace/errno.d (revision d7d962ead0b6e5e8a39202d0590022082bf5bfb6)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  *
22  * Portions Copyright 2006-2008 John Birrell jb@freebsd.org
23  * Portions Copyright 2018 Devin Teske dteske@freebsd.org
24  *
25  * $FreeBSD$
26  */
27 /*
28  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
29  * Use is subject to license terms.
30  */
31 
32 inline int EPERM = 1;
33 #pragma D binding "1.0" EPERM
34 inline int ENOENT = 2;
35 #pragma D binding "1.0" ENOENT
36 inline int ESRCH = 3;
37 #pragma D binding "1.0" ESRCH
38 inline int EINTR = 4;
39 #pragma D binding "1.0" EINTR
40 inline int EIO = 5;
41 #pragma D binding "1.0" EIO
42 inline int ENXIO = 6;
43 #pragma D binding "1.0" ENXIO
44 inline int E2BIG = 7;
45 #pragma D binding "1.0" E2BIG
46 inline int ENOEXEC = 8;
47 #pragma D binding "1.0" ENOEXEC
48 inline int EBADF = 9;
49 #pragma D binding "1.0" EBADF
50 inline int ECHILD = 10;
51 #pragma D binding "1.0" ECHILD
52 inline int EDEADLK = 11;
53 #pragma D binding "1.0" EDEADLK
54 inline int ENOMEM = 12;
55 #pragma D binding "1.0" ENOMEM
56 inline int EACCES = 13;
57 #pragma D binding "1.0" EACCES
58 inline int EFAULT = 14;
59 #pragma D binding "1.0" EFAULT
60 inline int ENOTBLK = 15;
61 #pragma D binding "1.0" ENOTBLK
62 inline int EBUSY = 16;
63 #pragma D binding "1.0" EBUSY
64 inline int EEXIST = 17;
65 #pragma D binding "1.0" EEXIST
66 inline int EXDEV = 18;
67 #pragma D binding "1.0" EXDEV
68 inline int ENODEV = 19;
69 #pragma D binding "1.0" ENODEV
70 inline int ENOTDIR = 20;
71 #pragma D binding "1.0" ENOTDIR
72 inline int EISDIR = 21;
73 #pragma D binding "1.0" EISDIR
74 inline int EINVAL = 22;
75 #pragma D binding "1.0" EINVAL
76 inline int ENFILE = 23;
77 #pragma D binding "1.0" ENFILE
78 inline int EMFILE = 24;
79 #pragma D binding "1.0" EMFILE
80 inline int ENOTTY = 25;
81 #pragma D binding "1.0" ENOTTY
82 inline int ETXTBSY = 26;
83 #pragma D binding "1.0" ETXTBSY
84 inline int EFBIG = 27;
85 #pragma D binding "1.0" EFBIG
86 inline int ENOSPC = 28;
87 #pragma D binding "1.0" ENOSPC
88 inline int ESPIPE = 29;
89 #pragma D binding "1.0" ESPIPE
90 inline int EROFS = 30;
91 #pragma D binding "1.0" EROFS
92 inline int EMLINK = 31;
93 #pragma D binding "1.0" EMLINK
94 inline int EPIPE = 32;
95 #pragma D binding "1.0" EPIPE
96 inline int EDOM = 33;
97 #pragma D binding "1.0" EDOM
98 inline int ERANGE = 34;
99 #pragma D binding "1.0" ERANGE
100 inline int EAGAIN = 35;
101 #pragma D binding "1.0" EAGAIN
102 inline int EWOULDBLOCK = EAGAIN;
103 #pragma D binding "1.0" EWOULDBLOCK
104 inline int EINPROGRESS = 36;
105 #pragma D binding "1.0" EINPROGRESS
106 inline int EALREADY = 37;
107 #pragma D binding "1.0" EALREADY
108 inline int ENOTSOCK = 38;
109 #pragma D binding "1.0" ENOTSOCK
110 inline int EDESTADDRREQ = 39;
111 #pragma D binding "1.0" EDESTADDRREQ
112 inline int EMSGSIZE = 40;
113 #pragma D binding "1.0" EMSGSIZE
114 inline int EPROTOTYPE = 41;
115 #pragma D binding "1.0" EPROTOTYPE
116 inline int ENOPROTOOPT = 42;
117 #pragma D binding "1.0" ENOPROTOOPT
118 inline int EPROTONOSUPPORT = 43;
119 #pragma D binding "1.0" EPROTONOSUPPORT
120 inline int ESOCKTNOSUPPORT = 44;
121 #pragma D binding "1.0" ESOCKTNOSUPPORT
122 inline int EOPNOTSUPP = 45;
123 #pragma D binding "1.0" EOPNOTSUPP
124 inline int ENOTSUP = EOPNOTSUPP;
125 #pragma D binding "1.0" ENOTSUP
126 inline int EPFNOSUPPORT = 46;
127 #pragma D binding "1.0" EPFNOSUPPORT
128 inline int EAFNOSUPPORT = 47;
129 #pragma D binding "1.0" EAFNOSUPPORT
130 inline int EADDRINUSE = 48;
131 #pragma D binding "1.0" EADDRINUSE
132 inline int EADDRNOTAVAIL = 49;
133 #pragma D binding "1.0" EADDRNOTAVAIL
134 inline int ENETDOWN = 50;
135 #pragma D binding "1.0" ENETDOWN
136 inline int ENETUNREACH = 51;
137 #pragma D binding "1.0" ENETUNREACH
138 inline int ENETRESET = 52;
139 #pragma D binding "1.0" ENETRESET
140 inline int ECONNABORTED = 53;
141 #pragma D binding "1.0" ECONNABORTED
142 inline int ECONNRESET = 54;
143 #pragma D binding "1.0" ECONNRESET
144 inline int ENOBUFS = 55;
145 #pragma D binding "1.0" ENOBUFS
146 inline int EISCONN = 56;
147 #pragma D binding "1.0" EISCONN
148 inline int ENOTCONN = 57;
149 #pragma D binding "1.0" ENOTCONN
150 inline int ESHUTDOWN = 58;
151 #pragma D binding "1.0" ESHUTDOWN
152 inline int ETOOMANYREFS = 59;
153 #pragma D binding "1.0" ETOOMANYREFS
154 inline int ETIMEDOUT = 60;
155 #pragma D binding "1.0" ETIMEDOUT
156 inline int ECONNREFUSED = 61;
157 #pragma D binding "1.0" ECONNREFUSED
158 inline int ELOOP = 62;
159 #pragma D binding "1.0" ELOOP
160 inline int ENAMETOOLONG = 63;
161 #pragma D binding "1.0" ENAMETOOLONG
162 inline int EHOSTDOWN = 64;
163 #pragma D binding "1.0" EHOSTDOWN
164 inline int EHOSTUNREACH = 65;
165 #pragma D binding "1.0" EHOSTUNREACH
166 inline int ENOTEMPTY = 66;
167 #pragma D binding "1.0" ENOTEMPTY
168 inline int EPROCLIM = 67;
169 #pragma D binding "1.0" EPROCLIM
170 inline int EUSERS = 68;
171 #pragma D binding "1.0" EUSERS
172 inline int EDQUOT = 69;
173 #pragma D binding "1.0" EDQUOT
174 inline int ESTALE = 70;
175 #pragma D binding "1.0" ESTALE
176 inline int EREMOTE = 71;
177 #pragma D binding "1.0" EREMOTE
178 inline int EBADRPC = 72;
179 #pragma D binding "1.0" EBADRPC
180 inline int ERPCMISMATCH = 73;
181 #pragma D binding "1.0" ERPCMISMATCH
182 inline int EPROGUNAVAIL = 74;
183 #pragma D binding "1.0" EPROGUNAVAIL
184 inline int EPROGMISMATCH = 75;
185 #pragma D binding "1.0" EPROGMISMATCH
186 inline int EPROCUNAVAIL = 76;
187 #pragma D binding "1.0" EPROCUNAVAIL
188 inline int ENOLCK = 77;
189 #pragma D binding "1.0" ENOLCK
190 inline int ENOSYS = 78;
191 #pragma D binding "1.0" ENOSYS
192 inline int EFTYPE = 79;
193 #pragma D binding "1.0" EFTYPE
194 inline int EAUTH = 80;
195 #pragma D binding "1.0" EAUTH
196 inline int ENEEDAUTH = 81;
197 #pragma D binding "1.0" ENEEDAUTH
198 inline int EIDRM = 82;
199 #pragma D binding "1.0" EIDRM
200 inline int ENOMSG = 83;
201 #pragma D binding "1.0" ENOMSG
202 inline int EOVERFLOW = 84;
203 #pragma D binding "1.0" EOVERFLOW
204 inline int ECANCELED = 85;
205 #pragma D binding "1.0" ECANCELED
206 inline int EILSEQ = 86;
207 #pragma D binding "1.0" EILSEQ
208 inline int ENOATTR = 87;
209 #pragma D binding "1.0" ENOATTR
210 inline int EDOOFUS = 88;
211 #pragma D binding "1.0" EDOOFUS
212 inline int EBADMSG = 89;
213 #pragma D binding "1.0" EBADMSG
214 inline int EMULTIHOP = 90;
215 #pragma D binding "1.0" EMULTIHOP
216 inline int ENOLINK = 91;
217 #pragma D binding "1.0" ENOLINK
218 inline int EPROTO = 92;
219 #pragma D binding "1.0" EPROTO
220 inline int ENOTCAPABLE = 93;
221 #pragma D binding "1.13" ENOTCAPABLE
222 inline int ECAPMODE = 94;
223 #pragma D binding "1.13" ECAPMODE
224 inline int ENOTRECOVERABLE = 95;
225 #pragma D binding "1.13" ENOTRECOVERABLE
226 inline int EOWNERDEAD = 96;
227 #pragma D binding "1.13" EOWNERDEAD
228 inline int EINTEGRITY = 97;
229 #pragma D binding "1.13" EINTEGRITY
230 inline int ELAST = 97;
231 #pragma D binding "1.0" ELAST
232 inline int ERESTART = -1;
233 #pragma D binding "1.0" ERESTART
234 inline int EJUSTRETURN = -2;
235 #pragma D binding "1.0" EJUSTRETURN
236 inline int ENOIOCTL = -3;
237 #pragma D binding "1.0" ENOIOCTL
238 inline int EDIRIOCTL = -4;
239 #pragma D binding "1.0" EDIRIOCTL
240 inline int ERELOOKUP = -5;
241 #pragma D binding "1.13" ERELOOKUP
242 
243 /*
244  * Error strings from <sys/errno.h>
245  */
246 #pragma D binding "1.13" strerror
247 inline string strerror[int errno] =
248 	errno == 0 ? 			"Success" :
249 	errno == EPERM ?		"Operation not permitted" :
250 	errno == ENOENT ?		"No such file or directory" :
251 	errno == ESRCH ?		"No such process" :
252 	errno == EINTR ?		"Interrupted system call" :
253 	errno == EIO ?			"Input/output error" :
254 	errno == ENXIO ?		"Device not configured" :
255 	errno == E2BIG ?		"Argument list too long" :
256 	errno == ENOEXEC ?		"Exec format error" :
257 	errno == EBADF ?		"Bad file descriptor" :
258 	errno == ECHILD ?		"No child processes" :
259 	errno == EDEADLK ?		"Resource deadlock avoided" :
260 	errno == ENOMEM ?		"Cannot allocate memory" :
261 	errno == EACCES ?		"Permission denied" :
262 	errno == EFAULT ?		"Bad address" :
263 	errno == ENOTBLK ?		"Block device required" :
264 	errno == EBUSY ?		"Device busy" :
265 	errno == EEXIST ?		"File exists" :
266 	errno == EXDEV ?		"Cross-device link" :
267 	errno == ENODEV ?		"Operation not supported by device" :
268 	errno == ENOTDIR ?		"Not a directory" :
269 	errno == EISDIR ?		"Is a directory" :
270 	errno == EINVAL ?		"Invalid argument" :
271 	errno == ENFILE ?		"Too many open files in system" :
272 	errno == EMFILE ?		"Too many open files" :
273 	errno == ENOTTY ?		"Inappropriate ioctl for device" :
274 	errno == ETXTBSY ?		"Text file busy" :
275 	errno == EFBIG ?		"File too large" :
276 	errno == ENOSPC ?		"No space left on device" :
277 	errno == ESPIPE ?		"Illegal seek" :
278 	errno == EROFS ?		"Read-only filesystem" :
279 	errno == EMLINK ?		"Too many links" :
280 	errno == EPIPE ?		"Broken pipe" :
281 	errno == EDOM ?			"Numerical argument out of domain" :
282 	errno == ERANGE ?		"Result too large" :
283 	errno == EAGAIN ?		"Resource temporarily unavailable" :
284 	errno == EINPROGRESS ?		"Operation now in progress" :
285 	errno == EALREADY ?		"Operation already in progress" :
286 	errno == ENOTSOCK ?		"Socket operation on non-socket" :
287 	errno == EDESTADDRREQ ?		"Destination address required" :
288 	errno == EMSGSIZE ?		"Message too long" :
289 	errno == EPROTOTYPE ?		"Protocol wrong type for socket" :
290 	errno == ENOPROTOOPT ?		"Protocol not available" :
291 	errno == EPROTONOSUPPORT ?	"Protocol not supported" :
292 	errno == ESOCKTNOSUPPORT ?	"Socket type not supported" :
293 	errno == EOPNOTSUPP ?		"Operation not supported" :
294 	errno == EPFNOSUPPORT ?		"Protocol family not supported" :
295 	errno == EAFNOSUPPORT ?		"Address family not supported by protocol family" :
296 	errno == EADDRINUSE ?		"Address already in use" :
297 	errno == EADDRNOTAVAIL ?	"Can't assign requested address" :
298 	errno == ENETDOWN ?		"Network is down" :
299 	errno == ENETUNREACH ?		"Network is unreachable" :
300 	errno == ENETRESET ?		"Network dropped connection on reset" :
301 	errno == ECONNABORTED ?		"Software caused connection abort" :
302 	errno == ECONNRESET ?		"Connection reset by peer" :
303 	errno == ENOBUFS ?		"No buffer space available" :
304 	errno == EISCONN ?		"Socket is already connected" :
305 	errno == ENOTCONN ?		"Socket is not connected" :
306 	errno == ESHUTDOWN ?		"Can't send after socket shutdown" :
307 	errno == ETOOMANYREFS ?		"Too many references: can't splice" :
308 	errno == ETIMEDOUT ?		"Operation timed out" :
309 	errno == ECONNREFUSED ?		"Connection refused" :
310 	errno == ELOOP ?		"Too many levels of symbolic links" :
311 	errno == ENAMETOOLONG ?		"File name too long" :
312 	errno == EHOSTDOWN ?		"Host is down" :
313 	errno == EHOSTUNREACH ?		"No route to host" :
314 	errno == ENOTEMPTY ?		"Directory not empty" :
315 	errno == EPROCLIM ?		"Too many processes" :
316 	errno == EUSERS ?		"Too many users" :
317 	errno == EDQUOT ?		"Disc quota exceeded" :
318 	errno == ESTALE ?		"Stale NFS file handle" :
319 	errno == EREMOTE ?		"Too many levels of remote in path" :
320 	errno == EBADRPC ?		"RPC struct is bad" :
321 	errno == ERPCMISMATCH ?		"RPC version wrong" :
322 	errno == EPROGUNAVAIL ?		"RPC prog. not avail" :
323 	errno == EPROGMISMATCH ?	"Program version wrong" :
324 	errno == EPROCUNAVAIL ?		"Bad procedure for program" :
325 	errno == ENOLCK ?		"No locks available" :
326 	errno == ENOSYS ?		"Function not implemented" :
327 	errno == EFTYPE ?		"Inappropriate file type or format" :
328 	errno == EAUTH ?		"Authentication error" :
329 	errno == ENEEDAUTH ?		"Need authenticator" :
330 	errno == EIDRM ?		"Identifier removed" :
331 	errno == ENOMSG ?		"No message of desired type" :
332 	errno == EOVERFLOW ?		"Value too large to be stored in data type" :
333 	errno == ECANCELED ?		"Operation canceled" :
334 	errno == EILSEQ ?		"Illegal byte sequence" :
335 	errno == ENOATTR ?		"Attribute not found" :
336 	errno == EDOOFUS ?		"Programming error" :
337 	errno == EBADMSG ?		"Bad message" :
338 	errno == EMULTIHOP ?		"Multihop attempted" :
339 	errno == ENOLINK ?		"Link has been severed" :
340 	errno == EPROTO ?		"Protocol error" :
341 	errno == ENOTCAPABLE ?		"Capabilities insufficient" :
342 	errno == ECAPMODE ?		"Not permitted in capability mode" :
343 	errno == ENOTRECOVERABLE ?	"State not recoverable" :
344 	errno == EOWNERDEAD ?		"Previous owner died" :
345 	errno == EINTEGRITY ?		"Integrity check failed" :
346 	errno == ERESTART ?		"restart syscall" :
347 	errno == EJUSTRETURN ?		"don't modify regs, just return" :
348 	errno == ENOIOCTL ?		"ioctl not handled by this layer" :
349 	errno == EDIRIOCTL ?		"do direct ioctl in GEOM" :
350 	errno == ERELOOKUP ?		"retry the directory lookup" :
351 	"Unknown error";
352