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