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 EILSEQ: Self = Self(47);
104 pub const ENONET: Self = Self(50);
106 pub const ENODATA: Self = Self(51);
108 pub const ETIME: Self = Self(52);
110 pub const ENOSR: Self = Self(53);
112 pub const ENOSTR: Self = Self(54);
114 pub const ENOPKG: Self = Self(55);
116 pub const ENOLINK: Self = Self(57);
118 pub const EADV: Self = Self(58);
120 pub const ESRMNT: Self = Self(59);
122 pub const ECOMM: Self = Self(60);
124 pub const EPROTO: Self = Self(61);
126 pub const EMULTIHOP: Self = Self(64);
128 pub const EDOTDOT: Self = Self(66);
130 pub const EBADMSG: Self = Self(67);
132 pub const EUSERS: Self = Self(68);
134 pub const EDQUOT: Self = Self(69);
136 pub const ESTALE: Self = Self(70);
138 pub const EREMOTE: Self = Self(71);
140 pub const EOVERFLOW: Self = Self(72);
142 pub const EBADE: Self = Self(160);
144 pub const EBADR: Self = Self(161);
146 pub const EXFULL: Self = Self(162);
148 pub const ENOANO: Self = Self(163);
150 pub const EBADRQC: Self = Self(164);
152 pub const EBADSLT: Self = Self(165);
154 pub const EBFONT: Self = Self(166);
156 pub const ENOTUNIQ: Self = Self(167);
158 pub const EBADFD: Self = Self(168);
160 pub const EREMCHG: Self = Self(169);
162 pub const ELIBACC: Self = Self(170);
164 pub const ELIBBAD: Self = Self(171);
166 pub const ELIBSCN: Self = Self(172);
168 pub const ELIBMAX: Self = Self(173);
170 pub const ELIBEXEC: Self = Self(174);
172 pub const ERESTART: Self = Self(175);
174 pub const ESTRPIPE: Self = Self(176);
176 pub const EUCLEAN: Self = Self(177);
178 pub const ENOTNAM: Self = Self(178);
180 pub const ENAVAIL: Self = Self(179);
182 pub const EISNAM: Self = Self(180);
184 pub const EREMOTEIO: Self = Self(181);
186 pub const ENOMEDIUM: Self = Self(182);
188 pub const EMEDIUMTYPE: Self = Self(183);
190 pub const ENOKEY: Self = Self(184);
192 pub const EKEYEXPIRED: Self = Self(185);
194 pub const EKEYREVOKED: Self = Self(186);
196 pub const EKEYREJECTED: Self = Self(187);
198 pub const ENOTSOCK: Self = Self(216);
200 pub const EDESTADDRREQ: Self = Self(217);
202 pub const EMSGSIZE: Self = Self(218);
204 pub const EPROTOTYPE: Self = Self(219);
206 pub const ENOPROTOOPT: Self = Self(220);
208 pub const EPROTONOSUPPORT: Self = Self(221);
210 pub const ESOCKTNOSUPPORT: Self = Self(222);
212 pub const EOPNOTSUPP: Self = Self(223);
214 pub const EPFNOSUPPORT: Self = Self(224);
216 pub const EAFNOSUPPORT: Self = Self(225);
218 pub const EADDRINUSE: Self = Self(226);
220 pub const EADDRNOTAVAIL: Self = Self(227);
222 pub const ENETDOWN: Self = Self(228);
224 pub const ENETUNREACH: Self = Self(229);
226 pub const ENETRESET: Self = Self(230);
228 pub const ECONNABORTED: Self = Self(231);
230 pub const ECONNRESET: Self = Self(232);
232 pub const ENOBUFS: Self = Self(233);
234 pub const EISCONN: Self = Self(234);
236 pub const ENOTCONN: Self = Self(235);
238 pub const ESHUTDOWN: Self = Self(236);
240 pub const ETOOMANYREFS: Self = Self(237);
242 pub const ETIMEDOUT: Self = Self(238);
244 pub const ECONNREFUSED: Self = Self(239);
246 pub const EHOSTDOWN: Self = Self(241);
248 pub const EHOSTUNREACH: Self = Self(242);
250 pub const EALREADY: Self = Self(244);
252 pub const EINPROGRESS: Self = Self(245);
254 pub const ENOTEMPTY: Self = Self(247);
256 pub const ENAMETOOLONG: Self = Self(248);
258 pub const ELOOP: Self = Self(249);
260 pub const ENOSYS: Self = Self(251);
262 pub const ECANCELLED: Self = Self(253);
264 pub const EOWNERDEAD: Self = Self(254);
266 pub const ENOTRECOVERABLE: Self = Self(255);
268 pub const ERFKILL: Self = Self(256);
270 pub const EHWPOISON: Self = Self(257);
272 pub const ERESTARTSYS: Self = Self(512);
274 pub const ERESTARTNOINTR: Self = Self(513);
276 pub const ERESTARTNOHAND: Self = Self(514);
278 pub const ENOIOCTLCMD: Self = Self(515);
280 pub const ERESTART_RESTARTBLOCK: Self = Self(516);
282 pub const EPROBE_DEFER: Self = Self(517);
284 pub const EOPENSTALE: Self = Self(518);
286 pub const ENOPARAM: Self = Self(519);
288 pub const EBADHANDLE: Self = Self(521);
290 pub const ENOTSYNC: Self = Self(522);
292 pub const EBADCOOKIE: Self = Self(523);
294 pub const ENOTSUPP: Self = Self(524);
296 pub const ETOOSMALL: Self = Self(525);
298 pub const ESERVERFAULT: Self = Self(526);
300 pub const EBADTYPE: Self = Self(527);
302 pub const EJUKEBOX: Self = Self(528);
304 pub const EIOCBQUEUED: Self = Self(529);
306 pub const ERECALLCONFLICT: Self = Self(530);
308 pub const ENOGRACE: Self = Self(531);
310 pub const ECANCELED: Self = Self::ECANCELLED;
312 pub const EDEADLOCK: Self = Self::EDEADLK;
314 pub const EREFUSED: Self = Self::ECONNREFUSED;
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; 150] = [
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, 47, 50,
326 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 64, 66, 67, 68, 69, 70, 71, 72, 160, 161, 162, 163,
327 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181,
328 182, 183, 184, 185, 186, 187, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227,
329 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 241, 242, 244, 245, 247, 248,
330 249, 251, 253, 254, 255, 256, 257, 512, 513, 514, 515, 516, 517, 518, 519, 521, 522, 523,
331 524, 525, 526, 527, 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 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 47 => Some(("EILSEQ", "Illegal byte sequence")),
383 50 => Some(("ENONET", "Machine is not on the network")),
384 51 => Some(("ENODATA", "No data available")),
385 52 => Some(("ETIME", "Timer expired")),
386 53 => Some(("ENOSR", "Out of streams resources")),
387 54 => Some(("ENOSTR", "Device not a stream")),
388 55 => Some(("ENOPKG", "Package not installed")),
389 57 => Some(("ENOLINK", "Link has been severed")),
390 58 => Some(("EADV", "Advertise error")),
391 59 => Some(("ESRMNT", "Srmount error")),
392 60 => Some(("ECOMM", "Communication error on send")),
393 61 => Some(("EPROTO", "Protocol error")),
394 64 => Some(("EMULTIHOP", "Multihop attempted")),
395 66 => Some(("EDOTDOT", "RFS specific error")),
396 67 => Some(("EBADMSG", "Not a data message")),
397 68 => Some(("EUSERS", "Too many users")),
398 69 => Some(("EDQUOT", "Quota exceeded")),
399 70 => Some(("ESTALE", "Stale file handle")),
400 71 => Some(("EREMOTE", "Object is remote")),
401 72 => Some(("EOVERFLOW", "Value too large for defined data type")),
402 160 => Some(("EBADE", "Invalid exchange")),
403 161 => Some(("EBADR", "Invalid request descriptor")),
404 162 => Some(("EXFULL", "Exchange full")),
405 163 => Some(("ENOANO", "No anode")),
406 164 => Some(("EBADRQC", "Invalid request code")),
407 165 => Some(("EBADSLT", "Invalid slot")),
408 166 => Some(("EBFONT", "Bad font file format")),
409 167 => Some(("ENOTUNIQ", "Name not unique on network")),
410 168 => Some(("EBADFD", "File descriptor in bad state")),
411 169 => Some(("EREMCHG", "Remote address changed")),
412 170 => Some(("ELIBACC", "Can not access a needed shared library")),
413 171 => Some(("ELIBBAD", "Accessing a corrupted shared library")),
414 172 => Some(("ELIBSCN", ".lib section in a.out corrupted")),
415 173 => Some(("ELIBMAX", "Attempting to link in too many shared libraries")),
416 174 => Some(("ELIBEXEC", "Cannot exec a shared library directly")),
417 175 => Some(("ERESTART", "Interrupted system call should be restarted")),
418 176 => Some(("ESTRPIPE", "Streams pipe error")),
419 177 => Some(("EUCLEAN", "Structure needs cleaning")),
420 178 => Some(("ENOTNAM", "Not a XENIX named type file")),
421 179 => Some(("ENAVAIL", "No XENIX semaphores available")),
422 180 => Some(("EISNAM", "Is a named type file")),
423 181 => Some(("EREMOTEIO", "Remote I/O error")),
424 182 => Some(("ENOMEDIUM", "No medium found")),
425 183 => Some(("EMEDIUMTYPE", "Wrong medium type")),
426 184 => Some(("ENOKEY", "Required key not available")),
427 185 => Some(("EKEYEXPIRED", "Key has expired")),
428 186 => Some(("EKEYREVOKED", "Key has been revoked")),
429 187 => Some(("EKEYREJECTED", "Key was rejected by service")),
430 216 => Some(("ENOTSOCK", "Socket operation on non-socket")),
431 217 => Some(("EDESTADDRREQ", "Destination address required")),
432 218 => Some(("EMSGSIZE", "Message too long")),
433 219 => Some(("EPROTOTYPE", "Protocol wrong type for socket")),
434 220 => Some(("ENOPROTOOPT", "Protocol not available")),
435 221 => Some(("EPROTONOSUPPORT", "Protocol not supported")),
436 222 => Some(("ESOCKTNOSUPPORT", "Socket type not supported")),
437 223 => Some((
438 "EOPNOTSUPP",
439 "Operation not supported on transport endpoint",
440 )),
441 224 => Some(("EPFNOSUPPORT", "Protocol family not supported")),
442 225 => Some(("EAFNOSUPPORT", "Address family not supported by protocol")),
443 226 => Some(("EADDRINUSE", "Address already in use")),
444 227 => Some(("EADDRNOTAVAIL", "Cannot assign requested address")),
445 228 => Some(("ENETDOWN", "Network is down")),
446 229 => Some(("ENETUNREACH", "Network is unreachable")),
447 230 => Some(("ENETRESET", "Network dropped connection because of reset")),
448 231 => Some(("ECONNABORTED", "Software caused connection abort")),
449 232 => Some(("ECONNRESET", "Connection reset by peer")),
450 233 => Some(("ENOBUFS", "No buffer space available")),
451 234 => Some(("EISCONN", "Transport endpoint is already connected")),
452 235 => Some(("ENOTCONN", "Transport endpoint is not connected")),
453 236 => Some(("ESHUTDOWN", "Cannot send after transport endpoint shutdown")),
454 237 => Some(("ETOOMANYREFS", "Too many references: cannot splice")),
455 238 => Some(("ETIMEDOUT", "Connection timed out")),
456 239 => Some(("ECONNREFUSED", "Connection refused")),
457 241 => Some(("EHOSTDOWN", "Host is down")),
458 242 => Some(("EHOSTUNREACH", "No route to host")),
459 244 => Some(("EALREADY", "Operation already in progress")),
460 245 => Some(("EINPROGRESS", "Operation now in progress")),
461 247 => Some(("ENOTEMPTY", "Directory not empty")),
462 248 => Some(("ENAMETOOLONG", "File name too long")),
463 249 => Some(("ELOOP", "Too many symbolic links encountered")),
464 251 => Some(("ENOSYS", "Function not implemented")),
465 253 => Some((
466 "ECANCELLED",
467 "aio request was canceled before complete (POSIX.4 / HPUX)",
468 )),
469 254 => Some(("EOWNERDEAD", "Owner died")),
470 255 => Some(("ENOTRECOVERABLE", "State not recoverable")),
471 256 => Some(("ERFKILL", "Operation not possible due to RF-kill")),
472 257 => Some(("EHWPOISON", "Memory page has hardware error")),
473 512 => Some(("ERESTARTSYS", "Restart syscall")),
474 513 => Some(("ERESTARTNOINTR", "Restart if no interrupt")),
475 514 => Some(("ERESTARTNOHAND", "restart if no handler..")),
476 515 => Some(("ENOIOCTLCMD", "No ioctl command")),
477 516 => Some((
478 "ERESTART_RESTARTBLOCK",
479 "restart by calling sys_restart_syscall",
480 )),
481 517 => Some(("EPROBE_DEFER", "Driver requests probe retry")),
482 518 => Some(("EOPENSTALE", "open found a stale dentry")),
483 519 => Some(("ENOPARAM", "Parameter not supported")),
484 521 => Some(("EBADHANDLE", "Illegal NFS file handle")),
485 522 => Some(("ENOTSYNC", "Update synchronization mismatch")),
486 523 => Some(("EBADCOOKIE", "Cookie is stale")),
487 524 => Some(("ENOTSUPP", "Operation is not supported")),
488 525 => Some(("ETOOSMALL", "Buffer or request is too small")),
489 526 => Some(("ESERVERFAULT", "An untranslatable error occurred")),
490 527 => Some(("EBADTYPE", "Type not supported by server")),
491 528 => Some((
492 "EJUKEBOX",
493 "Request initiated, but will not complete before timeout",
494 )),
495 529 => Some(("EIOCBQUEUED", "iocb queued, will get completion event")),
496 530 => Some(("ERECALLCONFLICT", "conflict with recalled state")),
497 531 => Some(("ENOGRACE", "NFS file lock reclaim refused")),
498 _ => None,
499 }
500 }
501}