1#![allow(dead_code)]
4
5crate::macros::def_errno!();
8
9impl Errno {
10 pub const EPERM: Self = Self(1);
12 pub const ENOENT: Self = Self(2);
14 pub const ESRCH: Self = Self(3);
16 pub const EINTR: Self = Self(4);
18 pub const EIO: Self = Self(5);
20 pub const ENXIO: Self = Self(6);
22 pub const E2BIG: Self = Self(7);
24 pub const ENOEXEC: Self = Self(8);
26 pub const EBADF: Self = Self(9);
28 pub const ECHILD: Self = Self(10);
30 pub const EAGAIN: Self = Self(11);
32 pub const ENOMEM: Self = Self(12);
34 pub const EACCES: Self = Self(13);
36 pub const EFAULT: Self = Self(14);
38 pub const ENOTBLK: Self = Self(15);
40 pub const EBUSY: Self = Self(16);
42 pub const EEXIST: Self = Self(17);
44 pub const EXDEV: Self = Self(18);
46 pub const ENODEV: Self = Self(19);
48 pub const ENOTDIR: Self = Self(20);
50 pub const EISDIR: Self = Self(21);
52 pub const EINVAL: Self = Self(22);
54 pub const ENFILE: Self = Self(23);
56 pub const EMFILE: Self = Self(24);
58 pub const ENOTTY: Self = Self(25);
60 pub const ETXTBSY: Self = Self(26);
62 pub const EFBIG: Self = Self(27);
64 pub const ENOSPC: Self = Self(28);
66 pub const ESPIPE: Self = Self(29);
68 pub const EROFS: Self = Self(30);
70 pub const EMLINK: Self = Self(31);
72 pub const EPIPE: Self = Self(32);
74 pub const EDOM: Self = Self(33);
76 pub const ERANGE: Self = Self(34);
78 pub const EINPROGRESS: Self = Self(36);
80 pub const EALREADY: Self = Self(37);
82 pub const ENOTSOCK: Self = Self(38);
84 pub const EDESTADDRREQ: Self = Self(39);
86 pub const EMSGSIZE: Self = Self(40);
88 pub const EPROTOTYPE: Self = Self(41);
90 pub const ENOPROTOOPT: Self = Self(42);
92 pub const EPROTONOSUPPORT: Self = Self(43);
94 pub const ESOCKTNOSUPPORT: Self = Self(44);
96 pub const EOPNOTSUPP: Self = Self(45);
98 pub const EPFNOSUPPORT: Self = Self(46);
100 pub const EAFNOSUPPORT: Self = Self(47);
102 pub const EADDRINUSE: Self = Self(48);
104 pub const EADDRNOTAVAIL: Self = Self(49);
106 pub const ENETDOWN: Self = Self(50);
108 pub const ENETUNREACH: Self = Self(51);
110 pub const ENETRESET: Self = Self(52);
112 pub const ECONNABORTED: Self = Self(53);
114 pub const ECONNRESET: Self = Self(54);
116 pub const ENOBUFS: Self = Self(55);
118 pub const EISCONN: Self = Self(56);
120 pub const ENOTCONN: Self = Self(57);
122 pub const ESHUTDOWN: Self = Self(58);
124 pub const ETOOMANYREFS: Self = Self(59);
126 pub const ETIMEDOUT: Self = Self(60);
128 pub const ECONNREFUSED: Self = Self(61);
130 pub const ELOOP: Self = Self(62);
132 pub const ENAMETOOLONG: Self = Self(63);
134 pub const EHOSTDOWN: Self = Self(64);
136 pub const EHOSTUNREACH: Self = Self(65);
138 pub const ENOTEMPTY: Self = Self(66);
140 pub const EPROCLIM: Self = Self(67);
142 pub const EUSERS: Self = Self(68);
144 pub const EDQUOT: Self = Self(69);
146 pub const ESTALE: Self = Self(70);
148 pub const EREMOTE: Self = Self(71);
150 pub const ENOSTR: Self = Self(72);
152 pub const ETIME: Self = Self(73);
154 pub const ENOSR: Self = Self(74);
156 pub const ENOMSG: Self = Self(75);
158 pub const EBADMSG: Self = Self(76);
160 pub const EIDRM: Self = Self(77);
162 pub const EDEADLK: Self = Self(78);
164 pub const ENOLCK: Self = Self(79);
166 pub const ENONET: Self = Self(80);
168 pub const ERREMOTE: Self = Self(81);
170 pub const ENOLINK: Self = Self(82);
172 pub const EADV: Self = Self(83);
174 pub const ESRMNT: Self = Self(84);
176 pub const ECOMM: Self = Self(85);
178 pub const EPROTO: Self = Self(86);
180 pub const EMULTIHOP: Self = Self(87);
182 pub const EDOTDOT: Self = Self(88);
184 pub const EREMCHG: Self = Self(89);
186 pub const ENOSYS: Self = Self(90);
188 pub const ESTRPIPE: Self = Self(91);
190 pub const EOVERFLOW: Self = Self(92);
192 pub const EBADFD: Self = Self(93);
194 pub const ECHRNG: Self = Self(94);
196 pub const EL2NSYNC: Self = Self(95);
198 pub const EL3HLT: Self = Self(96);
200 pub const EL3RST: Self = Self(97);
202 pub const ELNRNG: Self = Self(98);
204 pub const EUNATCH: Self = Self(99);
206 pub const ENOCSI: Self = Self(100);
208 pub const EL2HLT: Self = Self(101);
210 pub const EBADE: Self = Self(102);
212 pub const EBADR: Self = Self(103);
214 pub const EXFULL: Self = Self(104);
216 pub const ENOANO: Self = Self(105);
218 pub const EBADRQC: Self = Self(106);
220 pub const EBADSLT: Self = Self(107);
222 pub const EDEADLOCK: Self = Self(108);
224 pub const EBFONT: Self = Self(109);
226 pub const ELIBEXEC: Self = Self(110);
228 pub const ENODATA: Self = Self(111);
230 pub const ELIBBAD: Self = Self(112);
232 pub const ENOPKG: Self = Self(113);
234 pub const ELIBACC: Self = Self(114);
236 pub const ENOTUNIQ: Self = Self(115);
238 pub const ERESTART: Self = Self(116);
240 pub const EUCLEAN: Self = Self(117);
242 pub const ENOTNAM: Self = Self(118);
244 pub const ENAVAIL: Self = Self(119);
246 pub const EISNAM: Self = Self(120);
248 pub const EREMOTEIO: Self = Self(121);
250 pub const EILSEQ: Self = Self(122);
252 pub const ELIBMAX: Self = Self(123);
254 pub const ELIBSCN: Self = Self(124);
256 pub const ENOMEDIUM: Self = Self(125);
258 pub const EMEDIUMTYPE: Self = Self(126);
260 pub const ECANCELED: Self = Self(127);
262 pub const ENOKEY: Self = Self(128);
264 pub const EKEYEXPIRED: Self = Self(129);
266 pub const EKEYREVOKED: Self = Self(130);
268 pub const EKEYREJECTED: Self = Self(131);
270 pub const EOWNERDEAD: Self = Self(132);
272 pub const ENOTRECOVERABLE: Self = Self(133);
274 pub const ERFKILL: Self = Self(134);
276 pub const EHWPOISON: Self = Self(135);
278 pub const ERESTARTSYS: Self = Self(512);
280 pub const ERESTARTNOINTR: Self = Self(513);
282 pub const ERESTARTNOHAND: Self = Self(514);
284 pub const ENOIOCTLCMD: Self = Self(515);
286 pub const ERESTART_RESTARTBLOCK: Self = Self(516);
288 pub const EPROBE_DEFER: Self = Self(517);
290 pub const EOPENSTALE: Self = Self(518);
292 pub const ENOPARAM: Self = Self(519);
294 pub const EBADHANDLE: Self = Self(521);
296 pub const ENOTSYNC: Self = Self(522);
298 pub const EBADCOOKIE: Self = Self(523);
300 pub const ENOTSUPP: Self = Self(524);
302 pub const ETOOSMALL: Self = Self(525);
304 pub const ESERVERFAULT: Self = Self(526);
306 pub const EBADTYPE: Self = Self(527);
308 pub const EJUKEBOX: Self = Self(528);
310 pub const EIOCBQUEUED: Self = Self(529);
312 pub const ERECALLCONFLICT: Self = Self(530);
314 pub const ENOGRACE: Self = Self(531);
316 pub const EWOULDBLOCK: Self = Self::EAGAIN;
318
319 pub const MIN: i32 = 1;
320 pub const MAX: i32 = 531;
321
322 #[cfg(feature = "iter")]
323 const ALL: [i32; 153] = [
324 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
325 26, 27, 28, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
326 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
327 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
328 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
329 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
330 133, 134, 135, 512, 513, 514, 515, 516, 517, 518, 519, 521, 522, 523, 524, 525, 526, 527,
331 528, 529, 530, 531,
332 ];
333
334 pub(crate) fn name_and_description(&self) -> Option<(&'static str, &'static str)> {
335 match self.0 {
336 1 => Some(("EPERM", "Operation not permitted")),
337 2 => Some(("ENOENT", "No such file or directory")),
338 3 => Some(("ESRCH", "No such process")),
339 4 => Some(("EINTR", "Interrupted system call")),
340 5 => Some(("EIO", "I/O error")),
341 6 => Some(("ENXIO", "No such device or address")),
342 7 => Some(("E2BIG", "Argument list too long")),
343 8 => Some(("ENOEXEC", "Exec format error")),
344 9 => Some(("EBADF", "Bad file number")),
345 10 => Some(("ECHILD", "No child processes")),
346 11 => Some(("EAGAIN", "Try again")),
347 12 => Some(("ENOMEM", "Out of memory")),
348 13 => Some(("EACCES", "Permission denied")),
349 14 => Some(("EFAULT", "Bad address")),
350 15 => Some(("ENOTBLK", "Block device required")),
351 16 => Some(("EBUSY", "Device or resource busy")),
352 17 => Some(("EEXIST", "File exists")),
353 18 => Some(("EXDEV", "Cross-device link")),
354 19 => Some(("ENODEV", "No such device")),
355 20 => Some(("ENOTDIR", "Not a directory")),
356 21 => Some(("EISDIR", "Is a directory")),
357 22 => Some(("EINVAL", "Invalid argument")),
358 23 => Some(("ENFILE", "File table overflow")),
359 24 => Some(("EMFILE", "Too many open files")),
360 25 => Some(("ENOTTY", "Not a typewriter")),
361 26 => Some(("ETXTBSY", "Text file busy")),
362 27 => Some(("EFBIG", "File too large")),
363 28 => Some(("ENOSPC", "No space left on device")),
364 29 => Some(("ESPIPE", "Illegal seek")),
365 30 => Some(("EROFS", "Read-only file system")),
366 31 => Some(("EMLINK", "Too many links")),
367 32 => Some(("EPIPE", "Broken pipe")),
368 33 => Some(("EDOM", "Math argument out of domain of func")),
369 34 => Some(("ERANGE", "Math result not representable")),
370 36 => Some(("EINPROGRESS", "Operation now in progress")),
371 37 => Some(("EALREADY", "Operation already in progress")),
372 38 => Some(("ENOTSOCK", "Socket operation on non-socket")),
373 39 => Some(("EDESTADDRREQ", "Destination address required")),
374 40 => Some(("EMSGSIZE", "Message too long")),
375 41 => Some(("EPROTOTYPE", "Protocol wrong type for socket")),
376 42 => Some(("ENOPROTOOPT", "Protocol not available")),
377 43 => Some(("EPROTONOSUPPORT", "Protocol not supported")),
378 44 => Some(("ESOCKTNOSUPPORT", "Socket type not supported")),
379 45 => Some(("EOPNOTSUPP", "Op not supported on transport endpoint")),
380 46 => Some(("EPFNOSUPPORT", "Protocol family not supported")),
381 47 => Some(("EAFNOSUPPORT", "Address family not supported by protocol")),
382 48 => Some(("EADDRINUSE", "Address already in use")),
383 49 => Some(("EADDRNOTAVAIL", "Cannot assign requested address")),
384 50 => Some(("ENETDOWN", "Network is down")),
385 51 => Some(("ENETUNREACH", "Network is unreachable")),
386 52 => Some(("ENETRESET", "Net dropped connection because of reset")),
387 53 => Some(("ECONNABORTED", "Software caused connection abort")),
388 54 => Some(("ECONNRESET", "Connection reset by peer")),
389 55 => Some(("ENOBUFS", "No buffer space available")),
390 56 => Some(("EISCONN", "Transport endpoint is already connected")),
391 57 => Some(("ENOTCONN", "Transport endpoint is not connected")),
392 58 => Some(("ESHUTDOWN", "No send after transport endpoint shutdown")),
393 59 => Some(("ETOOMANYREFS", "Too many references: cannot splice")),
394 60 => Some(("ETIMEDOUT", "Connection timed out")),
395 61 => Some(("ECONNREFUSED", "Connection refused")),
396 62 => Some(("ELOOP", "Too many symbolic links encountered")),
397 63 => Some(("ENAMETOOLONG", "File name too long")),
398 64 => Some(("EHOSTDOWN", "Host is down")),
399 65 => Some(("EHOSTUNREACH", "No route to host")),
400 66 => Some(("ENOTEMPTY", "Directory not empty")),
401 67 => Some(("EPROCLIM", "SUNOS: Too many processes")),
402 68 => Some(("EUSERS", "Too many users")),
403 69 => Some(("EDQUOT", "Quota exceeded")),
404 70 => Some(("ESTALE", "Stale file handle")),
405 71 => Some(("EREMOTE", "Object is remote")),
406 72 => Some(("ENOSTR", "Device not a stream")),
407 73 => Some(("ETIME", "Timer expired")),
408 74 => Some(("ENOSR", "Out of streams resources")),
409 75 => Some(("ENOMSG", "No message of desired type")),
410 76 => Some(("EBADMSG", "Not a data message")),
411 77 => Some(("EIDRM", "Identifier removed")),
412 78 => Some(("EDEADLK", "Resource deadlock would occur")),
413 79 => Some(("ENOLCK", "No record locks available")),
414 80 => Some(("ENONET", "Machine is not on the network")),
415 81 => Some(("ERREMOTE", "SunOS: Too many lvls of remote in path")),
416 82 => Some(("ENOLINK", "Link has been severed")),
417 83 => Some(("EADV", "Advertise error")),
418 84 => Some(("ESRMNT", "Srmount error")),
419 85 => Some(("ECOMM", "Communication error on send")),
420 86 => Some(("EPROTO", "Protocol error")),
421 87 => Some(("EMULTIHOP", "Multihop attempted")),
422 88 => Some(("EDOTDOT", "RFS specific error")),
423 89 => Some(("EREMCHG", "Remote address changed")),
424 90 => Some(("ENOSYS", "Function not implemented")),
425 91 => Some(("ESTRPIPE", "Streams pipe error")),
426 92 => Some(("EOVERFLOW", "Value too large for defined data type")),
427 93 => Some(("EBADFD", "File descriptor in bad state")),
428 94 => Some(("ECHRNG", "Channel number out of range")),
429 95 => Some(("EL2NSYNC", "Level 2 not synchronized")),
430 96 => Some(("EL3HLT", "Level 3 halted")),
431 97 => Some(("EL3RST", "Level 3 reset")),
432 98 => Some(("ELNRNG", "Link number out of range")),
433 99 => Some(("EUNATCH", "Protocol driver not attached")),
434 100 => Some(("ENOCSI", "No CSI structure available")),
435 101 => Some(("EL2HLT", "Level 2 halted")),
436 102 => Some(("EBADE", "Invalid exchange")),
437 103 => Some(("EBADR", "Invalid request descriptor")),
438 104 => Some(("EXFULL", "Exchange full")),
439 105 => Some(("ENOANO", "No anode")),
440 106 => Some(("EBADRQC", "Invalid request code")),
441 107 => Some(("EBADSLT", "Invalid slot")),
442 108 => Some(("EDEADLOCK", "File locking deadlock error")),
443 109 => Some(("EBFONT", "Bad font file format")),
444 110 => Some(("ELIBEXEC", "Cannot exec a shared library directly")),
445 111 => Some(("ENODATA", "No data available")),
446 112 => Some(("ELIBBAD", "Accessing a corrupted shared library")),
447 113 => Some(("ENOPKG", "Package not installed")),
448 114 => Some(("ELIBACC", "Can not access a needed shared library")),
449 115 => Some(("ENOTUNIQ", "Name not unique on network")),
450 116 => Some(("ERESTART", "Interrupted syscall should be restarted")),
451 117 => Some(("EUCLEAN", "Structure needs cleaning")),
452 118 => Some(("ENOTNAM", "Not a XENIX named type file")),
453 119 => Some(("ENAVAIL", "No XENIX semaphores available")),
454 120 => Some(("EISNAM", "Is a named type file")),
455 121 => Some(("EREMOTEIO", "Remote I/O error")),
456 122 => Some(("EILSEQ", "Illegal byte sequence")),
457 123 => Some(("ELIBMAX", "Atmpt to link in too many shared libs")),
458 124 => Some(("ELIBSCN", ".lib section in a.out corrupted")),
459 125 => Some(("ENOMEDIUM", "No medium found")),
460 126 => Some(("EMEDIUMTYPE", "Wrong medium type")),
461 127 => Some(("ECANCELED", "Operation Cancelled")),
462 128 => Some(("ENOKEY", "Required key not available")),
463 129 => Some(("EKEYEXPIRED", "Key has expired")),
464 130 => Some(("EKEYREVOKED", "Key has been revoked")),
465 131 => Some(("EKEYREJECTED", "Key was rejected by service")),
466 132 => Some(("EOWNERDEAD", "Owner died")),
467 133 => Some(("ENOTRECOVERABLE", "State not recoverable")),
468 134 => Some(("ERFKILL", "Operation not possible due to RF-kill")),
469 135 => Some(("EHWPOISON", "Memory page has hardware error")),
470 512 => Some(("ERESTARTSYS", "Restart syscall")),
471 513 => Some(("ERESTARTNOINTR", "Restart if no interrupt")),
472 514 => Some(("ERESTARTNOHAND", "restart if no handler..")),
473 515 => Some(("ENOIOCTLCMD", "No ioctl command")),
474 516 => Some((
475 "ERESTART_RESTARTBLOCK",
476 "restart by calling sys_restart_syscall",
477 )),
478 517 => Some(("EPROBE_DEFER", "Driver requests probe retry")),
479 518 => Some(("EOPENSTALE", "open found a stale dentry")),
480 519 => Some(("ENOPARAM", "Parameter not supported")),
481 521 => Some(("EBADHANDLE", "Illegal NFS file handle")),
482 522 => Some(("ENOTSYNC", "Update synchronization mismatch")),
483 523 => Some(("EBADCOOKIE", "Cookie is stale")),
484 524 => Some(("ENOTSUPP", "Operation is not supported")),
485 525 => Some(("ETOOSMALL", "Buffer or request is too small")),
486 526 => Some(("ESERVERFAULT", "An untranslatable error occurred")),
487 527 => Some(("EBADTYPE", "Type not supported by server")),
488 528 => Some((
489 "EJUKEBOX",
490 "Request initiated, but will not complete before timeout",
491 )),
492 529 => Some(("EIOCBQUEUED", "iocb queued, will get completion event")),
493 530 => Some(("ERECALLCONFLICT", "conflict with recalled state")),
494 531 => Some(("ENOGRACE", "NFS file lock reclaim refused")),
495 _ => None,
496 }
497 }
498}