1#![allow(dead_code)]
2
3use crate::Errno;
6impl Errno {
7 pub const EDATALESS: Self = Self(-8);
9 pub const EKEEPLOOKING: Self = Self(-7);
11 pub const EREDRIVEOPEN: Self = Self(-6);
13 pub const ERECYCLE: Self = Self(-5);
15 pub const EJUSTRETURN: Self = Self(-2);
17 pub const ERESTART: Self = Self(-1);
19 pub const EPERM: Self = Self(1);
21 pub const ENOENT: Self = Self(2);
23 pub const ESRCH: Self = Self(3);
25 pub const EINTR: Self = Self(4);
27 pub const EIO: Self = Self(5);
29 pub const ENXIO: Self = Self(6);
31 pub const E2BIG: Self = Self(7);
33 pub const ENOEXEC: Self = Self(8);
35 pub const EBADF: Self = Self(9);
37 pub const ECHILD: Self = Self(10);
39 pub const EDEADLK: Self = Self(11);
41 pub const ENOMEM: Self = Self(12);
43 pub const EACCES: Self = Self(13);
45 pub const EFAULT: Self = Self(14);
47 pub const ENOTBLK: Self = Self(15);
49 pub const EBUSY: Self = Self(16);
51 pub const EEXIST: Self = Self(17);
53 pub const EXDEV: Self = Self(18);
55 pub const ENODEV: Self = Self(19);
57 pub const ENOTDIR: Self = Self(20);
59 pub const EISDIR: Self = Self(21);
61 pub const EINVAL: Self = Self(22);
63 pub const ENFILE: Self = Self(23);
65 pub const EMFILE: Self = Self(24);
67 pub const ENOTTY: Self = Self(25);
69 pub const ETXTBSY: Self = Self(26);
71 pub const EFBIG: Self = Self(27);
73 pub const ENOSPC: Self = Self(28);
75 pub const ESPIPE: Self = Self(29);
77 pub const EROFS: Self = Self(30);
79 pub const EMLINK: Self = Self(31);
81 pub const EPIPE: Self = Self(32);
83 pub const EDOM: Self = Self(33);
85 pub const ERANGE: Self = Self(34);
87 pub const EAGAIN: Self = Self(35);
89 pub const EINPROGRESS: Self = Self(36);
91 pub const EALREADY: Self = Self(37);
93 pub const ENOTSOCK: Self = Self(38);
95 pub const EDESTADDRREQ: Self = Self(39);
97 pub const EMSGSIZE: Self = Self(40);
99 pub const EPROTOTYPE: Self = Self(41);
101 pub const ENOPROTOOPT: Self = Self(42);
103 pub const EPROTONOSUPPORT: Self = Self(43);
105 pub const ESOCKTNOSUPPORT: Self = Self(44);
107 pub const ENOTSUP: Self = Self(45);
109 pub const EPFNOSUPPORT: Self = Self(46);
111 pub const EAFNOSUPPORT: Self = Self(47);
113 pub const EADDRINUSE: Self = Self(48);
115 pub const EADDRNOTAVAIL: Self = Self(49);
117 pub const ENETDOWN: Self = Self(50);
119 pub const ENETUNREACH: Self = Self(51);
121 pub const ENETRESET: Self = Self(52);
123 pub const ECONNABORTED: Self = Self(53);
125 pub const ECONNRESET: Self = Self(54);
127 pub const ENOBUFS: Self = Self(55);
129 pub const EISCONN: Self = Self(56);
131 pub const ENOTCONN: Self = Self(57);
133 pub const ESHUTDOWN: Self = Self(58);
135 pub const ETOOMANYREFS: Self = Self(59);
137 pub const ETIMEDOUT: Self = Self(60);
139 pub const ECONNREFUSED: Self = Self(61);
141 pub const ELOOP: Self = Self(62);
143 pub const ENAMETOOLONG: Self = Self(63);
145 pub const EHOSTDOWN: Self = Self(64);
147 pub const EHOSTUNREACH: Self = Self(65);
149 pub const ENOTEMPTY: Self = Self(66);
151 pub const EPROCLIM: Self = Self(67);
153 pub const EUSERS: Self = Self(68);
155 pub const EDQUOT: Self = Self(69);
157 pub const ESTALE: Self = Self(70);
159 pub const EREMOTE: Self = Self(71);
161 pub const EBADRPC: Self = Self(72);
163 pub const ERPCMISMATCH: Self = Self(73);
165 pub const EPROGUNAVAIL: Self = Self(74);
167 pub const EPROGMISMATCH: Self = Self(75);
169 pub const EPROCUNAVAIL: Self = Self(76);
171 pub const ENOLCK: Self = Self(77);
173 pub const ENOSYS: Self = Self(78);
175 pub const EFTYPE: Self = Self(79);
177 pub const EAUTH: Self = Self(80);
179 pub const ENEEDAUTH: Self = Self(81);
181 pub const EPWROFF: Self = Self(82);
183 pub const EDEVERR: Self = Self(83);
185 pub const EOVERFLOW: Self = Self(84);
187 pub const EBADEXEC: Self = Self(85);
189 pub const EBADARCH: Self = Self(86);
191 pub const ESHLIBVERS: Self = Self(87);
193 pub const EBADMACHO: Self = Self(88);
195 pub const ECANCELED: Self = Self(89);
197 pub const EIDRM: Self = Self(90);
199 pub const ENOMSG: Self = Self(91);
201 pub const EILSEQ: Self = Self(92);
203 pub const ENOATTR: Self = Self(93);
205 pub const EBADMSG: Self = Self(94);
207 pub const EMULTIHOP: Self = Self(95);
209 pub const ENODATA: Self = Self(96);
211 pub const ENOLINK: Self = Self(97);
213 pub const ENOSR: Self = Self(98);
215 pub const ENOSTR: Self = Self(99);
217 pub const EPROTO: Self = Self(100);
219 pub const ETIME: Self = Self(101);
221 pub const EOPNOTSUPP: Self = Self(102);
223 pub const ENOPOLICY: Self = Self(103);
225 pub const ENOTRECOVERABLE: Self = Self(104);
227 pub const EOWNERDEAD: Self = Self(105);
229 pub const EQFULL: Self = Self(106);
231 pub const ECVCERORR: Self = Self(256);
233 pub const ECVPERORR: Self = Self(512);
235 pub const EWOULDBLOCK: Self = Self::EAGAIN;
237
238 pub const MIN: i32 = -8;
239 pub const MAX: i32 = 512;
240
241 #[cfg(feature = "iter")]
242 pub(crate) const ALL: [i32; 114] = [
243 -8, -7, -6, -5, -2, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
244 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
245 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
246 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
247 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 256, 512,
248 ];
249
250 pub(crate) fn name_and_description(&self) -> Option<(&'static str, &'static str)> {
251 match self.0 {
252 -8 => Some(("EDATALESS", "kernel internal error")),
253 -7 => Some(("EKEEPLOOKING", "kernel internal error")),
254 -6 => Some(("EREDRIVEOPEN", "kernel internal error")),
255 -5 => Some((
256 "ERECYCLE",
257 "restart lookup under heavy vnode pressure/recycling",
258 )),
259 -2 => Some(("EJUSTRETURN", "don't modify regs, just return")),
260 -1 => Some(("ERESTART", "restart syscall")),
261 1 => Some(("EPERM", "Operation not permitted")),
262 2 => Some(("ENOENT", "No such file or directory")),
263 3 => Some(("ESRCH", "No such process")),
264 4 => Some(("EINTR", "Interrupted system call")),
265 5 => Some(("EIO", "Input/output error")),
266 6 => Some(("ENXIO", "Device not configured")),
267 7 => Some(("E2BIG", "Argument list too long")),
268 8 => Some(("ENOEXEC", "Exec format error")),
269 9 => Some(("EBADF", "Bad file descriptor")),
270 10 => Some(("ECHILD", "No child processes")),
271 11 => Some(("EDEADLK", "Resource deadlock avoided")),
272 12 => Some(("ENOMEM", "Cannot allocate memory")),
273 13 => Some(("EACCES", "Permission denied")),
274 14 => Some(("EFAULT", "Bad address")),
275 15 => Some(("ENOTBLK", "Block device required")),
276 16 => Some(("EBUSY", "Device / Resource busy")),
277 17 => Some(("EEXIST", "File exists")),
278 18 => Some(("EXDEV", "Cross-device link")),
279 19 => Some(("ENODEV", "Operation not supported by device")),
280 20 => Some(("ENOTDIR", "Not a directory")),
281 21 => Some(("EISDIR", "Is a directory")),
282 22 => Some(("EINVAL", "Invalid argument")),
283 23 => Some(("ENFILE", "Too many open files in system")),
284 24 => Some(("EMFILE", "Too many open files")),
285 25 => Some(("ENOTTY", "Inappropriate ioctl for device")),
286 26 => Some(("ETXTBSY", "Text file busy")),
287 27 => Some(("EFBIG", "File too large")),
288 28 => Some(("ENOSPC", "No space left on device")),
289 29 => Some(("ESPIPE", "Illegal seek")),
290 30 => Some(("EROFS", "Read-only file system")),
291 31 => Some(("EMLINK", "Too many links")),
292 32 => Some(("EPIPE", "Broken pipe")),
293 33 => Some(("EDOM", "Numerical argument out of domain")),
294 34 => Some(("ERANGE", "Result too large")),
295 35 => Some(("EAGAIN", "Resource temporarily unavailable")),
296 36 => Some(("EINPROGRESS", "Operation now in progress")),
297 37 => Some(("EALREADY", "Operation already in progress")),
298 38 => Some(("ENOTSOCK", "Socket operation on non-socket")),
299 39 => Some(("EDESTADDRREQ", "Destination address required")),
300 40 => Some(("EMSGSIZE", "Message too long")),
301 41 => Some(("EPROTOTYPE", "Protocol wrong type for socket")),
302 42 => Some(("ENOPROTOOPT", "Protocol not available")),
303 43 => Some(("EPROTONOSUPPORT", "Protocol not supported")),
304 44 => Some(("ESOCKTNOSUPPORT", "Socket type not supported")),
305 45 => Some(("ENOTSUP", "Operation not supported")),
306 46 => Some(("EPFNOSUPPORT", "Protocol family not supported")),
307 47 => Some((
308 "EAFNOSUPPORT",
309 "Address family not supported by protocol family",
310 )),
311 48 => Some(("EADDRINUSE", "Address already in use")),
312 49 => Some(("EADDRNOTAVAIL", "Can't assign requested address")),
313 50 => Some(("ENETDOWN", "Network is down")),
314 51 => Some(("ENETUNREACH", "Network is unreachable")),
315 52 => Some(("ENETRESET", "Network dropped connection on reset")),
316 53 => Some(("ECONNABORTED", "Software caused connection abort")),
317 54 => Some(("ECONNRESET", "Connection reset by peer")),
318 55 => Some(("ENOBUFS", "No buffer space available")),
319 56 => Some(("EISCONN", "Socket is already connected")),
320 57 => Some(("ENOTCONN", "Socket is not connected")),
321 58 => Some(("ESHUTDOWN", "Can't send after socket shutdown")),
322 59 => Some(("ETOOMANYREFS", "Too many references: can't splice")),
323 60 => Some(("ETIMEDOUT", "Operation timed out")),
324 61 => Some(("ECONNREFUSED", "Connection refused")),
325 62 => Some(("ELOOP", "Too many levels of symbolic links")),
326 63 => Some(("ENAMETOOLONG", "File name too long")),
327 64 => Some(("EHOSTDOWN", "Host is down")),
328 65 => Some(("EHOSTUNREACH", "No route to host")),
329 66 => Some(("ENOTEMPTY", "Directory not empty")),
330 67 => Some(("EPROCLIM", "Too many processes")),
331 68 => Some(("EUSERS", "Too many users")),
332 69 => Some(("EDQUOT", "Disc quota exceeded")),
333 70 => Some(("ESTALE", "Stale NFS file handle")),
334 71 => Some(("EREMOTE", "Too many levels of remote in path")),
335 72 => Some(("EBADRPC", "RPC struct is bad")),
336 73 => Some(("ERPCMISMATCH", "RPC version wrong")),
337 74 => Some(("EPROGUNAVAIL", "RPC prog. not avail")),
338 75 => Some(("EPROGMISMATCH", "Program version wrong")),
339 76 => Some(("EPROCUNAVAIL", "Bad procedure for program")),
340 77 => Some(("ENOLCK", "No locks available")),
341 78 => Some(("ENOSYS", "Function not implemented")),
342 79 => Some(("EFTYPE", "Inappropriate file type or format")),
343 80 => Some(("EAUTH", "Authentication error")),
344 81 => Some(("ENEEDAUTH", "Need authenticator")),
345 82 => Some(("EPWROFF", "Device power is off")),
346 83 => Some(("EDEVERR", "Device error, e.g. paper out")),
347 84 => Some(("EOVERFLOW", "Value too large to be stored in data type")),
348 85 => Some(("EBADEXEC", "Bad executable")),
349 86 => Some(("EBADARCH", "Bad CPU type in executable")),
350 87 => Some(("ESHLIBVERS", "Shared library version mismatch")),
351 88 => Some(("EBADMACHO", "Malformed Macho file")),
352 89 => Some(("ECANCELED", "Operation canceled")),
353 90 => Some(("EIDRM", "Identifier removed")),
354 91 => Some(("ENOMSG", "No message of desired type")),
355 92 => Some(("EILSEQ", "Illegal byte sequence")),
356 93 => Some(("ENOATTR", "Attribute not found")),
357 94 => Some(("EBADMSG", "Bad message")),
358 95 => Some(("EMULTIHOP", "Reserved")),
359 96 => Some(("ENODATA", "No message available on STREAM")),
360 97 => Some(("ENOLINK", "Reserved")),
361 98 => Some(("ENOSR", "No STREAM resources")),
362 99 => Some(("ENOSTR", "Not a STREAM")),
363 100 => Some(("EPROTO", "Protocol error")),
364 101 => Some(("ETIME", "STREAM ioctl timeout")),
365 102 => Some(("EOPNOTSUPP", "Operation not supported on socket")),
366 103 => Some(("ENOPOLICY", "No such policy registered")),
367 104 => Some(("ENOTRECOVERABLE", "State not recoverable")),
368 105 => Some(("EOWNERDEAD", "Previous owner died")),
369 106 => Some(("EQFULL", "Interface output queue is full")),
370 256 => Some(("ECVCERORR", "kernel internal error")),
371 512 => Some(("ECVPERORR", "kernel internal error")),
372 _ => None,
373 }
374 }
375}