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 ENOMSG: Self = Self(35);
80 pub const EIDRM: Self = Self(36);
82 pub const ECHRNG: Self = Self(37);
84 pub const EL2NSYNC: Self = Self(38);
86 pub const EL3HLT: Self = Self(39);
88 pub const EL3RST: Self = Self(40);
90 pub const ELNRNG: Self = Self(41);
92 pub const EUNATCH: Self = Self(42);
94 pub const ENOCSI: Self = Self(43);
96 pub const EL2HLT: Self = Self(44);
98 pub const EDEADLK: Self = Self(45);
100 pub const ENOLCK: Self = Self(46);
102 pub const EBADE: Self = Self(50);
104 pub const EBADR: Self = Self(51);
106 pub const EXFULL: Self = Self(52);
108 pub const ENOANO: Self = Self(53);
110 pub const EBADRQC: Self = Self(54);
112 pub const EBADSLT: Self = Self(55);
114 pub const EDEADLOCK: Self = Self(56);
116 pub const EBFONT: Self = Self(59);
118 pub const ENOSTR: Self = Self(60);
120 pub const ENODATA: Self = Self(61);
122 pub const ETIME: Self = Self(62);
124 pub const ENOSR: Self = Self(63);
126 pub const ENONET: Self = Self(64);
128 pub const ENOPKG: Self = Self(65);
130 pub const EREMOTE: Self = Self(66);
132 pub const ENOLINK: Self = Self(67);
134 pub const EADV: Self = Self(68);
136 pub const ESRMNT: Self = Self(69);
138 pub const ECOMM: Self = Self(70);
140 pub const EPROTO: Self = Self(71);
142 pub const EDOTDOT: Self = Self(73);
144 pub const EMULTIHOP: Self = Self(74);
146 pub const EBADMSG: Self = Self(77);
148 pub const ENAMETOOLONG: Self = Self(78);
150 pub const EOVERFLOW: Self = Self(79);
152 pub const ENOTUNIQ: Self = Self(80);
154 pub const EBADFD: Self = Self(81);
156 pub const EREMCHG: Self = Self(82);
158 pub const ELIBACC: Self = Self(83);
160 pub const ELIBBAD: Self = Self(84);
162 pub const ELIBSCN: Self = Self(85);
164 pub const ELIBMAX: Self = Self(86);
166 pub const ELIBEXEC: Self = Self(87);
168 pub const EILSEQ: Self = Self(88);
170 pub const ENOSYS: Self = Self(89);
172 pub const ELOOP: Self = Self(90);
174 pub const ERESTART: Self = Self(91);
176 pub const ESTRPIPE: Self = Self(92);
178 pub const ENOTEMPTY: Self = Self(93);
180 pub const EUSERS: Self = Self(94);
182 pub const ENOTSOCK: Self = Self(95);
184 pub const EDESTADDRREQ: Self = Self(96);
186 pub const EMSGSIZE: Self = Self(97);
188 pub const EPROTOTYPE: Self = Self(98);
190 pub const ENOPROTOOPT: Self = Self(99);
192 pub const EPROTONOSUPPORT: Self = Self(120);
194 pub const ESOCKTNOSUPPORT: Self = Self(121);
196 pub const EOPNOTSUPP: Self = Self(122);
198 pub const EPFNOSUPPORT: Self = Self(123);
200 pub const EAFNOSUPPORT: Self = Self(124);
202 pub const EADDRINUSE: Self = Self(125);
204 pub const EADDRNOTAVAIL: Self = Self(126);
206 pub const ENETDOWN: Self = Self(127);
208 pub const ENETUNREACH: Self = Self(128);
210 pub const ENETRESET: Self = Self(129);
212 pub const ECONNABORTED: Self = Self(130);
214 pub const ECONNRESET: Self = Self(131);
216 pub const ENOBUFS: Self = Self(132);
218 pub const EISCONN: Self = Self(133);
220 pub const ENOTCONN: Self = Self(134);
222 pub const EUCLEAN: Self = Self(135);
224 pub const ENOTNAM: Self = Self(137);
226 pub const ENAVAIL: Self = Self(138);
228 pub const EISNAM: Self = Self(139);
230 pub const EREMOTEIO: Self = Self(140);
232 pub const EINIT: Self = Self(141);
234 pub const EREMDEV: Self = Self(142);
236 pub const ESHUTDOWN: Self = Self(143);
238 pub const ETOOMANYREFS: Self = Self(144);
240 pub const ETIMEDOUT: Self = Self(145);
242 pub const ECONNREFUSED: Self = Self(146);
244 pub const EHOSTDOWN: Self = Self(147);
246 pub const EHOSTUNREACH: Self = Self(148);
248 pub const EALREADY: Self = Self(149);
250 pub const EINPROGRESS: Self = Self(150);
252 pub const ESTALE: Self = Self(151);
254 pub const ECANCELED: Self = Self(158);
256 pub const ENOMEDIUM: Self = Self(159);
258 pub const EMEDIUMTYPE: Self = Self(160);
260 pub const ENOKEY: Self = Self(161);
262 pub const EKEYEXPIRED: Self = Self(162);
264 pub const EKEYREVOKED: Self = Self(163);
266 pub const EKEYREJECTED: Self = Self(164);
268 pub const EOWNERDEAD: Self = Self(165);
270 pub const ENOTRECOVERABLE: Self = Self(166);
272 pub const ERFKILL: Self = Self(167);
274 pub const EHWPOISON: Self = Self(168);
276 pub const ERESTARTSYS: Self = Self(512);
278 pub const ERESTARTNOINTR: Self = Self(513);
280 pub const ERESTARTNOHAND: Self = Self(514);
282 pub const ENOIOCTLCMD: Self = Self(515);
284 pub const ERESTART_RESTARTBLOCK: Self = Self(516);
286 pub const EPROBE_DEFER: Self = Self(517);
288 pub const EOPENSTALE: Self = Self(518);
290 pub const ENOPARAM: Self = Self(519);
292 pub const EBADHANDLE: Self = Self(521);
294 pub const ENOTSYNC: Self = Self(522);
296 pub const EBADCOOKIE: Self = Self(523);
298 pub const ENOTSUPP: Self = Self(524);
300 pub const ETOOSMALL: Self = Self(525);
302 pub const ESERVERFAULT: Self = Self(526);
304 pub const EBADTYPE: Self = Self(527);
306 pub const EJUKEBOX: Self = Self(528);
308 pub const EIOCBQUEUED: Self = Self(529);
310 pub const ERECALLCONFLICT: Self = Self(530);
312 pub const ENOGRACE: Self = Self(531);
314 pub const EDQUOT: Self = Self(1133);
316 pub const EWOULDBLOCK: Self = Self::EAGAIN;
318
319 pub const MIN: i32 = 1;
320 pub const MAX: i32 = 1133;
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, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 50, 51,
326 52, 53, 54, 55, 56, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 73, 74, 77, 78, 79,
327 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 120, 121,
328 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 137, 138, 139, 140,
329 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 158, 159, 160, 161, 162, 163, 164,
330 165, 166, 167, 168, 512, 513, 514, 515, 516, 517, 518, 519, 521, 522, 523, 524, 525, 526,
331 527, 528, 529, 530, 531, 1133,
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 35 => Some(("ENOMSG", "No message of desired type")),
371 36 => Some(("EIDRM", "Identifier removed")),
372 37 => Some(("ECHRNG", "Channel number out of range")),
373 38 => Some(("EL2NSYNC", "Level 2 not synchronized")),
374 39 => Some(("EL3HLT", "Level 3 halted")),
375 40 => Some(("EL3RST", "Level 3 reset")),
376 41 => Some(("ELNRNG", "Link number out of range")),
377 42 => Some(("EUNATCH", "Protocol driver not attached")),
378 43 => Some(("ENOCSI", "No CSI structure available")),
379 44 => Some(("EL2HLT", "Level 2 halted")),
380 45 => Some(("EDEADLK", "Resource deadlock would occur")),
381 46 => Some(("ENOLCK", "No record locks available")),
382 50 => Some(("EBADE", "Invalid exchange")),
383 51 => Some(("EBADR", "Invalid request descriptor")),
384 52 => Some(("EXFULL", "Exchange full")),
385 53 => Some(("ENOANO", "No anode")),
386 54 => Some(("EBADRQC", "Invalid request code")),
387 55 => Some(("EBADSLT", "Invalid slot")),
388 56 => Some(("EDEADLOCK", "File locking deadlock error")),
389 59 => Some(("EBFONT", "Bad font file format")),
390 60 => Some(("ENOSTR", "Device not a stream")),
391 61 => Some(("ENODATA", "No data available")),
392 62 => Some(("ETIME", "Timer expired")),
393 63 => Some(("ENOSR", "Out of streams resources")),
394 64 => Some(("ENONET", "Machine is not on the network")),
395 65 => Some(("ENOPKG", "Package not installed")),
396 66 => Some(("EREMOTE", "Object is remote")),
397 67 => Some(("ENOLINK", "Link has been severed")),
398 68 => Some(("EADV", "Advertise error")),
399 69 => Some(("ESRMNT", "Srmount error")),
400 70 => Some(("ECOMM", "Communication error on send")),
401 71 => Some(("EPROTO", "Protocol error")),
402 73 => Some(("EDOTDOT", "RFS specific error")),
403 74 => Some(("EMULTIHOP", "Multihop attempted")),
404 77 => Some(("EBADMSG", "Not a data message")),
405 78 => Some(("ENAMETOOLONG", "File name too long")),
406 79 => Some(("EOVERFLOW", "Value too large for defined data type")),
407 80 => Some(("ENOTUNIQ", "Name not unique on network")),
408 81 => Some(("EBADFD", "File descriptor in bad state")),
409 82 => Some(("EREMCHG", "Remote address changed")),
410 83 => Some(("ELIBACC", "Can not access a needed shared library")),
411 84 => Some(("ELIBBAD", "Accessing a corrupted shared library")),
412 85 => Some(("ELIBSCN", ".lib section in a.out corrupted")),
413 86 => Some(("ELIBMAX", "Attempting to link in too many shared libraries")),
414 87 => Some(("ELIBEXEC", "Cannot exec a shared library directly")),
415 88 => Some(("EILSEQ", "Illegal byte sequence")),
416 89 => Some(("ENOSYS", "Function not implemented")),
417 90 => Some(("ELOOP", "Too many symbolic links encountered")),
418 91 => Some(("ERESTART", "Interrupted system call should be restarted")),
419 92 => Some(("ESTRPIPE", "Streams pipe error")),
420 93 => Some(("ENOTEMPTY", "Directory not empty")),
421 94 => Some(("EUSERS", "Too many users")),
422 95 => Some(("ENOTSOCK", "Socket operation on non-socket")),
423 96 => Some(("EDESTADDRREQ", "Destination address required")),
424 97 => Some(("EMSGSIZE", "Message too long")),
425 98 => Some(("EPROTOTYPE", "Protocol wrong type for socket")),
426 99 => Some(("ENOPROTOOPT", "Protocol not available")),
427 120 => Some(("EPROTONOSUPPORT", "Protocol not supported")),
428 121 => Some(("ESOCKTNOSUPPORT", "Socket type not supported")),
429 122 => Some((
430 "EOPNOTSUPP",
431 "Operation not supported on transport endpoint",
432 )),
433 123 => Some(("EPFNOSUPPORT", "Protocol family not supported")),
434 124 => Some(("EAFNOSUPPORT", "Address family not supported by protocol")),
435 125 => Some(("EADDRINUSE", "Address already in use")),
436 126 => Some(("EADDRNOTAVAIL", "Cannot assign requested address")),
437 127 => Some(("ENETDOWN", "Network is down")),
438 128 => Some(("ENETUNREACH", "Network is unreachable")),
439 129 => Some(("ENETRESET", "Network dropped connection because of reset")),
440 130 => Some(("ECONNABORTED", "Software caused connection abort")),
441 131 => Some(("ECONNRESET", "Connection reset by peer")),
442 132 => Some(("ENOBUFS", "No buffer space available")),
443 133 => Some(("EISCONN", "Transport endpoint is already connected")),
444 134 => Some(("ENOTCONN", "Transport endpoint is not connected")),
445 135 => Some(("EUCLEAN", "Structure needs cleaning")),
446 137 => Some(("ENOTNAM", "Not a XENIX named type file")),
447 138 => Some(("ENAVAIL", "No XENIX semaphores available")),
448 139 => Some(("EISNAM", "Is a named type file")),
449 140 => Some(("EREMOTEIO", "Remote I/O error")),
450 141 => Some(("EINIT", "Reserved")),
451 142 => Some(("EREMDEV", "Error 142")),
452 143 => Some(("ESHUTDOWN", "Cannot send after transport endpoint shutdown")),
453 144 => Some(("ETOOMANYREFS", "Too many references: cannot splice")),
454 145 => Some(("ETIMEDOUT", "Connection timed out")),
455 146 => Some(("ECONNREFUSED", "Connection refused")),
456 147 => Some(("EHOSTDOWN", "Host is down")),
457 148 => Some(("EHOSTUNREACH", "No route to host")),
458 149 => Some(("EALREADY", "Operation already in progress")),
459 150 => Some(("EINPROGRESS", "Operation now in progress")),
460 151 => Some(("ESTALE", "Stale file handle")),
461 158 => Some(("ECANCELED", "AIO operation canceled")),
462 159 => Some(("ENOMEDIUM", "No medium found")),
463 160 => Some(("EMEDIUMTYPE", "Wrong medium type")),
464 161 => Some(("ENOKEY", "Required key not available")),
465 162 => Some(("EKEYEXPIRED", "Key has expired")),
466 163 => Some(("EKEYREVOKED", "Key has been revoked")),
467 164 => Some(("EKEYREJECTED", "Key was rejected by service")),
468 165 => Some(("EOWNERDEAD", "Owner died")),
469 166 => Some(("ENOTRECOVERABLE", "State not recoverable")),
470 167 => Some(("ERFKILL", "Operation not possible due to RF-kill")),
471 168 => Some(("EHWPOISON", "Memory page has hardware error")),
472 512 => Some(("ERESTARTSYS", "Restart syscall")),
473 513 => Some(("ERESTARTNOINTR", "Restart if no interrupt")),
474 514 => Some(("ERESTARTNOHAND", "restart if no handler..")),
475 515 => Some(("ENOIOCTLCMD", "No ioctl command")),
476 516 => Some((
477 "ERESTART_RESTARTBLOCK",
478 "restart by calling sys_restart_syscall",
479 )),
480 517 => Some(("EPROBE_DEFER", "Driver requests probe retry")),
481 518 => Some(("EOPENSTALE", "open found a stale dentry")),
482 519 => Some(("ENOPARAM", "Parameter not supported")),
483 521 => Some(("EBADHANDLE", "Illegal NFS file handle")),
484 522 => Some(("ENOTSYNC", "Update synchronization mismatch")),
485 523 => Some(("EBADCOOKIE", "Cookie is stale")),
486 524 => Some(("ENOTSUPP", "Operation is not supported")),
487 525 => Some(("ETOOSMALL", "Buffer or request is too small")),
488 526 => Some(("ESERVERFAULT", "An untranslatable error occurred")),
489 527 => Some(("EBADTYPE", "Type not supported by server")),
490 528 => Some((
491 "EJUKEBOX",
492 "Request initiated, but will not complete before timeout",
493 )),
494 529 => Some(("EIOCBQUEUED", "iocb queued, will get completion event")),
495 530 => Some(("ERECALLCONFLICT", "conflict with recalled state")),
496 531 => Some(("ENOGRACE", "NFS file lock reclaim refused")),
497 1133 => Some(("EDQUOT", "Quota exceeded")),
498 _ => None,
499 }
500 }
501}