1use crate::Result;
2use cfg_if::cfg_if;
3use libc::{c_int, c_void};
4use std::convert::TryFrom;
5use std::{error, fmt, io};
6
7pub use self::consts::*;
8
9cfg_if! {
10 if #[cfg(any(target_os = "freebsd",
11 target_os = "ios",
12 target_os = "macos"))] {
13 unsafe fn errno_location() -> *mut c_int {
14 libc::__error()
15 }
16 } else if #[cfg(any(target_os = "android",
17 target_os = "netbsd",
18 target_os = "openbsd"))] {
19 unsafe fn errno_location() -> *mut c_int {
20 libc::__errno()
21 }
22 } else if #[cfg(any(target_os = "linux",
23 target_os = "redox",
24 target_os = "dragonfly",
25 target_os = "fuchsia"))] {
26 unsafe fn errno_location() -> *mut c_int {
27 libc::__errno_location()
28 }
29 } else if #[cfg(any(target_os = "illumos", target_os = "solaris"))] {
30 unsafe fn errno_location() -> *mut c_int {
31 libc::___errno()
32 }
33 } else if #[cfg(any(target_os = "haiku",))] {
34 unsafe fn errno_location() -> *mut c_int {
35 libc::_errnop()
36 }
37 } else if #[cfg(any(target_os = "aix"))] {
38 unsafe fn errno_location() -> *mut c_int {
39 libc::_Errno()
40 }
41 }
42}
43
44/// Sets the platform-specific errno to no-error
45fn clear() {
46 // Safe because errno is a thread-local variable
47 unsafe {
48 *errno_location() = 0;
49 }
50}
51
52/// Returns the platform-specific value of errno
53pub fn errno() -> i32 {
54 unsafe { *errno_location() }
55}
56
57impl Errno {
58 pub fn last() -> Self {
59 last()
60 }
61
62 pub fn desc(self) -> &'static str {
63 desc(self)
64 }
65
66 pub const fn from_i32(err: i32) -> Errno {
67 from_i32(err)
68 }
69
70 pub fn clear() {
71 clear()
72 }
73
74 /// Returns `Ok(value)` if it does not contain the sentinel value. This
75 /// should not be used when `-1` is not the errno sentinel value.
76 #[inline]
77 pub fn result<S: ErrnoSentinel + PartialEq<S>>(value: S) -> Result<S> {
78 if value == S::sentinel() {
79 Err(Self::last())
80 } else {
81 Ok(value)
82 }
83 }
84}
85
86/// The sentinel value indicates that a function failed and more detailed
87/// information about the error can be found in `errno`
88pub trait ErrnoSentinel: Sized {
89 fn sentinel() -> Self;
90}
91
92impl ErrnoSentinel for isize {
93 fn sentinel() -> Self {
94 -1
95 }
96}
97
98impl ErrnoSentinel for i32 {
99 fn sentinel() -> Self {
100 -1
101 }
102}
103
104impl ErrnoSentinel for i64 {
105 fn sentinel() -> Self {
106 -1
107 }
108}
109
110impl ErrnoSentinel for *mut c_void {
111 fn sentinel() -> Self {
112 -1isize as *mut c_void
113 }
114}
115
116impl ErrnoSentinel for libc::sighandler_t {
117 fn sentinel() -> Self {
118 libc::SIG_ERR
119 }
120}
121
122impl error::Error for Errno {}
123
124impl fmt::Display for Errno {
125 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
126 write!(f, "{:?}: {}", self, self.desc())
127 }
128}
129
130impl From<Errno> for io::Error {
131 fn from(err: Errno) -> Self {
132 io::Error::from_raw_os_error(code:err as i32)
133 }
134}
135
136impl TryFrom<io::Error> for Errno {
137 type Error = io::Error;
138
139 fn try_from(ioerror: io::Error) -> std::result::Result<Self, io::Error> {
140 ioerror.raw_os_error().map(Errno::from_i32).ok_or(err:ioerror)
141 }
142}
143
144fn last() -> Errno {
145 Errno::from_i32(err:errno())
146}
147
148fn desc(errno: Errno) -> &'static str {
149 use self::Errno::*;
150 match errno {
151 UnknownErrno => "Unknown errno",
152 EPERM => "Operation not permitted",
153 ENOENT => "No such file or directory",
154 ESRCH => "No such process",
155 EINTR => "Interrupted system call",
156 EIO => "I/O error",
157 ENXIO => "No such device or address",
158 E2BIG => "Argument list too long",
159 ENOEXEC => "Exec format error",
160 EBADF => "Bad file number",
161 ECHILD => "No child processes",
162 EAGAIN => "Try again",
163 ENOMEM => "Out of memory",
164 EACCES => "Permission denied",
165 EFAULT => "Bad address",
166 #[cfg(not(target_os = "haiku"))]
167 ENOTBLK => "Block device required",
168 EBUSY => "Device or resource busy",
169 EEXIST => "File exists",
170 EXDEV => "Cross-device link",
171 ENODEV => "No such device",
172 ENOTDIR => "Not a directory",
173 EISDIR => "Is a directory",
174 EINVAL => "Invalid argument",
175 ENFILE => "File table overflow",
176 EMFILE => "Too many open files",
177 ENOTTY => "Not a typewriter",
178 ETXTBSY => "Text file busy",
179 EFBIG => "File too large",
180 ENOSPC => "No space left on device",
181 ESPIPE => "Illegal seek",
182 EROFS => "Read-only file system",
183 EMLINK => "Too many links",
184 EPIPE => "Broken pipe",
185 EDOM => "Math argument out of domain of func",
186 ERANGE => "Math result not representable",
187 EDEADLK => "Resource deadlock would occur",
188 ENAMETOOLONG => "File name too long",
189 ENOLCK => "No record locks available",
190 ENOSYS => "Function not implemented",
191 ENOTEMPTY => "Directory not empty",
192 ELOOP => "Too many symbolic links encountered",
193 ENOMSG => "No message of desired type",
194 EIDRM => "Identifier removed",
195 EINPROGRESS => "Operation now in progress",
196 EALREADY => "Operation already in progress",
197 ENOTSOCK => "Socket operation on non-socket",
198 EDESTADDRREQ => "Destination address required",
199 EMSGSIZE => "Message too long",
200 EPROTOTYPE => "Protocol wrong type for socket",
201 ENOPROTOOPT => "Protocol not available",
202 EPROTONOSUPPORT => "Protocol not supported",
203 #[cfg(not(target_os = "haiku"))]
204 ESOCKTNOSUPPORT => "Socket type not supported",
205 #[cfg(not(target_os = "haiku"))]
206 EPFNOSUPPORT => "Protocol family not supported",
207 #[cfg(not(target_os = "haiku"))]
208 EAFNOSUPPORT => "Address family not supported by protocol",
209 EADDRINUSE => "Address already in use",
210 EADDRNOTAVAIL => "Cannot assign requested address",
211 ENETDOWN => "Network is down",
212 ENETUNREACH => "Network is unreachable",
213 ENETRESET => "Network dropped connection because of reset",
214 ECONNABORTED => "Software caused connection abort",
215 ECONNRESET => "Connection reset by peer",
216 ENOBUFS => "No buffer space available",
217 EISCONN => "Transport endpoint is already connected",
218 ENOTCONN => "Transport endpoint is not connected",
219 ESHUTDOWN => "Cannot send after transport endpoint shutdown",
220 #[cfg(not(target_os = "haiku"))]
221 ETOOMANYREFS => "Too many references: cannot splice",
222 ETIMEDOUT => "Connection timed out",
223 ECONNREFUSED => "Connection refused",
224 EHOSTDOWN => "Host is down",
225 EHOSTUNREACH => "No route to host",
226
227 #[cfg(any(
228 target_os = "linux",
229 target_os = "android",
230 target_os = "aix",
231 target_os = "illumos",
232 target_os = "solaris",
233 target_os = "fuchsia"
234 ))]
235 ECHRNG => "Channel number out of range",
236
237 #[cfg(any(
238 target_os = "linux",
239 target_os = "android",
240 target_os = "aix",
241 target_os = "illumos",
242 target_os = "solaris",
243 target_os = "fuchsia"
244 ))]
245 EL2NSYNC => "Level 2 not synchronized",
246
247 #[cfg(any(
248 target_os = "linux",
249 target_os = "android",
250 target_os = "aix",
251 target_os = "illumos",
252 target_os = "solaris",
253 target_os = "fuchsia"
254 ))]
255 EL3HLT => "Level 3 halted",
256
257 #[cfg(any(
258 target_os = "linux",
259 target_os = "android",
260 target_os = "aix",
261 target_os = "illumos",
262 target_os = "solaris",
263 target_os = "fuchsia"
264 ))]
265 EL3RST => "Level 3 reset",
266
267 #[cfg(any(
268 target_os = "linux",
269 target_os = "android",
270 target_os = "aix",
271 target_os = "illumos",
272 target_os = "solaris",
273 target_os = "fuchsia"
274 ))]
275 ELNRNG => "Link number out of range",
276
277 #[cfg(any(
278 target_os = "linux",
279 target_os = "android",
280 target_os = "aix",
281 target_os = "illumos",
282 target_os = "solaris",
283 target_os = "fuchsia"
284 ))]
285 EUNATCH => "Protocol driver not attached",
286
287 #[cfg(any(
288 target_os = "linux",
289 target_os = "android",
290 target_os = "aix",
291 target_os = "illumos",
292 target_os = "solaris",
293 target_os = "fuchsia"
294 ))]
295 ENOCSI => "No CSI structure available",
296
297 #[cfg(any(
298 target_os = "linux",
299 target_os = "android",
300 target_os = "aix",
301 target_os = "illumos",
302 target_os = "solaris",
303 target_os = "fuchsia"
304 ))]
305 EL2HLT => "Level 2 halted",
306
307 #[cfg(any(
308 target_os = "linux",
309 target_os = "android",
310 target_os = "illumos",
311 target_os = "solaris",
312 target_os = "fuchsia"
313 ))]
314 EBADE => "Invalid exchange",
315
316 #[cfg(any(
317 target_os = "linux",
318 target_os = "android",
319 target_os = "illumos",
320 target_os = "solaris",
321 target_os = "fuchsia"
322 ))]
323 EBADR => "Invalid request descriptor",
324
325 #[cfg(any(
326 target_os = "linux",
327 target_os = "android",
328 target_os = "illumos",
329 target_os = "solaris",
330 target_os = "fuchsia"
331 ))]
332 EXFULL => "Exchange full",
333
334 #[cfg(any(
335 target_os = "linux",
336 target_os = "android",
337 target_os = "illumos",
338 target_os = "solaris",
339 target_os = "fuchsia"
340 ))]
341 ENOANO => "No anode",
342
343 #[cfg(any(
344 target_os = "linux",
345 target_os = "android",
346 target_os = "illumos",
347 target_os = "solaris",
348 target_os = "fuchsia"
349 ))]
350 EBADRQC => "Invalid request code",
351
352 #[cfg(any(
353 target_os = "linux",
354 target_os = "android",
355 target_os = "illumos",
356 target_os = "solaris",
357 target_os = "fuchsia"
358 ))]
359 EBADSLT => "Invalid slot",
360
361 #[cfg(any(
362 target_os = "linux",
363 target_os = "android",
364 target_os = "illumos",
365 target_os = "solaris",
366 target_os = "fuchsia"
367 ))]
368 EBFONT => "Bad font file format",
369
370 #[cfg(any(
371 target_os = "linux",
372 target_os = "android",
373 target_os = "illumos",
374 target_os = "solaris",
375 target_os = "fuchsia"
376 ))]
377 ENOSTR => "Device not a stream",
378
379 #[cfg(any(
380 target_os = "linux",
381 target_os = "android",
382 target_os = "illumos",
383 target_os = "solaris",
384 target_os = "fuchsia"
385 ))]
386 ENODATA => "No data available",
387
388 #[cfg(any(
389 target_os = "linux",
390 target_os = "android",
391 target_os = "illumos",
392 target_os = "solaris",
393 target_os = "fuchsia"
394 ))]
395 ETIME => "Timer expired",
396
397 #[cfg(any(
398 target_os = "linux",
399 target_os = "android",
400 target_os = "illumos",
401 target_os = "solaris",
402 target_os = "fuchsia"
403 ))]
404 ENOSR => "Out of streams resources",
405
406 #[cfg(any(
407 target_os = "linux",
408 target_os = "android",
409 target_os = "illumos",
410 target_os = "solaris",
411 target_os = "fuchsia"
412 ))]
413 ENONET => "Machine is not on the network",
414
415 #[cfg(any(
416 target_os = "linux",
417 target_os = "android",
418 target_os = "illumos",
419 target_os = "solaris",
420 target_os = "fuchsia"
421 ))]
422 ENOPKG => "Package not installed",
423
424 #[cfg(any(
425 target_os = "linux",
426 target_os = "android",
427 target_os = "illumos",
428 target_os = "solaris",
429 target_os = "fuchsia"
430 ))]
431 EREMOTE => "Object is remote",
432
433 #[cfg(any(
434 target_os = "linux",
435 target_os = "android",
436 target_os = "aix",
437 target_os = "illumos",
438 target_os = "solaris",
439 target_os = "fuchsia"
440 ))]
441 ENOLINK => "Link has been severed",
442
443 #[cfg(any(
444 target_os = "linux",
445 target_os = "android",
446 target_os = "illumos",
447 target_os = "solaris",
448 target_os = "fuchsia"
449 ))]
450 EADV => "Advertise error",
451
452 #[cfg(any(
453 target_os = "linux",
454 target_os = "android",
455 target_os = "illumos",
456 target_os = "solaris",
457 target_os = "fuchsia"
458 ))]
459 ESRMNT => "Srmount error",
460
461 #[cfg(any(
462 target_os = "linux",
463 target_os = "android",
464 target_os = "illumos",
465 target_os = "solaris",
466 target_os = "fuchsia"
467 ))]
468 ECOMM => "Communication error on send",
469
470 #[cfg(any(
471 target_os = "linux",
472 target_os = "android",
473 target_os = "aix",
474 target_os = "illumos",
475 target_os = "solaris",
476 target_os = "fuchsia"
477 ))]
478 EPROTO => "Protocol error",
479
480 #[cfg(any(
481 target_os = "linux",
482 target_os = "android",
483 target_os = "aix",
484 target_os = "illumos",
485 target_os = "solaris",
486 target_os = "fuchsia"
487 ))]
488 EMULTIHOP => "Multihop attempted",
489
490 #[cfg(any(
491 target_os = "linux",
492 target_os = "android",
493 target_os = "fuchsia"
494 ))]
495 EDOTDOT => "RFS specific error",
496
497 #[cfg(any(
498 target_os = "linux",
499 target_os = "android",
500 target_os = "aix",
501 target_os = "fuchsia"
502 ))]
503 EBADMSG => "Not a data message",
504
505 #[cfg(any(target_os = "illumos", target_os = "solaris"))]
506 EBADMSG => "Trying to read unreadable message",
507
508 #[cfg(any(
509 target_os = "linux",
510 target_os = "android",
511 target_os = "aix",
512 target_os = "fuchsia",
513 target_os = "haiku"
514 ))]
515 EOVERFLOW => "Value too large for defined data type",
516
517 #[cfg(any(
518 target_os = "linux",
519 target_os = "android",
520 target_os = "illumos",
521 target_os = "solaris",
522 target_os = "fuchsia"
523 ))]
524 ENOTUNIQ => "Name not unique on network",
525
526 #[cfg(any(
527 target_os = "linux",
528 target_os = "android",
529 target_os = "illumos",
530 target_os = "solaris",
531 target_os = "fuchsia"
532 ))]
533 EBADFD => "File descriptor in bad state",
534
535 #[cfg(any(
536 target_os = "linux",
537 target_os = "android",
538 target_os = "illumos",
539 target_os = "solaris",
540 target_os = "fuchsia"
541 ))]
542 EREMCHG => "Remote address changed",
543
544 #[cfg(any(
545 target_os = "linux",
546 target_os = "android",
547 target_os = "illumos",
548 target_os = "solaris",
549 target_os = "fuchsia"
550 ))]
551 ELIBACC => "Can not access a needed shared library",
552
553 #[cfg(any(
554 target_os = "linux",
555 target_os = "android",
556 target_os = "illumos",
557 target_os = "solaris",
558 target_os = "fuchsia"
559 ))]
560 ELIBBAD => "Accessing a corrupted shared library",
561
562 #[cfg(any(
563 target_os = "linux",
564 target_os = "android",
565 target_os = "illumos",
566 target_os = "solaris",
567 target_os = "fuchsia"
568 ))]
569 ELIBSCN => ".lib section in a.out corrupted",
570
571 #[cfg(any(
572 target_os = "linux",
573 target_os = "android",
574 target_os = "illumos",
575 target_os = "solaris",
576 target_os = "fuchsia"
577 ))]
578 ELIBMAX => "Attempting to link in too many shared libraries",
579
580 #[cfg(any(
581 target_os = "linux",
582 target_os = "android",
583 target_os = "illumos",
584 target_os = "solaris",
585 target_os = "fuchsia"
586 ))]
587 ELIBEXEC => "Cannot exec a shared library directly",
588
589 #[cfg(any(
590 target_os = "linux",
591 target_os = "android",
592 target_os = "aix",
593 target_os = "illumos",
594 target_os = "solaris",
595 target_os = "fuchsia",
596 target_os = "openbsd"
597 ))]
598 EILSEQ => "Illegal byte sequence",
599
600 #[cfg(any(
601 target_os = "linux",
602 target_os = "android",
603 target_os = "aix",
604 target_os = "illumos",
605 target_os = "solaris",
606 target_os = "fuchsia"
607 ))]
608 ERESTART => "Interrupted system call should be restarted",
609
610 #[cfg(any(
611 target_os = "linux",
612 target_os = "android",
613 target_os = "illumos",
614 target_os = "solaris",
615 target_os = "fuchsia"
616 ))]
617 ESTRPIPE => "Streams pipe error",
618
619 #[cfg(any(
620 target_os = "linux",
621 target_os = "android",
622 target_os = "illumos",
623 target_os = "solaris",
624 target_os = "fuchsia"
625 ))]
626 EUSERS => "Too many users",
627
628 #[cfg(any(
629 target_os = "linux",
630 target_os = "android",
631 target_os = "fuchsia",
632 target_os = "netbsd",
633 target_os = "redox"
634 ))]
635 EOPNOTSUPP => "Operation not supported on transport endpoint",
636
637 #[cfg(any(
638 target_os = "linux",
639 target_os = "android",
640 target_os = "fuchsia"
641 ))]
642 ESTALE => "Stale file handle",
643
644 #[cfg(any(
645 target_os = "linux",
646 target_os = "android",
647 target_os = "fuchsia"
648 ))]
649 EUCLEAN => "Structure needs cleaning",
650
651 #[cfg(any(
652 target_os = "linux",
653 target_os = "android",
654 target_os = "fuchsia"
655 ))]
656 ENOTNAM => "Not a XENIX named type file",
657
658 #[cfg(any(
659 target_os = "linux",
660 target_os = "android",
661 target_os = "fuchsia"
662 ))]
663 ENAVAIL => "No XENIX semaphores available",
664
665 #[cfg(any(
666 target_os = "linux",
667 target_os = "android",
668 target_os = "fuchsia"
669 ))]
670 EISNAM => "Is a named type file",
671
672 #[cfg(any(
673 target_os = "linux",
674 target_os = "android",
675 target_os = "fuchsia"
676 ))]
677 EREMOTEIO => "Remote I/O error",
678
679 #[cfg(any(
680 target_os = "linux",
681 target_os = "android",
682 target_os = "fuchsia"
683 ))]
684 EDQUOT => "Quota exceeded",
685
686 #[cfg(any(
687 target_os = "linux",
688 target_os = "android",
689 target_os = "fuchsia",
690 target_os = "openbsd",
691 target_os = "dragonfly"
692 ))]
693 ENOMEDIUM => "No medium found",
694
695 #[cfg(any(
696 target_os = "linux",
697 target_os = "android",
698 target_os = "fuchsia",
699 target_os = "openbsd"
700 ))]
701 EMEDIUMTYPE => "Wrong medium type",
702
703 #[cfg(any(
704 target_os = "linux",
705 target_os = "android",
706 target_os = "illumos",
707 target_os = "solaris",
708 target_os = "fuchsia",
709 target_os = "haiku"
710 ))]
711 ECANCELED => "Operation canceled",
712
713 #[cfg(any(
714 target_os = "linux",
715 target_os = "android",
716 target_os = "fuchsia"
717 ))]
718 ENOKEY => "Required key not available",
719
720 #[cfg(any(
721 target_os = "linux",
722 target_os = "android",
723 target_os = "fuchsia"
724 ))]
725 EKEYEXPIRED => "Key has expired",
726
727 #[cfg(any(
728 target_os = "linux",
729 target_os = "android",
730 target_os = "fuchsia"
731 ))]
732 EKEYREVOKED => "Key has been revoked",
733
734 #[cfg(any(
735 target_os = "linux",
736 target_os = "android",
737 target_os = "fuchsia"
738 ))]
739 EKEYREJECTED => "Key was rejected by service",
740
741 #[cfg(any(
742 target_os = "linux",
743 target_os = "android",
744 target_os = "aix",
745 target_os = "fuchsia"
746 ))]
747 EOWNERDEAD => "Owner died",
748
749 #[cfg(any(target_os = "illumos", target_os = "solaris"))]
750 EOWNERDEAD => "Process died with lock",
751
752 #[cfg(any(
753 target_os = "linux",
754 target_os = "android",
755 target_os = "aix",
756 target_os = "fuchsia"
757 ))]
758 ENOTRECOVERABLE => "State not recoverable",
759
760 #[cfg(any(target_os = "illumos", target_os = "solaris"))]
761 ENOTRECOVERABLE => "Lock is not recoverable",
762
763 #[cfg(any(
764 all(target_os = "linux", not(target_arch = "mips")),
765 target_os = "fuchsia"
766 ))]
767 ERFKILL => "Operation not possible due to RF-kill",
768
769 #[cfg(any(
770 all(target_os = "linux", not(target_arch = "mips")),
771 target_os = "fuchsia"
772 ))]
773 EHWPOISON => "Memory page has hardware error",
774
775 #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
776 EDOOFUS => "Programming error",
777
778 #[cfg(any(
779 target_os = "freebsd",
780 target_os = "dragonfly",
781 target_os = "redox"
782 ))]
783 EMULTIHOP => "Multihop attempted",
784
785 #[cfg(any(
786 target_os = "freebsd",
787 target_os = "dragonfly",
788 target_os = "redox"
789 ))]
790 ENOLINK => "Link has been severed",
791
792 #[cfg(target_os = "freebsd")]
793 ENOTCAPABLE => "Capabilities insufficient",
794
795 #[cfg(target_os = "freebsd")]
796 ECAPMODE => "Not permitted in capability mode",
797
798 #[cfg(any(
799 target_os = "macos",
800 target_os = "freebsd",
801 target_os = "dragonfly",
802 target_os = "ios",
803 target_os = "openbsd",
804 target_os = "netbsd"
805 ))]
806 ENEEDAUTH => "Need authenticator",
807
808 #[cfg(any(
809 target_os = "macos",
810 target_os = "freebsd",
811 target_os = "dragonfly",
812 target_os = "ios",
813 target_os = "openbsd",
814 target_os = "netbsd",
815 target_os = "redox",
816 target_os = "illumos",
817 target_os = "solaris"
818 ))]
819 EOVERFLOW => "Value too large to be stored in data type",
820
821 #[cfg(any(
822 target_os = "macos",
823 target_os = "freebsd",
824 target_os = "dragonfly",
825 target_os = "ios",
826 target_os = "netbsd",
827 target_os = "redox",
828 target_os = "haiku"
829 ))]
830 EILSEQ => "Illegal byte sequence",
831
832 #[cfg(any(
833 target_os = "macos",
834 target_os = "freebsd",
835 target_os = "dragonfly",
836 target_os = "ios",
837 target_os = "openbsd",
838 target_os = "netbsd",
839 target_os = "haiku"
840 ))]
841 ENOATTR => "Attribute not found",
842
843 #[cfg(any(
844 target_os = "macos",
845 target_os = "freebsd",
846 target_os = "dragonfly",
847 target_os = "ios",
848 target_os = "openbsd",
849 target_os = "netbsd",
850 target_os = "redox",
851 target_os = "haiku"
852 ))]
853 EBADMSG => "Bad message",
854
855 #[cfg(any(
856 target_os = "macos",
857 target_os = "freebsd",
858 target_os = "dragonfly",
859 target_os = "ios",
860 target_os = "openbsd",
861 target_os = "netbsd",
862 target_os = "redox",
863 target_os = "haiku"
864 ))]
865 EPROTO => "Protocol error",
866
867 #[cfg(any(
868 target_os = "macos",
869 target_os = "freebsd",
870 target_os = "dragonfly",
871 target_os = "ios",
872 target_os = "openbsd"
873 ))]
874 ENOTRECOVERABLE => "State not recoverable",
875
876 #[cfg(any(
877 target_os = "macos",
878 target_os = "freebsd",
879 target_os = "dragonfly",
880 target_os = "ios",
881 target_os = "openbsd"
882 ))]
883 EOWNERDEAD => "Previous owner died",
884
885 #[cfg(any(
886 target_os = "macos",
887 target_os = "freebsd",
888 target_os = "dragonfly",
889 target_os = "ios",
890 target_os = "openbsd",
891 target_os = "netbsd",
892 target_os = "aix",
893 target_os = "illumos",
894 target_os = "solaris",
895 target_os = "haiku"
896 ))]
897 ENOTSUP => "Operation not supported",
898
899 #[cfg(any(
900 target_os = "macos",
901 target_os = "freebsd",
902 target_os = "dragonfly",
903 target_os = "ios",
904 target_os = "aix",
905 target_os = "openbsd",
906 target_os = "netbsd"
907 ))]
908 EPROCLIM => "Too many processes",
909
910 #[cfg(any(
911 target_os = "macos",
912 target_os = "freebsd",
913 target_os = "dragonfly",
914 target_os = "ios",
915 target_os = "aix",
916 target_os = "openbsd",
917 target_os = "netbsd",
918 target_os = "redox"
919 ))]
920 EUSERS => "Too many users",
921
922 #[cfg(any(
923 target_os = "macos",
924 target_os = "freebsd",
925 target_os = "dragonfly",
926 target_os = "ios",
927 target_os = "openbsd",
928 target_os = "netbsd",
929 target_os = "redox",
930 target_os = "aix",
931 target_os = "illumos",
932 target_os = "solaris",
933 target_os = "haiku"
934 ))]
935 EDQUOT => "Disc quota exceeded",
936
937 #[cfg(any(
938 target_os = "macos",
939 target_os = "freebsd",
940 target_os = "dragonfly",
941 target_os = "ios",
942 target_os = "openbsd",
943 target_os = "netbsd",
944 target_os = "redox",
945 target_os = "aix",
946 target_os = "illumos",
947 target_os = "solaris",
948 target_os = "haiku"
949 ))]
950 ESTALE => "Stale NFS file handle",
951
952 #[cfg(any(
953 target_os = "macos",
954 target_os = "freebsd",
955 target_os = "dragonfly",
956 target_os = "ios",
957 target_os = "aix",
958 target_os = "openbsd",
959 target_os = "netbsd",
960 target_os = "redox"
961 ))]
962 EREMOTE => "Too many levels of remote in path",
963
964 #[cfg(any(
965 target_os = "macos",
966 target_os = "freebsd",
967 target_os = "dragonfly",
968 target_os = "ios",
969 target_os = "openbsd",
970 target_os = "netbsd"
971 ))]
972 EBADRPC => "RPC struct is bad",
973
974 #[cfg(any(
975 target_os = "macos",
976 target_os = "freebsd",
977 target_os = "dragonfly",
978 target_os = "ios",
979 target_os = "openbsd",
980 target_os = "netbsd"
981 ))]
982 ERPCMISMATCH => "RPC version wrong",
983
984 #[cfg(any(
985 target_os = "macos",
986 target_os = "freebsd",
987 target_os = "dragonfly",
988 target_os = "ios",
989 target_os = "openbsd",
990 target_os = "netbsd"
991 ))]
992 EPROGUNAVAIL => "RPC prog. not avail",
993
994 #[cfg(any(
995 target_os = "macos",
996 target_os = "freebsd",
997 target_os = "dragonfly",
998 target_os = "ios",
999 target_os = "openbsd",
1000 target_os = "netbsd"
1001 ))]
1002 EPROGMISMATCH => "Program version wrong",
1003
1004 #[cfg(any(
1005 target_os = "macos",
1006 target_os = "freebsd",
1007 target_os = "dragonfly",
1008 target_os = "ios",
1009 target_os = "openbsd",
1010 target_os = "netbsd"
1011 ))]
1012 EPROCUNAVAIL => "Bad procedure for program",
1013
1014 #[cfg(any(
1015 target_os = "macos",
1016 target_os = "freebsd",
1017 target_os = "dragonfly",
1018 target_os = "ios",
1019 target_os = "openbsd",
1020 target_os = "netbsd"
1021 ))]
1022 EFTYPE => "Inappropriate file type or format",
1023
1024 #[cfg(any(
1025 target_os = "macos",
1026 target_os = "freebsd",
1027 target_os = "dragonfly",
1028 target_os = "ios",
1029 target_os = "openbsd",
1030 target_os = "netbsd"
1031 ))]
1032 EAUTH => "Authentication error",
1033
1034 #[cfg(any(
1035 target_os = "macos",
1036 target_os = "freebsd",
1037 target_os = "dragonfly",
1038 target_os = "ios",
1039 target_os = "aix",
1040 target_os = "openbsd",
1041 target_os = "netbsd",
1042 target_os = "redox"
1043 ))]
1044 ECANCELED => "Operation canceled",
1045
1046 #[cfg(any(target_os = "macos", target_os = "ios"))]
1047 EPWROFF => "Device power is off",
1048
1049 #[cfg(any(target_os = "macos", target_os = "ios"))]
1050 EDEVERR => "Device error, e.g. paper out",
1051
1052 #[cfg(any(target_os = "macos", target_os = "ios"))]
1053 EBADEXEC => "Bad executable",
1054
1055 #[cfg(any(target_os = "macos", target_os = "ios"))]
1056 EBADARCH => "Bad CPU type in executable",
1057
1058 #[cfg(any(target_os = "macos", target_os = "ios"))]
1059 ESHLIBVERS => "Shared library version mismatch",
1060
1061 #[cfg(any(target_os = "macos", target_os = "ios"))]
1062 EBADMACHO => "Malformed Macho file",
1063
1064 #[cfg(any(
1065 target_os = "macos",
1066 target_os = "ios",
1067 target_os = "netbsd",
1068 target_os = "haiku"
1069 ))]
1070 EMULTIHOP => "Reserved",
1071
1072 #[cfg(any(
1073 target_os = "macos",
1074 target_os = "ios",
1075 target_os = "aix",
1076 target_os = "netbsd",
1077 target_os = "redox"
1078 ))]
1079 ENODATA => "No message available on STREAM",
1080
1081 #[cfg(any(
1082 target_os = "macos",
1083 target_os = "ios",
1084 target_os = "netbsd",
1085 target_os = "haiku"
1086 ))]
1087 ENOLINK => "Reserved",
1088
1089 #[cfg(any(
1090 target_os = "macos",
1091 target_os = "ios",
1092 target_os = "aix",
1093 target_os = "netbsd",
1094 target_os = "redox"
1095 ))]
1096 ENOSR => "No STREAM resources",
1097
1098 #[cfg(any(
1099 target_os = "macos",
1100 target_os = "ios",
1101 target_os = "aix",
1102 target_os = "netbsd",
1103 target_os = "redox"
1104 ))]
1105 ENOSTR => "Not a STREAM",
1106
1107 #[cfg(any(
1108 target_os = "macos",
1109 target_os = "ios",
1110 target_os = "aix",
1111 target_os = "netbsd",
1112 target_os = "redox"
1113 ))]
1114 ETIME => "STREAM ioctl timeout",
1115
1116 #[cfg(any(
1117 target_os = "macos",
1118 target_os = "ios",
1119 target_os = "aix",
1120 target_os = "illumos",
1121 target_os = "solaris"
1122 ))]
1123 EOPNOTSUPP => "Operation not supported on socket",
1124
1125 #[cfg(any(target_os = "macos", target_os = "ios"))]
1126 ENOPOLICY => "No such policy registered",
1127
1128 #[cfg(any(target_os = "macos", target_os = "ios"))]
1129 EQFULL => "Interface output queue is full",
1130
1131 #[cfg(target_os = "openbsd")]
1132 EOPNOTSUPP => "Operation not supported",
1133
1134 #[cfg(target_os = "openbsd")]
1135 EIPSEC => "IPsec processing failure",
1136
1137 #[cfg(target_os = "dragonfly")]
1138 EASYNC => "Async",
1139
1140 #[cfg(any(target_os = "illumos", target_os = "solaris"))]
1141 EDEADLOCK => "Resource deadlock would occur",
1142
1143 #[cfg(any(target_os = "illumos", target_os = "solaris"))]
1144 ELOCKUNMAPPED => "Locked lock was unmapped",
1145
1146 #[cfg(any(target_os = "illumos", target_os = "solaris"))]
1147 ENOTACTIVE => "Facility is not active",
1148 }
1149}
1150
1151#[cfg(any(target_os = "linux", target_os = "android", target_os = "fuchsia"))]
1152mod consts {
1153 #[derive(Clone, Copy, Debug, Eq, PartialEq)]
1154 #[repr(i32)]
1155 #[non_exhaustive]
1156 pub enum Errno {
1157 UnknownErrno = 0,
1158 EPERM = libc::EPERM,
1159 ENOENT = libc::ENOENT,
1160 ESRCH = libc::ESRCH,
1161 EINTR = libc::EINTR,
1162 EIO = libc::EIO,
1163 ENXIO = libc::ENXIO,
1164 E2BIG = libc::E2BIG,
1165 ENOEXEC = libc::ENOEXEC,
1166 EBADF = libc::EBADF,
1167 ECHILD = libc::ECHILD,
1168 EAGAIN = libc::EAGAIN,
1169 ENOMEM = libc::ENOMEM,
1170 EACCES = libc::EACCES,
1171 EFAULT = libc::EFAULT,
1172 ENOTBLK = libc::ENOTBLK,
1173 EBUSY = libc::EBUSY,
1174 EEXIST = libc::EEXIST,
1175 EXDEV = libc::EXDEV,
1176 ENODEV = libc::ENODEV,
1177 ENOTDIR = libc::ENOTDIR,
1178 EISDIR = libc::EISDIR,
1179 EINVAL = libc::EINVAL,
1180 ENFILE = libc::ENFILE,
1181 EMFILE = libc::EMFILE,
1182 ENOTTY = libc::ENOTTY,
1183 ETXTBSY = libc::ETXTBSY,
1184 EFBIG = libc::EFBIG,
1185 ENOSPC = libc::ENOSPC,
1186 ESPIPE = libc::ESPIPE,
1187 EROFS = libc::EROFS,
1188 EMLINK = libc::EMLINK,
1189 EPIPE = libc::EPIPE,
1190 EDOM = libc::EDOM,
1191 ERANGE = libc::ERANGE,
1192 EDEADLK = libc::EDEADLK,
1193 ENAMETOOLONG = libc::ENAMETOOLONG,
1194 ENOLCK = libc::ENOLCK,
1195 ENOSYS = libc::ENOSYS,
1196 ENOTEMPTY = libc::ENOTEMPTY,
1197 ELOOP = libc::ELOOP,
1198 ENOMSG = libc::ENOMSG,
1199 EIDRM = libc::EIDRM,
1200 ECHRNG = libc::ECHRNG,
1201 EL2NSYNC = libc::EL2NSYNC,
1202 EL3HLT = libc::EL3HLT,
1203 EL3RST = libc::EL3RST,
1204 ELNRNG = libc::ELNRNG,
1205 EUNATCH = libc::EUNATCH,
1206 ENOCSI = libc::ENOCSI,
1207 EL2HLT = libc::EL2HLT,
1208 EBADE = libc::EBADE,
1209 EBADR = libc::EBADR,
1210 EXFULL = libc::EXFULL,
1211 ENOANO = libc::ENOANO,
1212 EBADRQC = libc::EBADRQC,
1213 EBADSLT = libc::EBADSLT,
1214 EBFONT = libc::EBFONT,
1215 ENOSTR = libc::ENOSTR,
1216 ENODATA = libc::ENODATA,
1217 ETIME = libc::ETIME,
1218 ENOSR = libc::ENOSR,
1219 ENONET = libc::ENONET,
1220 ENOPKG = libc::ENOPKG,
1221 EREMOTE = libc::EREMOTE,
1222 ENOLINK = libc::ENOLINK,
1223 EADV = libc::EADV,
1224 ESRMNT = libc::ESRMNT,
1225 ECOMM = libc::ECOMM,
1226 EPROTO = libc::EPROTO,
1227 EMULTIHOP = libc::EMULTIHOP,
1228 EDOTDOT = libc::EDOTDOT,
1229 EBADMSG = libc::EBADMSG,
1230 EOVERFLOW = libc::EOVERFLOW,
1231 ENOTUNIQ = libc::ENOTUNIQ,
1232 EBADFD = libc::EBADFD,
1233 EREMCHG = libc::EREMCHG,
1234 ELIBACC = libc::ELIBACC,
1235 ELIBBAD = libc::ELIBBAD,
1236 ELIBSCN = libc::ELIBSCN,
1237 ELIBMAX = libc::ELIBMAX,
1238 ELIBEXEC = libc::ELIBEXEC,
1239 EILSEQ = libc::EILSEQ,
1240 ERESTART = libc::ERESTART,
1241 ESTRPIPE = libc::ESTRPIPE,
1242 EUSERS = libc::EUSERS,
1243 ENOTSOCK = libc::ENOTSOCK,
1244 EDESTADDRREQ = libc::EDESTADDRREQ,
1245 EMSGSIZE = libc::EMSGSIZE,
1246 EPROTOTYPE = libc::EPROTOTYPE,
1247 ENOPROTOOPT = libc::ENOPROTOOPT,
1248 EPROTONOSUPPORT = libc::EPROTONOSUPPORT,
1249 ESOCKTNOSUPPORT = libc::ESOCKTNOSUPPORT,
1250 EOPNOTSUPP = libc::EOPNOTSUPP,
1251 EPFNOSUPPORT = libc::EPFNOSUPPORT,
1252 EAFNOSUPPORT = libc::EAFNOSUPPORT,
1253 EADDRINUSE = libc::EADDRINUSE,
1254 EADDRNOTAVAIL = libc::EADDRNOTAVAIL,
1255 ENETDOWN = libc::ENETDOWN,
1256 ENETUNREACH = libc::ENETUNREACH,
1257 ENETRESET = libc::ENETRESET,
1258 ECONNABORTED = libc::ECONNABORTED,
1259 ECONNRESET = libc::ECONNRESET,
1260 ENOBUFS = libc::ENOBUFS,
1261 EISCONN = libc::EISCONN,
1262 ENOTCONN = libc::ENOTCONN,
1263 ESHUTDOWN = libc::ESHUTDOWN,
1264 ETOOMANYREFS = libc::ETOOMANYREFS,
1265 ETIMEDOUT = libc::ETIMEDOUT,
1266 ECONNREFUSED = libc::ECONNREFUSED,
1267 EHOSTDOWN = libc::EHOSTDOWN,
1268 EHOSTUNREACH = libc::EHOSTUNREACH,
1269 EALREADY = libc::EALREADY,
1270 EINPROGRESS = libc::EINPROGRESS,
1271 ESTALE = libc::ESTALE,
1272 EUCLEAN = libc::EUCLEAN,
1273 ENOTNAM = libc::ENOTNAM,
1274 ENAVAIL = libc::ENAVAIL,
1275 EISNAM = libc::EISNAM,
1276 EREMOTEIO = libc::EREMOTEIO,
1277 EDQUOT = libc::EDQUOT,
1278 ENOMEDIUM = libc::ENOMEDIUM,
1279 EMEDIUMTYPE = libc::EMEDIUMTYPE,
1280 ECANCELED = libc::ECANCELED,
1281 ENOKEY = libc::ENOKEY,
1282 EKEYEXPIRED = libc::EKEYEXPIRED,
1283 EKEYREVOKED = libc::EKEYREVOKED,
1284 EKEYREJECTED = libc::EKEYREJECTED,
1285 EOWNERDEAD = libc::EOWNERDEAD,
1286 ENOTRECOVERABLE = libc::ENOTRECOVERABLE,
1287 #[cfg(not(any(target_os = "android", target_arch = "mips")))]
1288 ERFKILL = libc::ERFKILL,
1289 #[cfg(not(any(target_os = "android", target_arch = "mips")))]
1290 EHWPOISON = libc::EHWPOISON,
1291 }
1292
1293 impl Errno {
1294 pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
1295 pub const EDEADLOCK: Errno = Errno::EDEADLK;
1296 pub const ENOTSUP: Errno = Errno::EOPNOTSUPP;
1297 }
1298
1299 pub const fn from_i32(e: i32) -> Errno {
1300 use self::Errno::*;
1301
1302 match e {
1303 libc::EPERM => EPERM,
1304 libc::ENOENT => ENOENT,
1305 libc::ESRCH => ESRCH,
1306 libc::EINTR => EINTR,
1307 libc::EIO => EIO,
1308 libc::ENXIO => ENXIO,
1309 libc::E2BIG => E2BIG,
1310 libc::ENOEXEC => ENOEXEC,
1311 libc::EBADF => EBADF,
1312 libc::ECHILD => ECHILD,
1313 libc::EAGAIN => EAGAIN,
1314 libc::ENOMEM => ENOMEM,
1315 libc::EACCES => EACCES,
1316 libc::EFAULT => EFAULT,
1317 libc::ENOTBLK => ENOTBLK,
1318 libc::EBUSY => EBUSY,
1319 libc::EEXIST => EEXIST,
1320 libc::EXDEV => EXDEV,
1321 libc::ENODEV => ENODEV,
1322 libc::ENOTDIR => ENOTDIR,
1323 libc::EISDIR => EISDIR,
1324 libc::EINVAL => EINVAL,
1325 libc::ENFILE => ENFILE,
1326 libc::EMFILE => EMFILE,
1327 libc::ENOTTY => ENOTTY,
1328 libc::ETXTBSY => ETXTBSY,
1329 libc::EFBIG => EFBIG,
1330 libc::ENOSPC => ENOSPC,
1331 libc::ESPIPE => ESPIPE,
1332 libc::EROFS => EROFS,
1333 libc::EMLINK => EMLINK,
1334 libc::EPIPE => EPIPE,
1335 libc::EDOM => EDOM,
1336 libc::ERANGE => ERANGE,
1337 libc::EDEADLK => EDEADLK,
1338 libc::ENAMETOOLONG => ENAMETOOLONG,
1339 libc::ENOLCK => ENOLCK,
1340 libc::ENOSYS => ENOSYS,
1341 libc::ENOTEMPTY => ENOTEMPTY,
1342 libc::ELOOP => ELOOP,
1343 libc::ENOMSG => ENOMSG,
1344 libc::EIDRM => EIDRM,
1345 libc::ECHRNG => ECHRNG,
1346 libc::EL2NSYNC => EL2NSYNC,
1347 libc::EL3HLT => EL3HLT,
1348 libc::EL3RST => EL3RST,
1349 libc::ELNRNG => ELNRNG,
1350 libc::EUNATCH => EUNATCH,
1351 libc::ENOCSI => ENOCSI,
1352 libc::EL2HLT => EL2HLT,
1353 libc::EBADE => EBADE,
1354 libc::EBADR => EBADR,
1355 libc::EXFULL => EXFULL,
1356 libc::ENOANO => ENOANO,
1357 libc::EBADRQC => EBADRQC,
1358 libc::EBADSLT => EBADSLT,
1359 libc::EBFONT => EBFONT,
1360 libc::ENOSTR => ENOSTR,
1361 libc::ENODATA => ENODATA,
1362 libc::ETIME => ETIME,
1363 libc::ENOSR => ENOSR,
1364 libc::ENONET => ENONET,
1365 libc::ENOPKG => ENOPKG,
1366 libc::EREMOTE => EREMOTE,
1367 libc::ENOLINK => ENOLINK,
1368 libc::EADV => EADV,
1369 libc::ESRMNT => ESRMNT,
1370 libc::ECOMM => ECOMM,
1371 libc::EPROTO => EPROTO,
1372 libc::EMULTIHOP => EMULTIHOP,
1373 libc::EDOTDOT => EDOTDOT,
1374 libc::EBADMSG => EBADMSG,
1375 libc::EOVERFLOW => EOVERFLOW,
1376 libc::ENOTUNIQ => ENOTUNIQ,
1377 libc::EBADFD => EBADFD,
1378 libc::EREMCHG => EREMCHG,
1379 libc::ELIBACC => ELIBACC,
1380 libc::ELIBBAD => ELIBBAD,
1381 libc::ELIBSCN => ELIBSCN,
1382 libc::ELIBMAX => ELIBMAX,
1383 libc::ELIBEXEC => ELIBEXEC,
1384 libc::EILSEQ => EILSEQ,
1385 libc::ERESTART => ERESTART,
1386 libc::ESTRPIPE => ESTRPIPE,
1387 libc::EUSERS => EUSERS,
1388 libc::ENOTSOCK => ENOTSOCK,
1389 libc::EDESTADDRREQ => EDESTADDRREQ,
1390 libc::EMSGSIZE => EMSGSIZE,
1391 libc::EPROTOTYPE => EPROTOTYPE,
1392 libc::ENOPROTOOPT => ENOPROTOOPT,
1393 libc::EPROTONOSUPPORT => EPROTONOSUPPORT,
1394 libc::ESOCKTNOSUPPORT => ESOCKTNOSUPPORT,
1395 libc::EOPNOTSUPP => EOPNOTSUPP,
1396 libc::EPFNOSUPPORT => EPFNOSUPPORT,
1397 libc::EAFNOSUPPORT => EAFNOSUPPORT,
1398 libc::EADDRINUSE => EADDRINUSE,
1399 libc::EADDRNOTAVAIL => EADDRNOTAVAIL,
1400 libc::ENETDOWN => ENETDOWN,
1401 libc::ENETUNREACH => ENETUNREACH,
1402 libc::ENETRESET => ENETRESET,
1403 libc::ECONNABORTED => ECONNABORTED,
1404 libc::ECONNRESET => ECONNRESET,
1405 libc::ENOBUFS => ENOBUFS,
1406 libc::EISCONN => EISCONN,
1407 libc::ENOTCONN => ENOTCONN,
1408 libc::ESHUTDOWN => ESHUTDOWN,
1409 libc::ETOOMANYREFS => ETOOMANYREFS,
1410 libc::ETIMEDOUT => ETIMEDOUT,
1411 libc::ECONNREFUSED => ECONNREFUSED,
1412 libc::EHOSTDOWN => EHOSTDOWN,
1413 libc::EHOSTUNREACH => EHOSTUNREACH,
1414 libc::EALREADY => EALREADY,
1415 libc::EINPROGRESS => EINPROGRESS,
1416 libc::ESTALE => ESTALE,
1417 libc::EUCLEAN => EUCLEAN,
1418 libc::ENOTNAM => ENOTNAM,
1419 libc::ENAVAIL => ENAVAIL,
1420 libc::EISNAM => EISNAM,
1421 libc::EREMOTEIO => EREMOTEIO,
1422 libc::EDQUOT => EDQUOT,
1423 libc::ENOMEDIUM => ENOMEDIUM,
1424 libc::EMEDIUMTYPE => EMEDIUMTYPE,
1425 libc::ECANCELED => ECANCELED,
1426 libc::ENOKEY => ENOKEY,
1427 libc::EKEYEXPIRED => EKEYEXPIRED,
1428 libc::EKEYREVOKED => EKEYREVOKED,
1429 libc::EKEYREJECTED => EKEYREJECTED,
1430 libc::EOWNERDEAD => EOWNERDEAD,
1431 libc::ENOTRECOVERABLE => ENOTRECOVERABLE,
1432 #[cfg(not(any(target_os = "android", target_arch = "mips")))]
1433 libc::ERFKILL => ERFKILL,
1434 #[cfg(not(any(target_os = "android", target_arch = "mips")))]
1435 libc::EHWPOISON => EHWPOISON,
1436 _ => UnknownErrno,
1437 }
1438 }
1439}
1440
1441#[cfg(any(target_os = "macos", target_os = "ios"))]
1442mod consts {
1443 #[derive(Clone, Copy, Debug, Eq, PartialEq)]
1444 #[repr(i32)]
1445 #[non_exhaustive]
1446 pub enum Errno {
1447 UnknownErrno = 0,
1448 EPERM = libc::EPERM,
1449 ENOENT = libc::ENOENT,
1450 ESRCH = libc::ESRCH,
1451 EINTR = libc::EINTR,
1452 EIO = libc::EIO,
1453 ENXIO = libc::ENXIO,
1454 E2BIG = libc::E2BIG,
1455 ENOEXEC = libc::ENOEXEC,
1456 EBADF = libc::EBADF,
1457 ECHILD = libc::ECHILD,
1458 EDEADLK = libc::EDEADLK,
1459 ENOMEM = libc::ENOMEM,
1460 EACCES = libc::EACCES,
1461 EFAULT = libc::EFAULT,
1462 ENOTBLK = libc::ENOTBLK,
1463 EBUSY = libc::EBUSY,
1464 EEXIST = libc::EEXIST,
1465 EXDEV = libc::EXDEV,
1466 ENODEV = libc::ENODEV,
1467 ENOTDIR = libc::ENOTDIR,
1468 EISDIR = libc::EISDIR,
1469 EINVAL = libc::EINVAL,
1470 ENFILE = libc::ENFILE,
1471 EMFILE = libc::EMFILE,
1472 ENOTTY = libc::ENOTTY,
1473 ETXTBSY = libc::ETXTBSY,
1474 EFBIG = libc::EFBIG,
1475 ENOSPC = libc::ENOSPC,
1476 ESPIPE = libc::ESPIPE,
1477 EROFS = libc::EROFS,
1478 EMLINK = libc::EMLINK,
1479 EPIPE = libc::EPIPE,
1480 EDOM = libc::EDOM,
1481 ERANGE = libc::ERANGE,
1482 EAGAIN = libc::EAGAIN,
1483 EINPROGRESS = libc::EINPROGRESS,
1484 EALREADY = libc::EALREADY,
1485 ENOTSOCK = libc::ENOTSOCK,
1486 EDESTADDRREQ = libc::EDESTADDRREQ,
1487 EMSGSIZE = libc::EMSGSIZE,
1488 EPROTOTYPE = libc::EPROTOTYPE,
1489 ENOPROTOOPT = libc::ENOPROTOOPT,
1490 EPROTONOSUPPORT = libc::EPROTONOSUPPORT,
1491 ESOCKTNOSUPPORT = libc::ESOCKTNOSUPPORT,
1492 ENOTSUP = libc::ENOTSUP,
1493 EPFNOSUPPORT = libc::EPFNOSUPPORT,
1494 EAFNOSUPPORT = libc::EAFNOSUPPORT,
1495 EADDRINUSE = libc::EADDRINUSE,
1496 EADDRNOTAVAIL = libc::EADDRNOTAVAIL,
1497 ENETDOWN = libc::ENETDOWN,
1498 ENETUNREACH = libc::ENETUNREACH,
1499 ENETRESET = libc::ENETRESET,
1500 ECONNABORTED = libc::ECONNABORTED,
1501 ECONNRESET = libc::ECONNRESET,
1502 ENOBUFS = libc::ENOBUFS,
1503 EISCONN = libc::EISCONN,
1504 ENOTCONN = libc::ENOTCONN,
1505 ESHUTDOWN = libc::ESHUTDOWN,
1506 ETOOMANYREFS = libc::ETOOMANYREFS,
1507 ETIMEDOUT = libc::ETIMEDOUT,
1508 ECONNREFUSED = libc::ECONNREFUSED,
1509 ELOOP = libc::ELOOP,
1510 ENAMETOOLONG = libc::ENAMETOOLONG,
1511 EHOSTDOWN = libc::EHOSTDOWN,
1512 EHOSTUNREACH = libc::EHOSTUNREACH,
1513 ENOTEMPTY = libc::ENOTEMPTY,
1514 EPROCLIM = libc::EPROCLIM,
1515 EUSERS = libc::EUSERS,
1516 EDQUOT = libc::EDQUOT,
1517 ESTALE = libc::ESTALE,
1518 EREMOTE = libc::EREMOTE,
1519 EBADRPC = libc::EBADRPC,
1520 ERPCMISMATCH = libc::ERPCMISMATCH,
1521 EPROGUNAVAIL = libc::EPROGUNAVAIL,
1522 EPROGMISMATCH = libc::EPROGMISMATCH,
1523 EPROCUNAVAIL = libc::EPROCUNAVAIL,
1524 ENOLCK = libc::ENOLCK,
1525 ENOSYS = libc::ENOSYS,
1526 EFTYPE = libc::EFTYPE,
1527 EAUTH = libc::EAUTH,
1528 ENEEDAUTH = libc::ENEEDAUTH,
1529 EPWROFF = libc::EPWROFF,
1530 EDEVERR = libc::EDEVERR,
1531 EOVERFLOW = libc::EOVERFLOW,
1532 EBADEXEC = libc::EBADEXEC,
1533 EBADARCH = libc::EBADARCH,
1534 ESHLIBVERS = libc::ESHLIBVERS,
1535 EBADMACHO = libc::EBADMACHO,
1536 ECANCELED = libc::ECANCELED,
1537 EIDRM = libc::EIDRM,
1538 ENOMSG = libc::ENOMSG,
1539 EILSEQ = libc::EILSEQ,
1540 ENOATTR = libc::ENOATTR,
1541 EBADMSG = libc::EBADMSG,
1542 EMULTIHOP = libc::EMULTIHOP,
1543 ENODATA = libc::ENODATA,
1544 ENOLINK = libc::ENOLINK,
1545 ENOSR = libc::ENOSR,
1546 ENOSTR = libc::ENOSTR,
1547 EPROTO = libc::EPROTO,
1548 ETIME = libc::ETIME,
1549 EOPNOTSUPP = libc::EOPNOTSUPP,
1550 ENOPOLICY = libc::ENOPOLICY,
1551 ENOTRECOVERABLE = libc::ENOTRECOVERABLE,
1552 EOWNERDEAD = libc::EOWNERDEAD,
1553 EQFULL = libc::EQFULL,
1554 }
1555
1556 impl Errno {
1557 pub const ELAST: Errno = Errno::EQFULL;
1558 pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
1559 pub const EDEADLOCK: Errno = Errno::EDEADLK;
1560 }
1561
1562 pub const fn from_i32(e: i32) -> Errno {
1563 use self::Errno::*;
1564
1565 match e {
1566 libc::EPERM => EPERM,
1567 libc::ENOENT => ENOENT,
1568 libc::ESRCH => ESRCH,
1569 libc::EINTR => EINTR,
1570 libc::EIO => EIO,
1571 libc::ENXIO => ENXIO,
1572 libc::E2BIG => E2BIG,
1573 libc::ENOEXEC => ENOEXEC,
1574 libc::EBADF => EBADF,
1575 libc::ECHILD => ECHILD,
1576 libc::EDEADLK => EDEADLK,
1577 libc::ENOMEM => ENOMEM,
1578 libc::EACCES => EACCES,
1579 libc::EFAULT => EFAULT,
1580 libc::ENOTBLK => ENOTBLK,
1581 libc::EBUSY => EBUSY,
1582 libc::EEXIST => EEXIST,
1583 libc::EXDEV => EXDEV,
1584 libc::ENODEV => ENODEV,
1585 libc::ENOTDIR => ENOTDIR,
1586 libc::EISDIR => EISDIR,
1587 libc::EINVAL => EINVAL,
1588 libc::ENFILE => ENFILE,
1589 libc::EMFILE => EMFILE,
1590 libc::ENOTTY => ENOTTY,
1591 libc::ETXTBSY => ETXTBSY,
1592 libc::EFBIG => EFBIG,
1593 libc::ENOSPC => ENOSPC,
1594 libc::ESPIPE => ESPIPE,
1595 libc::EROFS => EROFS,
1596 libc::EMLINK => EMLINK,
1597 libc::EPIPE => EPIPE,
1598 libc::EDOM => EDOM,
1599 libc::ERANGE => ERANGE,
1600 libc::EAGAIN => EAGAIN,
1601 libc::EINPROGRESS => EINPROGRESS,
1602 libc::EALREADY => EALREADY,
1603 libc::ENOTSOCK => ENOTSOCK,
1604 libc::EDESTADDRREQ => EDESTADDRREQ,
1605 libc::EMSGSIZE => EMSGSIZE,
1606 libc::EPROTOTYPE => EPROTOTYPE,
1607 libc::ENOPROTOOPT => ENOPROTOOPT,
1608 libc::EPROTONOSUPPORT => EPROTONOSUPPORT,
1609 libc::ESOCKTNOSUPPORT => ESOCKTNOSUPPORT,
1610 libc::ENOTSUP => ENOTSUP,
1611 libc::EPFNOSUPPORT => EPFNOSUPPORT,
1612 libc::EAFNOSUPPORT => EAFNOSUPPORT,
1613 libc::EADDRINUSE => EADDRINUSE,
1614 libc::EADDRNOTAVAIL => EADDRNOTAVAIL,
1615 libc::ENETDOWN => ENETDOWN,
1616 libc::ENETUNREACH => ENETUNREACH,
1617 libc::ENETRESET => ENETRESET,
1618 libc::ECONNABORTED => ECONNABORTED,
1619 libc::ECONNRESET => ECONNRESET,
1620 libc::ENOBUFS => ENOBUFS,
1621 libc::EISCONN => EISCONN,
1622 libc::ENOTCONN => ENOTCONN,
1623 libc::ESHUTDOWN => ESHUTDOWN,
1624 libc::ETOOMANYREFS => ETOOMANYREFS,
1625 libc::ETIMEDOUT => ETIMEDOUT,
1626 libc::ECONNREFUSED => ECONNREFUSED,
1627 libc::ELOOP => ELOOP,
1628 libc::ENAMETOOLONG => ENAMETOOLONG,
1629 libc::EHOSTDOWN => EHOSTDOWN,
1630 libc::EHOSTUNREACH => EHOSTUNREACH,
1631 libc::ENOTEMPTY => ENOTEMPTY,
1632 libc::EPROCLIM => EPROCLIM,
1633 libc::EUSERS => EUSERS,
1634 libc::EDQUOT => EDQUOT,
1635 libc::ESTALE => ESTALE,
1636 libc::EREMOTE => EREMOTE,
1637 libc::EBADRPC => EBADRPC,
1638 libc::ERPCMISMATCH => ERPCMISMATCH,
1639 libc::EPROGUNAVAIL => EPROGUNAVAIL,
1640 libc::EPROGMISMATCH => EPROGMISMATCH,
1641 libc::EPROCUNAVAIL => EPROCUNAVAIL,
1642 libc::ENOLCK => ENOLCK,
1643 libc::ENOSYS => ENOSYS,
1644 libc::EFTYPE => EFTYPE,
1645 libc::EAUTH => EAUTH,
1646 libc::ENEEDAUTH => ENEEDAUTH,
1647 libc::EPWROFF => EPWROFF,
1648 libc::EDEVERR => EDEVERR,
1649 libc::EOVERFLOW => EOVERFLOW,
1650 libc::EBADEXEC => EBADEXEC,
1651 libc::EBADARCH => EBADARCH,
1652 libc::ESHLIBVERS => ESHLIBVERS,
1653 libc::EBADMACHO => EBADMACHO,
1654 libc::ECANCELED => ECANCELED,
1655 libc::EIDRM => EIDRM,
1656 libc::ENOMSG => ENOMSG,
1657 libc::EILSEQ => EILSEQ,
1658 libc::ENOATTR => ENOATTR,
1659 libc::EBADMSG => EBADMSG,
1660 libc::EMULTIHOP => EMULTIHOP,
1661 libc::ENODATA => ENODATA,
1662 libc::ENOLINK => ENOLINK,
1663 libc::ENOSR => ENOSR,
1664 libc::ENOSTR => ENOSTR,
1665 libc::EPROTO => EPROTO,
1666 libc::ETIME => ETIME,
1667 libc::EOPNOTSUPP => EOPNOTSUPP,
1668 libc::ENOPOLICY => ENOPOLICY,
1669 libc::ENOTRECOVERABLE => ENOTRECOVERABLE,
1670 libc::EOWNERDEAD => EOWNERDEAD,
1671 libc::EQFULL => EQFULL,
1672 _ => UnknownErrno,
1673 }
1674 }
1675}
1676
1677#[cfg(target_os = "freebsd")]
1678mod consts {
1679 #[derive(Clone, Copy, Debug, Eq, PartialEq)]
1680 #[repr(i32)]
1681 #[non_exhaustive]
1682 pub enum Errno {
1683 UnknownErrno = 0,
1684 EPERM = libc::EPERM,
1685 ENOENT = libc::ENOENT,
1686 ESRCH = libc::ESRCH,
1687 EINTR = libc::EINTR,
1688 EIO = libc::EIO,
1689 ENXIO = libc::ENXIO,
1690 E2BIG = libc::E2BIG,
1691 ENOEXEC = libc::ENOEXEC,
1692 EBADF = libc::EBADF,
1693 ECHILD = libc::ECHILD,
1694 EDEADLK = libc::EDEADLK,
1695 ENOMEM = libc::ENOMEM,
1696 EACCES = libc::EACCES,
1697 EFAULT = libc::EFAULT,
1698 ENOTBLK = libc::ENOTBLK,
1699 EBUSY = libc::EBUSY,
1700 EEXIST = libc::EEXIST,
1701 EXDEV = libc::EXDEV,
1702 ENODEV = libc::ENODEV,
1703 ENOTDIR = libc::ENOTDIR,
1704 EISDIR = libc::EISDIR,
1705 EINVAL = libc::EINVAL,
1706 ENFILE = libc::ENFILE,
1707 EMFILE = libc::EMFILE,
1708 ENOTTY = libc::ENOTTY,
1709 ETXTBSY = libc::ETXTBSY,
1710 EFBIG = libc::EFBIG,
1711 ENOSPC = libc::ENOSPC,
1712 ESPIPE = libc::ESPIPE,
1713 EROFS = libc::EROFS,
1714 EMLINK = libc::EMLINK,
1715 EPIPE = libc::EPIPE,
1716 EDOM = libc::EDOM,
1717 ERANGE = libc::ERANGE,
1718 EAGAIN = libc::EAGAIN,
1719 EINPROGRESS = libc::EINPROGRESS,
1720 EALREADY = libc::EALREADY,
1721 ENOTSOCK = libc::ENOTSOCK,
1722 EDESTADDRREQ = libc::EDESTADDRREQ,
1723 EMSGSIZE = libc::EMSGSIZE,
1724 EPROTOTYPE = libc::EPROTOTYPE,
1725 ENOPROTOOPT = libc::ENOPROTOOPT,
1726 EPROTONOSUPPORT = libc::EPROTONOSUPPORT,
1727 ESOCKTNOSUPPORT = libc::ESOCKTNOSUPPORT,
1728 ENOTSUP = libc::ENOTSUP,
1729 EPFNOSUPPORT = libc::EPFNOSUPPORT,
1730 EAFNOSUPPORT = libc::EAFNOSUPPORT,
1731 EADDRINUSE = libc::EADDRINUSE,
1732 EADDRNOTAVAIL = libc::EADDRNOTAVAIL,
1733 ENETDOWN = libc::ENETDOWN,
1734 ENETUNREACH = libc::ENETUNREACH,
1735 ENETRESET = libc::ENETRESET,
1736 ECONNABORTED = libc::ECONNABORTED,
1737 ECONNRESET = libc::ECONNRESET,
1738 ENOBUFS = libc::ENOBUFS,
1739 EISCONN = libc::EISCONN,
1740 ENOTCONN = libc::ENOTCONN,
1741 ESHUTDOWN = libc::ESHUTDOWN,
1742 ETOOMANYREFS = libc::ETOOMANYREFS,
1743 ETIMEDOUT = libc::ETIMEDOUT,
1744 ECONNREFUSED = libc::ECONNREFUSED,
1745 ELOOP = libc::ELOOP,
1746 ENAMETOOLONG = libc::ENAMETOOLONG,
1747 EHOSTDOWN = libc::EHOSTDOWN,
1748 EHOSTUNREACH = libc::EHOSTUNREACH,
1749 ENOTEMPTY = libc::ENOTEMPTY,
1750 EPROCLIM = libc::EPROCLIM,
1751 EUSERS = libc::EUSERS,
1752 EDQUOT = libc::EDQUOT,
1753 ESTALE = libc::ESTALE,
1754 EREMOTE = libc::EREMOTE,
1755 EBADRPC = libc::EBADRPC,
1756 ERPCMISMATCH = libc::ERPCMISMATCH,
1757 EPROGUNAVAIL = libc::EPROGUNAVAIL,
1758 EPROGMISMATCH = libc::EPROGMISMATCH,
1759 EPROCUNAVAIL = libc::EPROCUNAVAIL,
1760 ENOLCK = libc::ENOLCK,
1761 ENOSYS = libc::ENOSYS,
1762 EFTYPE = libc::EFTYPE,
1763 EAUTH = libc::EAUTH,
1764 ENEEDAUTH = libc::ENEEDAUTH,
1765 EIDRM = libc::EIDRM,
1766 ENOMSG = libc::ENOMSG,
1767 EOVERFLOW = libc::EOVERFLOW,
1768 ECANCELED = libc::ECANCELED,
1769 EILSEQ = libc::EILSEQ,
1770 ENOATTR = libc::ENOATTR,
1771 EDOOFUS = libc::EDOOFUS,
1772 EBADMSG = libc::EBADMSG,
1773 EMULTIHOP = libc::EMULTIHOP,
1774 ENOLINK = libc::ENOLINK,
1775 EPROTO = libc::EPROTO,
1776 ENOTCAPABLE = libc::ENOTCAPABLE,
1777 ECAPMODE = libc::ECAPMODE,
1778 ENOTRECOVERABLE = libc::ENOTRECOVERABLE,
1779 EOWNERDEAD = libc::EOWNERDEAD,
1780 }
1781
1782 impl Errno {
1783 pub const ELAST: Errno = Errno::EOWNERDEAD;
1784 pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
1785 pub const EDEADLOCK: Errno = Errno::EDEADLK;
1786 pub const EOPNOTSUPP: Errno = Errno::ENOTSUP;
1787 }
1788
1789 pub const fn from_i32(e: i32) -> Errno {
1790 use self::Errno::*;
1791
1792 match e {
1793 libc::EPERM => EPERM,
1794 libc::ENOENT => ENOENT,
1795 libc::ESRCH => ESRCH,
1796 libc::EINTR => EINTR,
1797 libc::EIO => EIO,
1798 libc::ENXIO => ENXIO,
1799 libc::E2BIG => E2BIG,
1800 libc::ENOEXEC => ENOEXEC,
1801 libc::EBADF => EBADF,
1802 libc::ECHILD => ECHILD,
1803 libc::EDEADLK => EDEADLK,
1804 libc::ENOMEM => ENOMEM,
1805 libc::EACCES => EACCES,
1806 libc::EFAULT => EFAULT,
1807 libc::ENOTBLK => ENOTBLK,
1808 libc::EBUSY => EBUSY,
1809 libc::EEXIST => EEXIST,
1810 libc::EXDEV => EXDEV,
1811 libc::ENODEV => ENODEV,
1812 libc::ENOTDIR => ENOTDIR,
1813 libc::EISDIR => EISDIR,
1814 libc::EINVAL => EINVAL,
1815 libc::ENFILE => ENFILE,
1816 libc::EMFILE => EMFILE,
1817 libc::ENOTTY => ENOTTY,
1818 libc::ETXTBSY => ETXTBSY,
1819 libc::EFBIG => EFBIG,
1820 libc::ENOSPC => ENOSPC,
1821 libc::ESPIPE => ESPIPE,
1822 libc::EROFS => EROFS,
1823 libc::EMLINK => EMLINK,
1824 libc::EPIPE => EPIPE,
1825 libc::EDOM => EDOM,
1826 libc::ERANGE => ERANGE,
1827 libc::EAGAIN => EAGAIN,
1828 libc::EINPROGRESS => EINPROGRESS,
1829 libc::EALREADY => EALREADY,
1830 libc::ENOTSOCK => ENOTSOCK,
1831 libc::EDESTADDRREQ => EDESTADDRREQ,
1832 libc::EMSGSIZE => EMSGSIZE,
1833 libc::EPROTOTYPE => EPROTOTYPE,
1834 libc::ENOPROTOOPT => ENOPROTOOPT,
1835 libc::EPROTONOSUPPORT => EPROTONOSUPPORT,
1836 libc::ESOCKTNOSUPPORT => ESOCKTNOSUPPORT,
1837 libc::ENOTSUP => ENOTSUP,
1838 libc::EPFNOSUPPORT => EPFNOSUPPORT,
1839 libc::EAFNOSUPPORT => EAFNOSUPPORT,
1840 libc::EADDRINUSE => EADDRINUSE,
1841 libc::EADDRNOTAVAIL => EADDRNOTAVAIL,
1842 libc::ENETDOWN => ENETDOWN,
1843 libc::ENETUNREACH => ENETUNREACH,
1844 libc::ENETRESET => ENETRESET,
1845 libc::ECONNABORTED => ECONNABORTED,
1846 libc::ECONNRESET => ECONNRESET,
1847 libc::ENOBUFS => ENOBUFS,
1848 libc::EISCONN => EISCONN,
1849 libc::ENOTCONN => ENOTCONN,
1850 libc::ESHUTDOWN => ESHUTDOWN,
1851 libc::ETOOMANYREFS => ETOOMANYREFS,
1852 libc::ETIMEDOUT => ETIMEDOUT,
1853 libc::ECONNREFUSED => ECONNREFUSED,
1854 libc::ELOOP => ELOOP,
1855 libc::ENAMETOOLONG => ENAMETOOLONG,
1856 libc::EHOSTDOWN => EHOSTDOWN,
1857 libc::EHOSTUNREACH => EHOSTUNREACH,
1858 libc::ENOTEMPTY => ENOTEMPTY,
1859 libc::EPROCLIM => EPROCLIM,
1860 libc::EUSERS => EUSERS,
1861 libc::EDQUOT => EDQUOT,
1862 libc::ESTALE => ESTALE,
1863 libc::EREMOTE => EREMOTE,
1864 libc::EBADRPC => EBADRPC,
1865 libc::ERPCMISMATCH => ERPCMISMATCH,
1866 libc::EPROGUNAVAIL => EPROGUNAVAIL,
1867 libc::EPROGMISMATCH => EPROGMISMATCH,
1868 libc::EPROCUNAVAIL => EPROCUNAVAIL,
1869 libc::ENOLCK => ENOLCK,
1870 libc::ENOSYS => ENOSYS,
1871 libc::EFTYPE => EFTYPE,
1872 libc::EAUTH => EAUTH,
1873 libc::ENEEDAUTH => ENEEDAUTH,
1874 libc::EIDRM => EIDRM,
1875 libc::ENOMSG => ENOMSG,
1876 libc::EOVERFLOW => EOVERFLOW,
1877 libc::ECANCELED => ECANCELED,
1878 libc::EILSEQ => EILSEQ,
1879 libc::ENOATTR => ENOATTR,
1880 libc::EDOOFUS => EDOOFUS,
1881 libc::EBADMSG => EBADMSG,
1882 libc::EMULTIHOP => EMULTIHOP,
1883 libc::ENOLINK => ENOLINK,
1884 libc::EPROTO => EPROTO,
1885 libc::ENOTCAPABLE => ENOTCAPABLE,
1886 libc::ECAPMODE => ECAPMODE,
1887 libc::ENOTRECOVERABLE => ENOTRECOVERABLE,
1888 libc::EOWNERDEAD => EOWNERDEAD,
1889 _ => UnknownErrno,
1890 }
1891 }
1892}
1893
1894#[cfg(target_os = "dragonfly")]
1895mod consts {
1896 #[derive(Clone, Copy, Debug, Eq, PartialEq)]
1897 #[repr(i32)]
1898 #[non_exhaustive]
1899 pub enum Errno {
1900 UnknownErrno = 0,
1901 EPERM = libc::EPERM,
1902 ENOENT = libc::ENOENT,
1903 ESRCH = libc::ESRCH,
1904 EINTR = libc::EINTR,
1905 EIO = libc::EIO,
1906 ENXIO = libc::ENXIO,
1907 E2BIG = libc::E2BIG,
1908 ENOEXEC = libc::ENOEXEC,
1909 EBADF = libc::EBADF,
1910 ECHILD = libc::ECHILD,
1911 EDEADLK = libc::EDEADLK,
1912 ENOMEM = libc::ENOMEM,
1913 EACCES = libc::EACCES,
1914 EFAULT = libc::EFAULT,
1915 ENOTBLK = libc::ENOTBLK,
1916 EBUSY = libc::EBUSY,
1917 EEXIST = libc::EEXIST,
1918 EXDEV = libc::EXDEV,
1919 ENODEV = libc::ENODEV,
1920 ENOTDIR = libc::ENOTDIR,
1921 EISDIR = libc::EISDIR,
1922 EINVAL = libc::EINVAL,
1923 ENFILE = libc::ENFILE,
1924 EMFILE = libc::EMFILE,
1925 ENOTTY = libc::ENOTTY,
1926 ETXTBSY = libc::ETXTBSY,
1927 EFBIG = libc::EFBIG,
1928 ENOSPC = libc::ENOSPC,
1929 ESPIPE = libc::ESPIPE,
1930 EROFS = libc::EROFS,
1931 EMLINK = libc::EMLINK,
1932 EPIPE = libc::EPIPE,
1933 EDOM = libc::EDOM,
1934 ERANGE = libc::ERANGE,
1935 EAGAIN = libc::EAGAIN,
1936 EINPROGRESS = libc::EINPROGRESS,
1937 EALREADY = libc::EALREADY,
1938 ENOTSOCK = libc::ENOTSOCK,
1939 EDESTADDRREQ = libc::EDESTADDRREQ,
1940 EMSGSIZE = libc::EMSGSIZE,
1941 EPROTOTYPE = libc::EPROTOTYPE,
1942 ENOPROTOOPT = libc::ENOPROTOOPT,
1943 EPROTONOSUPPORT = libc::EPROTONOSUPPORT,
1944 ESOCKTNOSUPPORT = libc::ESOCKTNOSUPPORT,
1945 ENOTSUP = libc::ENOTSUP,
1946 EPFNOSUPPORT = libc::EPFNOSUPPORT,
1947 EAFNOSUPPORT = libc::EAFNOSUPPORT,
1948 EADDRINUSE = libc::EADDRINUSE,
1949 EADDRNOTAVAIL = libc::EADDRNOTAVAIL,
1950 ENETDOWN = libc::ENETDOWN,
1951 ENETUNREACH = libc::ENETUNREACH,
1952 ENETRESET = libc::ENETRESET,
1953 ECONNABORTED = libc::ECONNABORTED,
1954 ECONNRESET = libc::ECONNRESET,
1955 ENOBUFS = libc::ENOBUFS,
1956 EISCONN = libc::EISCONN,
1957 ENOTCONN = libc::ENOTCONN,
1958 ESHUTDOWN = libc::ESHUTDOWN,
1959 ETOOMANYREFS = libc::ETOOMANYREFS,
1960 ETIMEDOUT = libc::ETIMEDOUT,
1961 ECONNREFUSED = libc::ECONNREFUSED,
1962 ELOOP = libc::ELOOP,
1963 ENAMETOOLONG = libc::ENAMETOOLONG,
1964 EHOSTDOWN = libc::EHOSTDOWN,
1965 EHOSTUNREACH = libc::EHOSTUNREACH,
1966 ENOTEMPTY = libc::ENOTEMPTY,
1967 EPROCLIM = libc::EPROCLIM,
1968 EUSERS = libc::EUSERS,
1969 EDQUOT = libc::EDQUOT,
1970 ESTALE = libc::ESTALE,
1971 EREMOTE = libc::EREMOTE,
1972 EBADRPC = libc::EBADRPC,
1973 ERPCMISMATCH = libc::ERPCMISMATCH,
1974 EPROGUNAVAIL = libc::EPROGUNAVAIL,
1975 EPROGMISMATCH = libc::EPROGMISMATCH,
1976 EPROCUNAVAIL = libc::EPROCUNAVAIL,
1977 ENOLCK = libc::ENOLCK,
1978 ENOSYS = libc::ENOSYS,
1979 EFTYPE = libc::EFTYPE,
1980 EAUTH = libc::EAUTH,
1981 ENEEDAUTH = libc::ENEEDAUTH,
1982 EIDRM = libc::EIDRM,
1983 ENOMSG = libc::ENOMSG,
1984 EOVERFLOW = libc::EOVERFLOW,
1985 ECANCELED = libc::ECANCELED,
1986 EILSEQ = libc::EILSEQ,
1987 ENOATTR = libc::ENOATTR,
1988 EDOOFUS = libc::EDOOFUS,
1989 EBADMSG = libc::EBADMSG,
1990 EMULTIHOP = libc::EMULTIHOP,
1991 ENOLINK = libc::ENOLINK,
1992 EPROTO = libc::EPROTO,
1993 ENOMEDIUM = libc::ENOMEDIUM,
1994 ENOTRECOVERABLE = libc::ENOTRECOVERABLE,
1995 EOWNERDEAD = libc::EOWNERDEAD,
1996 EASYNC = libc::EASYNC,
1997 }
1998
1999 impl Errno {
2000 pub const ELAST: Errno = Errno::EASYNC;
2001 pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
2002 pub const EDEADLOCK: Errno = Errno::EDEADLK;
2003 pub const EOPNOTSUPP: Errno = Errno::ENOTSUP;
2004 }
2005
2006 pub const fn from_i32(e: i32) -> Errno {
2007 use self::Errno::*;
2008
2009 match e {
2010 libc::EPERM => EPERM,
2011 libc::ENOENT => ENOENT,
2012 libc::ESRCH => ESRCH,
2013 libc::EINTR => EINTR,
2014 libc::EIO => EIO,
2015 libc::ENXIO => ENXIO,
2016 libc::E2BIG => E2BIG,
2017 libc::ENOEXEC => ENOEXEC,
2018 libc::EBADF => EBADF,
2019 libc::ECHILD => ECHILD,
2020 libc::EDEADLK => EDEADLK,
2021 libc::ENOMEM => ENOMEM,
2022 libc::EACCES => EACCES,
2023 libc::EFAULT => EFAULT,
2024 libc::ENOTBLK => ENOTBLK,
2025 libc::EBUSY => EBUSY,
2026 libc::EEXIST => EEXIST,
2027 libc::EXDEV => EXDEV,
2028 libc::ENODEV => ENODEV,
2029 libc::ENOTDIR => ENOTDIR,
2030 libc::EISDIR => EISDIR,
2031 libc::EINVAL => EINVAL,
2032 libc::ENFILE => ENFILE,
2033 libc::EMFILE => EMFILE,
2034 libc::ENOTTY => ENOTTY,
2035 libc::ETXTBSY => ETXTBSY,
2036 libc::EFBIG => EFBIG,
2037 libc::ENOSPC => ENOSPC,
2038 libc::ESPIPE => ESPIPE,
2039 libc::EROFS => EROFS,
2040 libc::EMLINK => EMLINK,
2041 libc::EPIPE => EPIPE,
2042 libc::EDOM => EDOM,
2043 libc::ERANGE => ERANGE,
2044 libc::EAGAIN => EAGAIN,
2045 libc::EINPROGRESS => EINPROGRESS,
2046 libc::EALREADY => EALREADY,
2047 libc::ENOTSOCK => ENOTSOCK,
2048 libc::EDESTADDRREQ => EDESTADDRREQ,
2049 libc::EMSGSIZE => EMSGSIZE,
2050 libc::EPROTOTYPE => EPROTOTYPE,
2051 libc::ENOPROTOOPT => ENOPROTOOPT,
2052 libc::EPROTONOSUPPORT => EPROTONOSUPPORT,
2053 libc::ESOCKTNOSUPPORT => ESOCKTNOSUPPORT,
2054 libc::ENOTSUP => ENOTSUP,
2055 libc::EPFNOSUPPORT => EPFNOSUPPORT,
2056 libc::EAFNOSUPPORT => EAFNOSUPPORT,
2057 libc::EADDRINUSE => EADDRINUSE,
2058 libc::EADDRNOTAVAIL => EADDRNOTAVAIL,
2059 libc::ENETDOWN => ENETDOWN,
2060 libc::ENETUNREACH => ENETUNREACH,
2061 libc::ENETRESET => ENETRESET,
2062 libc::ECONNABORTED => ECONNABORTED,
2063 libc::ECONNRESET => ECONNRESET,
2064 libc::ENOBUFS => ENOBUFS,
2065 libc::EISCONN => EISCONN,
2066 libc::ENOTCONN => ENOTCONN,
2067 libc::ESHUTDOWN => ESHUTDOWN,
2068 libc::ETOOMANYREFS => ETOOMANYREFS,
2069 libc::ETIMEDOUT => ETIMEDOUT,
2070 libc::ECONNREFUSED => ECONNREFUSED,
2071 libc::ELOOP => ELOOP,
2072 libc::ENAMETOOLONG => ENAMETOOLONG,
2073 libc::EHOSTDOWN => EHOSTDOWN,
2074 libc::EHOSTUNREACH => EHOSTUNREACH,
2075 libc::ENOTEMPTY => ENOTEMPTY,
2076 libc::EPROCLIM => EPROCLIM,
2077 libc::EUSERS => EUSERS,
2078 libc::EDQUOT => EDQUOT,
2079 libc::ESTALE => ESTALE,
2080 libc::EREMOTE => EREMOTE,
2081 libc::EBADRPC => EBADRPC,
2082 libc::ERPCMISMATCH => ERPCMISMATCH,
2083 libc::EPROGUNAVAIL => EPROGUNAVAIL,
2084 libc::EPROGMISMATCH => EPROGMISMATCH,
2085 libc::EPROCUNAVAIL => EPROCUNAVAIL,
2086 libc::ENOLCK => ENOLCK,
2087 libc::ENOSYS => ENOSYS,
2088 libc::EFTYPE => EFTYPE,
2089 libc::EAUTH => EAUTH,
2090 libc::ENEEDAUTH => ENEEDAUTH,
2091 libc::EIDRM => EIDRM,
2092 libc::ENOMSG => ENOMSG,
2093 libc::EOVERFLOW => EOVERFLOW,
2094 libc::ECANCELED => ECANCELED,
2095 libc::EILSEQ => EILSEQ,
2096 libc::ENOATTR => ENOATTR,
2097 libc::EDOOFUS => EDOOFUS,
2098 libc::EBADMSG => EBADMSG,
2099 libc::EMULTIHOP => EMULTIHOP,
2100 libc::ENOLINK => ENOLINK,
2101 libc::EPROTO => EPROTO,
2102 libc::ENOMEDIUM => ENOMEDIUM,
2103 libc::EASYNC => EASYNC,
2104 _ => UnknownErrno,
2105 }
2106 }
2107}
2108
2109#[cfg(target_os = "openbsd")]
2110mod consts {
2111 #[derive(Clone, Copy, Debug, Eq, PartialEq)]
2112 #[repr(i32)]
2113 #[non_exhaustive]
2114 pub enum Errno {
2115 UnknownErrno = 0,
2116 EPERM = libc::EPERM,
2117 ENOENT = libc::ENOENT,
2118 ESRCH = libc::ESRCH,
2119 EINTR = libc::EINTR,
2120 EIO = libc::EIO,
2121 ENXIO = libc::ENXIO,
2122 E2BIG = libc::E2BIG,
2123 ENOEXEC = libc::ENOEXEC,
2124 EBADF = libc::EBADF,
2125 ECHILD = libc::ECHILD,
2126 EDEADLK = libc::EDEADLK,
2127 ENOMEM = libc::ENOMEM,
2128 EACCES = libc::EACCES,
2129 EFAULT = libc::EFAULT,
2130 ENOTBLK = libc::ENOTBLK,
2131 EBUSY = libc::EBUSY,
2132 EEXIST = libc::EEXIST,
2133 EXDEV = libc::EXDEV,
2134 ENODEV = libc::ENODEV,
2135 ENOTDIR = libc::ENOTDIR,
2136 EISDIR = libc::EISDIR,
2137 EINVAL = libc::EINVAL,
2138 ENFILE = libc::ENFILE,
2139 EMFILE = libc::EMFILE,
2140 ENOTTY = libc::ENOTTY,
2141 ETXTBSY = libc::ETXTBSY,
2142 EFBIG = libc::EFBIG,
2143 ENOSPC = libc::ENOSPC,
2144 ESPIPE = libc::ESPIPE,
2145 EROFS = libc::EROFS,
2146 EMLINK = libc::EMLINK,
2147 EPIPE = libc::EPIPE,
2148 EDOM = libc::EDOM,
2149 ERANGE = libc::ERANGE,
2150 EAGAIN = libc::EAGAIN,
2151 EINPROGRESS = libc::EINPROGRESS,
2152 EALREADY = libc::EALREADY,
2153 ENOTSOCK = libc::ENOTSOCK,
2154 EDESTADDRREQ = libc::EDESTADDRREQ,
2155 EMSGSIZE = libc::EMSGSIZE,
2156 EPROTOTYPE = libc::EPROTOTYPE,
2157 ENOPROTOOPT = libc::ENOPROTOOPT,
2158 EPROTONOSUPPORT = libc::EPROTONOSUPPORT,
2159 ESOCKTNOSUPPORT = libc::ESOCKTNOSUPPORT,
2160 EOPNOTSUPP = libc::EOPNOTSUPP,
2161 EPFNOSUPPORT = libc::EPFNOSUPPORT,
2162 EAFNOSUPPORT = libc::EAFNOSUPPORT,
2163 EADDRINUSE = libc::EADDRINUSE,
2164 EADDRNOTAVAIL = libc::EADDRNOTAVAIL,
2165 ENETDOWN = libc::ENETDOWN,
2166 ENETUNREACH = libc::ENETUNREACH,
2167 ENETRESET = libc::ENETRESET,
2168 ECONNABORTED = libc::ECONNABORTED,
2169 ECONNRESET = libc::ECONNRESET,
2170 ENOBUFS = libc::ENOBUFS,
2171 EISCONN = libc::EISCONN,
2172 ENOTCONN = libc::ENOTCONN,
2173 ESHUTDOWN = libc::ESHUTDOWN,
2174 ETOOMANYREFS = libc::ETOOMANYREFS,
2175 ETIMEDOUT = libc::ETIMEDOUT,
2176 ECONNREFUSED = libc::ECONNREFUSED,
2177 ELOOP = libc::ELOOP,
2178 ENAMETOOLONG = libc::ENAMETOOLONG,
2179 EHOSTDOWN = libc::EHOSTDOWN,
2180 EHOSTUNREACH = libc::EHOSTUNREACH,
2181 ENOTEMPTY = libc::ENOTEMPTY,
2182 EPROCLIM = libc::EPROCLIM,
2183 EUSERS = libc::EUSERS,
2184 EDQUOT = libc::EDQUOT,
2185 ESTALE = libc::ESTALE,
2186 EREMOTE = libc::EREMOTE,
2187 EBADRPC = libc::EBADRPC,
2188 ERPCMISMATCH = libc::ERPCMISMATCH,
2189 EPROGUNAVAIL = libc::EPROGUNAVAIL,
2190 EPROGMISMATCH = libc::EPROGMISMATCH,
2191 EPROCUNAVAIL = libc::EPROCUNAVAIL,
2192 ENOLCK = libc::ENOLCK,
2193 ENOSYS = libc::ENOSYS,
2194 EFTYPE = libc::EFTYPE,
2195 EAUTH = libc::EAUTH,
2196 ENEEDAUTH = libc::ENEEDAUTH,
2197 EIPSEC = libc::EIPSEC,
2198 ENOATTR = libc::ENOATTR,
2199 EILSEQ = libc::EILSEQ,
2200 ENOMEDIUM = libc::ENOMEDIUM,
2201 EMEDIUMTYPE = libc::EMEDIUMTYPE,
2202 EOVERFLOW = libc::EOVERFLOW,
2203 ECANCELED = libc::ECANCELED,
2204 EIDRM = libc::EIDRM,
2205 ENOMSG = libc::ENOMSG,
2206 ENOTSUP = libc::ENOTSUP,
2207 EBADMSG = libc::EBADMSG,
2208 ENOTRECOVERABLE = libc::ENOTRECOVERABLE,
2209 EOWNERDEAD = libc::EOWNERDEAD,
2210 EPROTO = libc::EPROTO,
2211 }
2212
2213 impl Errno {
2214 pub const ELAST: Errno = Errno::ENOTSUP;
2215 pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
2216 }
2217
2218 pub const fn from_i32(e: i32) -> Errno {
2219 use self::Errno::*;
2220
2221 match e {
2222 libc::EPERM => EPERM,
2223 libc::ENOENT => ENOENT,
2224 libc::ESRCH => ESRCH,
2225 libc::EINTR => EINTR,
2226 libc::EIO => EIO,
2227 libc::ENXIO => ENXIO,
2228 libc::E2BIG => E2BIG,
2229 libc::ENOEXEC => ENOEXEC,
2230 libc::EBADF => EBADF,
2231 libc::ECHILD => ECHILD,
2232 libc::EDEADLK => EDEADLK,
2233 libc::ENOMEM => ENOMEM,
2234 libc::EACCES => EACCES,
2235 libc::EFAULT => EFAULT,
2236 libc::ENOTBLK => ENOTBLK,
2237 libc::EBUSY => EBUSY,
2238 libc::EEXIST => EEXIST,
2239 libc::EXDEV => EXDEV,
2240 libc::ENODEV => ENODEV,
2241 libc::ENOTDIR => ENOTDIR,
2242 libc::EISDIR => EISDIR,
2243 libc::EINVAL => EINVAL,
2244 libc::ENFILE => ENFILE,
2245 libc::EMFILE => EMFILE,
2246 libc::ENOTTY => ENOTTY,
2247 libc::ETXTBSY => ETXTBSY,
2248 libc::EFBIG => EFBIG,
2249 libc::ENOSPC => ENOSPC,
2250 libc::ESPIPE => ESPIPE,
2251 libc::EROFS => EROFS,
2252 libc::EMLINK => EMLINK,
2253 libc::EPIPE => EPIPE,
2254 libc::EDOM => EDOM,
2255 libc::ERANGE => ERANGE,
2256 libc::EAGAIN => EAGAIN,
2257 libc::EINPROGRESS => EINPROGRESS,
2258 libc::EALREADY => EALREADY,
2259 libc::ENOTSOCK => ENOTSOCK,
2260 libc::EDESTADDRREQ => EDESTADDRREQ,
2261 libc::EMSGSIZE => EMSGSIZE,
2262 libc::EPROTOTYPE => EPROTOTYPE,
2263 libc::ENOPROTOOPT => ENOPROTOOPT,
2264 libc::EPROTONOSUPPORT => EPROTONOSUPPORT,
2265 libc::ESOCKTNOSUPPORT => ESOCKTNOSUPPORT,
2266 libc::EOPNOTSUPP => EOPNOTSUPP,
2267 libc::EPFNOSUPPORT => EPFNOSUPPORT,
2268 libc::EAFNOSUPPORT => EAFNOSUPPORT,
2269 libc::EADDRINUSE => EADDRINUSE,
2270 libc::EADDRNOTAVAIL => EADDRNOTAVAIL,
2271 libc::ENETDOWN => ENETDOWN,
2272 libc::ENETUNREACH => ENETUNREACH,
2273 libc::ENETRESET => ENETRESET,
2274 libc::ECONNABORTED => ECONNABORTED,
2275 libc::ECONNRESET => ECONNRESET,
2276 libc::ENOBUFS => ENOBUFS,
2277 libc::EISCONN => EISCONN,
2278 libc::ENOTCONN => ENOTCONN,
2279 libc::ESHUTDOWN => ESHUTDOWN,
2280 libc::ETOOMANYREFS => ETOOMANYREFS,
2281 libc::ETIMEDOUT => ETIMEDOUT,
2282 libc::ECONNREFUSED => ECONNREFUSED,
2283 libc::ELOOP => ELOOP,
2284 libc::ENAMETOOLONG => ENAMETOOLONG,
2285 libc::EHOSTDOWN => EHOSTDOWN,
2286 libc::EHOSTUNREACH => EHOSTUNREACH,
2287 libc::ENOTEMPTY => ENOTEMPTY,
2288 libc::EPROCLIM => EPROCLIM,
2289 libc::EUSERS => EUSERS,
2290 libc::EDQUOT => EDQUOT,
2291 libc::ESTALE => ESTALE,
2292 libc::EREMOTE => EREMOTE,
2293 libc::EBADRPC => EBADRPC,
2294 libc::ERPCMISMATCH => ERPCMISMATCH,
2295 libc::EPROGUNAVAIL => EPROGUNAVAIL,
2296 libc::EPROGMISMATCH => EPROGMISMATCH,
2297 libc::EPROCUNAVAIL => EPROCUNAVAIL,
2298 libc::ENOLCK => ENOLCK,
2299 libc::ENOSYS => ENOSYS,
2300 libc::EFTYPE => EFTYPE,
2301 libc::EAUTH => EAUTH,
2302 libc::ENEEDAUTH => ENEEDAUTH,
2303 libc::EIPSEC => EIPSEC,
2304 libc::ENOATTR => ENOATTR,
2305 libc::EILSEQ => EILSEQ,
2306 libc::ENOMEDIUM => ENOMEDIUM,
2307 libc::EMEDIUMTYPE => EMEDIUMTYPE,
2308 libc::EOVERFLOW => EOVERFLOW,
2309 libc::ECANCELED => ECANCELED,
2310 libc::EIDRM => EIDRM,
2311 libc::ENOMSG => ENOMSG,
2312 libc::ENOTSUP => ENOTSUP,
2313 libc::EBADMSG => EBADMSG,
2314 libc::ENOTRECOVERABLE => ENOTRECOVERABLE,
2315 libc::EOWNERDEAD => EOWNERDEAD,
2316 libc::EPROTO => EPROTO,
2317 _ => UnknownErrno,
2318 }
2319 }
2320}
2321
2322#[cfg(target_os = "netbsd")]
2323mod consts {
2324 #[derive(Clone, Copy, Debug, Eq, PartialEq)]
2325 #[repr(i32)]
2326 #[non_exhaustive]
2327 pub enum Errno {
2328 UnknownErrno = 0,
2329 EPERM = libc::EPERM,
2330 ENOENT = libc::ENOENT,
2331 ESRCH = libc::ESRCH,
2332 EINTR = libc::EINTR,
2333 EIO = libc::EIO,
2334 ENXIO = libc::ENXIO,
2335 E2BIG = libc::E2BIG,
2336 ENOEXEC = libc::ENOEXEC,
2337 EBADF = libc::EBADF,
2338 ECHILD = libc::ECHILD,
2339 EDEADLK = libc::EDEADLK,
2340 ENOMEM = libc::ENOMEM,
2341 EACCES = libc::EACCES,
2342 EFAULT = libc::EFAULT,
2343 ENOTBLK = libc::ENOTBLK,
2344 EBUSY = libc::EBUSY,
2345 EEXIST = libc::EEXIST,
2346 EXDEV = libc::EXDEV,
2347 ENODEV = libc::ENODEV,
2348 ENOTDIR = libc::ENOTDIR,
2349 EISDIR = libc::EISDIR,
2350 EINVAL = libc::EINVAL,
2351 ENFILE = libc::ENFILE,
2352 EMFILE = libc::EMFILE,
2353 ENOTTY = libc::ENOTTY,
2354 ETXTBSY = libc::ETXTBSY,
2355 EFBIG = libc::EFBIG,
2356 ENOSPC = libc::ENOSPC,
2357 ESPIPE = libc::ESPIPE,
2358 EROFS = libc::EROFS,
2359 EMLINK = libc::EMLINK,
2360 EPIPE = libc::EPIPE,
2361 EDOM = libc::EDOM,
2362 ERANGE = libc::ERANGE,
2363 EAGAIN = libc::EAGAIN,
2364 EINPROGRESS = libc::EINPROGRESS,
2365 EALREADY = libc::EALREADY,
2366 ENOTSOCK = libc::ENOTSOCK,
2367 EDESTADDRREQ = libc::EDESTADDRREQ,
2368 EMSGSIZE = libc::EMSGSIZE,
2369 EPROTOTYPE = libc::EPROTOTYPE,
2370 ENOPROTOOPT = libc::ENOPROTOOPT,
2371 EPROTONOSUPPORT = libc::EPROTONOSUPPORT,
2372 ESOCKTNOSUPPORT = libc::ESOCKTNOSUPPORT,
2373 EOPNOTSUPP = libc::EOPNOTSUPP,
2374 EPFNOSUPPORT = libc::EPFNOSUPPORT,
2375 EAFNOSUPPORT = libc::EAFNOSUPPORT,
2376 EADDRINUSE = libc::EADDRINUSE,
2377 EADDRNOTAVAIL = libc::EADDRNOTAVAIL,
2378 ENETDOWN = libc::ENETDOWN,
2379 ENETUNREACH = libc::ENETUNREACH,
2380 ENETRESET = libc::ENETRESET,
2381 ECONNABORTED = libc::ECONNABORTED,
2382 ECONNRESET = libc::ECONNRESET,
2383 ENOBUFS = libc::ENOBUFS,
2384 EISCONN = libc::EISCONN,
2385 ENOTCONN = libc::ENOTCONN,
2386 ESHUTDOWN = libc::ESHUTDOWN,
2387 ETOOMANYREFS = libc::ETOOMANYREFS,
2388 ETIMEDOUT = libc::ETIMEDOUT,
2389 ECONNREFUSED = libc::ECONNREFUSED,
2390 ELOOP = libc::ELOOP,
2391 ENAMETOOLONG = libc::ENAMETOOLONG,
2392 EHOSTDOWN = libc::EHOSTDOWN,
2393 EHOSTUNREACH = libc::EHOSTUNREACH,
2394 ENOTEMPTY = libc::ENOTEMPTY,
2395 EPROCLIM = libc::EPROCLIM,
2396 EUSERS = libc::EUSERS,
2397 EDQUOT = libc::EDQUOT,
2398 ESTALE = libc::ESTALE,
2399 EREMOTE = libc::EREMOTE,
2400 EBADRPC = libc::EBADRPC,
2401 ERPCMISMATCH = libc::ERPCMISMATCH,
2402 EPROGUNAVAIL = libc::EPROGUNAVAIL,
2403 EPROGMISMATCH = libc::EPROGMISMATCH,
2404 EPROCUNAVAIL = libc::EPROCUNAVAIL,
2405 ENOLCK = libc::ENOLCK,
2406 ENOSYS = libc::ENOSYS,
2407 EFTYPE = libc::EFTYPE,
2408 EAUTH = libc::EAUTH,
2409 ENEEDAUTH = libc::ENEEDAUTH,
2410 EIDRM = libc::EIDRM,
2411 ENOMSG = libc::ENOMSG,
2412 EOVERFLOW = libc::EOVERFLOW,
2413 EILSEQ = libc::EILSEQ,
2414 ENOTSUP = libc::ENOTSUP,
2415 ECANCELED = libc::ECANCELED,
2416 EBADMSG = libc::EBADMSG,
2417 ENODATA = libc::ENODATA,
2418 ENOSR = libc::ENOSR,
2419 ENOSTR = libc::ENOSTR,
2420 ETIME = libc::ETIME,
2421 ENOATTR = libc::ENOATTR,
2422 EMULTIHOP = libc::EMULTIHOP,
2423 ENOLINK = libc::ENOLINK,
2424 EPROTO = libc::EPROTO,
2425 }
2426
2427 impl Errno {
2428 pub const ELAST: Errno = Errno::ENOTSUP;
2429 pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
2430 }
2431
2432 pub const fn from_i32(e: i32) -> Errno {
2433 use self::Errno::*;
2434
2435 match e {
2436 libc::EPERM => EPERM,
2437 libc::ENOENT => ENOENT,
2438 libc::ESRCH => ESRCH,
2439 libc::EINTR => EINTR,
2440 libc::EIO => EIO,
2441 libc::ENXIO => ENXIO,
2442 libc::E2BIG => E2BIG,
2443 libc::ENOEXEC => ENOEXEC,
2444 libc::EBADF => EBADF,
2445 libc::ECHILD => ECHILD,
2446 libc::EDEADLK => EDEADLK,
2447 libc::ENOMEM => ENOMEM,
2448 libc::EACCES => EACCES,
2449 libc::EFAULT => EFAULT,
2450 libc::ENOTBLK => ENOTBLK,
2451 libc::EBUSY => EBUSY,
2452 libc::EEXIST => EEXIST,
2453 libc::EXDEV => EXDEV,
2454 libc::ENODEV => ENODEV,
2455 libc::ENOTDIR => ENOTDIR,
2456 libc::EISDIR => EISDIR,
2457 libc::EINVAL => EINVAL,
2458 libc::ENFILE => ENFILE,
2459 libc::EMFILE => EMFILE,
2460 libc::ENOTTY => ENOTTY,
2461 libc::ETXTBSY => ETXTBSY,
2462 libc::EFBIG => EFBIG,
2463 libc::ENOSPC => ENOSPC,
2464 libc::ESPIPE => ESPIPE,
2465 libc::EROFS => EROFS,
2466 libc::EMLINK => EMLINK,
2467 libc::EPIPE => EPIPE,
2468 libc::EDOM => EDOM,
2469 libc::ERANGE => ERANGE,
2470 libc::EAGAIN => EAGAIN,
2471 libc::EINPROGRESS => EINPROGRESS,
2472 libc::EALREADY => EALREADY,
2473 libc::ENOTSOCK => ENOTSOCK,
2474 libc::EDESTADDRREQ => EDESTADDRREQ,
2475 libc::EMSGSIZE => EMSGSIZE,
2476 libc::EPROTOTYPE => EPROTOTYPE,
2477 libc::ENOPROTOOPT => ENOPROTOOPT,
2478 libc::EPROTONOSUPPORT => EPROTONOSUPPORT,
2479 libc::ESOCKTNOSUPPORT => ESOCKTNOSUPPORT,
2480 libc::EOPNOTSUPP => EOPNOTSUPP,
2481 libc::EPFNOSUPPORT => EPFNOSUPPORT,
2482 libc::EAFNOSUPPORT => EAFNOSUPPORT,
2483 libc::EADDRINUSE => EADDRINUSE,
2484 libc::EADDRNOTAVAIL => EADDRNOTAVAIL,
2485 libc::ENETDOWN => ENETDOWN,
2486 libc::ENETUNREACH => ENETUNREACH,
2487 libc::ENETRESET => ENETRESET,
2488 libc::ECONNABORTED => ECONNABORTED,
2489 libc::ECONNRESET => ECONNRESET,
2490 libc::ENOBUFS => ENOBUFS,
2491 libc::EISCONN => EISCONN,
2492 libc::ENOTCONN => ENOTCONN,
2493 libc::ESHUTDOWN => ESHUTDOWN,
2494 libc::ETOOMANYREFS => ETOOMANYREFS,
2495 libc::ETIMEDOUT => ETIMEDOUT,
2496 libc::ECONNREFUSED => ECONNREFUSED,
2497 libc::ELOOP => ELOOP,
2498 libc::ENAMETOOLONG => ENAMETOOLONG,
2499 libc::EHOSTDOWN => EHOSTDOWN,
2500 libc::EHOSTUNREACH => EHOSTUNREACH,
2501 libc::ENOTEMPTY => ENOTEMPTY,
2502 libc::EPROCLIM => EPROCLIM,
2503 libc::EUSERS => EUSERS,
2504 libc::EDQUOT => EDQUOT,
2505 libc::ESTALE => ESTALE,
2506 libc::EREMOTE => EREMOTE,
2507 libc::EBADRPC => EBADRPC,
2508 libc::ERPCMISMATCH => ERPCMISMATCH,
2509 libc::EPROGUNAVAIL => EPROGUNAVAIL,
2510 libc::EPROGMISMATCH => EPROGMISMATCH,
2511 libc::EPROCUNAVAIL => EPROCUNAVAIL,
2512 libc::ENOLCK => ENOLCK,
2513 libc::ENOSYS => ENOSYS,
2514 libc::EFTYPE => EFTYPE,
2515 libc::EAUTH => EAUTH,
2516 libc::ENEEDAUTH => ENEEDAUTH,
2517 libc::EIDRM => EIDRM,
2518 libc::ENOMSG => ENOMSG,
2519 libc::EOVERFLOW => EOVERFLOW,
2520 libc::EILSEQ => EILSEQ,
2521 libc::ENOTSUP => ENOTSUP,
2522 libc::ECANCELED => ECANCELED,
2523 libc::EBADMSG => EBADMSG,
2524 libc::ENODATA => ENODATA,
2525 libc::ENOSR => ENOSR,
2526 libc::ENOSTR => ENOSTR,
2527 libc::ETIME => ETIME,
2528 libc::ENOATTR => ENOATTR,
2529 libc::EMULTIHOP => EMULTIHOP,
2530 libc::ENOLINK => ENOLINK,
2531 libc::EPROTO => EPROTO,
2532 _ => UnknownErrno,
2533 }
2534 }
2535}
2536
2537#[cfg(target_os = "redox")]
2538mod consts {
2539 #[derive(Clone, Copy, Debug, Eq, PartialEq)]
2540 #[repr(i32)]
2541 #[non_exhaustive]
2542 pub enum Errno {
2543 UnknownErrno = 0,
2544 EPERM = libc::EPERM,
2545 ENOENT = libc::ENOENT,
2546 ESRCH = libc::ESRCH,
2547 EINTR = libc::EINTR,
2548 EIO = libc::EIO,
2549 ENXIO = libc::ENXIO,
2550 E2BIG = libc::E2BIG,
2551 ENOEXEC = libc::ENOEXEC,
2552 EBADF = libc::EBADF,
2553 ECHILD = libc::ECHILD,
2554 EDEADLK = libc::EDEADLK,
2555 ENOMEM = libc::ENOMEM,
2556 EACCES = libc::EACCES,
2557 EFAULT = libc::EFAULT,
2558 ENOTBLK = libc::ENOTBLK,
2559 EBUSY = libc::EBUSY,
2560 EEXIST = libc::EEXIST,
2561 EXDEV = libc::EXDEV,
2562 ENODEV = libc::ENODEV,
2563 ENOTDIR = libc::ENOTDIR,
2564 EISDIR = libc::EISDIR,
2565 EINVAL = libc::EINVAL,
2566 ENFILE = libc::ENFILE,
2567 EMFILE = libc::EMFILE,
2568 ENOTTY = libc::ENOTTY,
2569 ETXTBSY = libc::ETXTBSY,
2570 EFBIG = libc::EFBIG,
2571 ENOSPC = libc::ENOSPC,
2572 ESPIPE = libc::ESPIPE,
2573 EROFS = libc::EROFS,
2574 EMLINK = libc::EMLINK,
2575 EPIPE = libc::EPIPE,
2576 EDOM = libc::EDOM,
2577 ERANGE = libc::ERANGE,
2578 EAGAIN = libc::EAGAIN,
2579 EINPROGRESS = libc::EINPROGRESS,
2580 EALREADY = libc::EALREADY,
2581 ENOTSOCK = libc::ENOTSOCK,
2582 EDESTADDRREQ = libc::EDESTADDRREQ,
2583 EMSGSIZE = libc::EMSGSIZE,
2584 EPROTOTYPE = libc::EPROTOTYPE,
2585 ENOPROTOOPT = libc::ENOPROTOOPT,
2586 EPROTONOSUPPORT = libc::EPROTONOSUPPORT,
2587 ESOCKTNOSUPPORT = libc::ESOCKTNOSUPPORT,
2588 EOPNOTSUPP = libc::EOPNOTSUPP,
2589 EPFNOSUPPORT = libc::EPFNOSUPPORT,
2590 EAFNOSUPPORT = libc::EAFNOSUPPORT,
2591 EADDRINUSE = libc::EADDRINUSE,
2592 EADDRNOTAVAIL = libc::EADDRNOTAVAIL,
2593 ENETDOWN = libc::ENETDOWN,
2594 ENETUNREACH = libc::ENETUNREACH,
2595 ENETRESET = libc::ENETRESET,
2596 ECONNABORTED = libc::ECONNABORTED,
2597 ECONNRESET = libc::ECONNRESET,
2598 ENOBUFS = libc::ENOBUFS,
2599 EISCONN = libc::EISCONN,
2600 ENOTCONN = libc::ENOTCONN,
2601 ESHUTDOWN = libc::ESHUTDOWN,
2602 ETOOMANYREFS = libc::ETOOMANYREFS,
2603 ETIMEDOUT = libc::ETIMEDOUT,
2604 ECONNREFUSED = libc::ECONNREFUSED,
2605 ELOOP = libc::ELOOP,
2606 ENAMETOOLONG = libc::ENAMETOOLONG,
2607 EHOSTDOWN = libc::EHOSTDOWN,
2608 EHOSTUNREACH = libc::EHOSTUNREACH,
2609 ENOTEMPTY = libc::ENOTEMPTY,
2610 EUSERS = libc::EUSERS,
2611 EDQUOT = libc::EDQUOT,
2612 ESTALE = libc::ESTALE,
2613 EREMOTE = libc::EREMOTE,
2614 ENOLCK = libc::ENOLCK,
2615 ENOSYS = libc::ENOSYS,
2616 EIDRM = libc::EIDRM,
2617 ENOMSG = libc::ENOMSG,
2618 EOVERFLOW = libc::EOVERFLOW,
2619 EILSEQ = libc::EILSEQ,
2620 ECANCELED = libc::ECANCELED,
2621 EBADMSG = libc::EBADMSG,
2622 ENODATA = libc::ENODATA,
2623 ENOSR = libc::ENOSR,
2624 ENOSTR = libc::ENOSTR,
2625 ETIME = libc::ETIME,
2626 EMULTIHOP = libc::EMULTIHOP,
2627 ENOLINK = libc::ENOLINK,
2628 EPROTO = libc::EPROTO,
2629 }
2630
2631 impl Errno {
2632 pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
2633 }
2634
2635 pub const fn from_i32(e: i32) -> Errno {
2636 use self::Errno::*;
2637
2638 match e {
2639 libc::EPERM => EPERM,
2640 libc::ENOENT => ENOENT,
2641 libc::ESRCH => ESRCH,
2642 libc::EINTR => EINTR,
2643 libc::EIO => EIO,
2644 libc::ENXIO => ENXIO,
2645 libc::E2BIG => E2BIG,
2646 libc::ENOEXEC => ENOEXEC,
2647 libc::EBADF => EBADF,
2648 libc::ECHILD => ECHILD,
2649 libc::EDEADLK => EDEADLK,
2650 libc::ENOMEM => ENOMEM,
2651 libc::EACCES => EACCES,
2652 libc::EFAULT => EFAULT,
2653 libc::ENOTBLK => ENOTBLK,
2654 libc::EBUSY => EBUSY,
2655 libc::EEXIST => EEXIST,
2656 libc::EXDEV => EXDEV,
2657 libc::ENODEV => ENODEV,
2658 libc::ENOTDIR => ENOTDIR,
2659 libc::EISDIR => EISDIR,
2660 libc::EINVAL => EINVAL,
2661 libc::ENFILE => ENFILE,
2662 libc::EMFILE => EMFILE,
2663 libc::ENOTTY => ENOTTY,
2664 libc::ETXTBSY => ETXTBSY,
2665 libc::EFBIG => EFBIG,
2666 libc::ENOSPC => ENOSPC,
2667 libc::ESPIPE => ESPIPE,
2668 libc::EROFS => EROFS,
2669 libc::EMLINK => EMLINK,
2670 libc::EPIPE => EPIPE,
2671 libc::EDOM => EDOM,
2672 libc::ERANGE => ERANGE,
2673 libc::EAGAIN => EAGAIN,
2674 libc::EINPROGRESS => EINPROGRESS,
2675 libc::EALREADY => EALREADY,
2676 libc::ENOTSOCK => ENOTSOCK,
2677 libc::EDESTADDRREQ => EDESTADDRREQ,
2678 libc::EMSGSIZE => EMSGSIZE,
2679 libc::EPROTOTYPE => EPROTOTYPE,
2680 libc::ENOPROTOOPT => ENOPROTOOPT,
2681 libc::EPROTONOSUPPORT => EPROTONOSUPPORT,
2682 libc::ESOCKTNOSUPPORT => ESOCKTNOSUPPORT,
2683 libc::EOPNOTSUPP => EOPNOTSUPP,
2684 libc::EPFNOSUPPORT => EPFNOSUPPORT,
2685 libc::EAFNOSUPPORT => EAFNOSUPPORT,
2686 libc::EADDRINUSE => EADDRINUSE,
2687 libc::EADDRNOTAVAIL => EADDRNOTAVAIL,
2688 libc::ENETDOWN => ENETDOWN,
2689 libc::ENETUNREACH => ENETUNREACH,
2690 libc::ENETRESET => ENETRESET,
2691 libc::ECONNABORTED => ECONNABORTED,
2692 libc::ECONNRESET => ECONNRESET,
2693 libc::ENOBUFS => ENOBUFS,
2694 libc::EISCONN => EISCONN,
2695 libc::ENOTCONN => ENOTCONN,
2696 libc::ESHUTDOWN => ESHUTDOWN,
2697 libc::ETOOMANYREFS => ETOOMANYREFS,
2698 libc::ETIMEDOUT => ETIMEDOUT,
2699 libc::ECONNREFUSED => ECONNREFUSED,
2700 libc::ELOOP => ELOOP,
2701 libc::ENAMETOOLONG => ENAMETOOLONG,
2702 libc::EHOSTDOWN => EHOSTDOWN,
2703 libc::EHOSTUNREACH => EHOSTUNREACH,
2704 libc::ENOTEMPTY => ENOTEMPTY,
2705 libc::EUSERS => EUSERS,
2706 libc::EDQUOT => EDQUOT,
2707 libc::ESTALE => ESTALE,
2708 libc::EREMOTE => EREMOTE,
2709 libc::ENOLCK => ENOLCK,
2710 libc::ENOSYS => ENOSYS,
2711 libc::EIDRM => EIDRM,
2712 libc::ENOMSG => ENOMSG,
2713 libc::EOVERFLOW => EOVERFLOW,
2714 libc::EILSEQ => EILSEQ,
2715 libc::ECANCELED => ECANCELED,
2716 libc::EBADMSG => EBADMSG,
2717 libc::ENODATA => ENODATA,
2718 libc::ENOSR => ENOSR,
2719 libc::ENOSTR => ENOSTR,
2720 libc::ETIME => ETIME,
2721 libc::EMULTIHOP => EMULTIHOP,
2722 libc::ENOLINK => ENOLINK,
2723 libc::EPROTO => EPROTO,
2724 _ => UnknownErrno,
2725 }
2726 }
2727}
2728
2729#[cfg(any(target_os = "illumos", target_os = "solaris"))]
2730mod consts {
2731 #[derive(Clone, Copy, Debug, Eq, PartialEq)]
2732 #[repr(i32)]
2733 #[non_exhaustive]
2734 pub enum Errno {
2735 UnknownErrno = 0,
2736 EPERM = libc::EPERM,
2737 ENOENT = libc::ENOENT,
2738 ESRCH = libc::ESRCH,
2739 EINTR = libc::EINTR,
2740 EIO = libc::EIO,
2741 ENXIO = libc::ENXIO,
2742 E2BIG = libc::E2BIG,
2743 ENOEXEC = libc::ENOEXEC,
2744 EBADF = libc::EBADF,
2745 ECHILD = libc::ECHILD,
2746 EAGAIN = libc::EAGAIN,
2747 ENOMEM = libc::ENOMEM,
2748 EACCES = libc::EACCES,
2749 EFAULT = libc::EFAULT,
2750 ENOTBLK = libc::ENOTBLK,
2751 EBUSY = libc::EBUSY,
2752 EEXIST = libc::EEXIST,
2753 EXDEV = libc::EXDEV,
2754 ENODEV = libc::ENODEV,
2755 ENOTDIR = libc::ENOTDIR,
2756 EISDIR = libc::EISDIR,
2757 EINVAL = libc::EINVAL,
2758 ENFILE = libc::ENFILE,
2759 EMFILE = libc::EMFILE,
2760 ENOTTY = libc::ENOTTY,
2761 ETXTBSY = libc::ETXTBSY,
2762 EFBIG = libc::EFBIG,
2763 ENOSPC = libc::ENOSPC,
2764 ESPIPE = libc::ESPIPE,
2765 EROFS = libc::EROFS,
2766 EMLINK = libc::EMLINK,
2767 EPIPE = libc::EPIPE,
2768 EDOM = libc::EDOM,
2769 ERANGE = libc::ERANGE,
2770 ENOMSG = libc::ENOMSG,
2771 EIDRM = libc::EIDRM,
2772 ECHRNG = libc::ECHRNG,
2773 EL2NSYNC = libc::EL2NSYNC,
2774 EL3HLT = libc::EL3HLT,
2775 EL3RST = libc::EL3RST,
2776 ELNRNG = libc::ELNRNG,
2777 EUNATCH = libc::EUNATCH,
2778 ENOCSI = libc::ENOCSI,
2779 EL2HLT = libc::EL2HLT,
2780 EDEADLK = libc::EDEADLK,
2781 ENOLCK = libc::ENOLCK,
2782 ECANCELED = libc::ECANCELED,
2783 ENOTSUP = libc::ENOTSUP,
2784 EDQUOT = libc::EDQUOT,
2785 EBADE = libc::EBADE,
2786 EBADR = libc::EBADR,
2787 EXFULL = libc::EXFULL,
2788 ENOANO = libc::ENOANO,
2789 EBADRQC = libc::EBADRQC,
2790 EBADSLT = libc::EBADSLT,
2791 EDEADLOCK = libc::EDEADLOCK,
2792 EBFONT = libc::EBFONT,
2793 EOWNERDEAD = libc::EOWNERDEAD,
2794 ENOTRECOVERABLE = libc::ENOTRECOVERABLE,
2795 ENOSTR = libc::ENOSTR,
2796 ENODATA = libc::ENODATA,
2797 ETIME = libc::ETIME,
2798 ENOSR = libc::ENOSR,
2799 ENONET = libc::ENONET,
2800 ENOPKG = libc::ENOPKG,
2801 EREMOTE = libc::EREMOTE,
2802 ENOLINK = libc::ENOLINK,
2803 EADV = libc::EADV,
2804 ESRMNT = libc::ESRMNT,
2805 ECOMM = libc::ECOMM,
2806 EPROTO = libc::EPROTO,
2807 ELOCKUNMAPPED = libc::ELOCKUNMAPPED,
2808 ENOTACTIVE = libc::ENOTACTIVE,
2809 EMULTIHOP = libc::EMULTIHOP,
2810 EBADMSG = libc::EBADMSG,
2811 ENAMETOOLONG = libc::ENAMETOOLONG,
2812 EOVERFLOW = libc::EOVERFLOW,
2813 ENOTUNIQ = libc::ENOTUNIQ,
2814 EBADFD = libc::EBADFD,
2815 EREMCHG = libc::EREMCHG,
2816 ELIBACC = libc::ELIBACC,
2817 ELIBBAD = libc::ELIBBAD,
2818 ELIBSCN = libc::ELIBSCN,
2819 ELIBMAX = libc::ELIBMAX,
2820 ELIBEXEC = libc::ELIBEXEC,
2821 EILSEQ = libc::EILSEQ,
2822 ENOSYS = libc::ENOSYS,
2823 ELOOP = libc::ELOOP,
2824 ERESTART = libc::ERESTART,
2825 ESTRPIPE = libc::ESTRPIPE,
2826 ENOTEMPTY = libc::ENOTEMPTY,
2827 EUSERS = libc::EUSERS,
2828 ENOTSOCK = libc::ENOTSOCK,
2829 EDESTADDRREQ = libc::EDESTADDRREQ,
2830 EMSGSIZE = libc::EMSGSIZE,
2831 EPROTOTYPE = libc::EPROTOTYPE,
2832 ENOPROTOOPT = libc::ENOPROTOOPT,
2833 EPROTONOSUPPORT = libc::EPROTONOSUPPORT,
2834 ESOCKTNOSUPPORT = libc::ESOCKTNOSUPPORT,
2835 EOPNOTSUPP = libc::EOPNOTSUPP,
2836 EPFNOSUPPORT = libc::EPFNOSUPPORT,
2837 EAFNOSUPPORT = libc::EAFNOSUPPORT,
2838 EADDRINUSE = libc::EADDRINUSE,
2839 EADDRNOTAVAIL = libc::EADDRNOTAVAIL,
2840 ENETDOWN = libc::ENETDOWN,
2841 ENETUNREACH = libc::ENETUNREACH,
2842 ENETRESET = libc::ENETRESET,
2843 ECONNABORTED = libc::ECONNABORTED,
2844 ECONNRESET = libc::ECONNRESET,
2845 ENOBUFS = libc::ENOBUFS,
2846 EISCONN = libc::EISCONN,
2847 ENOTCONN = libc::ENOTCONN,
2848 ESHUTDOWN = libc::ESHUTDOWN,
2849 ETOOMANYREFS = libc::ETOOMANYREFS,
2850 ETIMEDOUT = libc::ETIMEDOUT,
2851 ECONNREFUSED = libc::ECONNREFUSED,
2852 EHOSTDOWN = libc::EHOSTDOWN,
2853 EHOSTUNREACH = libc::EHOSTUNREACH,
2854 EALREADY = libc::EALREADY,
2855 EINPROGRESS = libc::EINPROGRESS,
2856 ESTALE = libc::ESTALE,
2857 }
2858
2859 impl Errno {
2860 pub const ELAST: Errno = Errno::ESTALE;
2861 pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
2862 }
2863
2864 pub const fn from_i32(e: i32) -> Errno {
2865 use self::Errno::*;
2866
2867 match e {
2868 libc::EPERM => EPERM,
2869 libc::ENOENT => ENOENT,
2870 libc::ESRCH => ESRCH,
2871 libc::EINTR => EINTR,
2872 libc::EIO => EIO,
2873 libc::ENXIO => ENXIO,
2874 libc::E2BIG => E2BIG,
2875 libc::ENOEXEC => ENOEXEC,
2876 libc::EBADF => EBADF,
2877 libc::ECHILD => ECHILD,
2878 libc::EAGAIN => EAGAIN,
2879 libc::ENOMEM => ENOMEM,
2880 libc::EACCES => EACCES,
2881 libc::EFAULT => EFAULT,
2882 libc::ENOTBLK => ENOTBLK,
2883 libc::EBUSY => EBUSY,
2884 libc::EEXIST => EEXIST,
2885 libc::EXDEV => EXDEV,
2886 libc::ENODEV => ENODEV,
2887 libc::ENOTDIR => ENOTDIR,
2888 libc::EISDIR => EISDIR,
2889 libc::EINVAL => EINVAL,
2890 libc::ENFILE => ENFILE,
2891 libc::EMFILE => EMFILE,
2892 libc::ENOTTY => ENOTTY,
2893 libc::ETXTBSY => ETXTBSY,
2894 libc::EFBIG => EFBIG,
2895 libc::ENOSPC => ENOSPC,
2896 libc::ESPIPE => ESPIPE,
2897 libc::EROFS => EROFS,
2898 libc::EMLINK => EMLINK,
2899 libc::EPIPE => EPIPE,
2900 libc::EDOM => EDOM,
2901 libc::ERANGE => ERANGE,
2902 libc::ENOMSG => ENOMSG,
2903 libc::EIDRM => EIDRM,
2904 libc::ECHRNG => ECHRNG,
2905 libc::EL2NSYNC => EL2NSYNC,
2906 libc::EL3HLT => EL3HLT,
2907 libc::EL3RST => EL3RST,
2908 libc::ELNRNG => ELNRNG,
2909 libc::EUNATCH => EUNATCH,
2910 libc::ENOCSI => ENOCSI,
2911 libc::EL2HLT => EL2HLT,
2912 libc::EDEADLK => EDEADLK,
2913 libc::ENOLCK => ENOLCK,
2914 libc::ECANCELED => ECANCELED,
2915 libc::ENOTSUP => ENOTSUP,
2916 libc::EDQUOT => EDQUOT,
2917 libc::EBADE => EBADE,
2918 libc::EBADR => EBADR,
2919 libc::EXFULL => EXFULL,
2920 libc::ENOANO => ENOANO,
2921 libc::EBADRQC => EBADRQC,
2922 libc::EBADSLT => EBADSLT,
2923 libc::EDEADLOCK => EDEADLOCK,
2924 libc::EBFONT => EBFONT,
2925 libc::EOWNERDEAD => EOWNERDEAD,
2926 libc::ENOTRECOVERABLE => ENOTRECOVERABLE,
2927 libc::ENOSTR => ENOSTR,
2928 libc::ENODATA => ENODATA,
2929 libc::ETIME => ETIME,
2930 libc::ENOSR => ENOSR,
2931 libc::ENONET => ENONET,
2932 libc::ENOPKG => ENOPKG,
2933 libc::EREMOTE => EREMOTE,
2934 libc::ENOLINK => ENOLINK,
2935 libc::EADV => EADV,
2936 libc::ESRMNT => ESRMNT,
2937 libc::ECOMM => ECOMM,
2938 libc::EPROTO => EPROTO,
2939 libc::ELOCKUNMAPPED => ELOCKUNMAPPED,
2940 libc::ENOTACTIVE => ENOTACTIVE,
2941 libc::EMULTIHOP => EMULTIHOP,
2942 libc::EBADMSG => EBADMSG,
2943 libc::ENAMETOOLONG => ENAMETOOLONG,
2944 libc::EOVERFLOW => EOVERFLOW,
2945 libc::ENOTUNIQ => ENOTUNIQ,
2946 libc::EBADFD => EBADFD,
2947 libc::EREMCHG => EREMCHG,
2948 libc::ELIBACC => ELIBACC,
2949 libc::ELIBBAD => ELIBBAD,
2950 libc::ELIBSCN => ELIBSCN,
2951 libc::ELIBMAX => ELIBMAX,
2952 libc::ELIBEXEC => ELIBEXEC,
2953 libc::EILSEQ => EILSEQ,
2954 libc::ENOSYS => ENOSYS,
2955 libc::ELOOP => ELOOP,
2956 libc::ERESTART => ERESTART,
2957 libc::ESTRPIPE => ESTRPIPE,
2958 libc::ENOTEMPTY => ENOTEMPTY,
2959 libc::EUSERS => EUSERS,
2960 libc::ENOTSOCK => ENOTSOCK,
2961 libc::EDESTADDRREQ => EDESTADDRREQ,
2962 libc::EMSGSIZE => EMSGSIZE,
2963 libc::EPROTOTYPE => EPROTOTYPE,
2964 libc::ENOPROTOOPT => ENOPROTOOPT,
2965 libc::EPROTONOSUPPORT => EPROTONOSUPPORT,
2966 libc::ESOCKTNOSUPPORT => ESOCKTNOSUPPORT,
2967 libc::EOPNOTSUPP => EOPNOTSUPP,
2968 libc::EPFNOSUPPORT => EPFNOSUPPORT,
2969 libc::EAFNOSUPPORT => EAFNOSUPPORT,
2970 libc::EADDRINUSE => EADDRINUSE,
2971 libc::EADDRNOTAVAIL => EADDRNOTAVAIL,
2972 libc::ENETDOWN => ENETDOWN,
2973 libc::ENETUNREACH => ENETUNREACH,
2974 libc::ENETRESET => ENETRESET,
2975 libc::ECONNABORTED => ECONNABORTED,
2976 libc::ECONNRESET => ECONNRESET,
2977 libc::ENOBUFS => ENOBUFS,
2978 libc::EISCONN => EISCONN,
2979 libc::ENOTCONN => ENOTCONN,
2980 libc::ESHUTDOWN => ESHUTDOWN,
2981 libc::ETOOMANYREFS => ETOOMANYREFS,
2982 libc::ETIMEDOUT => ETIMEDOUT,
2983 libc::ECONNREFUSED => ECONNREFUSED,
2984 libc::EHOSTDOWN => EHOSTDOWN,
2985 libc::EHOSTUNREACH => EHOSTUNREACH,
2986 libc::EALREADY => EALREADY,
2987 libc::EINPROGRESS => EINPROGRESS,
2988 libc::ESTALE => ESTALE,
2989 _ => UnknownErrno,
2990 }
2991 }
2992}
2993
2994#[cfg(target_os = "haiku")]
2995mod consts {
2996 #[derive(Clone, Copy, Debug, Eq, PartialEq)]
2997 #[repr(i32)]
2998 #[non_exhaustive]
2999 pub enum Errno {
3000 UnknownErrno = 0,
3001 EPERM = libc::EPERM,
3002 ENOENT = libc::ENOENT,
3003 ESRCH = libc::ESRCH,
3004 EINTR = libc::EINTR,
3005 EIO = libc::EIO,
3006 ENXIO = libc::ENXIO,
3007 E2BIG = libc::E2BIG,
3008 ENOEXEC = libc::ENOEXEC,
3009 EBADF = libc::EBADF,
3010 ECHILD = libc::ECHILD,
3011 EDEADLK = libc::EDEADLK,
3012 ENOMEM = libc::ENOMEM,
3013 EACCES = libc::EACCES,
3014 EFAULT = libc::EFAULT,
3015 EBUSY = libc::EBUSY,
3016 EEXIST = libc::EEXIST,
3017 EXDEV = libc::EXDEV,
3018 ENODEV = libc::ENODEV,
3019 ENOTDIR = libc::ENOTDIR,
3020 EISDIR = libc::EISDIR,
3021 EINVAL = libc::EINVAL,
3022 ENFILE = libc::ENFILE,
3023 EMFILE = libc::EMFILE,
3024 ENOTTY = libc::ENOTTY,
3025 ETXTBSY = libc::ETXTBSY,
3026 EFBIG = libc::EFBIG,
3027 ENOSPC = libc::ENOSPC,
3028 ESPIPE = libc::ESPIPE,
3029 EROFS = libc::EROFS,
3030 EMLINK = libc::EMLINK,
3031 EPIPE = libc::EPIPE,
3032 EDOM = libc::EDOM,
3033 ERANGE = libc::ERANGE,
3034 EAGAIN = libc::EAGAIN,
3035 EINPROGRESS = libc::EINPROGRESS,
3036 EALREADY = libc::EALREADY,
3037 ENOTSOCK = libc::ENOTSOCK,
3038 EDESTADDRREQ = libc::EDESTADDRREQ,
3039 EMSGSIZE = libc::EMSGSIZE,
3040 EPROTOTYPE = libc::EPROTOTYPE,
3041 ENOPROTOOPT = libc::ENOPROTOOPT,
3042 EPROTONOSUPPORT = libc::EPROTONOSUPPORT,
3043 ENOTSUP = libc::ENOTSUP,
3044 EADDRINUSE = libc::EADDRINUSE,
3045 EADDRNOTAVAIL = libc::EADDRNOTAVAIL,
3046 ENETDOWN = libc::ENETDOWN,
3047 ENETUNREACH = libc::ENETUNREACH,
3048 ENETRESET = libc::ENETRESET,
3049 ECONNABORTED = libc::ECONNABORTED,
3050 ECONNRESET = libc::ECONNRESET,
3051 ENOBUFS = libc::ENOBUFS,
3052 EISCONN = libc::EISCONN,
3053 ENOTCONN = libc::ENOTCONN,
3054 ESHUTDOWN = libc::ESHUTDOWN,
3055 ETIMEDOUT = libc::ETIMEDOUT,
3056 ECONNREFUSED = libc::ECONNREFUSED,
3057 ELOOP = libc::ELOOP,
3058 ENAMETOOLONG = libc::ENAMETOOLONG,
3059 EHOSTDOWN = libc::EHOSTDOWN,
3060 EHOSTUNREACH = libc::EHOSTUNREACH,
3061 ENOTEMPTY = libc::ENOTEMPTY,
3062 EDQUOT = libc::EDQUOT,
3063 ESTALE = libc::ESTALE,
3064 ENOLCK = libc::ENOLCK,
3065 ENOSYS = libc::ENOSYS,
3066 EIDRM = libc::EIDRM,
3067 ENOMSG = libc::ENOMSG,
3068 EOVERFLOW = libc::EOVERFLOW,
3069 ECANCELED = libc::ECANCELED,
3070 EILSEQ = libc::EILSEQ,
3071 ENOATTR = libc::ENOATTR,
3072 EBADMSG = libc::EBADMSG,
3073 EMULTIHOP = libc::EMULTIHOP,
3074 ENOLINK = libc::ENOLINK,
3075 EPROTO = libc::EPROTO,
3076 }
3077
3078 impl Errno {
3079 pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
3080 pub const EDEADLOCK: Errno = Errno::EDEADLK;
3081 pub const EOPNOTSUPP: Errno = Errno::ENOTSUP;
3082 }
3083
3084 pub const fn from_i32(e: i32) -> Errno {
3085 use self::Errno::*;
3086
3087 match e {
3088 libc::EPERM => EPERM,
3089 libc::ENOENT => ENOENT,
3090 libc::ESRCH => ESRCH,
3091 libc::EINTR => EINTR,
3092 libc::EIO => EIO,
3093 libc::ENXIO => ENXIO,
3094 libc::E2BIG => E2BIG,
3095 libc::ENOEXEC => ENOEXEC,
3096 libc::EBADF => EBADF,
3097 libc::ECHILD => ECHILD,
3098 libc::EDEADLK => EDEADLK,
3099 libc::ENOMEM => ENOMEM,
3100 libc::EACCES => EACCES,
3101 libc::EFAULT => EFAULT,
3102 libc::EBUSY => EBUSY,
3103 libc::EEXIST => EEXIST,
3104 libc::EXDEV => EXDEV,
3105 libc::ENODEV => ENODEV,
3106 libc::ENOTDIR => ENOTDIR,
3107 libc::EISDIR => EISDIR,
3108 libc::EINVAL => EINVAL,
3109 libc::ENFILE => ENFILE,
3110 libc::EMFILE => EMFILE,
3111 libc::ENOTTY => ENOTTY,
3112 libc::ETXTBSY => ETXTBSY,
3113 libc::EFBIG => EFBIG,
3114 libc::ENOSPC => ENOSPC,
3115 libc::ESPIPE => ESPIPE,
3116 libc::EROFS => EROFS,
3117 libc::EMLINK => EMLINK,
3118 libc::EPIPE => EPIPE,
3119 libc::EDOM => EDOM,
3120 libc::ERANGE => ERANGE,
3121 libc::EAGAIN => EAGAIN,
3122 libc::EINPROGRESS => EINPROGRESS,
3123 libc::EALREADY => EALREADY,
3124 libc::ENOTSOCK => ENOTSOCK,
3125 libc::EDESTADDRREQ => EDESTADDRREQ,
3126 libc::EMSGSIZE => EMSGSIZE,
3127 libc::EPROTOTYPE => EPROTOTYPE,
3128 libc::ENOPROTOOPT => ENOPROTOOPT,
3129 libc::EPROTONOSUPPORT => EPROTONOSUPPORT,
3130 libc::ENOTSUP => ENOTSUP,
3131 libc::EADDRINUSE => EADDRINUSE,
3132 libc::EADDRNOTAVAIL => EADDRNOTAVAIL,
3133 libc::ENETDOWN => ENETDOWN,
3134 libc::ENETUNREACH => ENETUNREACH,
3135 libc::ENETRESET => ENETRESET,
3136 libc::ECONNABORTED => ECONNABORTED,
3137 libc::ECONNRESET => ECONNRESET,
3138 libc::ENOBUFS => ENOBUFS,
3139 libc::EISCONN => EISCONN,
3140 libc::ENOTCONN => ENOTCONN,
3141 libc::ESHUTDOWN => ESHUTDOWN,
3142 libc::ETIMEDOUT => ETIMEDOUT,
3143 libc::ECONNREFUSED => ECONNREFUSED,
3144 libc::ELOOP => ELOOP,
3145 libc::ENAMETOOLONG => ENAMETOOLONG,
3146 libc::EHOSTDOWN => EHOSTDOWN,
3147 libc::EHOSTUNREACH => EHOSTUNREACH,
3148 libc::ENOTEMPTY => ENOTEMPTY,
3149 libc::EDQUOT => EDQUOT,
3150 libc::ESTALE => ESTALE,
3151 libc::ENOLCK => ENOLCK,
3152 libc::ENOSYS => ENOSYS,
3153 libc::EIDRM => EIDRM,
3154 libc::ENOMSG => ENOMSG,
3155 libc::EOVERFLOW => EOVERFLOW,
3156 libc::ECANCELED => ECANCELED,
3157 libc::EILSEQ => EILSEQ,
3158 libc::ENOATTR => ENOATTR,
3159 libc::EBADMSG => EBADMSG,
3160 libc::EMULTIHOP => EMULTIHOP,
3161 libc::ENOLINK => ENOLINK,
3162 libc::EPROTO => EPROTO,
3163 _ => UnknownErrno,
3164 }
3165 }
3166}
3167
3168#[cfg(target_os = "aix")]
3169mod consts {
3170 #[derive(Clone, Copy, Debug, Eq, PartialEq)]
3171 #[repr(i32)]
3172 #[non_exhaustive]
3173 pub enum Errno {
3174 UnknownErrno = 0,
3175 EPERM = libc::EPERM,
3176 ENOENT = libc::ENOENT,
3177 ESRCH = libc::ESRCH,
3178 EINTR = libc::EINTR,
3179 EIO = libc::EIO,
3180 ENXIO = libc::ENXIO,
3181 E2BIG = libc::E2BIG,
3182 ENOEXEC = libc::ENOEXEC,
3183 EBADF = libc::EBADF,
3184 ECHILD = libc::ECHILD,
3185 EAGAIN = libc::EAGAIN,
3186 ENOMEM = libc::ENOMEM,
3187 EACCES = libc::EACCES,
3188 EFAULT = libc::EFAULT,
3189 ENOTBLK = libc::ENOTBLK,
3190 EBUSY = libc::EBUSY,
3191 EEXIST = libc::EEXIST,
3192 EXDEV = libc::EXDEV,
3193 ENODEV = libc::ENODEV,
3194 ENOTDIR = libc::ENOTDIR,
3195 EISDIR = libc::EISDIR,
3196 EINVAL = libc::EINVAL,
3197 ENFILE = libc::ENFILE,
3198 EMFILE = libc::EMFILE,
3199 ENOTTY = libc::ENOTTY,
3200 ETXTBSY = libc::ETXTBSY,
3201 EFBIG = libc::EFBIG,
3202 ENOSPC = libc::ENOSPC,
3203 ESPIPE = libc::ESPIPE,
3204 EROFS = libc::EROFS,
3205 EMLINK = libc::EMLINK,
3206 EPIPE = libc::EPIPE,
3207 EDOM = libc::EDOM,
3208 ERANGE = libc::ERANGE,
3209 EDEADLK = libc::EDEADLK,
3210 ENAMETOOLONG = libc::ENAMETOOLONG,
3211 ENOLCK = libc::ENOLCK,
3212 ENOSYS = libc::ENOSYS,
3213 ENOTEMPTY = libc::ENOTEMPTY,
3214 ELOOP = libc::ELOOP,
3215 ENOMSG = libc::ENOMSG,
3216 EIDRM = libc::EIDRM,
3217 EINPROGRESS = libc::EINPROGRESS,
3218 EALREADY = libc::EALREADY,
3219 ENOTSOCK = libc::ENOTSOCK,
3220 EDESTADDRREQ = libc::EDESTADDRREQ,
3221 EMSGSIZE = libc::EMSGSIZE,
3222 EPROTOTYPE = libc::EPROTOTYPE,
3223 ENOPROTOOPT = libc::ENOPROTOOPT,
3224 EPROTONOSUPPORT = libc::EPROTONOSUPPORT,
3225 ESOCKTNOSUPPORT = libc::ESOCKTNOSUPPORT,
3226 EPFNOSUPPORT = libc::EPFNOSUPPORT,
3227 EAFNOSUPPORT = libc::EAFNOSUPPORT,
3228 EADDRINUSE = libc::EADDRINUSE,
3229 EADDRNOTAVAIL = libc::EADDRNOTAVAIL,
3230 ENETDOWN = libc::ENETDOWN,
3231 ENETUNREACH = libc::ENETUNREACH,
3232 ENETRESET = libc::ENETRESET,
3233 ECONNABORTED = libc::ECONNABORTED,
3234 ECONNRESET = libc::ECONNRESET,
3235 ENOBUFS = libc::ENOBUFS,
3236 EISCONN = libc::EISCONN,
3237 ENOTCONN = libc::ENOTCONN,
3238 ESHUTDOWN = libc::ESHUTDOWN,
3239 ETOOMANYREFS = libc::ETOOMANYREFS,
3240 ETIMEDOUT = libc::ETIMEDOUT,
3241 ECONNREFUSED = libc::ECONNREFUSED,
3242 EHOSTDOWN = libc::EHOSTDOWN,
3243 EHOSTUNREACH = libc::EHOSTUNREACH,
3244 ECHRNG = libc::ECHRNG,
3245 EL2NSYNC = libc::EL2NSYNC,
3246 EL3HLT = libc::EL3HLT,
3247 EL3RST = libc::EL3RST,
3248 ELNRNG = libc::ELNRNG,
3249 EUNATCH = libc::EUNATCH,
3250 ENOCSI = libc::ENOCSI,
3251 EL2HLT = libc::EL2HLT,
3252 ENOLINK = libc::ENOLINK,
3253 EPROTO = libc::EPROTO,
3254 EMULTIHOP = libc::EMULTIHOP,
3255 EBADMSG = libc::EBADMSG,
3256 EOVERFLOW = libc::EOVERFLOW,
3257 EILSEQ = libc::EILSEQ,
3258 ERESTART = libc::ERESTART,
3259 EOWNERDEAD = libc::EOWNERDEAD,
3260 ENOTRECOVERABLE = libc::ENOTRECOVERABLE,
3261 ENOTSUP = libc::ENOTSUP,
3262 EPROCLIM = libc::EPROCLIM,
3263 EUSERS = libc::EUSERS,
3264 EDQUOT = libc::EDQUOT,
3265 ESTALE = libc::ESTALE,
3266 EREMOTE = libc::EREMOTE,
3267 ECANCELED = libc::ECANCELED,
3268 ENODATA = libc::ENODATA,
3269 ENOSR = libc::ENOSR,
3270 ENOSTR = libc::ENOSTR,
3271 ETIME = libc::ETIME,
3272 EOPNOTSUPP = libc::EOPNOTSUPP,
3273 }
3274
3275 pub const fn from_i32(e: i32) -> Errno {
3276 use self::Errno::*;
3277
3278 match e {
3279 libc::EPERM => EPERM,
3280 libc::ENOENT => ENOENT,
3281 libc::ESRCH => ESRCH,
3282 libc::EINTR => EINTR,
3283 libc::EIO => EIO,
3284 libc::ENXIO => ENXIO,
3285 libc::E2BIG => E2BIG,
3286 libc::ENOEXEC => ENOEXEC,
3287 libc::EBADF => EBADF,
3288 libc::ECHILD => ECHILD,
3289 libc::EAGAIN => EAGAIN,
3290 libc::ENOMEM => ENOMEM,
3291 libc::EACCES => EACCES,
3292 libc::EFAULT => EFAULT,
3293 libc::ENOTBLK => ENOTBLK,
3294 libc::EBUSY => EBUSY,
3295 libc::EEXIST => EEXIST,
3296 libc::EXDEV => EXDEV,
3297 libc::ENODEV => ENODEV,
3298 libc::ENOTDIR => ENOTDIR,
3299 libc::EISDIR => EISDIR,
3300 libc::EINVAL => EINVAL,
3301 libc::ENFILE => ENFILE,
3302 libc::EMFILE => EMFILE,
3303 libc::ENOTTY => ENOTTY,
3304 libc::ETXTBSY => ETXTBSY,
3305 libc::EFBIG => EFBIG,
3306 libc::ENOSPC => ENOSPC,
3307 libc::ESPIPE => ESPIPE,
3308 libc::EROFS => EROFS,
3309 libc::EMLINK => EMLINK,
3310 libc::EPIPE => EPIPE,
3311 libc::EDOM => EDOM,
3312 libc::ERANGE => ERANGE,
3313 libc::EDEADLK => EDEADLK,
3314 libc::ENAMETOOLONG => ENAMETOOLONG,
3315 libc::ENOLCK => ENOLCK,
3316 libc::ENOSYS => ENOSYS,
3317 libc::ENOTEMPTY => ENOTEMPTY,
3318 libc::ELOOP => ELOOP,
3319 libc::ENOMSG => ENOMSG,
3320 libc::EIDRM => EIDRM,
3321 libc::EINPROGRESS => EINPROGRESS,
3322 libc::EALREADY => EALREADY,
3323 libc::ENOTSOCK => ENOTSOCK,
3324 libc::EDESTADDRREQ => EDESTADDRREQ,
3325 libc::EMSGSIZE => EMSGSIZE,
3326 libc::EPROTOTYPE => EPROTOTYPE,
3327 libc::ENOPROTOOPT => ENOPROTOOPT,
3328 libc::EPROTONOSUPPORT => EPROTONOSUPPORT,
3329 libc::ESOCKTNOSUPPORT => ESOCKTNOSUPPORT,
3330 libc::EPFNOSUPPORT => EPFNOSUPPORT,
3331 libc::EAFNOSUPPORT => EAFNOSUPPORT,
3332 libc::EADDRINUSE => EADDRINUSE,
3333 libc::EADDRNOTAVAIL => EADDRNOTAVAIL,
3334 libc::ENETDOWN => ENETDOWN,
3335 libc::ENETUNREACH => ENETUNREACH,
3336 libc::ENETRESET => ENETRESET,
3337 libc::ECONNABORTED => ECONNABORTED,
3338 libc::ECONNRESET => ECONNRESET,
3339 libc::ENOBUFS => ENOBUFS,
3340 libc::EISCONN => EISCONN,
3341 libc::ENOTCONN => ENOTCONN,
3342 libc::ESHUTDOWN => ESHUTDOWN,
3343 libc::ETOOMANYREFS => ETOOMANYREFS,
3344 libc::ETIMEDOUT => ETIMEDOUT,
3345 libc::ECONNREFUSED => ECONNREFUSED,
3346 libc::EHOSTDOWN => EHOSTDOWN,
3347 libc::EHOSTUNREACH => EHOSTUNREACH,
3348 libc::ECHRNG => ECHRNG,
3349 libc::EL2NSYNC => EL2NSYNC,
3350 libc::EL3HLT => EL3HLT,
3351 libc::EL3RST => EL3RST,
3352 libc::ELNRNG => ELNRNG,
3353 libc::EUNATCH => EUNATCH,
3354 libc::ENOCSI => ENOCSI,
3355 libc::EL2HLT => EL2HLT,
3356 libc::ENOLINK => ENOLINK,
3357 libc::EPROTO => EPROTO,
3358 libc::EMULTIHOP => EMULTIHOP,
3359 libc::EBADMSG => EBADMSG,
3360 libc::EOVERFLOW => EOVERFLOW,
3361 libc::EILSEQ => EILSEQ,
3362 libc::ERESTART => ERESTART,
3363 libc::ENOTRECOVERABLE => ENOTRECOVERABLE,
3364 libc::EOWNERDEAD => EOWNERDEAD,
3365 libc::ENOTSUP => ENOTSUP,
3366 libc::EPROCLIM => EPROCLIM,
3367 libc::EUSERS => EUSERS,
3368 libc::EDQUOT => EDQUOT,
3369 libc::ESTALE => ESTALE,
3370 libc::EREMOTE => EREMOTE,
3371 libc::ECANCELED => ECANCELED,
3372 libc::ENODATA => ENODATA,
3373 libc::ENOSR => ENOSR,
3374 libc::ENOSTR => ENOSTR,
3375 libc::ETIME => ETIME,
3376 libc::EOPNOTSUPP => EOPNOTSUPP,
3377 _ => UnknownErrno,
3378 }
3379 }
3380}
3381