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
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.
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]
22 * Portions Copyright 2006-2008 John Birrell jb@freebsd.org
23 * Portions Copyright 2018 Devin Teske dteske@freebsd.org
28 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
29 * Use is subject to license terms.
33 #pragma D binding "1.0" EPERM
34 inline int ENOENT = 2;
35 #pragma D binding "1.0" ENOENT
37 #pragma D binding "1.0" ESRCH
39 #pragma D binding "1.0" EINTR
41 #pragma D binding "1.0" EIO
43 #pragma D binding "1.0" ENXIO
45 #pragma D binding "1.0" E2BIG
46 inline int ENOEXEC = 8;
47 #pragma D binding "1.0" ENOEXEC
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
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 ELAST = 96;
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
242 * Error strings from <sys/errno.h>
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 == ERESTART ? "restart syscall" :
344 errno == EJUSTRETURN ? "don't modify regs, just return" :
345 errno == ENOIOCTL ? "ioctl not handled by this layer" :
346 errno == EDIRIOCTL ? "do direct ioctl in GEOM" :
347 errno == ERELOOKUP ? "retry the directory lookup" :