13da5c369Sopenharmony_ciuse crate::Result;
23da5c369Sopenharmony_ciuse cfg_if::cfg_if;
33da5c369Sopenharmony_ciuse libc::{c_int, c_void};
43da5c369Sopenharmony_ciuse std::convert::TryFrom;
53da5c369Sopenharmony_ciuse std::{error, fmt, io};
63da5c369Sopenharmony_ci
73da5c369Sopenharmony_cipub use self::consts::*;
83da5c369Sopenharmony_ci
93da5c369Sopenharmony_cicfg_if! {
103da5c369Sopenharmony_ci    if #[cfg(any(target_os = "freebsd",
113da5c369Sopenharmony_ci                 target_os = "ios",
123da5c369Sopenharmony_ci                 target_os = "macos"))] {
133da5c369Sopenharmony_ci        unsafe fn errno_location() -> *mut c_int {
143da5c369Sopenharmony_ci            libc::__error()
153da5c369Sopenharmony_ci        }
163da5c369Sopenharmony_ci    } else if #[cfg(any(target_os = "android",
173da5c369Sopenharmony_ci                        target_os = "netbsd",
183da5c369Sopenharmony_ci                        target_os = "openbsd"))] {
193da5c369Sopenharmony_ci        unsafe fn errno_location() -> *mut c_int {
203da5c369Sopenharmony_ci            libc::__errno()
213da5c369Sopenharmony_ci        }
223da5c369Sopenharmony_ci    } else if #[cfg(any(target_os = "linux",
233da5c369Sopenharmony_ci                        target_os = "redox",
243da5c369Sopenharmony_ci                        target_os = "dragonfly",
253da5c369Sopenharmony_ci                        target_os = "fuchsia"))] {
263da5c369Sopenharmony_ci        unsafe fn errno_location() -> *mut c_int {
273da5c369Sopenharmony_ci            libc::__errno_location()
283da5c369Sopenharmony_ci        }
293da5c369Sopenharmony_ci    } else if #[cfg(any(target_os = "illumos", target_os = "solaris"))] {
303da5c369Sopenharmony_ci        unsafe fn errno_location() -> *mut c_int {
313da5c369Sopenharmony_ci            libc::___errno()
323da5c369Sopenharmony_ci        }
333da5c369Sopenharmony_ci    } else if #[cfg(any(target_os = "haiku",))] {
343da5c369Sopenharmony_ci        unsafe fn errno_location() -> *mut c_int {
353da5c369Sopenharmony_ci            libc::_errnop()
363da5c369Sopenharmony_ci        }
373da5c369Sopenharmony_ci    }
383da5c369Sopenharmony_ci}
393da5c369Sopenharmony_ci
403da5c369Sopenharmony_ci/// Sets the platform-specific errno to no-error
413da5c369Sopenharmony_cifn clear() {
423da5c369Sopenharmony_ci    // Safe because errno is a thread-local variable
433da5c369Sopenharmony_ci    unsafe {
443da5c369Sopenharmony_ci        *errno_location() = 0;
453da5c369Sopenharmony_ci    }
463da5c369Sopenharmony_ci}
473da5c369Sopenharmony_ci
483da5c369Sopenharmony_ci/// Returns the platform-specific value of errno
493da5c369Sopenharmony_cipub fn errno() -> i32 {
503da5c369Sopenharmony_ci    unsafe { *errno_location() }
513da5c369Sopenharmony_ci}
523da5c369Sopenharmony_ci
533da5c369Sopenharmony_ciimpl Errno {
543da5c369Sopenharmony_ci    pub fn last() -> Self {
553da5c369Sopenharmony_ci        last()
563da5c369Sopenharmony_ci    }
573da5c369Sopenharmony_ci
583da5c369Sopenharmony_ci    pub fn desc(self) -> &'static str {
593da5c369Sopenharmony_ci        desc(self)
603da5c369Sopenharmony_ci    }
613da5c369Sopenharmony_ci
623da5c369Sopenharmony_ci    pub const fn from_i32(err: i32) -> Errno {
633da5c369Sopenharmony_ci        from_i32(err)
643da5c369Sopenharmony_ci    }
653da5c369Sopenharmony_ci
663da5c369Sopenharmony_ci    pub fn clear() {
673da5c369Sopenharmony_ci        clear()
683da5c369Sopenharmony_ci    }
693da5c369Sopenharmony_ci
703da5c369Sopenharmony_ci    /// Returns `Ok(value)` if it does not contain the sentinel value. This
713da5c369Sopenharmony_ci    /// should not be used when `-1` is not the errno sentinel value.
723da5c369Sopenharmony_ci    #[inline]
733da5c369Sopenharmony_ci    pub fn result<S: ErrnoSentinel + PartialEq<S>>(value: S) -> Result<S> {
743da5c369Sopenharmony_ci        if value == S::sentinel() {
753da5c369Sopenharmony_ci            Err(Self::last())
763da5c369Sopenharmony_ci        } else {
773da5c369Sopenharmony_ci            Ok(value)
783da5c369Sopenharmony_ci        }
793da5c369Sopenharmony_ci    }
803da5c369Sopenharmony_ci}
813da5c369Sopenharmony_ci
823da5c369Sopenharmony_ci/// The sentinel value indicates that a function failed and more detailed
833da5c369Sopenharmony_ci/// information about the error can be found in `errno`
843da5c369Sopenharmony_cipub trait ErrnoSentinel: Sized {
853da5c369Sopenharmony_ci    fn sentinel() -> Self;
863da5c369Sopenharmony_ci}
873da5c369Sopenharmony_ci
883da5c369Sopenharmony_ciimpl ErrnoSentinel for isize {
893da5c369Sopenharmony_ci    fn sentinel() -> Self {
903da5c369Sopenharmony_ci        -1
913da5c369Sopenharmony_ci    }
923da5c369Sopenharmony_ci}
933da5c369Sopenharmony_ci
943da5c369Sopenharmony_ciimpl ErrnoSentinel for i32 {
953da5c369Sopenharmony_ci    fn sentinel() -> Self {
963da5c369Sopenharmony_ci        -1
973da5c369Sopenharmony_ci    }
983da5c369Sopenharmony_ci}
993da5c369Sopenharmony_ci
1003da5c369Sopenharmony_ciimpl ErrnoSentinel for i64 {
1013da5c369Sopenharmony_ci    fn sentinel() -> Self {
1023da5c369Sopenharmony_ci        -1
1033da5c369Sopenharmony_ci    }
1043da5c369Sopenharmony_ci}
1053da5c369Sopenharmony_ci
1063da5c369Sopenharmony_ciimpl ErrnoSentinel for *mut c_void {
1073da5c369Sopenharmony_ci    fn sentinel() -> Self {
1083da5c369Sopenharmony_ci        -1isize as *mut c_void
1093da5c369Sopenharmony_ci    }
1103da5c369Sopenharmony_ci}
1113da5c369Sopenharmony_ci
1123da5c369Sopenharmony_ciimpl ErrnoSentinel for libc::sighandler_t {
1133da5c369Sopenharmony_ci    fn sentinel() -> Self {
1143da5c369Sopenharmony_ci        libc::SIG_ERR
1153da5c369Sopenharmony_ci    }
1163da5c369Sopenharmony_ci}
1173da5c369Sopenharmony_ci
1183da5c369Sopenharmony_ciimpl error::Error for Errno {}
1193da5c369Sopenharmony_ci
1203da5c369Sopenharmony_ciimpl fmt::Display for Errno {
1213da5c369Sopenharmony_ci    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1223da5c369Sopenharmony_ci        write!(f, "{:?}: {}", self, self.desc())
1233da5c369Sopenharmony_ci    }
1243da5c369Sopenharmony_ci}
1253da5c369Sopenharmony_ci
1263da5c369Sopenharmony_ciimpl From<Errno> for io::Error {
1273da5c369Sopenharmony_ci    fn from(err: Errno) -> Self {
1283da5c369Sopenharmony_ci        io::Error::from_raw_os_error(err as i32)
1293da5c369Sopenharmony_ci    }
1303da5c369Sopenharmony_ci}
1313da5c369Sopenharmony_ci
1323da5c369Sopenharmony_ciimpl TryFrom<io::Error> for Errno {
1333da5c369Sopenharmony_ci    type Error = io::Error;
1343da5c369Sopenharmony_ci
1353da5c369Sopenharmony_ci    fn try_from(ioerror: io::Error) -> std::result::Result<Self, io::Error> {
1363da5c369Sopenharmony_ci        ioerror.raw_os_error().map(Errno::from_i32).ok_or(ioerror)
1373da5c369Sopenharmony_ci    }
1383da5c369Sopenharmony_ci}
1393da5c369Sopenharmony_ci
1403da5c369Sopenharmony_cifn last() -> Errno {
1413da5c369Sopenharmony_ci    Errno::from_i32(errno())
1423da5c369Sopenharmony_ci}
1433da5c369Sopenharmony_ci
1443da5c369Sopenharmony_cifn desc(errno: Errno) -> &'static str {
1453da5c369Sopenharmony_ci    use self::Errno::*;
1463da5c369Sopenharmony_ci    match errno {
1473da5c369Sopenharmony_ci        UnknownErrno => "Unknown errno",
1483da5c369Sopenharmony_ci        EPERM => "Operation not permitted",
1493da5c369Sopenharmony_ci        ENOENT => "No such file or directory",
1503da5c369Sopenharmony_ci        ESRCH => "No such process",
1513da5c369Sopenharmony_ci        EINTR => "Interrupted system call",
1523da5c369Sopenharmony_ci        EIO => "I/O error",
1533da5c369Sopenharmony_ci        ENXIO => "No such device or address",
1543da5c369Sopenharmony_ci        E2BIG => "Argument list too long",
1553da5c369Sopenharmony_ci        ENOEXEC => "Exec format error",
1563da5c369Sopenharmony_ci        EBADF => "Bad file number",
1573da5c369Sopenharmony_ci        ECHILD => "No child processes",
1583da5c369Sopenharmony_ci        EAGAIN => "Try again",
1593da5c369Sopenharmony_ci        ENOMEM => "Out of memory",
1603da5c369Sopenharmony_ci        EACCES => "Permission denied",
1613da5c369Sopenharmony_ci        EFAULT => "Bad address",
1623da5c369Sopenharmony_ci        #[cfg(not(target_os = "haiku"))]
1633da5c369Sopenharmony_ci        ENOTBLK => "Block device required",
1643da5c369Sopenharmony_ci        EBUSY => "Device or resource busy",
1653da5c369Sopenharmony_ci        EEXIST => "File exists",
1663da5c369Sopenharmony_ci        EXDEV => "Cross-device link",
1673da5c369Sopenharmony_ci        ENODEV => "No such device",
1683da5c369Sopenharmony_ci        ENOTDIR => "Not a directory",
1693da5c369Sopenharmony_ci        EISDIR => "Is a directory",
1703da5c369Sopenharmony_ci        EINVAL => "Invalid argument",
1713da5c369Sopenharmony_ci        ENFILE => "File table overflow",
1723da5c369Sopenharmony_ci        EMFILE => "Too many open files",
1733da5c369Sopenharmony_ci        ENOTTY => "Not a typewriter",
1743da5c369Sopenharmony_ci        ETXTBSY => "Text file busy",
1753da5c369Sopenharmony_ci        EFBIG => "File too large",
1763da5c369Sopenharmony_ci        ENOSPC => "No space left on device",
1773da5c369Sopenharmony_ci        ESPIPE => "Illegal seek",
1783da5c369Sopenharmony_ci        EROFS => "Read-only file system",
1793da5c369Sopenharmony_ci        EMLINK => "Too many links",
1803da5c369Sopenharmony_ci        EPIPE => "Broken pipe",
1813da5c369Sopenharmony_ci        EDOM => "Math argument out of domain of func",
1823da5c369Sopenharmony_ci        ERANGE => "Math result not representable",
1833da5c369Sopenharmony_ci        EDEADLK => "Resource deadlock would occur",
1843da5c369Sopenharmony_ci        ENAMETOOLONG => "File name too long",
1853da5c369Sopenharmony_ci        ENOLCK => "No record locks available",
1863da5c369Sopenharmony_ci        ENOSYS => "Function not implemented",
1873da5c369Sopenharmony_ci        ENOTEMPTY => "Directory not empty",
1883da5c369Sopenharmony_ci        ELOOP => "Too many symbolic links encountered",
1893da5c369Sopenharmony_ci        ENOMSG => "No message of desired type",
1903da5c369Sopenharmony_ci        EIDRM => "Identifier removed",
1913da5c369Sopenharmony_ci        EINPROGRESS => "Operation now in progress",
1923da5c369Sopenharmony_ci        EALREADY => "Operation already in progress",
1933da5c369Sopenharmony_ci        ENOTSOCK => "Socket operation on non-socket",
1943da5c369Sopenharmony_ci        EDESTADDRREQ => "Destination address required",
1953da5c369Sopenharmony_ci        EMSGSIZE => "Message too long",
1963da5c369Sopenharmony_ci        EPROTOTYPE => "Protocol wrong type for socket",
1973da5c369Sopenharmony_ci        ENOPROTOOPT => "Protocol not available",
1983da5c369Sopenharmony_ci        EPROTONOSUPPORT => "Protocol not supported",
1993da5c369Sopenharmony_ci        #[cfg(not(target_os = "haiku"))]
2003da5c369Sopenharmony_ci        ESOCKTNOSUPPORT => "Socket type not supported",
2013da5c369Sopenharmony_ci        #[cfg(not(target_os = "haiku"))]
2023da5c369Sopenharmony_ci        EPFNOSUPPORT => "Protocol family not supported",
2033da5c369Sopenharmony_ci        #[cfg(not(target_os = "haiku"))]
2043da5c369Sopenharmony_ci        EAFNOSUPPORT => "Address family not supported by protocol",
2053da5c369Sopenharmony_ci        EADDRINUSE => "Address already in use",
2063da5c369Sopenharmony_ci        EADDRNOTAVAIL => "Cannot assign requested address",
2073da5c369Sopenharmony_ci        ENETDOWN => "Network is down",
2083da5c369Sopenharmony_ci        ENETUNREACH => "Network is unreachable",
2093da5c369Sopenharmony_ci        ENETRESET => "Network dropped connection because of reset",
2103da5c369Sopenharmony_ci        ECONNABORTED => "Software caused connection abort",
2113da5c369Sopenharmony_ci        ECONNRESET => "Connection reset by peer",
2123da5c369Sopenharmony_ci        ENOBUFS => "No buffer space available",
2133da5c369Sopenharmony_ci        EISCONN => "Transport endpoint is already connected",
2143da5c369Sopenharmony_ci        ENOTCONN => "Transport endpoint is not connected",
2153da5c369Sopenharmony_ci        ESHUTDOWN => "Cannot send after transport endpoint shutdown",
2163da5c369Sopenharmony_ci        #[cfg(not(target_os = "haiku"))]
2173da5c369Sopenharmony_ci        ETOOMANYREFS => "Too many references: cannot splice",
2183da5c369Sopenharmony_ci        ETIMEDOUT => "Connection timed out",
2193da5c369Sopenharmony_ci        ECONNREFUSED => "Connection refused",
2203da5c369Sopenharmony_ci        EHOSTDOWN => "Host is down",
2213da5c369Sopenharmony_ci        EHOSTUNREACH => "No route to host",
2223da5c369Sopenharmony_ci
2233da5c369Sopenharmony_ci        #[cfg(any(
2243da5c369Sopenharmony_ci            target_os = "linux",
2253da5c369Sopenharmony_ci            target_os = "android",
2263da5c369Sopenharmony_ci            target_os = "illumos",
2273da5c369Sopenharmony_ci            target_os = "solaris",
2283da5c369Sopenharmony_ci            target_os = "fuchsia"
2293da5c369Sopenharmony_ci        ))]
2303da5c369Sopenharmony_ci        ECHRNG => "Channel number out of range",
2313da5c369Sopenharmony_ci
2323da5c369Sopenharmony_ci        #[cfg(any(
2333da5c369Sopenharmony_ci            target_os = "linux",
2343da5c369Sopenharmony_ci            target_os = "android",
2353da5c369Sopenharmony_ci            target_os = "illumos",
2363da5c369Sopenharmony_ci            target_os = "solaris",
2373da5c369Sopenharmony_ci            target_os = "fuchsia"
2383da5c369Sopenharmony_ci        ))]
2393da5c369Sopenharmony_ci        EL2NSYNC => "Level 2 not synchronized",
2403da5c369Sopenharmony_ci
2413da5c369Sopenharmony_ci        #[cfg(any(
2423da5c369Sopenharmony_ci            target_os = "linux",
2433da5c369Sopenharmony_ci            target_os = "android",
2443da5c369Sopenharmony_ci            target_os = "illumos",
2453da5c369Sopenharmony_ci            target_os = "solaris",
2463da5c369Sopenharmony_ci            target_os = "fuchsia"
2473da5c369Sopenharmony_ci        ))]
2483da5c369Sopenharmony_ci        EL3HLT => "Level 3 halted",
2493da5c369Sopenharmony_ci
2503da5c369Sopenharmony_ci        #[cfg(any(
2513da5c369Sopenharmony_ci            target_os = "linux",
2523da5c369Sopenharmony_ci            target_os = "android",
2533da5c369Sopenharmony_ci            target_os = "illumos",
2543da5c369Sopenharmony_ci            target_os = "solaris",
2553da5c369Sopenharmony_ci            target_os = "fuchsia"
2563da5c369Sopenharmony_ci        ))]
2573da5c369Sopenharmony_ci        EL3RST => "Level 3 reset",
2583da5c369Sopenharmony_ci
2593da5c369Sopenharmony_ci        #[cfg(any(
2603da5c369Sopenharmony_ci            target_os = "linux",
2613da5c369Sopenharmony_ci            target_os = "android",
2623da5c369Sopenharmony_ci            target_os = "illumos",
2633da5c369Sopenharmony_ci            target_os = "solaris",
2643da5c369Sopenharmony_ci            target_os = "fuchsia"
2653da5c369Sopenharmony_ci        ))]
2663da5c369Sopenharmony_ci        ELNRNG => "Link number out of range",
2673da5c369Sopenharmony_ci
2683da5c369Sopenharmony_ci        #[cfg(any(
2693da5c369Sopenharmony_ci            target_os = "linux",
2703da5c369Sopenharmony_ci            target_os = "android",
2713da5c369Sopenharmony_ci            target_os = "illumos",
2723da5c369Sopenharmony_ci            target_os = "solaris",
2733da5c369Sopenharmony_ci            target_os = "fuchsia"
2743da5c369Sopenharmony_ci        ))]
2753da5c369Sopenharmony_ci        EUNATCH => "Protocol driver not attached",
2763da5c369Sopenharmony_ci
2773da5c369Sopenharmony_ci        #[cfg(any(
2783da5c369Sopenharmony_ci            target_os = "linux",
2793da5c369Sopenharmony_ci            target_os = "android",
2803da5c369Sopenharmony_ci            target_os = "illumos",
2813da5c369Sopenharmony_ci            target_os = "solaris",
2823da5c369Sopenharmony_ci            target_os = "fuchsia"
2833da5c369Sopenharmony_ci        ))]
2843da5c369Sopenharmony_ci        ENOCSI => "No CSI structure available",
2853da5c369Sopenharmony_ci
2863da5c369Sopenharmony_ci        #[cfg(any(
2873da5c369Sopenharmony_ci            target_os = "linux",
2883da5c369Sopenharmony_ci            target_os = "android",
2893da5c369Sopenharmony_ci            target_os = "illumos",
2903da5c369Sopenharmony_ci            target_os = "solaris",
2913da5c369Sopenharmony_ci            target_os = "fuchsia"
2923da5c369Sopenharmony_ci        ))]
2933da5c369Sopenharmony_ci        EL2HLT => "Level 2 halted",
2943da5c369Sopenharmony_ci
2953da5c369Sopenharmony_ci        #[cfg(any(
2963da5c369Sopenharmony_ci            target_os = "linux",
2973da5c369Sopenharmony_ci            target_os = "android",
2983da5c369Sopenharmony_ci            target_os = "illumos",
2993da5c369Sopenharmony_ci            target_os = "solaris",
3003da5c369Sopenharmony_ci            target_os = "fuchsia"
3013da5c369Sopenharmony_ci        ))]
3023da5c369Sopenharmony_ci        EBADE => "Invalid exchange",
3033da5c369Sopenharmony_ci
3043da5c369Sopenharmony_ci        #[cfg(any(
3053da5c369Sopenharmony_ci            target_os = "linux",
3063da5c369Sopenharmony_ci            target_os = "android",
3073da5c369Sopenharmony_ci            target_os = "illumos",
3083da5c369Sopenharmony_ci            target_os = "solaris",
3093da5c369Sopenharmony_ci            target_os = "fuchsia"
3103da5c369Sopenharmony_ci        ))]
3113da5c369Sopenharmony_ci        EBADR => "Invalid request descriptor",
3123da5c369Sopenharmony_ci
3133da5c369Sopenharmony_ci        #[cfg(any(
3143da5c369Sopenharmony_ci            target_os = "linux",
3153da5c369Sopenharmony_ci            target_os = "android",
3163da5c369Sopenharmony_ci            target_os = "illumos",
3173da5c369Sopenharmony_ci            target_os = "solaris",
3183da5c369Sopenharmony_ci            target_os = "fuchsia"
3193da5c369Sopenharmony_ci        ))]
3203da5c369Sopenharmony_ci        EXFULL => "Exchange full",
3213da5c369Sopenharmony_ci
3223da5c369Sopenharmony_ci        #[cfg(any(
3233da5c369Sopenharmony_ci            target_os = "linux",
3243da5c369Sopenharmony_ci            target_os = "android",
3253da5c369Sopenharmony_ci            target_os = "illumos",
3263da5c369Sopenharmony_ci            target_os = "solaris",
3273da5c369Sopenharmony_ci            target_os = "fuchsia"
3283da5c369Sopenharmony_ci        ))]
3293da5c369Sopenharmony_ci        ENOANO => "No anode",
3303da5c369Sopenharmony_ci
3313da5c369Sopenharmony_ci        #[cfg(any(
3323da5c369Sopenharmony_ci            target_os = "linux",
3333da5c369Sopenharmony_ci            target_os = "android",
3343da5c369Sopenharmony_ci            target_os = "illumos",
3353da5c369Sopenharmony_ci            target_os = "solaris",
3363da5c369Sopenharmony_ci            target_os = "fuchsia"
3373da5c369Sopenharmony_ci        ))]
3383da5c369Sopenharmony_ci        EBADRQC => "Invalid request code",
3393da5c369Sopenharmony_ci
3403da5c369Sopenharmony_ci        #[cfg(any(
3413da5c369Sopenharmony_ci            target_os = "linux",
3423da5c369Sopenharmony_ci            target_os = "android",
3433da5c369Sopenharmony_ci            target_os = "illumos",
3443da5c369Sopenharmony_ci            target_os = "solaris",
3453da5c369Sopenharmony_ci            target_os = "fuchsia"
3463da5c369Sopenharmony_ci        ))]
3473da5c369Sopenharmony_ci        EBADSLT => "Invalid slot",
3483da5c369Sopenharmony_ci
3493da5c369Sopenharmony_ci        #[cfg(any(
3503da5c369Sopenharmony_ci            target_os = "linux",
3513da5c369Sopenharmony_ci            target_os = "android",
3523da5c369Sopenharmony_ci            target_os = "illumos",
3533da5c369Sopenharmony_ci            target_os = "solaris",
3543da5c369Sopenharmony_ci            target_os = "fuchsia"
3553da5c369Sopenharmony_ci        ))]
3563da5c369Sopenharmony_ci        EBFONT => "Bad font file format",
3573da5c369Sopenharmony_ci
3583da5c369Sopenharmony_ci        #[cfg(any(
3593da5c369Sopenharmony_ci            target_os = "linux",
3603da5c369Sopenharmony_ci            target_os = "android",
3613da5c369Sopenharmony_ci            target_os = "illumos",
3623da5c369Sopenharmony_ci            target_os = "solaris",
3633da5c369Sopenharmony_ci            target_os = "fuchsia"
3643da5c369Sopenharmony_ci        ))]
3653da5c369Sopenharmony_ci        ENOSTR => "Device not a stream",
3663da5c369Sopenharmony_ci
3673da5c369Sopenharmony_ci        #[cfg(any(
3683da5c369Sopenharmony_ci            target_os = "linux",
3693da5c369Sopenharmony_ci            target_os = "android",
3703da5c369Sopenharmony_ci            target_os = "illumos",
3713da5c369Sopenharmony_ci            target_os = "solaris",
3723da5c369Sopenharmony_ci            target_os = "fuchsia"
3733da5c369Sopenharmony_ci        ))]
3743da5c369Sopenharmony_ci        ENODATA => "No data available",
3753da5c369Sopenharmony_ci
3763da5c369Sopenharmony_ci        #[cfg(any(
3773da5c369Sopenharmony_ci            target_os = "linux",
3783da5c369Sopenharmony_ci            target_os = "android",
3793da5c369Sopenharmony_ci            target_os = "illumos",
3803da5c369Sopenharmony_ci            target_os = "solaris",
3813da5c369Sopenharmony_ci            target_os = "fuchsia"
3823da5c369Sopenharmony_ci        ))]
3833da5c369Sopenharmony_ci        ETIME => "Timer expired",
3843da5c369Sopenharmony_ci
3853da5c369Sopenharmony_ci        #[cfg(any(
3863da5c369Sopenharmony_ci            target_os = "linux",
3873da5c369Sopenharmony_ci            target_os = "android",
3883da5c369Sopenharmony_ci            target_os = "illumos",
3893da5c369Sopenharmony_ci            target_os = "solaris",
3903da5c369Sopenharmony_ci            target_os = "fuchsia"
3913da5c369Sopenharmony_ci        ))]
3923da5c369Sopenharmony_ci        ENOSR => "Out of streams resources",
3933da5c369Sopenharmony_ci
3943da5c369Sopenharmony_ci        #[cfg(any(
3953da5c369Sopenharmony_ci            target_os = "linux",
3963da5c369Sopenharmony_ci            target_os = "android",
3973da5c369Sopenharmony_ci            target_os = "illumos",
3983da5c369Sopenharmony_ci            target_os = "solaris",
3993da5c369Sopenharmony_ci            target_os = "fuchsia"
4003da5c369Sopenharmony_ci        ))]
4013da5c369Sopenharmony_ci        ENONET => "Machine is not on the network",
4023da5c369Sopenharmony_ci
4033da5c369Sopenharmony_ci        #[cfg(any(
4043da5c369Sopenharmony_ci            target_os = "linux",
4053da5c369Sopenharmony_ci            target_os = "android",
4063da5c369Sopenharmony_ci            target_os = "illumos",
4073da5c369Sopenharmony_ci            target_os = "solaris",
4083da5c369Sopenharmony_ci            target_os = "fuchsia"
4093da5c369Sopenharmony_ci        ))]
4103da5c369Sopenharmony_ci        ENOPKG => "Package not installed",
4113da5c369Sopenharmony_ci
4123da5c369Sopenharmony_ci        #[cfg(any(
4133da5c369Sopenharmony_ci            target_os = "linux",
4143da5c369Sopenharmony_ci            target_os = "android",
4153da5c369Sopenharmony_ci            target_os = "illumos",
4163da5c369Sopenharmony_ci            target_os = "solaris",
4173da5c369Sopenharmony_ci            target_os = "fuchsia"
4183da5c369Sopenharmony_ci        ))]
4193da5c369Sopenharmony_ci        EREMOTE => "Object is remote",
4203da5c369Sopenharmony_ci
4213da5c369Sopenharmony_ci        #[cfg(any(
4223da5c369Sopenharmony_ci            target_os = "linux",
4233da5c369Sopenharmony_ci            target_os = "android",
4243da5c369Sopenharmony_ci            target_os = "illumos",
4253da5c369Sopenharmony_ci            target_os = "solaris",
4263da5c369Sopenharmony_ci            target_os = "fuchsia"
4273da5c369Sopenharmony_ci        ))]
4283da5c369Sopenharmony_ci        ENOLINK => "Link has been severed",
4293da5c369Sopenharmony_ci
4303da5c369Sopenharmony_ci        #[cfg(any(
4313da5c369Sopenharmony_ci            target_os = "linux",
4323da5c369Sopenharmony_ci            target_os = "android",
4333da5c369Sopenharmony_ci            target_os = "illumos",
4343da5c369Sopenharmony_ci            target_os = "solaris",
4353da5c369Sopenharmony_ci            target_os = "fuchsia"
4363da5c369Sopenharmony_ci        ))]
4373da5c369Sopenharmony_ci        EADV => "Advertise error",
4383da5c369Sopenharmony_ci
4393da5c369Sopenharmony_ci        #[cfg(any(
4403da5c369Sopenharmony_ci            target_os = "linux",
4413da5c369Sopenharmony_ci            target_os = "android",
4423da5c369Sopenharmony_ci            target_os = "illumos",
4433da5c369Sopenharmony_ci            target_os = "solaris",
4443da5c369Sopenharmony_ci            target_os = "fuchsia"
4453da5c369Sopenharmony_ci        ))]
4463da5c369Sopenharmony_ci        ESRMNT => "Srmount error",
4473da5c369Sopenharmony_ci
4483da5c369Sopenharmony_ci        #[cfg(any(
4493da5c369Sopenharmony_ci            target_os = "linux",
4503da5c369Sopenharmony_ci            target_os = "android",
4513da5c369Sopenharmony_ci            target_os = "illumos",
4523da5c369Sopenharmony_ci            target_os = "solaris",
4533da5c369Sopenharmony_ci            target_os = "fuchsia"
4543da5c369Sopenharmony_ci        ))]
4553da5c369Sopenharmony_ci        ECOMM => "Communication error on send",
4563da5c369Sopenharmony_ci
4573da5c369Sopenharmony_ci        #[cfg(any(
4583da5c369Sopenharmony_ci            target_os = "linux",
4593da5c369Sopenharmony_ci            target_os = "android",
4603da5c369Sopenharmony_ci            target_os = "illumos",
4613da5c369Sopenharmony_ci            target_os = "solaris",
4623da5c369Sopenharmony_ci            target_os = "fuchsia"
4633da5c369Sopenharmony_ci        ))]
4643da5c369Sopenharmony_ci        EPROTO => "Protocol error",
4653da5c369Sopenharmony_ci
4663da5c369Sopenharmony_ci        #[cfg(any(
4673da5c369Sopenharmony_ci            target_os = "linux",
4683da5c369Sopenharmony_ci            target_os = "android",
4693da5c369Sopenharmony_ci            target_os = "illumos",
4703da5c369Sopenharmony_ci            target_os = "solaris",
4713da5c369Sopenharmony_ci            target_os = "fuchsia"
4723da5c369Sopenharmony_ci        ))]
4733da5c369Sopenharmony_ci        EMULTIHOP => "Multihop attempted",
4743da5c369Sopenharmony_ci
4753da5c369Sopenharmony_ci        #[cfg(any(
4763da5c369Sopenharmony_ci            target_os = "linux",
4773da5c369Sopenharmony_ci            target_os = "android",
4783da5c369Sopenharmony_ci            target_os = "fuchsia"
4793da5c369Sopenharmony_ci        ))]
4803da5c369Sopenharmony_ci        EDOTDOT => "RFS specific error",
4813da5c369Sopenharmony_ci
4823da5c369Sopenharmony_ci        #[cfg(any(
4833da5c369Sopenharmony_ci            target_os = "linux",
4843da5c369Sopenharmony_ci            target_os = "android",
4853da5c369Sopenharmony_ci            target_os = "fuchsia"
4863da5c369Sopenharmony_ci        ))]
4873da5c369Sopenharmony_ci        EBADMSG => "Not a data message",
4883da5c369Sopenharmony_ci
4893da5c369Sopenharmony_ci        #[cfg(any(target_os = "illumos", target_os = "solaris"))]
4903da5c369Sopenharmony_ci        EBADMSG => "Trying to read unreadable message",
4913da5c369Sopenharmony_ci
4923da5c369Sopenharmony_ci        #[cfg(any(
4933da5c369Sopenharmony_ci            target_os = "linux",
4943da5c369Sopenharmony_ci            target_os = "android",
4953da5c369Sopenharmony_ci            target_os = "fuchsia",
4963da5c369Sopenharmony_ci            target_os = "haiku"
4973da5c369Sopenharmony_ci        ))]
4983da5c369Sopenharmony_ci        EOVERFLOW => "Value too large for defined data type",
4993da5c369Sopenharmony_ci
5003da5c369Sopenharmony_ci        #[cfg(any(
5013da5c369Sopenharmony_ci            target_os = "linux",
5023da5c369Sopenharmony_ci            target_os = "android",
5033da5c369Sopenharmony_ci            target_os = "illumos",
5043da5c369Sopenharmony_ci            target_os = "solaris",
5053da5c369Sopenharmony_ci            target_os = "fuchsia"
5063da5c369Sopenharmony_ci        ))]
5073da5c369Sopenharmony_ci        ENOTUNIQ => "Name not unique on network",
5083da5c369Sopenharmony_ci
5093da5c369Sopenharmony_ci        #[cfg(any(
5103da5c369Sopenharmony_ci            target_os = "linux",
5113da5c369Sopenharmony_ci            target_os = "android",
5123da5c369Sopenharmony_ci            target_os = "illumos",
5133da5c369Sopenharmony_ci            target_os = "solaris",
5143da5c369Sopenharmony_ci            target_os = "fuchsia"
5153da5c369Sopenharmony_ci        ))]
5163da5c369Sopenharmony_ci        EBADFD => "File descriptor in bad state",
5173da5c369Sopenharmony_ci
5183da5c369Sopenharmony_ci        #[cfg(any(
5193da5c369Sopenharmony_ci            target_os = "linux",
5203da5c369Sopenharmony_ci            target_os = "android",
5213da5c369Sopenharmony_ci            target_os = "illumos",
5223da5c369Sopenharmony_ci            target_os = "solaris",
5233da5c369Sopenharmony_ci            target_os = "fuchsia"
5243da5c369Sopenharmony_ci        ))]
5253da5c369Sopenharmony_ci        EREMCHG => "Remote address changed",
5263da5c369Sopenharmony_ci
5273da5c369Sopenharmony_ci        #[cfg(any(
5283da5c369Sopenharmony_ci            target_os = "linux",
5293da5c369Sopenharmony_ci            target_os = "android",
5303da5c369Sopenharmony_ci            target_os = "illumos",
5313da5c369Sopenharmony_ci            target_os = "solaris",
5323da5c369Sopenharmony_ci            target_os = "fuchsia"
5333da5c369Sopenharmony_ci        ))]
5343da5c369Sopenharmony_ci        ELIBACC => "Can not access a needed shared library",
5353da5c369Sopenharmony_ci
5363da5c369Sopenharmony_ci        #[cfg(any(
5373da5c369Sopenharmony_ci            target_os = "linux",
5383da5c369Sopenharmony_ci            target_os = "android",
5393da5c369Sopenharmony_ci            target_os = "illumos",
5403da5c369Sopenharmony_ci            target_os = "solaris",
5413da5c369Sopenharmony_ci            target_os = "fuchsia"
5423da5c369Sopenharmony_ci        ))]
5433da5c369Sopenharmony_ci        ELIBBAD => "Accessing a corrupted shared library",
5443da5c369Sopenharmony_ci
5453da5c369Sopenharmony_ci        #[cfg(any(
5463da5c369Sopenharmony_ci            target_os = "linux",
5473da5c369Sopenharmony_ci            target_os = "android",
5483da5c369Sopenharmony_ci            target_os = "illumos",
5493da5c369Sopenharmony_ci            target_os = "solaris",
5503da5c369Sopenharmony_ci            target_os = "fuchsia"
5513da5c369Sopenharmony_ci        ))]
5523da5c369Sopenharmony_ci        ELIBSCN => ".lib section in a.out corrupted",
5533da5c369Sopenharmony_ci
5543da5c369Sopenharmony_ci        #[cfg(any(
5553da5c369Sopenharmony_ci            target_os = "linux",
5563da5c369Sopenharmony_ci            target_os = "android",
5573da5c369Sopenharmony_ci            target_os = "illumos",
5583da5c369Sopenharmony_ci            target_os = "solaris",
5593da5c369Sopenharmony_ci            target_os = "fuchsia"
5603da5c369Sopenharmony_ci        ))]
5613da5c369Sopenharmony_ci        ELIBMAX => "Attempting to link in too many shared libraries",
5623da5c369Sopenharmony_ci
5633da5c369Sopenharmony_ci        #[cfg(any(
5643da5c369Sopenharmony_ci            target_os = "linux",
5653da5c369Sopenharmony_ci            target_os = "android",
5663da5c369Sopenharmony_ci            target_os = "illumos",
5673da5c369Sopenharmony_ci            target_os = "solaris",
5683da5c369Sopenharmony_ci            target_os = "fuchsia"
5693da5c369Sopenharmony_ci        ))]
5703da5c369Sopenharmony_ci        ELIBEXEC => "Cannot exec a shared library directly",
5713da5c369Sopenharmony_ci
5723da5c369Sopenharmony_ci        #[cfg(any(
5733da5c369Sopenharmony_ci            target_os = "linux",
5743da5c369Sopenharmony_ci            target_os = "android",
5753da5c369Sopenharmony_ci            target_os = "illumos",
5763da5c369Sopenharmony_ci            target_os = "solaris",
5773da5c369Sopenharmony_ci            target_os = "fuchsia",
5783da5c369Sopenharmony_ci            target_os = "openbsd"
5793da5c369Sopenharmony_ci        ))]
5803da5c369Sopenharmony_ci        EILSEQ => "Illegal byte sequence",
5813da5c369Sopenharmony_ci
5823da5c369Sopenharmony_ci        #[cfg(any(
5833da5c369Sopenharmony_ci            target_os = "linux",
5843da5c369Sopenharmony_ci            target_os = "android",
5853da5c369Sopenharmony_ci            target_os = "illumos",
5863da5c369Sopenharmony_ci            target_os = "solaris",
5873da5c369Sopenharmony_ci            target_os = "fuchsia"
5883da5c369Sopenharmony_ci        ))]
5893da5c369Sopenharmony_ci        ERESTART => "Interrupted system call should be restarted",
5903da5c369Sopenharmony_ci
5913da5c369Sopenharmony_ci        #[cfg(any(
5923da5c369Sopenharmony_ci            target_os = "linux",
5933da5c369Sopenharmony_ci            target_os = "android",
5943da5c369Sopenharmony_ci            target_os = "illumos",
5953da5c369Sopenharmony_ci            target_os = "solaris",
5963da5c369Sopenharmony_ci            target_os = "fuchsia"
5973da5c369Sopenharmony_ci        ))]
5983da5c369Sopenharmony_ci        ESTRPIPE => "Streams pipe error",
5993da5c369Sopenharmony_ci
6003da5c369Sopenharmony_ci        #[cfg(any(
6013da5c369Sopenharmony_ci            target_os = "linux",
6023da5c369Sopenharmony_ci            target_os = "android",
6033da5c369Sopenharmony_ci            target_os = "illumos",
6043da5c369Sopenharmony_ci            target_os = "solaris",
6053da5c369Sopenharmony_ci            target_os = "fuchsia"
6063da5c369Sopenharmony_ci        ))]
6073da5c369Sopenharmony_ci        EUSERS => "Too many users",
6083da5c369Sopenharmony_ci
6093da5c369Sopenharmony_ci        #[cfg(any(
6103da5c369Sopenharmony_ci            target_os = "linux",
6113da5c369Sopenharmony_ci            target_os = "android",
6123da5c369Sopenharmony_ci            target_os = "fuchsia",
6133da5c369Sopenharmony_ci            target_os = "netbsd",
6143da5c369Sopenharmony_ci            target_os = "redox"
6153da5c369Sopenharmony_ci        ))]
6163da5c369Sopenharmony_ci        EOPNOTSUPP => "Operation not supported on transport endpoint",
6173da5c369Sopenharmony_ci
6183da5c369Sopenharmony_ci        #[cfg(any(
6193da5c369Sopenharmony_ci            target_os = "linux",
6203da5c369Sopenharmony_ci            target_os = "android",
6213da5c369Sopenharmony_ci            target_os = "fuchsia"
6223da5c369Sopenharmony_ci        ))]
6233da5c369Sopenharmony_ci        ESTALE => "Stale file handle",
6243da5c369Sopenharmony_ci
6253da5c369Sopenharmony_ci        #[cfg(any(
6263da5c369Sopenharmony_ci            target_os = "linux",
6273da5c369Sopenharmony_ci            target_os = "android",
6283da5c369Sopenharmony_ci            target_os = "fuchsia"
6293da5c369Sopenharmony_ci        ))]
6303da5c369Sopenharmony_ci        EUCLEAN => "Structure needs cleaning",
6313da5c369Sopenharmony_ci
6323da5c369Sopenharmony_ci        #[cfg(any(
6333da5c369Sopenharmony_ci            target_os = "linux",
6343da5c369Sopenharmony_ci            target_os = "android",
6353da5c369Sopenharmony_ci            target_os = "fuchsia"
6363da5c369Sopenharmony_ci        ))]
6373da5c369Sopenharmony_ci        ENOTNAM => "Not a XENIX named type file",
6383da5c369Sopenharmony_ci
6393da5c369Sopenharmony_ci        #[cfg(any(
6403da5c369Sopenharmony_ci            target_os = "linux",
6413da5c369Sopenharmony_ci            target_os = "android",
6423da5c369Sopenharmony_ci            target_os = "fuchsia"
6433da5c369Sopenharmony_ci        ))]
6443da5c369Sopenharmony_ci        ENAVAIL => "No XENIX semaphores available",
6453da5c369Sopenharmony_ci
6463da5c369Sopenharmony_ci        #[cfg(any(
6473da5c369Sopenharmony_ci            target_os = "linux",
6483da5c369Sopenharmony_ci            target_os = "android",
6493da5c369Sopenharmony_ci            target_os = "fuchsia"
6503da5c369Sopenharmony_ci        ))]
6513da5c369Sopenharmony_ci        EISNAM => "Is a named type file",
6523da5c369Sopenharmony_ci
6533da5c369Sopenharmony_ci        #[cfg(any(
6543da5c369Sopenharmony_ci            target_os = "linux",
6553da5c369Sopenharmony_ci            target_os = "android",
6563da5c369Sopenharmony_ci            target_os = "fuchsia"
6573da5c369Sopenharmony_ci        ))]
6583da5c369Sopenharmony_ci        EREMOTEIO => "Remote I/O error",
6593da5c369Sopenharmony_ci
6603da5c369Sopenharmony_ci        #[cfg(any(
6613da5c369Sopenharmony_ci            target_os = "linux",
6623da5c369Sopenharmony_ci            target_os = "android",
6633da5c369Sopenharmony_ci            target_os = "fuchsia"
6643da5c369Sopenharmony_ci        ))]
6653da5c369Sopenharmony_ci        EDQUOT => "Quota exceeded",
6663da5c369Sopenharmony_ci
6673da5c369Sopenharmony_ci        #[cfg(any(
6683da5c369Sopenharmony_ci            target_os = "linux",
6693da5c369Sopenharmony_ci            target_os = "android",
6703da5c369Sopenharmony_ci            target_os = "fuchsia",
6713da5c369Sopenharmony_ci            target_os = "openbsd",
6723da5c369Sopenharmony_ci            target_os = "dragonfly"
6733da5c369Sopenharmony_ci        ))]
6743da5c369Sopenharmony_ci        ENOMEDIUM => "No medium found",
6753da5c369Sopenharmony_ci
6763da5c369Sopenharmony_ci        #[cfg(any(
6773da5c369Sopenharmony_ci            target_os = "linux",
6783da5c369Sopenharmony_ci            target_os = "android",
6793da5c369Sopenharmony_ci            target_os = "fuchsia",
6803da5c369Sopenharmony_ci            target_os = "openbsd"
6813da5c369Sopenharmony_ci        ))]
6823da5c369Sopenharmony_ci        EMEDIUMTYPE => "Wrong medium type",
6833da5c369Sopenharmony_ci
6843da5c369Sopenharmony_ci        #[cfg(any(
6853da5c369Sopenharmony_ci            target_os = "linux",
6863da5c369Sopenharmony_ci            target_os = "android",
6873da5c369Sopenharmony_ci            target_os = "illumos",
6883da5c369Sopenharmony_ci            target_os = "solaris",
6893da5c369Sopenharmony_ci            target_os = "fuchsia",
6903da5c369Sopenharmony_ci            target_os = "haiku"
6913da5c369Sopenharmony_ci        ))]
6923da5c369Sopenharmony_ci        ECANCELED => "Operation canceled",
6933da5c369Sopenharmony_ci
6943da5c369Sopenharmony_ci        #[cfg(any(
6953da5c369Sopenharmony_ci            target_os = "linux",
6963da5c369Sopenharmony_ci            target_os = "android",
6973da5c369Sopenharmony_ci            target_os = "fuchsia"
6983da5c369Sopenharmony_ci        ))]
6993da5c369Sopenharmony_ci        ENOKEY => "Required key not available",
7003da5c369Sopenharmony_ci
7013da5c369Sopenharmony_ci        #[cfg(any(
7023da5c369Sopenharmony_ci            target_os = "linux",
7033da5c369Sopenharmony_ci            target_os = "android",
7043da5c369Sopenharmony_ci            target_os = "fuchsia"
7053da5c369Sopenharmony_ci        ))]
7063da5c369Sopenharmony_ci        EKEYEXPIRED => "Key has expired",
7073da5c369Sopenharmony_ci
7083da5c369Sopenharmony_ci        #[cfg(any(
7093da5c369Sopenharmony_ci            target_os = "linux",
7103da5c369Sopenharmony_ci            target_os = "android",
7113da5c369Sopenharmony_ci            target_os = "fuchsia"
7123da5c369Sopenharmony_ci        ))]
7133da5c369Sopenharmony_ci        EKEYREVOKED => "Key has been revoked",
7143da5c369Sopenharmony_ci
7153da5c369Sopenharmony_ci        #[cfg(any(
7163da5c369Sopenharmony_ci            target_os = "linux",
7173da5c369Sopenharmony_ci            target_os = "android",
7183da5c369Sopenharmony_ci            target_os = "fuchsia"
7193da5c369Sopenharmony_ci        ))]
7203da5c369Sopenharmony_ci        EKEYREJECTED => "Key was rejected by service",
7213da5c369Sopenharmony_ci
7223da5c369Sopenharmony_ci        #[cfg(any(
7233da5c369Sopenharmony_ci            target_os = "linux",
7243da5c369Sopenharmony_ci            target_os = "android",
7253da5c369Sopenharmony_ci            target_os = "fuchsia"
7263da5c369Sopenharmony_ci        ))]
7273da5c369Sopenharmony_ci        EOWNERDEAD => "Owner died",
7283da5c369Sopenharmony_ci
7293da5c369Sopenharmony_ci        #[cfg(any(target_os = "illumos", target_os = "solaris"))]
7303da5c369Sopenharmony_ci        EOWNERDEAD => "Process died with lock",
7313da5c369Sopenharmony_ci
7323da5c369Sopenharmony_ci        #[cfg(any(
7333da5c369Sopenharmony_ci            target_os = "linux",
7343da5c369Sopenharmony_ci            target_os = "android",
7353da5c369Sopenharmony_ci            target_os = "fuchsia"
7363da5c369Sopenharmony_ci        ))]
7373da5c369Sopenharmony_ci        ENOTRECOVERABLE => "State not recoverable",
7383da5c369Sopenharmony_ci
7393da5c369Sopenharmony_ci        #[cfg(any(target_os = "illumos", target_os = "solaris"))]
7403da5c369Sopenharmony_ci        ENOTRECOVERABLE => "Lock is not recoverable",
7413da5c369Sopenharmony_ci
7423da5c369Sopenharmony_ci        #[cfg(any(
7433da5c369Sopenharmony_ci            all(target_os = "linux", not(target_arch = "mips")),
7443da5c369Sopenharmony_ci            target_os = "fuchsia"
7453da5c369Sopenharmony_ci        ))]
7463da5c369Sopenharmony_ci        ERFKILL => "Operation not possible due to RF-kill",
7473da5c369Sopenharmony_ci
7483da5c369Sopenharmony_ci        #[cfg(any(
7493da5c369Sopenharmony_ci            all(target_os = "linux", not(target_arch = "mips")),
7503da5c369Sopenharmony_ci            target_os = "fuchsia"
7513da5c369Sopenharmony_ci        ))]
7523da5c369Sopenharmony_ci        EHWPOISON => "Memory page has hardware error",
7533da5c369Sopenharmony_ci
7543da5c369Sopenharmony_ci        #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
7553da5c369Sopenharmony_ci        EDOOFUS => "Programming error",
7563da5c369Sopenharmony_ci
7573da5c369Sopenharmony_ci        #[cfg(any(
7583da5c369Sopenharmony_ci            target_os = "freebsd",
7593da5c369Sopenharmony_ci            target_os = "dragonfly",
7603da5c369Sopenharmony_ci            target_os = "redox"
7613da5c369Sopenharmony_ci        ))]
7623da5c369Sopenharmony_ci        EMULTIHOP => "Multihop attempted",
7633da5c369Sopenharmony_ci
7643da5c369Sopenharmony_ci        #[cfg(any(
7653da5c369Sopenharmony_ci            target_os = "freebsd",
7663da5c369Sopenharmony_ci            target_os = "dragonfly",
7673da5c369Sopenharmony_ci            target_os = "redox"
7683da5c369Sopenharmony_ci        ))]
7693da5c369Sopenharmony_ci        ENOLINK => "Link has been severed",
7703da5c369Sopenharmony_ci
7713da5c369Sopenharmony_ci        #[cfg(target_os = "freebsd")]
7723da5c369Sopenharmony_ci        ENOTCAPABLE => "Capabilities insufficient",
7733da5c369Sopenharmony_ci
7743da5c369Sopenharmony_ci        #[cfg(target_os = "freebsd")]
7753da5c369Sopenharmony_ci        ECAPMODE => "Not permitted in capability mode",
7763da5c369Sopenharmony_ci
7773da5c369Sopenharmony_ci        #[cfg(any(
7783da5c369Sopenharmony_ci            target_os = "macos",
7793da5c369Sopenharmony_ci            target_os = "freebsd",
7803da5c369Sopenharmony_ci            target_os = "dragonfly",
7813da5c369Sopenharmony_ci            target_os = "ios",
7823da5c369Sopenharmony_ci            target_os = "openbsd",
7833da5c369Sopenharmony_ci            target_os = "netbsd"
7843da5c369Sopenharmony_ci        ))]
7853da5c369Sopenharmony_ci        ENEEDAUTH => "Need authenticator",
7863da5c369Sopenharmony_ci
7873da5c369Sopenharmony_ci        #[cfg(any(
7883da5c369Sopenharmony_ci            target_os = "macos",
7893da5c369Sopenharmony_ci            target_os = "freebsd",
7903da5c369Sopenharmony_ci            target_os = "dragonfly",
7913da5c369Sopenharmony_ci            target_os = "ios",
7923da5c369Sopenharmony_ci            target_os = "openbsd",
7933da5c369Sopenharmony_ci            target_os = "netbsd",
7943da5c369Sopenharmony_ci            target_os = "redox",
7953da5c369Sopenharmony_ci            target_os = "illumos",
7963da5c369Sopenharmony_ci            target_os = "solaris"
7973da5c369Sopenharmony_ci        ))]
7983da5c369Sopenharmony_ci        EOVERFLOW => "Value too large to be stored in data type",
7993da5c369Sopenharmony_ci
8003da5c369Sopenharmony_ci        #[cfg(any(
8013da5c369Sopenharmony_ci            target_os = "macos",
8023da5c369Sopenharmony_ci            target_os = "freebsd",
8033da5c369Sopenharmony_ci            target_os = "dragonfly",
8043da5c369Sopenharmony_ci            target_os = "ios",
8053da5c369Sopenharmony_ci            target_os = "netbsd",
8063da5c369Sopenharmony_ci            target_os = "redox",
8073da5c369Sopenharmony_ci            target_os = "haiku"
8083da5c369Sopenharmony_ci        ))]
8093da5c369Sopenharmony_ci        EILSEQ => "Illegal byte sequence",
8103da5c369Sopenharmony_ci
8113da5c369Sopenharmony_ci        #[cfg(any(
8123da5c369Sopenharmony_ci            target_os = "macos",
8133da5c369Sopenharmony_ci            target_os = "freebsd",
8143da5c369Sopenharmony_ci            target_os = "dragonfly",
8153da5c369Sopenharmony_ci            target_os = "ios",
8163da5c369Sopenharmony_ci            target_os = "openbsd",
8173da5c369Sopenharmony_ci            target_os = "netbsd",
8183da5c369Sopenharmony_ci            target_os = "haiku"
8193da5c369Sopenharmony_ci        ))]
8203da5c369Sopenharmony_ci        ENOATTR => "Attribute not found",
8213da5c369Sopenharmony_ci
8223da5c369Sopenharmony_ci        #[cfg(any(
8233da5c369Sopenharmony_ci            target_os = "macos",
8243da5c369Sopenharmony_ci            target_os = "freebsd",
8253da5c369Sopenharmony_ci            target_os = "dragonfly",
8263da5c369Sopenharmony_ci            target_os = "ios",
8273da5c369Sopenharmony_ci            target_os = "openbsd",
8283da5c369Sopenharmony_ci            target_os = "netbsd",
8293da5c369Sopenharmony_ci            target_os = "redox",
8303da5c369Sopenharmony_ci            target_os = "haiku"
8313da5c369Sopenharmony_ci        ))]
8323da5c369Sopenharmony_ci        EBADMSG => "Bad message",
8333da5c369Sopenharmony_ci
8343da5c369Sopenharmony_ci        #[cfg(any(
8353da5c369Sopenharmony_ci            target_os = "macos",
8363da5c369Sopenharmony_ci            target_os = "freebsd",
8373da5c369Sopenharmony_ci            target_os = "dragonfly",
8383da5c369Sopenharmony_ci            target_os = "ios",
8393da5c369Sopenharmony_ci            target_os = "openbsd",
8403da5c369Sopenharmony_ci            target_os = "netbsd",
8413da5c369Sopenharmony_ci            target_os = "redox",
8423da5c369Sopenharmony_ci            target_os = "haiku"
8433da5c369Sopenharmony_ci        ))]
8443da5c369Sopenharmony_ci        EPROTO => "Protocol error",
8453da5c369Sopenharmony_ci
8463da5c369Sopenharmony_ci        #[cfg(any(
8473da5c369Sopenharmony_ci            target_os = "macos",
8483da5c369Sopenharmony_ci            target_os = "freebsd",
8493da5c369Sopenharmony_ci            target_os = "dragonfly",
8503da5c369Sopenharmony_ci            target_os = "ios",
8513da5c369Sopenharmony_ci            target_os = "openbsd"
8523da5c369Sopenharmony_ci        ))]
8533da5c369Sopenharmony_ci        ENOTRECOVERABLE => "State not recoverable",
8543da5c369Sopenharmony_ci
8553da5c369Sopenharmony_ci        #[cfg(any(
8563da5c369Sopenharmony_ci            target_os = "macos",
8573da5c369Sopenharmony_ci            target_os = "freebsd",
8583da5c369Sopenharmony_ci            target_os = "dragonfly",
8593da5c369Sopenharmony_ci            target_os = "ios",
8603da5c369Sopenharmony_ci            target_os = "openbsd"
8613da5c369Sopenharmony_ci        ))]
8623da5c369Sopenharmony_ci        EOWNERDEAD => "Previous owner died",
8633da5c369Sopenharmony_ci
8643da5c369Sopenharmony_ci        #[cfg(any(
8653da5c369Sopenharmony_ci            target_os = "macos",
8663da5c369Sopenharmony_ci            target_os = "freebsd",
8673da5c369Sopenharmony_ci            target_os = "dragonfly",
8683da5c369Sopenharmony_ci            target_os = "ios",
8693da5c369Sopenharmony_ci            target_os = "openbsd",
8703da5c369Sopenharmony_ci            target_os = "netbsd",
8713da5c369Sopenharmony_ci            target_os = "illumos",
8723da5c369Sopenharmony_ci            target_os = "solaris",
8733da5c369Sopenharmony_ci            target_os = "haiku"
8743da5c369Sopenharmony_ci        ))]
8753da5c369Sopenharmony_ci        ENOTSUP => "Operation not supported",
8763da5c369Sopenharmony_ci
8773da5c369Sopenharmony_ci        #[cfg(any(
8783da5c369Sopenharmony_ci            target_os = "macos",
8793da5c369Sopenharmony_ci            target_os = "freebsd",
8803da5c369Sopenharmony_ci            target_os = "dragonfly",
8813da5c369Sopenharmony_ci            target_os = "ios",
8823da5c369Sopenharmony_ci            target_os = "openbsd",
8833da5c369Sopenharmony_ci            target_os = "netbsd"
8843da5c369Sopenharmony_ci        ))]
8853da5c369Sopenharmony_ci        EPROCLIM => "Too many processes",
8863da5c369Sopenharmony_ci
8873da5c369Sopenharmony_ci        #[cfg(any(
8883da5c369Sopenharmony_ci            target_os = "macos",
8893da5c369Sopenharmony_ci            target_os = "freebsd",
8903da5c369Sopenharmony_ci            target_os = "dragonfly",
8913da5c369Sopenharmony_ci            target_os = "ios",
8923da5c369Sopenharmony_ci            target_os = "openbsd",
8933da5c369Sopenharmony_ci            target_os = "netbsd",
8943da5c369Sopenharmony_ci            target_os = "redox"
8953da5c369Sopenharmony_ci        ))]
8963da5c369Sopenharmony_ci        EUSERS => "Too many users",
8973da5c369Sopenharmony_ci
8983da5c369Sopenharmony_ci        #[cfg(any(
8993da5c369Sopenharmony_ci            target_os = "macos",
9003da5c369Sopenharmony_ci            target_os = "freebsd",
9013da5c369Sopenharmony_ci            target_os = "dragonfly",
9023da5c369Sopenharmony_ci            target_os = "ios",
9033da5c369Sopenharmony_ci            target_os = "openbsd",
9043da5c369Sopenharmony_ci            target_os = "netbsd",
9053da5c369Sopenharmony_ci            target_os = "redox",
9063da5c369Sopenharmony_ci            target_os = "illumos",
9073da5c369Sopenharmony_ci            target_os = "solaris",
9083da5c369Sopenharmony_ci            target_os = "haiku"
9093da5c369Sopenharmony_ci        ))]
9103da5c369Sopenharmony_ci        EDQUOT => "Disc quota exceeded",
9113da5c369Sopenharmony_ci
9123da5c369Sopenharmony_ci        #[cfg(any(
9133da5c369Sopenharmony_ci            target_os = "macos",
9143da5c369Sopenharmony_ci            target_os = "freebsd",
9153da5c369Sopenharmony_ci            target_os = "dragonfly",
9163da5c369Sopenharmony_ci            target_os = "ios",
9173da5c369Sopenharmony_ci            target_os = "openbsd",
9183da5c369Sopenharmony_ci            target_os = "netbsd",
9193da5c369Sopenharmony_ci            target_os = "redox",
9203da5c369Sopenharmony_ci            target_os = "illumos",
9213da5c369Sopenharmony_ci            target_os = "solaris",
9223da5c369Sopenharmony_ci            target_os = "haiku"
9233da5c369Sopenharmony_ci        ))]
9243da5c369Sopenharmony_ci        ESTALE => "Stale NFS file handle",
9253da5c369Sopenharmony_ci
9263da5c369Sopenharmony_ci        #[cfg(any(
9273da5c369Sopenharmony_ci            target_os = "macos",
9283da5c369Sopenharmony_ci            target_os = "freebsd",
9293da5c369Sopenharmony_ci            target_os = "dragonfly",
9303da5c369Sopenharmony_ci            target_os = "ios",
9313da5c369Sopenharmony_ci            target_os = "openbsd",
9323da5c369Sopenharmony_ci            target_os = "netbsd",
9333da5c369Sopenharmony_ci            target_os = "redox"
9343da5c369Sopenharmony_ci        ))]
9353da5c369Sopenharmony_ci        EREMOTE => "Too many levels of remote in path",
9363da5c369Sopenharmony_ci
9373da5c369Sopenharmony_ci        #[cfg(any(
9383da5c369Sopenharmony_ci            target_os = "macos",
9393da5c369Sopenharmony_ci            target_os = "freebsd",
9403da5c369Sopenharmony_ci            target_os = "dragonfly",
9413da5c369Sopenharmony_ci            target_os = "ios",
9423da5c369Sopenharmony_ci            target_os = "openbsd",
9433da5c369Sopenharmony_ci            target_os = "netbsd"
9443da5c369Sopenharmony_ci        ))]
9453da5c369Sopenharmony_ci        EBADRPC => "RPC struct is bad",
9463da5c369Sopenharmony_ci
9473da5c369Sopenharmony_ci        #[cfg(any(
9483da5c369Sopenharmony_ci            target_os = "macos",
9493da5c369Sopenharmony_ci            target_os = "freebsd",
9503da5c369Sopenharmony_ci            target_os = "dragonfly",
9513da5c369Sopenharmony_ci            target_os = "ios",
9523da5c369Sopenharmony_ci            target_os = "openbsd",
9533da5c369Sopenharmony_ci            target_os = "netbsd"
9543da5c369Sopenharmony_ci        ))]
9553da5c369Sopenharmony_ci        ERPCMISMATCH => "RPC version wrong",
9563da5c369Sopenharmony_ci
9573da5c369Sopenharmony_ci        #[cfg(any(
9583da5c369Sopenharmony_ci            target_os = "macos",
9593da5c369Sopenharmony_ci            target_os = "freebsd",
9603da5c369Sopenharmony_ci            target_os = "dragonfly",
9613da5c369Sopenharmony_ci            target_os = "ios",
9623da5c369Sopenharmony_ci            target_os = "openbsd",
9633da5c369Sopenharmony_ci            target_os = "netbsd"
9643da5c369Sopenharmony_ci        ))]
9653da5c369Sopenharmony_ci        EPROGUNAVAIL => "RPC prog. not avail",
9663da5c369Sopenharmony_ci
9673da5c369Sopenharmony_ci        #[cfg(any(
9683da5c369Sopenharmony_ci            target_os = "macos",
9693da5c369Sopenharmony_ci            target_os = "freebsd",
9703da5c369Sopenharmony_ci            target_os = "dragonfly",
9713da5c369Sopenharmony_ci            target_os = "ios",
9723da5c369Sopenharmony_ci            target_os = "openbsd",
9733da5c369Sopenharmony_ci            target_os = "netbsd"
9743da5c369Sopenharmony_ci        ))]
9753da5c369Sopenharmony_ci        EPROGMISMATCH => "Program version wrong",
9763da5c369Sopenharmony_ci
9773da5c369Sopenharmony_ci        #[cfg(any(
9783da5c369Sopenharmony_ci            target_os = "macos",
9793da5c369Sopenharmony_ci            target_os = "freebsd",
9803da5c369Sopenharmony_ci            target_os = "dragonfly",
9813da5c369Sopenharmony_ci            target_os = "ios",
9823da5c369Sopenharmony_ci            target_os = "openbsd",
9833da5c369Sopenharmony_ci            target_os = "netbsd"
9843da5c369Sopenharmony_ci        ))]
9853da5c369Sopenharmony_ci        EPROCUNAVAIL => "Bad procedure for program",
9863da5c369Sopenharmony_ci
9873da5c369Sopenharmony_ci        #[cfg(any(
9883da5c369Sopenharmony_ci            target_os = "macos",
9893da5c369Sopenharmony_ci            target_os = "freebsd",
9903da5c369Sopenharmony_ci            target_os = "dragonfly",
9913da5c369Sopenharmony_ci            target_os = "ios",
9923da5c369Sopenharmony_ci            target_os = "openbsd",
9933da5c369Sopenharmony_ci            target_os = "netbsd"
9943da5c369Sopenharmony_ci        ))]
9953da5c369Sopenharmony_ci        EFTYPE => "Inappropriate file type or format",
9963da5c369Sopenharmony_ci
9973da5c369Sopenharmony_ci        #[cfg(any(
9983da5c369Sopenharmony_ci            target_os = "macos",
9993da5c369Sopenharmony_ci            target_os = "freebsd",
10003da5c369Sopenharmony_ci            target_os = "dragonfly",
10013da5c369Sopenharmony_ci            target_os = "ios",
10023da5c369Sopenharmony_ci            target_os = "openbsd",
10033da5c369Sopenharmony_ci            target_os = "netbsd"
10043da5c369Sopenharmony_ci        ))]
10053da5c369Sopenharmony_ci        EAUTH => "Authentication error",
10063da5c369Sopenharmony_ci
10073da5c369Sopenharmony_ci        #[cfg(any(
10083da5c369Sopenharmony_ci            target_os = "macos",
10093da5c369Sopenharmony_ci            target_os = "freebsd",
10103da5c369Sopenharmony_ci            target_os = "dragonfly",
10113da5c369Sopenharmony_ci            target_os = "ios",
10123da5c369Sopenharmony_ci            target_os = "openbsd",
10133da5c369Sopenharmony_ci            target_os = "netbsd",
10143da5c369Sopenharmony_ci            target_os = "redox"
10153da5c369Sopenharmony_ci        ))]
10163da5c369Sopenharmony_ci        ECANCELED => "Operation canceled",
10173da5c369Sopenharmony_ci
10183da5c369Sopenharmony_ci        #[cfg(any(target_os = "macos", target_os = "ios"))]
10193da5c369Sopenharmony_ci        EPWROFF => "Device power is off",
10203da5c369Sopenharmony_ci
10213da5c369Sopenharmony_ci        #[cfg(any(target_os = "macos", target_os = "ios"))]
10223da5c369Sopenharmony_ci        EDEVERR => "Device error, e.g. paper out",
10233da5c369Sopenharmony_ci
10243da5c369Sopenharmony_ci        #[cfg(any(target_os = "macos", target_os = "ios"))]
10253da5c369Sopenharmony_ci        EBADEXEC => "Bad executable",
10263da5c369Sopenharmony_ci
10273da5c369Sopenharmony_ci        #[cfg(any(target_os = "macos", target_os = "ios"))]
10283da5c369Sopenharmony_ci        EBADARCH => "Bad CPU type in executable",
10293da5c369Sopenharmony_ci
10303da5c369Sopenharmony_ci        #[cfg(any(target_os = "macos", target_os = "ios"))]
10313da5c369Sopenharmony_ci        ESHLIBVERS => "Shared library version mismatch",
10323da5c369Sopenharmony_ci
10333da5c369Sopenharmony_ci        #[cfg(any(target_os = "macos", target_os = "ios"))]
10343da5c369Sopenharmony_ci        EBADMACHO => "Malformed Macho file",
10353da5c369Sopenharmony_ci
10363da5c369Sopenharmony_ci        #[cfg(any(
10373da5c369Sopenharmony_ci            target_os = "macos",
10383da5c369Sopenharmony_ci            target_os = "ios",
10393da5c369Sopenharmony_ci            target_os = "netbsd",
10403da5c369Sopenharmony_ci            target_os = "haiku"
10413da5c369Sopenharmony_ci        ))]
10423da5c369Sopenharmony_ci        EMULTIHOP => "Reserved",
10433da5c369Sopenharmony_ci
10443da5c369Sopenharmony_ci        #[cfg(any(
10453da5c369Sopenharmony_ci            target_os = "macos",
10463da5c369Sopenharmony_ci            target_os = "ios",
10473da5c369Sopenharmony_ci            target_os = "netbsd",
10483da5c369Sopenharmony_ci            target_os = "redox"
10493da5c369Sopenharmony_ci        ))]
10503da5c369Sopenharmony_ci        ENODATA => "No message available on STREAM",
10513da5c369Sopenharmony_ci
10523da5c369Sopenharmony_ci        #[cfg(any(
10533da5c369Sopenharmony_ci            target_os = "macos",
10543da5c369Sopenharmony_ci            target_os = "ios",
10553da5c369Sopenharmony_ci            target_os = "netbsd",
10563da5c369Sopenharmony_ci            target_os = "haiku"
10573da5c369Sopenharmony_ci        ))]
10583da5c369Sopenharmony_ci        ENOLINK => "Reserved",
10593da5c369Sopenharmony_ci
10603da5c369Sopenharmony_ci        #[cfg(any(
10613da5c369Sopenharmony_ci            target_os = "macos",
10623da5c369Sopenharmony_ci            target_os = "ios",
10633da5c369Sopenharmony_ci            target_os = "netbsd",
10643da5c369Sopenharmony_ci            target_os = "redox"
10653da5c369Sopenharmony_ci        ))]
10663da5c369Sopenharmony_ci        ENOSR => "No STREAM resources",
10673da5c369Sopenharmony_ci
10683da5c369Sopenharmony_ci        #[cfg(any(
10693da5c369Sopenharmony_ci            target_os = "macos",
10703da5c369Sopenharmony_ci            target_os = "ios",
10713da5c369Sopenharmony_ci            target_os = "netbsd",
10723da5c369Sopenharmony_ci            target_os = "redox"
10733da5c369Sopenharmony_ci        ))]
10743da5c369Sopenharmony_ci        ENOSTR => "Not a STREAM",
10753da5c369Sopenharmony_ci
10763da5c369Sopenharmony_ci        #[cfg(any(
10773da5c369Sopenharmony_ci            target_os = "macos",
10783da5c369Sopenharmony_ci            target_os = "ios",
10793da5c369Sopenharmony_ci            target_os = "netbsd",
10803da5c369Sopenharmony_ci            target_os = "redox"
10813da5c369Sopenharmony_ci        ))]
10823da5c369Sopenharmony_ci        ETIME => "STREAM ioctl timeout",
10833da5c369Sopenharmony_ci
10843da5c369Sopenharmony_ci        #[cfg(any(
10853da5c369Sopenharmony_ci            target_os = "macos",
10863da5c369Sopenharmony_ci            target_os = "ios",
10873da5c369Sopenharmony_ci            target_os = "illumos",
10883da5c369Sopenharmony_ci            target_os = "solaris"
10893da5c369Sopenharmony_ci        ))]
10903da5c369Sopenharmony_ci        EOPNOTSUPP => "Operation not supported on socket",
10913da5c369Sopenharmony_ci
10923da5c369Sopenharmony_ci        #[cfg(any(target_os = "macos", target_os = "ios"))]
10933da5c369Sopenharmony_ci        ENOPOLICY => "No such policy registered",
10943da5c369Sopenharmony_ci
10953da5c369Sopenharmony_ci        #[cfg(any(target_os = "macos", target_os = "ios"))]
10963da5c369Sopenharmony_ci        EQFULL => "Interface output queue is full",
10973da5c369Sopenharmony_ci
10983da5c369Sopenharmony_ci        #[cfg(target_os = "openbsd")]
10993da5c369Sopenharmony_ci        EOPNOTSUPP => "Operation not supported",
11003da5c369Sopenharmony_ci
11013da5c369Sopenharmony_ci        #[cfg(target_os = "openbsd")]
11023da5c369Sopenharmony_ci        EIPSEC => "IPsec processing failure",
11033da5c369Sopenharmony_ci
11043da5c369Sopenharmony_ci        #[cfg(target_os = "dragonfly")]
11053da5c369Sopenharmony_ci        EASYNC => "Async",
11063da5c369Sopenharmony_ci
11073da5c369Sopenharmony_ci        #[cfg(any(target_os = "illumos", target_os = "solaris"))]
11083da5c369Sopenharmony_ci        EDEADLOCK => "Resource deadlock would occur",
11093da5c369Sopenharmony_ci
11103da5c369Sopenharmony_ci        #[cfg(any(target_os = "illumos", target_os = "solaris"))]
11113da5c369Sopenharmony_ci        ELOCKUNMAPPED => "Locked lock was unmapped",
11123da5c369Sopenharmony_ci
11133da5c369Sopenharmony_ci        #[cfg(any(target_os = "illumos", target_os = "solaris"))]
11143da5c369Sopenharmony_ci        ENOTACTIVE => "Facility is not active",
11153da5c369Sopenharmony_ci    }
11163da5c369Sopenharmony_ci}
11173da5c369Sopenharmony_ci
11183da5c369Sopenharmony_ci#[cfg(any(target_os = "linux", target_os = "android", target_os = "fuchsia"))]
11193da5c369Sopenharmony_cimod consts {
11203da5c369Sopenharmony_ci    #[derive(Clone, Copy, Debug, Eq, PartialEq)]
11213da5c369Sopenharmony_ci    #[repr(i32)]
11223da5c369Sopenharmony_ci    #[non_exhaustive]
11233da5c369Sopenharmony_ci    pub enum Errno {
11243da5c369Sopenharmony_ci        UnknownErrno = 0,
11253da5c369Sopenharmony_ci        EPERM = libc::EPERM,
11263da5c369Sopenharmony_ci        ENOENT = libc::ENOENT,
11273da5c369Sopenharmony_ci        ESRCH = libc::ESRCH,
11283da5c369Sopenharmony_ci        EINTR = libc::EINTR,
11293da5c369Sopenharmony_ci        EIO = libc::EIO,
11303da5c369Sopenharmony_ci        ENXIO = libc::ENXIO,
11313da5c369Sopenharmony_ci        E2BIG = libc::E2BIG,
11323da5c369Sopenharmony_ci        ENOEXEC = libc::ENOEXEC,
11333da5c369Sopenharmony_ci        EBADF = libc::EBADF,
11343da5c369Sopenharmony_ci        ECHILD = libc::ECHILD,
11353da5c369Sopenharmony_ci        EAGAIN = libc::EAGAIN,
11363da5c369Sopenharmony_ci        ENOMEM = libc::ENOMEM,
11373da5c369Sopenharmony_ci        EACCES = libc::EACCES,
11383da5c369Sopenharmony_ci        EFAULT = libc::EFAULT,
11393da5c369Sopenharmony_ci        ENOTBLK = libc::ENOTBLK,
11403da5c369Sopenharmony_ci        EBUSY = libc::EBUSY,
11413da5c369Sopenharmony_ci        EEXIST = libc::EEXIST,
11423da5c369Sopenharmony_ci        EXDEV = libc::EXDEV,
11433da5c369Sopenharmony_ci        ENODEV = libc::ENODEV,
11443da5c369Sopenharmony_ci        ENOTDIR = libc::ENOTDIR,
11453da5c369Sopenharmony_ci        EISDIR = libc::EISDIR,
11463da5c369Sopenharmony_ci        EINVAL = libc::EINVAL,
11473da5c369Sopenharmony_ci        ENFILE = libc::ENFILE,
11483da5c369Sopenharmony_ci        EMFILE = libc::EMFILE,
11493da5c369Sopenharmony_ci        ENOTTY = libc::ENOTTY,
11503da5c369Sopenharmony_ci        ETXTBSY = libc::ETXTBSY,
11513da5c369Sopenharmony_ci        EFBIG = libc::EFBIG,
11523da5c369Sopenharmony_ci        ENOSPC = libc::ENOSPC,
11533da5c369Sopenharmony_ci        ESPIPE = libc::ESPIPE,
11543da5c369Sopenharmony_ci        EROFS = libc::EROFS,
11553da5c369Sopenharmony_ci        EMLINK = libc::EMLINK,
11563da5c369Sopenharmony_ci        EPIPE = libc::EPIPE,
11573da5c369Sopenharmony_ci        EDOM = libc::EDOM,
11583da5c369Sopenharmony_ci        ERANGE = libc::ERANGE,
11593da5c369Sopenharmony_ci        EDEADLK = libc::EDEADLK,
11603da5c369Sopenharmony_ci        ENAMETOOLONG = libc::ENAMETOOLONG,
11613da5c369Sopenharmony_ci        ENOLCK = libc::ENOLCK,
11623da5c369Sopenharmony_ci        ENOSYS = libc::ENOSYS,
11633da5c369Sopenharmony_ci        ENOTEMPTY = libc::ENOTEMPTY,
11643da5c369Sopenharmony_ci        ELOOP = libc::ELOOP,
11653da5c369Sopenharmony_ci        ENOMSG = libc::ENOMSG,
11663da5c369Sopenharmony_ci        EIDRM = libc::EIDRM,
11673da5c369Sopenharmony_ci        ECHRNG = libc::ECHRNG,
11683da5c369Sopenharmony_ci        EL2NSYNC = libc::EL2NSYNC,
11693da5c369Sopenharmony_ci        EL3HLT = libc::EL3HLT,
11703da5c369Sopenharmony_ci        EL3RST = libc::EL3RST,
11713da5c369Sopenharmony_ci        ELNRNG = libc::ELNRNG,
11723da5c369Sopenharmony_ci        EUNATCH = libc::EUNATCH,
11733da5c369Sopenharmony_ci        ENOCSI = libc::ENOCSI,
11743da5c369Sopenharmony_ci        EL2HLT = libc::EL2HLT,
11753da5c369Sopenharmony_ci        EBADE = libc::EBADE,
11763da5c369Sopenharmony_ci        EBADR = libc::EBADR,
11773da5c369Sopenharmony_ci        EXFULL = libc::EXFULL,
11783da5c369Sopenharmony_ci        ENOANO = libc::ENOANO,
11793da5c369Sopenharmony_ci        EBADRQC = libc::EBADRQC,
11803da5c369Sopenharmony_ci        EBADSLT = libc::EBADSLT,
11813da5c369Sopenharmony_ci        EBFONT = libc::EBFONT,
11823da5c369Sopenharmony_ci        ENOSTR = libc::ENOSTR,
11833da5c369Sopenharmony_ci        ENODATA = libc::ENODATA,
11843da5c369Sopenharmony_ci        ETIME = libc::ETIME,
11853da5c369Sopenharmony_ci        ENOSR = libc::ENOSR,
11863da5c369Sopenharmony_ci        ENONET = libc::ENONET,
11873da5c369Sopenharmony_ci        ENOPKG = libc::ENOPKG,
11883da5c369Sopenharmony_ci        EREMOTE = libc::EREMOTE,
11893da5c369Sopenharmony_ci        ENOLINK = libc::ENOLINK,
11903da5c369Sopenharmony_ci        EADV = libc::EADV,
11913da5c369Sopenharmony_ci        ESRMNT = libc::ESRMNT,
11923da5c369Sopenharmony_ci        ECOMM = libc::ECOMM,
11933da5c369Sopenharmony_ci        EPROTO = libc::EPROTO,
11943da5c369Sopenharmony_ci        EMULTIHOP = libc::EMULTIHOP,
11953da5c369Sopenharmony_ci        EDOTDOT = libc::EDOTDOT,
11963da5c369Sopenharmony_ci        EBADMSG = libc::EBADMSG,
11973da5c369Sopenharmony_ci        EOVERFLOW = libc::EOVERFLOW,
11983da5c369Sopenharmony_ci        ENOTUNIQ = libc::ENOTUNIQ,
11993da5c369Sopenharmony_ci        EBADFD = libc::EBADFD,
12003da5c369Sopenharmony_ci        EREMCHG = libc::EREMCHG,
12013da5c369Sopenharmony_ci        ELIBACC = libc::ELIBACC,
12023da5c369Sopenharmony_ci        ELIBBAD = libc::ELIBBAD,
12033da5c369Sopenharmony_ci        ELIBSCN = libc::ELIBSCN,
12043da5c369Sopenharmony_ci        ELIBMAX = libc::ELIBMAX,
12053da5c369Sopenharmony_ci        ELIBEXEC = libc::ELIBEXEC,
12063da5c369Sopenharmony_ci        EILSEQ = libc::EILSEQ,
12073da5c369Sopenharmony_ci        ERESTART = libc::ERESTART,
12083da5c369Sopenharmony_ci        ESTRPIPE = libc::ESTRPIPE,
12093da5c369Sopenharmony_ci        EUSERS = libc::EUSERS,
12103da5c369Sopenharmony_ci        ENOTSOCK = libc::ENOTSOCK,
12113da5c369Sopenharmony_ci        EDESTADDRREQ = libc::EDESTADDRREQ,
12123da5c369Sopenharmony_ci        EMSGSIZE = libc::EMSGSIZE,
12133da5c369Sopenharmony_ci        EPROTOTYPE = libc::EPROTOTYPE,
12143da5c369Sopenharmony_ci        ENOPROTOOPT = libc::ENOPROTOOPT,
12153da5c369Sopenharmony_ci        EPROTONOSUPPORT = libc::EPROTONOSUPPORT,
12163da5c369Sopenharmony_ci        ESOCKTNOSUPPORT = libc::ESOCKTNOSUPPORT,
12173da5c369Sopenharmony_ci        EOPNOTSUPP = libc::EOPNOTSUPP,
12183da5c369Sopenharmony_ci        EPFNOSUPPORT = libc::EPFNOSUPPORT,
12193da5c369Sopenharmony_ci        EAFNOSUPPORT = libc::EAFNOSUPPORT,
12203da5c369Sopenharmony_ci        EADDRINUSE = libc::EADDRINUSE,
12213da5c369Sopenharmony_ci        EADDRNOTAVAIL = libc::EADDRNOTAVAIL,
12223da5c369Sopenharmony_ci        ENETDOWN = libc::ENETDOWN,
12233da5c369Sopenharmony_ci        ENETUNREACH = libc::ENETUNREACH,
12243da5c369Sopenharmony_ci        ENETRESET = libc::ENETRESET,
12253da5c369Sopenharmony_ci        ECONNABORTED = libc::ECONNABORTED,
12263da5c369Sopenharmony_ci        ECONNRESET = libc::ECONNRESET,
12273da5c369Sopenharmony_ci        ENOBUFS = libc::ENOBUFS,
12283da5c369Sopenharmony_ci        EISCONN = libc::EISCONN,
12293da5c369Sopenharmony_ci        ENOTCONN = libc::ENOTCONN,
12303da5c369Sopenharmony_ci        ESHUTDOWN = libc::ESHUTDOWN,
12313da5c369Sopenharmony_ci        ETOOMANYREFS = libc::ETOOMANYREFS,
12323da5c369Sopenharmony_ci        ETIMEDOUT = libc::ETIMEDOUT,
12333da5c369Sopenharmony_ci        ECONNREFUSED = libc::ECONNREFUSED,
12343da5c369Sopenharmony_ci        EHOSTDOWN = libc::EHOSTDOWN,
12353da5c369Sopenharmony_ci        EHOSTUNREACH = libc::EHOSTUNREACH,
12363da5c369Sopenharmony_ci        EALREADY = libc::EALREADY,
12373da5c369Sopenharmony_ci        EINPROGRESS = libc::EINPROGRESS,
12383da5c369Sopenharmony_ci        ESTALE = libc::ESTALE,
12393da5c369Sopenharmony_ci        EUCLEAN = libc::EUCLEAN,
12403da5c369Sopenharmony_ci        ENOTNAM = libc::ENOTNAM,
12413da5c369Sopenharmony_ci        ENAVAIL = libc::ENAVAIL,
12423da5c369Sopenharmony_ci        EISNAM = libc::EISNAM,
12433da5c369Sopenharmony_ci        EREMOTEIO = libc::EREMOTEIO,
12443da5c369Sopenharmony_ci        EDQUOT = libc::EDQUOT,
12453da5c369Sopenharmony_ci        ENOMEDIUM = libc::ENOMEDIUM,
12463da5c369Sopenharmony_ci        EMEDIUMTYPE = libc::EMEDIUMTYPE,
12473da5c369Sopenharmony_ci        ECANCELED = libc::ECANCELED,
12483da5c369Sopenharmony_ci        ENOKEY = libc::ENOKEY,
12493da5c369Sopenharmony_ci        EKEYEXPIRED = libc::EKEYEXPIRED,
12503da5c369Sopenharmony_ci        EKEYREVOKED = libc::EKEYREVOKED,
12513da5c369Sopenharmony_ci        EKEYREJECTED = libc::EKEYREJECTED,
12523da5c369Sopenharmony_ci        EOWNERDEAD = libc::EOWNERDEAD,
12533da5c369Sopenharmony_ci        ENOTRECOVERABLE = libc::ENOTRECOVERABLE,
12543da5c369Sopenharmony_ci        #[cfg(not(any(target_os = "android", target_arch = "mips")))]
12553da5c369Sopenharmony_ci        ERFKILL = libc::ERFKILL,
12563da5c369Sopenharmony_ci        #[cfg(not(any(target_os = "android", target_arch = "mips")))]
12573da5c369Sopenharmony_ci        EHWPOISON = libc::EHWPOISON,
12583da5c369Sopenharmony_ci    }
12593da5c369Sopenharmony_ci
12603da5c369Sopenharmony_ci    impl Errno {
12613da5c369Sopenharmony_ci        pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
12623da5c369Sopenharmony_ci        pub const EDEADLOCK: Errno = Errno::EDEADLK;
12633da5c369Sopenharmony_ci        pub const ENOTSUP: Errno = Errno::EOPNOTSUPP;
12643da5c369Sopenharmony_ci    }
12653da5c369Sopenharmony_ci
12663da5c369Sopenharmony_ci    pub const fn from_i32(e: i32) -> Errno {
12673da5c369Sopenharmony_ci        use self::Errno::*;
12683da5c369Sopenharmony_ci
12693da5c369Sopenharmony_ci        match e {
12703da5c369Sopenharmony_ci            libc::EPERM => EPERM,
12713da5c369Sopenharmony_ci            libc::ENOENT => ENOENT,
12723da5c369Sopenharmony_ci            libc::ESRCH => ESRCH,
12733da5c369Sopenharmony_ci            libc::EINTR => EINTR,
12743da5c369Sopenharmony_ci            libc::EIO => EIO,
12753da5c369Sopenharmony_ci            libc::ENXIO => ENXIO,
12763da5c369Sopenharmony_ci            libc::E2BIG => E2BIG,
12773da5c369Sopenharmony_ci            libc::ENOEXEC => ENOEXEC,
12783da5c369Sopenharmony_ci            libc::EBADF => EBADF,
12793da5c369Sopenharmony_ci            libc::ECHILD => ECHILD,
12803da5c369Sopenharmony_ci            libc::EAGAIN => EAGAIN,
12813da5c369Sopenharmony_ci            libc::ENOMEM => ENOMEM,
12823da5c369Sopenharmony_ci            libc::EACCES => EACCES,
12833da5c369Sopenharmony_ci            libc::EFAULT => EFAULT,
12843da5c369Sopenharmony_ci            libc::ENOTBLK => ENOTBLK,
12853da5c369Sopenharmony_ci            libc::EBUSY => EBUSY,
12863da5c369Sopenharmony_ci            libc::EEXIST => EEXIST,
12873da5c369Sopenharmony_ci            libc::EXDEV => EXDEV,
12883da5c369Sopenharmony_ci            libc::ENODEV => ENODEV,
12893da5c369Sopenharmony_ci            libc::ENOTDIR => ENOTDIR,
12903da5c369Sopenharmony_ci            libc::EISDIR => EISDIR,
12913da5c369Sopenharmony_ci            libc::EINVAL => EINVAL,
12923da5c369Sopenharmony_ci            libc::ENFILE => ENFILE,
12933da5c369Sopenharmony_ci            libc::EMFILE => EMFILE,
12943da5c369Sopenharmony_ci            libc::ENOTTY => ENOTTY,
12953da5c369Sopenharmony_ci            libc::ETXTBSY => ETXTBSY,
12963da5c369Sopenharmony_ci            libc::EFBIG => EFBIG,
12973da5c369Sopenharmony_ci            libc::ENOSPC => ENOSPC,
12983da5c369Sopenharmony_ci            libc::ESPIPE => ESPIPE,
12993da5c369Sopenharmony_ci            libc::EROFS => EROFS,
13003da5c369Sopenharmony_ci            libc::EMLINK => EMLINK,
13013da5c369Sopenharmony_ci            libc::EPIPE => EPIPE,
13023da5c369Sopenharmony_ci            libc::EDOM => EDOM,
13033da5c369Sopenharmony_ci            libc::ERANGE => ERANGE,
13043da5c369Sopenharmony_ci            libc::EDEADLK => EDEADLK,
13053da5c369Sopenharmony_ci            libc::ENAMETOOLONG => ENAMETOOLONG,
13063da5c369Sopenharmony_ci            libc::ENOLCK => ENOLCK,
13073da5c369Sopenharmony_ci            libc::ENOSYS => ENOSYS,
13083da5c369Sopenharmony_ci            libc::ENOTEMPTY => ENOTEMPTY,
13093da5c369Sopenharmony_ci            libc::ELOOP => ELOOP,
13103da5c369Sopenharmony_ci            libc::ENOMSG => ENOMSG,
13113da5c369Sopenharmony_ci            libc::EIDRM => EIDRM,
13123da5c369Sopenharmony_ci            libc::ECHRNG => ECHRNG,
13133da5c369Sopenharmony_ci            libc::EL2NSYNC => EL2NSYNC,
13143da5c369Sopenharmony_ci            libc::EL3HLT => EL3HLT,
13153da5c369Sopenharmony_ci            libc::EL3RST => EL3RST,
13163da5c369Sopenharmony_ci            libc::ELNRNG => ELNRNG,
13173da5c369Sopenharmony_ci            libc::EUNATCH => EUNATCH,
13183da5c369Sopenharmony_ci            libc::ENOCSI => ENOCSI,
13193da5c369Sopenharmony_ci            libc::EL2HLT => EL2HLT,
13203da5c369Sopenharmony_ci            libc::EBADE => EBADE,
13213da5c369Sopenharmony_ci            libc::EBADR => EBADR,
13223da5c369Sopenharmony_ci            libc::EXFULL => EXFULL,
13233da5c369Sopenharmony_ci            libc::ENOANO => ENOANO,
13243da5c369Sopenharmony_ci            libc::EBADRQC => EBADRQC,
13253da5c369Sopenharmony_ci            libc::EBADSLT => EBADSLT,
13263da5c369Sopenharmony_ci            libc::EBFONT => EBFONT,
13273da5c369Sopenharmony_ci            libc::ENOSTR => ENOSTR,
13283da5c369Sopenharmony_ci            libc::ENODATA => ENODATA,
13293da5c369Sopenharmony_ci            libc::ETIME => ETIME,
13303da5c369Sopenharmony_ci            libc::ENOSR => ENOSR,
13313da5c369Sopenharmony_ci            libc::ENONET => ENONET,
13323da5c369Sopenharmony_ci            libc::ENOPKG => ENOPKG,
13333da5c369Sopenharmony_ci            libc::EREMOTE => EREMOTE,
13343da5c369Sopenharmony_ci            libc::ENOLINK => ENOLINK,
13353da5c369Sopenharmony_ci            libc::EADV => EADV,
13363da5c369Sopenharmony_ci            libc::ESRMNT => ESRMNT,
13373da5c369Sopenharmony_ci            libc::ECOMM => ECOMM,
13383da5c369Sopenharmony_ci            libc::EPROTO => EPROTO,
13393da5c369Sopenharmony_ci            libc::EMULTIHOP => EMULTIHOP,
13403da5c369Sopenharmony_ci            libc::EDOTDOT => EDOTDOT,
13413da5c369Sopenharmony_ci            libc::EBADMSG => EBADMSG,
13423da5c369Sopenharmony_ci            libc::EOVERFLOW => EOVERFLOW,
13433da5c369Sopenharmony_ci            libc::ENOTUNIQ => ENOTUNIQ,
13443da5c369Sopenharmony_ci            libc::EBADFD => EBADFD,
13453da5c369Sopenharmony_ci            libc::EREMCHG => EREMCHG,
13463da5c369Sopenharmony_ci            libc::ELIBACC => ELIBACC,
13473da5c369Sopenharmony_ci            libc::ELIBBAD => ELIBBAD,
13483da5c369Sopenharmony_ci            libc::ELIBSCN => ELIBSCN,
13493da5c369Sopenharmony_ci            libc::ELIBMAX => ELIBMAX,
13503da5c369Sopenharmony_ci            libc::ELIBEXEC => ELIBEXEC,
13513da5c369Sopenharmony_ci            libc::EILSEQ => EILSEQ,
13523da5c369Sopenharmony_ci            libc::ERESTART => ERESTART,
13533da5c369Sopenharmony_ci            libc::ESTRPIPE => ESTRPIPE,
13543da5c369Sopenharmony_ci            libc::EUSERS => EUSERS,
13553da5c369Sopenharmony_ci            libc::ENOTSOCK => ENOTSOCK,
13563da5c369Sopenharmony_ci            libc::EDESTADDRREQ => EDESTADDRREQ,
13573da5c369Sopenharmony_ci            libc::EMSGSIZE => EMSGSIZE,
13583da5c369Sopenharmony_ci            libc::EPROTOTYPE => EPROTOTYPE,
13593da5c369Sopenharmony_ci            libc::ENOPROTOOPT => ENOPROTOOPT,
13603da5c369Sopenharmony_ci            libc::EPROTONOSUPPORT => EPROTONOSUPPORT,
13613da5c369Sopenharmony_ci            libc::ESOCKTNOSUPPORT => ESOCKTNOSUPPORT,
13623da5c369Sopenharmony_ci            libc::EOPNOTSUPP => EOPNOTSUPP,
13633da5c369Sopenharmony_ci            libc::EPFNOSUPPORT => EPFNOSUPPORT,
13643da5c369Sopenharmony_ci            libc::EAFNOSUPPORT => EAFNOSUPPORT,
13653da5c369Sopenharmony_ci            libc::EADDRINUSE => EADDRINUSE,
13663da5c369Sopenharmony_ci            libc::EADDRNOTAVAIL => EADDRNOTAVAIL,
13673da5c369Sopenharmony_ci            libc::ENETDOWN => ENETDOWN,
13683da5c369Sopenharmony_ci            libc::ENETUNREACH => ENETUNREACH,
13693da5c369Sopenharmony_ci            libc::ENETRESET => ENETRESET,
13703da5c369Sopenharmony_ci            libc::ECONNABORTED => ECONNABORTED,
13713da5c369Sopenharmony_ci            libc::ECONNRESET => ECONNRESET,
13723da5c369Sopenharmony_ci            libc::ENOBUFS => ENOBUFS,
13733da5c369Sopenharmony_ci            libc::EISCONN => EISCONN,
13743da5c369Sopenharmony_ci            libc::ENOTCONN => ENOTCONN,
13753da5c369Sopenharmony_ci            libc::ESHUTDOWN => ESHUTDOWN,
13763da5c369Sopenharmony_ci            libc::ETOOMANYREFS => ETOOMANYREFS,
13773da5c369Sopenharmony_ci            libc::ETIMEDOUT => ETIMEDOUT,
13783da5c369Sopenharmony_ci            libc::ECONNREFUSED => ECONNREFUSED,
13793da5c369Sopenharmony_ci            libc::EHOSTDOWN => EHOSTDOWN,
13803da5c369Sopenharmony_ci            libc::EHOSTUNREACH => EHOSTUNREACH,
13813da5c369Sopenharmony_ci            libc::EALREADY => EALREADY,
13823da5c369Sopenharmony_ci            libc::EINPROGRESS => EINPROGRESS,
13833da5c369Sopenharmony_ci            libc::ESTALE => ESTALE,
13843da5c369Sopenharmony_ci            libc::EUCLEAN => EUCLEAN,
13853da5c369Sopenharmony_ci            libc::ENOTNAM => ENOTNAM,
13863da5c369Sopenharmony_ci            libc::ENAVAIL => ENAVAIL,
13873da5c369Sopenharmony_ci            libc::EISNAM => EISNAM,
13883da5c369Sopenharmony_ci            libc::EREMOTEIO => EREMOTEIO,
13893da5c369Sopenharmony_ci            libc::EDQUOT => EDQUOT,
13903da5c369Sopenharmony_ci            libc::ENOMEDIUM => ENOMEDIUM,
13913da5c369Sopenharmony_ci            libc::EMEDIUMTYPE => EMEDIUMTYPE,
13923da5c369Sopenharmony_ci            libc::ECANCELED => ECANCELED,
13933da5c369Sopenharmony_ci            libc::ENOKEY => ENOKEY,
13943da5c369Sopenharmony_ci            libc::EKEYEXPIRED => EKEYEXPIRED,
13953da5c369Sopenharmony_ci            libc::EKEYREVOKED => EKEYREVOKED,
13963da5c369Sopenharmony_ci            libc::EKEYREJECTED => EKEYREJECTED,
13973da5c369Sopenharmony_ci            libc::EOWNERDEAD => EOWNERDEAD,
13983da5c369Sopenharmony_ci            libc::ENOTRECOVERABLE => ENOTRECOVERABLE,
13993da5c369Sopenharmony_ci            #[cfg(not(any(target_os = "android", target_arch = "mips")))]
14003da5c369Sopenharmony_ci            libc::ERFKILL => ERFKILL,
14013da5c369Sopenharmony_ci            #[cfg(not(any(target_os = "android", target_arch = "mips")))]
14023da5c369Sopenharmony_ci            libc::EHWPOISON => EHWPOISON,
14033da5c369Sopenharmony_ci            _ => UnknownErrno,
14043da5c369Sopenharmony_ci        }
14053da5c369Sopenharmony_ci    }
14063da5c369Sopenharmony_ci}
14073da5c369Sopenharmony_ci
14083da5c369Sopenharmony_ci#[cfg(any(target_os = "macos", target_os = "ios"))]
14093da5c369Sopenharmony_cimod consts {
14103da5c369Sopenharmony_ci    #[derive(Clone, Copy, Debug, Eq, PartialEq)]
14113da5c369Sopenharmony_ci    #[repr(i32)]
14123da5c369Sopenharmony_ci    #[non_exhaustive]
14133da5c369Sopenharmony_ci    pub enum Errno {
14143da5c369Sopenharmony_ci        UnknownErrno = 0,
14153da5c369Sopenharmony_ci        EPERM = libc::EPERM,
14163da5c369Sopenharmony_ci        ENOENT = libc::ENOENT,
14173da5c369Sopenharmony_ci        ESRCH = libc::ESRCH,
14183da5c369Sopenharmony_ci        EINTR = libc::EINTR,
14193da5c369Sopenharmony_ci        EIO = libc::EIO,
14203da5c369Sopenharmony_ci        ENXIO = libc::ENXIO,
14213da5c369Sopenharmony_ci        E2BIG = libc::E2BIG,
14223da5c369Sopenharmony_ci        ENOEXEC = libc::ENOEXEC,
14233da5c369Sopenharmony_ci        EBADF = libc::EBADF,
14243da5c369Sopenharmony_ci        ECHILD = libc::ECHILD,
14253da5c369Sopenharmony_ci        EDEADLK = libc::EDEADLK,
14263da5c369Sopenharmony_ci        ENOMEM = libc::ENOMEM,
14273da5c369Sopenharmony_ci        EACCES = libc::EACCES,
14283da5c369Sopenharmony_ci        EFAULT = libc::EFAULT,
14293da5c369Sopenharmony_ci        ENOTBLK = libc::ENOTBLK,
14303da5c369Sopenharmony_ci        EBUSY = libc::EBUSY,
14313da5c369Sopenharmony_ci        EEXIST = libc::EEXIST,
14323da5c369Sopenharmony_ci        EXDEV = libc::EXDEV,
14333da5c369Sopenharmony_ci        ENODEV = libc::ENODEV,
14343da5c369Sopenharmony_ci        ENOTDIR = libc::ENOTDIR,
14353da5c369Sopenharmony_ci        EISDIR = libc::EISDIR,
14363da5c369Sopenharmony_ci        EINVAL = libc::EINVAL,
14373da5c369Sopenharmony_ci        ENFILE = libc::ENFILE,
14383da5c369Sopenharmony_ci        EMFILE = libc::EMFILE,
14393da5c369Sopenharmony_ci        ENOTTY = libc::ENOTTY,
14403da5c369Sopenharmony_ci        ETXTBSY = libc::ETXTBSY,
14413da5c369Sopenharmony_ci        EFBIG = libc::EFBIG,
14423da5c369Sopenharmony_ci        ENOSPC = libc::ENOSPC,
14433da5c369Sopenharmony_ci        ESPIPE = libc::ESPIPE,
14443da5c369Sopenharmony_ci        EROFS = libc::EROFS,
14453da5c369Sopenharmony_ci        EMLINK = libc::EMLINK,
14463da5c369Sopenharmony_ci        EPIPE = libc::EPIPE,
14473da5c369Sopenharmony_ci        EDOM = libc::EDOM,
14483da5c369Sopenharmony_ci        ERANGE = libc::ERANGE,
14493da5c369Sopenharmony_ci        EAGAIN = libc::EAGAIN,
14503da5c369Sopenharmony_ci        EINPROGRESS = libc::EINPROGRESS,
14513da5c369Sopenharmony_ci        EALREADY = libc::EALREADY,
14523da5c369Sopenharmony_ci        ENOTSOCK = libc::ENOTSOCK,
14533da5c369Sopenharmony_ci        EDESTADDRREQ = libc::EDESTADDRREQ,
14543da5c369Sopenharmony_ci        EMSGSIZE = libc::EMSGSIZE,
14553da5c369Sopenharmony_ci        EPROTOTYPE = libc::EPROTOTYPE,
14563da5c369Sopenharmony_ci        ENOPROTOOPT = libc::ENOPROTOOPT,
14573da5c369Sopenharmony_ci        EPROTONOSUPPORT = libc::EPROTONOSUPPORT,
14583da5c369Sopenharmony_ci        ESOCKTNOSUPPORT = libc::ESOCKTNOSUPPORT,
14593da5c369Sopenharmony_ci        ENOTSUP = libc::ENOTSUP,
14603da5c369Sopenharmony_ci        EPFNOSUPPORT = libc::EPFNOSUPPORT,
14613da5c369Sopenharmony_ci        EAFNOSUPPORT = libc::EAFNOSUPPORT,
14623da5c369Sopenharmony_ci        EADDRINUSE = libc::EADDRINUSE,
14633da5c369Sopenharmony_ci        EADDRNOTAVAIL = libc::EADDRNOTAVAIL,
14643da5c369Sopenharmony_ci        ENETDOWN = libc::ENETDOWN,
14653da5c369Sopenharmony_ci        ENETUNREACH = libc::ENETUNREACH,
14663da5c369Sopenharmony_ci        ENETRESET = libc::ENETRESET,
14673da5c369Sopenharmony_ci        ECONNABORTED = libc::ECONNABORTED,
14683da5c369Sopenharmony_ci        ECONNRESET = libc::ECONNRESET,
14693da5c369Sopenharmony_ci        ENOBUFS = libc::ENOBUFS,
14703da5c369Sopenharmony_ci        EISCONN = libc::EISCONN,
14713da5c369Sopenharmony_ci        ENOTCONN = libc::ENOTCONN,
14723da5c369Sopenharmony_ci        ESHUTDOWN = libc::ESHUTDOWN,
14733da5c369Sopenharmony_ci        ETOOMANYREFS = libc::ETOOMANYREFS,
14743da5c369Sopenharmony_ci        ETIMEDOUT = libc::ETIMEDOUT,
14753da5c369Sopenharmony_ci        ECONNREFUSED = libc::ECONNREFUSED,
14763da5c369Sopenharmony_ci        ELOOP = libc::ELOOP,
14773da5c369Sopenharmony_ci        ENAMETOOLONG = libc::ENAMETOOLONG,
14783da5c369Sopenharmony_ci        EHOSTDOWN = libc::EHOSTDOWN,
14793da5c369Sopenharmony_ci        EHOSTUNREACH = libc::EHOSTUNREACH,
14803da5c369Sopenharmony_ci        ENOTEMPTY = libc::ENOTEMPTY,
14813da5c369Sopenharmony_ci        EPROCLIM = libc::EPROCLIM,
14823da5c369Sopenharmony_ci        EUSERS = libc::EUSERS,
14833da5c369Sopenharmony_ci        EDQUOT = libc::EDQUOT,
14843da5c369Sopenharmony_ci        ESTALE = libc::ESTALE,
14853da5c369Sopenharmony_ci        EREMOTE = libc::EREMOTE,
14863da5c369Sopenharmony_ci        EBADRPC = libc::EBADRPC,
14873da5c369Sopenharmony_ci        ERPCMISMATCH = libc::ERPCMISMATCH,
14883da5c369Sopenharmony_ci        EPROGUNAVAIL = libc::EPROGUNAVAIL,
14893da5c369Sopenharmony_ci        EPROGMISMATCH = libc::EPROGMISMATCH,
14903da5c369Sopenharmony_ci        EPROCUNAVAIL = libc::EPROCUNAVAIL,
14913da5c369Sopenharmony_ci        ENOLCK = libc::ENOLCK,
14923da5c369Sopenharmony_ci        ENOSYS = libc::ENOSYS,
14933da5c369Sopenharmony_ci        EFTYPE = libc::EFTYPE,
14943da5c369Sopenharmony_ci        EAUTH = libc::EAUTH,
14953da5c369Sopenharmony_ci        ENEEDAUTH = libc::ENEEDAUTH,
14963da5c369Sopenharmony_ci        EPWROFF = libc::EPWROFF,
14973da5c369Sopenharmony_ci        EDEVERR = libc::EDEVERR,
14983da5c369Sopenharmony_ci        EOVERFLOW = libc::EOVERFLOW,
14993da5c369Sopenharmony_ci        EBADEXEC = libc::EBADEXEC,
15003da5c369Sopenharmony_ci        EBADARCH = libc::EBADARCH,
15013da5c369Sopenharmony_ci        ESHLIBVERS = libc::ESHLIBVERS,
15023da5c369Sopenharmony_ci        EBADMACHO = libc::EBADMACHO,
15033da5c369Sopenharmony_ci        ECANCELED = libc::ECANCELED,
15043da5c369Sopenharmony_ci        EIDRM = libc::EIDRM,
15053da5c369Sopenharmony_ci        ENOMSG = libc::ENOMSG,
15063da5c369Sopenharmony_ci        EILSEQ = libc::EILSEQ,
15073da5c369Sopenharmony_ci        ENOATTR = libc::ENOATTR,
15083da5c369Sopenharmony_ci        EBADMSG = libc::EBADMSG,
15093da5c369Sopenharmony_ci        EMULTIHOP = libc::EMULTIHOP,
15103da5c369Sopenharmony_ci        ENODATA = libc::ENODATA,
15113da5c369Sopenharmony_ci        ENOLINK = libc::ENOLINK,
15123da5c369Sopenharmony_ci        ENOSR = libc::ENOSR,
15133da5c369Sopenharmony_ci        ENOSTR = libc::ENOSTR,
15143da5c369Sopenharmony_ci        EPROTO = libc::EPROTO,
15153da5c369Sopenharmony_ci        ETIME = libc::ETIME,
15163da5c369Sopenharmony_ci        EOPNOTSUPP = libc::EOPNOTSUPP,
15173da5c369Sopenharmony_ci        ENOPOLICY = libc::ENOPOLICY,
15183da5c369Sopenharmony_ci        ENOTRECOVERABLE = libc::ENOTRECOVERABLE,
15193da5c369Sopenharmony_ci        EOWNERDEAD = libc::EOWNERDEAD,
15203da5c369Sopenharmony_ci        EQFULL = libc::EQFULL,
15213da5c369Sopenharmony_ci    }
15223da5c369Sopenharmony_ci
15233da5c369Sopenharmony_ci    impl Errno {
15243da5c369Sopenharmony_ci        pub const ELAST: Errno = Errno::EQFULL;
15253da5c369Sopenharmony_ci        pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
15263da5c369Sopenharmony_ci        pub const EDEADLOCK: Errno = Errno::EDEADLK;
15273da5c369Sopenharmony_ci    }
15283da5c369Sopenharmony_ci
15293da5c369Sopenharmony_ci    pub const fn from_i32(e: i32) -> Errno {
15303da5c369Sopenharmony_ci        use self::Errno::*;
15313da5c369Sopenharmony_ci
15323da5c369Sopenharmony_ci        match e {
15333da5c369Sopenharmony_ci            libc::EPERM => EPERM,
15343da5c369Sopenharmony_ci            libc::ENOENT => ENOENT,
15353da5c369Sopenharmony_ci            libc::ESRCH => ESRCH,
15363da5c369Sopenharmony_ci            libc::EINTR => EINTR,
15373da5c369Sopenharmony_ci            libc::EIO => EIO,
15383da5c369Sopenharmony_ci            libc::ENXIO => ENXIO,
15393da5c369Sopenharmony_ci            libc::E2BIG => E2BIG,
15403da5c369Sopenharmony_ci            libc::ENOEXEC => ENOEXEC,
15413da5c369Sopenharmony_ci            libc::EBADF => EBADF,
15423da5c369Sopenharmony_ci            libc::ECHILD => ECHILD,
15433da5c369Sopenharmony_ci            libc::EDEADLK => EDEADLK,
15443da5c369Sopenharmony_ci            libc::ENOMEM => ENOMEM,
15453da5c369Sopenharmony_ci            libc::EACCES => EACCES,
15463da5c369Sopenharmony_ci            libc::EFAULT => EFAULT,
15473da5c369Sopenharmony_ci            libc::ENOTBLK => ENOTBLK,
15483da5c369Sopenharmony_ci            libc::EBUSY => EBUSY,
15493da5c369Sopenharmony_ci            libc::EEXIST => EEXIST,
15503da5c369Sopenharmony_ci            libc::EXDEV => EXDEV,
15513da5c369Sopenharmony_ci            libc::ENODEV => ENODEV,
15523da5c369Sopenharmony_ci            libc::ENOTDIR => ENOTDIR,
15533da5c369Sopenharmony_ci            libc::EISDIR => EISDIR,
15543da5c369Sopenharmony_ci            libc::EINVAL => EINVAL,
15553da5c369Sopenharmony_ci            libc::ENFILE => ENFILE,
15563da5c369Sopenharmony_ci            libc::EMFILE => EMFILE,
15573da5c369Sopenharmony_ci            libc::ENOTTY => ENOTTY,
15583da5c369Sopenharmony_ci            libc::ETXTBSY => ETXTBSY,
15593da5c369Sopenharmony_ci            libc::EFBIG => EFBIG,
15603da5c369Sopenharmony_ci            libc::ENOSPC => ENOSPC,
15613da5c369Sopenharmony_ci            libc::ESPIPE => ESPIPE,
15623da5c369Sopenharmony_ci            libc::EROFS => EROFS,
15633da5c369Sopenharmony_ci            libc::EMLINK => EMLINK,
15643da5c369Sopenharmony_ci            libc::EPIPE => EPIPE,
15653da5c369Sopenharmony_ci            libc::EDOM => EDOM,
15663da5c369Sopenharmony_ci            libc::ERANGE => ERANGE,
15673da5c369Sopenharmony_ci            libc::EAGAIN => EAGAIN,
15683da5c369Sopenharmony_ci            libc::EINPROGRESS => EINPROGRESS,
15693da5c369Sopenharmony_ci            libc::EALREADY => EALREADY,
15703da5c369Sopenharmony_ci            libc::ENOTSOCK => ENOTSOCK,
15713da5c369Sopenharmony_ci            libc::EDESTADDRREQ => EDESTADDRREQ,
15723da5c369Sopenharmony_ci            libc::EMSGSIZE => EMSGSIZE,
15733da5c369Sopenharmony_ci            libc::EPROTOTYPE => EPROTOTYPE,
15743da5c369Sopenharmony_ci            libc::ENOPROTOOPT => ENOPROTOOPT,
15753da5c369Sopenharmony_ci            libc::EPROTONOSUPPORT => EPROTONOSUPPORT,
15763da5c369Sopenharmony_ci            libc::ESOCKTNOSUPPORT => ESOCKTNOSUPPORT,
15773da5c369Sopenharmony_ci            libc::ENOTSUP => ENOTSUP,
15783da5c369Sopenharmony_ci            libc::EPFNOSUPPORT => EPFNOSUPPORT,
15793da5c369Sopenharmony_ci            libc::EAFNOSUPPORT => EAFNOSUPPORT,
15803da5c369Sopenharmony_ci            libc::EADDRINUSE => EADDRINUSE,
15813da5c369Sopenharmony_ci            libc::EADDRNOTAVAIL => EADDRNOTAVAIL,
15823da5c369Sopenharmony_ci            libc::ENETDOWN => ENETDOWN,
15833da5c369Sopenharmony_ci            libc::ENETUNREACH => ENETUNREACH,
15843da5c369Sopenharmony_ci            libc::ENETRESET => ENETRESET,
15853da5c369Sopenharmony_ci            libc::ECONNABORTED => ECONNABORTED,
15863da5c369Sopenharmony_ci            libc::ECONNRESET => ECONNRESET,
15873da5c369Sopenharmony_ci            libc::ENOBUFS => ENOBUFS,
15883da5c369Sopenharmony_ci            libc::EISCONN => EISCONN,
15893da5c369Sopenharmony_ci            libc::ENOTCONN => ENOTCONN,
15903da5c369Sopenharmony_ci            libc::ESHUTDOWN => ESHUTDOWN,
15913da5c369Sopenharmony_ci            libc::ETOOMANYREFS => ETOOMANYREFS,
15923da5c369Sopenharmony_ci            libc::ETIMEDOUT => ETIMEDOUT,
15933da5c369Sopenharmony_ci            libc::ECONNREFUSED => ECONNREFUSED,
15943da5c369Sopenharmony_ci            libc::ELOOP => ELOOP,
15953da5c369Sopenharmony_ci            libc::ENAMETOOLONG => ENAMETOOLONG,
15963da5c369Sopenharmony_ci            libc::EHOSTDOWN => EHOSTDOWN,
15973da5c369Sopenharmony_ci            libc::EHOSTUNREACH => EHOSTUNREACH,
15983da5c369Sopenharmony_ci            libc::ENOTEMPTY => ENOTEMPTY,
15993da5c369Sopenharmony_ci            libc::EPROCLIM => EPROCLIM,
16003da5c369Sopenharmony_ci            libc::EUSERS => EUSERS,
16013da5c369Sopenharmony_ci            libc::EDQUOT => EDQUOT,
16023da5c369Sopenharmony_ci            libc::ESTALE => ESTALE,
16033da5c369Sopenharmony_ci            libc::EREMOTE => EREMOTE,
16043da5c369Sopenharmony_ci            libc::EBADRPC => EBADRPC,
16053da5c369Sopenharmony_ci            libc::ERPCMISMATCH => ERPCMISMATCH,
16063da5c369Sopenharmony_ci            libc::EPROGUNAVAIL => EPROGUNAVAIL,
16073da5c369Sopenharmony_ci            libc::EPROGMISMATCH => EPROGMISMATCH,
16083da5c369Sopenharmony_ci            libc::EPROCUNAVAIL => EPROCUNAVAIL,
16093da5c369Sopenharmony_ci            libc::ENOLCK => ENOLCK,
16103da5c369Sopenharmony_ci            libc::ENOSYS => ENOSYS,
16113da5c369Sopenharmony_ci            libc::EFTYPE => EFTYPE,
16123da5c369Sopenharmony_ci            libc::EAUTH => EAUTH,
16133da5c369Sopenharmony_ci            libc::ENEEDAUTH => ENEEDAUTH,
16143da5c369Sopenharmony_ci            libc::EPWROFF => EPWROFF,
16153da5c369Sopenharmony_ci            libc::EDEVERR => EDEVERR,
16163da5c369Sopenharmony_ci            libc::EOVERFLOW => EOVERFLOW,
16173da5c369Sopenharmony_ci            libc::EBADEXEC => EBADEXEC,
16183da5c369Sopenharmony_ci            libc::EBADARCH => EBADARCH,
16193da5c369Sopenharmony_ci            libc::ESHLIBVERS => ESHLIBVERS,
16203da5c369Sopenharmony_ci            libc::EBADMACHO => EBADMACHO,
16213da5c369Sopenharmony_ci            libc::ECANCELED => ECANCELED,
16223da5c369Sopenharmony_ci            libc::EIDRM => EIDRM,
16233da5c369Sopenharmony_ci            libc::ENOMSG => ENOMSG,
16243da5c369Sopenharmony_ci            libc::EILSEQ => EILSEQ,
16253da5c369Sopenharmony_ci            libc::ENOATTR => ENOATTR,
16263da5c369Sopenharmony_ci            libc::EBADMSG => EBADMSG,
16273da5c369Sopenharmony_ci            libc::EMULTIHOP => EMULTIHOP,
16283da5c369Sopenharmony_ci            libc::ENODATA => ENODATA,
16293da5c369Sopenharmony_ci            libc::ENOLINK => ENOLINK,
16303da5c369Sopenharmony_ci            libc::ENOSR => ENOSR,
16313da5c369Sopenharmony_ci            libc::ENOSTR => ENOSTR,
16323da5c369Sopenharmony_ci            libc::EPROTO => EPROTO,
16333da5c369Sopenharmony_ci            libc::ETIME => ETIME,
16343da5c369Sopenharmony_ci            libc::EOPNOTSUPP => EOPNOTSUPP,
16353da5c369Sopenharmony_ci            libc::ENOPOLICY => ENOPOLICY,
16363da5c369Sopenharmony_ci            libc::ENOTRECOVERABLE => ENOTRECOVERABLE,
16373da5c369Sopenharmony_ci            libc::EOWNERDEAD => EOWNERDEAD,
16383da5c369Sopenharmony_ci            libc::EQFULL => EQFULL,
16393da5c369Sopenharmony_ci            _ => UnknownErrno,
16403da5c369Sopenharmony_ci        }
16413da5c369Sopenharmony_ci    }
16423da5c369Sopenharmony_ci}
16433da5c369Sopenharmony_ci
16443da5c369Sopenharmony_ci#[cfg(target_os = "freebsd")]
16453da5c369Sopenharmony_cimod consts {
16463da5c369Sopenharmony_ci    #[derive(Clone, Copy, Debug, Eq, PartialEq)]
16473da5c369Sopenharmony_ci    #[repr(i32)]
16483da5c369Sopenharmony_ci    #[non_exhaustive]
16493da5c369Sopenharmony_ci    pub enum Errno {
16503da5c369Sopenharmony_ci        UnknownErrno = 0,
16513da5c369Sopenharmony_ci        EPERM = libc::EPERM,
16523da5c369Sopenharmony_ci        ENOENT = libc::ENOENT,
16533da5c369Sopenharmony_ci        ESRCH = libc::ESRCH,
16543da5c369Sopenharmony_ci        EINTR = libc::EINTR,
16553da5c369Sopenharmony_ci        EIO = libc::EIO,
16563da5c369Sopenharmony_ci        ENXIO = libc::ENXIO,
16573da5c369Sopenharmony_ci        E2BIG = libc::E2BIG,
16583da5c369Sopenharmony_ci        ENOEXEC = libc::ENOEXEC,
16593da5c369Sopenharmony_ci        EBADF = libc::EBADF,
16603da5c369Sopenharmony_ci        ECHILD = libc::ECHILD,
16613da5c369Sopenharmony_ci        EDEADLK = libc::EDEADLK,
16623da5c369Sopenharmony_ci        ENOMEM = libc::ENOMEM,
16633da5c369Sopenharmony_ci        EACCES = libc::EACCES,
16643da5c369Sopenharmony_ci        EFAULT = libc::EFAULT,
16653da5c369Sopenharmony_ci        ENOTBLK = libc::ENOTBLK,
16663da5c369Sopenharmony_ci        EBUSY = libc::EBUSY,
16673da5c369Sopenharmony_ci        EEXIST = libc::EEXIST,
16683da5c369Sopenharmony_ci        EXDEV = libc::EXDEV,
16693da5c369Sopenharmony_ci        ENODEV = libc::ENODEV,
16703da5c369Sopenharmony_ci        ENOTDIR = libc::ENOTDIR,
16713da5c369Sopenharmony_ci        EISDIR = libc::EISDIR,
16723da5c369Sopenharmony_ci        EINVAL = libc::EINVAL,
16733da5c369Sopenharmony_ci        ENFILE = libc::ENFILE,
16743da5c369Sopenharmony_ci        EMFILE = libc::EMFILE,
16753da5c369Sopenharmony_ci        ENOTTY = libc::ENOTTY,
16763da5c369Sopenharmony_ci        ETXTBSY = libc::ETXTBSY,
16773da5c369Sopenharmony_ci        EFBIG = libc::EFBIG,
16783da5c369Sopenharmony_ci        ENOSPC = libc::ENOSPC,
16793da5c369Sopenharmony_ci        ESPIPE = libc::ESPIPE,
16803da5c369Sopenharmony_ci        EROFS = libc::EROFS,
16813da5c369Sopenharmony_ci        EMLINK = libc::EMLINK,
16823da5c369Sopenharmony_ci        EPIPE = libc::EPIPE,
16833da5c369Sopenharmony_ci        EDOM = libc::EDOM,
16843da5c369Sopenharmony_ci        ERANGE = libc::ERANGE,
16853da5c369Sopenharmony_ci        EAGAIN = libc::EAGAIN,
16863da5c369Sopenharmony_ci        EINPROGRESS = libc::EINPROGRESS,
16873da5c369Sopenharmony_ci        EALREADY = libc::EALREADY,
16883da5c369Sopenharmony_ci        ENOTSOCK = libc::ENOTSOCK,
16893da5c369Sopenharmony_ci        EDESTADDRREQ = libc::EDESTADDRREQ,
16903da5c369Sopenharmony_ci        EMSGSIZE = libc::EMSGSIZE,
16913da5c369Sopenharmony_ci        EPROTOTYPE = libc::EPROTOTYPE,
16923da5c369Sopenharmony_ci        ENOPROTOOPT = libc::ENOPROTOOPT,
16933da5c369Sopenharmony_ci        EPROTONOSUPPORT = libc::EPROTONOSUPPORT,
16943da5c369Sopenharmony_ci        ESOCKTNOSUPPORT = libc::ESOCKTNOSUPPORT,
16953da5c369Sopenharmony_ci        ENOTSUP = libc::ENOTSUP,
16963da5c369Sopenharmony_ci        EPFNOSUPPORT = libc::EPFNOSUPPORT,
16973da5c369Sopenharmony_ci        EAFNOSUPPORT = libc::EAFNOSUPPORT,
16983da5c369Sopenharmony_ci        EADDRINUSE = libc::EADDRINUSE,
16993da5c369Sopenharmony_ci        EADDRNOTAVAIL = libc::EADDRNOTAVAIL,
17003da5c369Sopenharmony_ci        ENETDOWN = libc::ENETDOWN,
17013da5c369Sopenharmony_ci        ENETUNREACH = libc::ENETUNREACH,
17023da5c369Sopenharmony_ci        ENETRESET = libc::ENETRESET,
17033da5c369Sopenharmony_ci        ECONNABORTED = libc::ECONNABORTED,
17043da5c369Sopenharmony_ci        ECONNRESET = libc::ECONNRESET,
17053da5c369Sopenharmony_ci        ENOBUFS = libc::ENOBUFS,
17063da5c369Sopenharmony_ci        EISCONN = libc::EISCONN,
17073da5c369Sopenharmony_ci        ENOTCONN = libc::ENOTCONN,
17083da5c369Sopenharmony_ci        ESHUTDOWN = libc::ESHUTDOWN,
17093da5c369Sopenharmony_ci        ETOOMANYREFS = libc::ETOOMANYREFS,
17103da5c369Sopenharmony_ci        ETIMEDOUT = libc::ETIMEDOUT,
17113da5c369Sopenharmony_ci        ECONNREFUSED = libc::ECONNREFUSED,
17123da5c369Sopenharmony_ci        ELOOP = libc::ELOOP,
17133da5c369Sopenharmony_ci        ENAMETOOLONG = libc::ENAMETOOLONG,
17143da5c369Sopenharmony_ci        EHOSTDOWN = libc::EHOSTDOWN,
17153da5c369Sopenharmony_ci        EHOSTUNREACH = libc::EHOSTUNREACH,
17163da5c369Sopenharmony_ci        ENOTEMPTY = libc::ENOTEMPTY,
17173da5c369Sopenharmony_ci        EPROCLIM = libc::EPROCLIM,
17183da5c369Sopenharmony_ci        EUSERS = libc::EUSERS,
17193da5c369Sopenharmony_ci        EDQUOT = libc::EDQUOT,
17203da5c369Sopenharmony_ci        ESTALE = libc::ESTALE,
17213da5c369Sopenharmony_ci        EREMOTE = libc::EREMOTE,
17223da5c369Sopenharmony_ci        EBADRPC = libc::EBADRPC,
17233da5c369Sopenharmony_ci        ERPCMISMATCH = libc::ERPCMISMATCH,
17243da5c369Sopenharmony_ci        EPROGUNAVAIL = libc::EPROGUNAVAIL,
17253da5c369Sopenharmony_ci        EPROGMISMATCH = libc::EPROGMISMATCH,
17263da5c369Sopenharmony_ci        EPROCUNAVAIL = libc::EPROCUNAVAIL,
17273da5c369Sopenharmony_ci        ENOLCK = libc::ENOLCK,
17283da5c369Sopenharmony_ci        ENOSYS = libc::ENOSYS,
17293da5c369Sopenharmony_ci        EFTYPE = libc::EFTYPE,
17303da5c369Sopenharmony_ci        EAUTH = libc::EAUTH,
17313da5c369Sopenharmony_ci        ENEEDAUTH = libc::ENEEDAUTH,
17323da5c369Sopenharmony_ci        EIDRM = libc::EIDRM,
17333da5c369Sopenharmony_ci        ENOMSG = libc::ENOMSG,
17343da5c369Sopenharmony_ci        EOVERFLOW = libc::EOVERFLOW,
17353da5c369Sopenharmony_ci        ECANCELED = libc::ECANCELED,
17363da5c369Sopenharmony_ci        EILSEQ = libc::EILSEQ,
17373da5c369Sopenharmony_ci        ENOATTR = libc::ENOATTR,
17383da5c369Sopenharmony_ci        EDOOFUS = libc::EDOOFUS,
17393da5c369Sopenharmony_ci        EBADMSG = libc::EBADMSG,
17403da5c369Sopenharmony_ci        EMULTIHOP = libc::EMULTIHOP,
17413da5c369Sopenharmony_ci        ENOLINK = libc::ENOLINK,
17423da5c369Sopenharmony_ci        EPROTO = libc::EPROTO,
17433da5c369Sopenharmony_ci        ENOTCAPABLE = libc::ENOTCAPABLE,
17443da5c369Sopenharmony_ci        ECAPMODE = libc::ECAPMODE,
17453da5c369Sopenharmony_ci        ENOTRECOVERABLE = libc::ENOTRECOVERABLE,
17463da5c369Sopenharmony_ci        EOWNERDEAD = libc::EOWNERDEAD,
17473da5c369Sopenharmony_ci    }
17483da5c369Sopenharmony_ci
17493da5c369Sopenharmony_ci    impl Errno {
17503da5c369Sopenharmony_ci        pub const ELAST: Errno = Errno::EOWNERDEAD;
17513da5c369Sopenharmony_ci        pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
17523da5c369Sopenharmony_ci        pub const EDEADLOCK: Errno = Errno::EDEADLK;
17533da5c369Sopenharmony_ci        pub const EOPNOTSUPP: Errno = Errno::ENOTSUP;
17543da5c369Sopenharmony_ci    }
17553da5c369Sopenharmony_ci
17563da5c369Sopenharmony_ci    pub const fn from_i32(e: i32) -> Errno {
17573da5c369Sopenharmony_ci        use self::Errno::*;
17583da5c369Sopenharmony_ci
17593da5c369Sopenharmony_ci        match e {
17603da5c369Sopenharmony_ci            libc::EPERM => EPERM,
17613da5c369Sopenharmony_ci            libc::ENOENT => ENOENT,
17623da5c369Sopenharmony_ci            libc::ESRCH => ESRCH,
17633da5c369Sopenharmony_ci            libc::EINTR => EINTR,
17643da5c369Sopenharmony_ci            libc::EIO => EIO,
17653da5c369Sopenharmony_ci            libc::ENXIO => ENXIO,
17663da5c369Sopenharmony_ci            libc::E2BIG => E2BIG,
17673da5c369Sopenharmony_ci            libc::ENOEXEC => ENOEXEC,
17683da5c369Sopenharmony_ci            libc::EBADF => EBADF,
17693da5c369Sopenharmony_ci            libc::ECHILD => ECHILD,
17703da5c369Sopenharmony_ci            libc::EDEADLK => EDEADLK,
17713da5c369Sopenharmony_ci            libc::ENOMEM => ENOMEM,
17723da5c369Sopenharmony_ci            libc::EACCES => EACCES,
17733da5c369Sopenharmony_ci            libc::EFAULT => EFAULT,
17743da5c369Sopenharmony_ci            libc::ENOTBLK => ENOTBLK,
17753da5c369Sopenharmony_ci            libc::EBUSY => EBUSY,
17763da5c369Sopenharmony_ci            libc::EEXIST => EEXIST,
17773da5c369Sopenharmony_ci            libc::EXDEV => EXDEV,
17783da5c369Sopenharmony_ci            libc::ENODEV => ENODEV,
17793da5c369Sopenharmony_ci            libc::ENOTDIR => ENOTDIR,
17803da5c369Sopenharmony_ci            libc::EISDIR => EISDIR,
17813da5c369Sopenharmony_ci            libc::EINVAL => EINVAL,
17823da5c369Sopenharmony_ci            libc::ENFILE => ENFILE,
17833da5c369Sopenharmony_ci            libc::EMFILE => EMFILE,
17843da5c369Sopenharmony_ci            libc::ENOTTY => ENOTTY,
17853da5c369Sopenharmony_ci            libc::ETXTBSY => ETXTBSY,
17863da5c369Sopenharmony_ci            libc::EFBIG => EFBIG,
17873da5c369Sopenharmony_ci            libc::ENOSPC => ENOSPC,
17883da5c369Sopenharmony_ci            libc::ESPIPE => ESPIPE,
17893da5c369Sopenharmony_ci            libc::EROFS => EROFS,
17903da5c369Sopenharmony_ci            libc::EMLINK => EMLINK,
17913da5c369Sopenharmony_ci            libc::EPIPE => EPIPE,
17923da5c369Sopenharmony_ci            libc::EDOM => EDOM,
17933da5c369Sopenharmony_ci            libc::ERANGE => ERANGE,
17943da5c369Sopenharmony_ci            libc::EAGAIN => EAGAIN,
17953da5c369Sopenharmony_ci            libc::EINPROGRESS => EINPROGRESS,
17963da5c369Sopenharmony_ci            libc::EALREADY => EALREADY,
17973da5c369Sopenharmony_ci            libc::ENOTSOCK => ENOTSOCK,
17983da5c369Sopenharmony_ci            libc::EDESTADDRREQ => EDESTADDRREQ,
17993da5c369Sopenharmony_ci            libc::EMSGSIZE => EMSGSIZE,
18003da5c369Sopenharmony_ci            libc::EPROTOTYPE => EPROTOTYPE,
18013da5c369Sopenharmony_ci            libc::ENOPROTOOPT => ENOPROTOOPT,
18023da5c369Sopenharmony_ci            libc::EPROTONOSUPPORT => EPROTONOSUPPORT,
18033da5c369Sopenharmony_ci            libc::ESOCKTNOSUPPORT => ESOCKTNOSUPPORT,
18043da5c369Sopenharmony_ci            libc::ENOTSUP => ENOTSUP,
18053da5c369Sopenharmony_ci            libc::EPFNOSUPPORT => EPFNOSUPPORT,
18063da5c369Sopenharmony_ci            libc::EAFNOSUPPORT => EAFNOSUPPORT,
18073da5c369Sopenharmony_ci            libc::EADDRINUSE => EADDRINUSE,
18083da5c369Sopenharmony_ci            libc::EADDRNOTAVAIL => EADDRNOTAVAIL,
18093da5c369Sopenharmony_ci            libc::ENETDOWN => ENETDOWN,
18103da5c369Sopenharmony_ci            libc::ENETUNREACH => ENETUNREACH,
18113da5c369Sopenharmony_ci            libc::ENETRESET => ENETRESET,
18123da5c369Sopenharmony_ci            libc::ECONNABORTED => ECONNABORTED,
18133da5c369Sopenharmony_ci            libc::ECONNRESET => ECONNRESET,
18143da5c369Sopenharmony_ci            libc::ENOBUFS => ENOBUFS,
18153da5c369Sopenharmony_ci            libc::EISCONN => EISCONN,
18163da5c369Sopenharmony_ci            libc::ENOTCONN => ENOTCONN,
18173da5c369Sopenharmony_ci            libc::ESHUTDOWN => ESHUTDOWN,
18183da5c369Sopenharmony_ci            libc::ETOOMANYREFS => ETOOMANYREFS,
18193da5c369Sopenharmony_ci            libc::ETIMEDOUT => ETIMEDOUT,
18203da5c369Sopenharmony_ci            libc::ECONNREFUSED => ECONNREFUSED,
18213da5c369Sopenharmony_ci            libc::ELOOP => ELOOP,
18223da5c369Sopenharmony_ci            libc::ENAMETOOLONG => ENAMETOOLONG,
18233da5c369Sopenharmony_ci            libc::EHOSTDOWN => EHOSTDOWN,
18243da5c369Sopenharmony_ci            libc::EHOSTUNREACH => EHOSTUNREACH,
18253da5c369Sopenharmony_ci            libc::ENOTEMPTY => ENOTEMPTY,
18263da5c369Sopenharmony_ci            libc::EPROCLIM => EPROCLIM,
18273da5c369Sopenharmony_ci            libc::EUSERS => EUSERS,
18283da5c369Sopenharmony_ci            libc::EDQUOT => EDQUOT,
18293da5c369Sopenharmony_ci            libc::ESTALE => ESTALE,
18303da5c369Sopenharmony_ci            libc::EREMOTE => EREMOTE,
18313da5c369Sopenharmony_ci            libc::EBADRPC => EBADRPC,
18323da5c369Sopenharmony_ci            libc::ERPCMISMATCH => ERPCMISMATCH,
18333da5c369Sopenharmony_ci            libc::EPROGUNAVAIL => EPROGUNAVAIL,
18343da5c369Sopenharmony_ci            libc::EPROGMISMATCH => EPROGMISMATCH,
18353da5c369Sopenharmony_ci            libc::EPROCUNAVAIL => EPROCUNAVAIL,
18363da5c369Sopenharmony_ci            libc::ENOLCK => ENOLCK,
18373da5c369Sopenharmony_ci            libc::ENOSYS => ENOSYS,
18383da5c369Sopenharmony_ci            libc::EFTYPE => EFTYPE,
18393da5c369Sopenharmony_ci            libc::EAUTH => EAUTH,
18403da5c369Sopenharmony_ci            libc::ENEEDAUTH => ENEEDAUTH,
18413da5c369Sopenharmony_ci            libc::EIDRM => EIDRM,
18423da5c369Sopenharmony_ci            libc::ENOMSG => ENOMSG,
18433da5c369Sopenharmony_ci            libc::EOVERFLOW => EOVERFLOW,
18443da5c369Sopenharmony_ci            libc::ECANCELED => ECANCELED,
18453da5c369Sopenharmony_ci            libc::EILSEQ => EILSEQ,
18463da5c369Sopenharmony_ci            libc::ENOATTR => ENOATTR,
18473da5c369Sopenharmony_ci            libc::EDOOFUS => EDOOFUS,
18483da5c369Sopenharmony_ci            libc::EBADMSG => EBADMSG,
18493da5c369Sopenharmony_ci            libc::EMULTIHOP => EMULTIHOP,
18503da5c369Sopenharmony_ci            libc::ENOLINK => ENOLINK,
18513da5c369Sopenharmony_ci            libc::EPROTO => EPROTO,
18523da5c369Sopenharmony_ci            libc::ENOTCAPABLE => ENOTCAPABLE,
18533da5c369Sopenharmony_ci            libc::ECAPMODE => ECAPMODE,
18543da5c369Sopenharmony_ci            libc::ENOTRECOVERABLE => ENOTRECOVERABLE,
18553da5c369Sopenharmony_ci            libc::EOWNERDEAD => EOWNERDEAD,
18563da5c369Sopenharmony_ci            _ => UnknownErrno,
18573da5c369Sopenharmony_ci        }
18583da5c369Sopenharmony_ci    }
18593da5c369Sopenharmony_ci}
18603da5c369Sopenharmony_ci
18613da5c369Sopenharmony_ci#[cfg(target_os = "dragonfly")]
18623da5c369Sopenharmony_cimod consts {
18633da5c369Sopenharmony_ci    #[derive(Clone, Copy, Debug, Eq, PartialEq)]
18643da5c369Sopenharmony_ci    #[repr(i32)]
18653da5c369Sopenharmony_ci    #[non_exhaustive]
18663da5c369Sopenharmony_ci    pub enum Errno {
18673da5c369Sopenharmony_ci        UnknownErrno = 0,
18683da5c369Sopenharmony_ci        EPERM = libc::EPERM,
18693da5c369Sopenharmony_ci        ENOENT = libc::ENOENT,
18703da5c369Sopenharmony_ci        ESRCH = libc::ESRCH,
18713da5c369Sopenharmony_ci        EINTR = libc::EINTR,
18723da5c369Sopenharmony_ci        EIO = libc::EIO,
18733da5c369Sopenharmony_ci        ENXIO = libc::ENXIO,
18743da5c369Sopenharmony_ci        E2BIG = libc::E2BIG,
18753da5c369Sopenharmony_ci        ENOEXEC = libc::ENOEXEC,
18763da5c369Sopenharmony_ci        EBADF = libc::EBADF,
18773da5c369Sopenharmony_ci        ECHILD = libc::ECHILD,
18783da5c369Sopenharmony_ci        EDEADLK = libc::EDEADLK,
18793da5c369Sopenharmony_ci        ENOMEM = libc::ENOMEM,
18803da5c369Sopenharmony_ci        EACCES = libc::EACCES,
18813da5c369Sopenharmony_ci        EFAULT = libc::EFAULT,
18823da5c369Sopenharmony_ci        ENOTBLK = libc::ENOTBLK,
18833da5c369Sopenharmony_ci        EBUSY = libc::EBUSY,
18843da5c369Sopenharmony_ci        EEXIST = libc::EEXIST,
18853da5c369Sopenharmony_ci        EXDEV = libc::EXDEV,
18863da5c369Sopenharmony_ci        ENODEV = libc::ENODEV,
18873da5c369Sopenharmony_ci        ENOTDIR = libc::ENOTDIR,
18883da5c369Sopenharmony_ci        EISDIR = libc::EISDIR,
18893da5c369Sopenharmony_ci        EINVAL = libc::EINVAL,
18903da5c369Sopenharmony_ci        ENFILE = libc::ENFILE,
18913da5c369Sopenharmony_ci        EMFILE = libc::EMFILE,
18923da5c369Sopenharmony_ci        ENOTTY = libc::ENOTTY,
18933da5c369Sopenharmony_ci        ETXTBSY = libc::ETXTBSY,
18943da5c369Sopenharmony_ci        EFBIG = libc::EFBIG,
18953da5c369Sopenharmony_ci        ENOSPC = libc::ENOSPC,
18963da5c369Sopenharmony_ci        ESPIPE = libc::ESPIPE,
18973da5c369Sopenharmony_ci        EROFS = libc::EROFS,
18983da5c369Sopenharmony_ci        EMLINK = libc::EMLINK,
18993da5c369Sopenharmony_ci        EPIPE = libc::EPIPE,
19003da5c369Sopenharmony_ci        EDOM = libc::EDOM,
19013da5c369Sopenharmony_ci        ERANGE = libc::ERANGE,
19023da5c369Sopenharmony_ci        EAGAIN = libc::EAGAIN,
19033da5c369Sopenharmony_ci        EINPROGRESS = libc::EINPROGRESS,
19043da5c369Sopenharmony_ci        EALREADY = libc::EALREADY,
19053da5c369Sopenharmony_ci        ENOTSOCK = libc::ENOTSOCK,
19063da5c369Sopenharmony_ci        EDESTADDRREQ = libc::EDESTADDRREQ,
19073da5c369Sopenharmony_ci        EMSGSIZE = libc::EMSGSIZE,
19083da5c369Sopenharmony_ci        EPROTOTYPE = libc::EPROTOTYPE,
19093da5c369Sopenharmony_ci        ENOPROTOOPT = libc::ENOPROTOOPT,
19103da5c369Sopenharmony_ci        EPROTONOSUPPORT = libc::EPROTONOSUPPORT,
19113da5c369Sopenharmony_ci        ESOCKTNOSUPPORT = libc::ESOCKTNOSUPPORT,
19123da5c369Sopenharmony_ci        ENOTSUP = libc::ENOTSUP,
19133da5c369Sopenharmony_ci        EPFNOSUPPORT = libc::EPFNOSUPPORT,
19143da5c369Sopenharmony_ci        EAFNOSUPPORT = libc::EAFNOSUPPORT,
19153da5c369Sopenharmony_ci        EADDRINUSE = libc::EADDRINUSE,
19163da5c369Sopenharmony_ci        EADDRNOTAVAIL = libc::EADDRNOTAVAIL,
19173da5c369Sopenharmony_ci        ENETDOWN = libc::ENETDOWN,
19183da5c369Sopenharmony_ci        ENETUNREACH = libc::ENETUNREACH,
19193da5c369Sopenharmony_ci        ENETRESET = libc::ENETRESET,
19203da5c369Sopenharmony_ci        ECONNABORTED = libc::ECONNABORTED,
19213da5c369Sopenharmony_ci        ECONNRESET = libc::ECONNRESET,
19223da5c369Sopenharmony_ci        ENOBUFS = libc::ENOBUFS,
19233da5c369Sopenharmony_ci        EISCONN = libc::EISCONN,
19243da5c369Sopenharmony_ci        ENOTCONN = libc::ENOTCONN,
19253da5c369Sopenharmony_ci        ESHUTDOWN = libc::ESHUTDOWN,
19263da5c369Sopenharmony_ci        ETOOMANYREFS = libc::ETOOMANYREFS,
19273da5c369Sopenharmony_ci        ETIMEDOUT = libc::ETIMEDOUT,
19283da5c369Sopenharmony_ci        ECONNREFUSED = libc::ECONNREFUSED,
19293da5c369Sopenharmony_ci        ELOOP = libc::ELOOP,
19303da5c369Sopenharmony_ci        ENAMETOOLONG = libc::ENAMETOOLONG,
19313da5c369Sopenharmony_ci        EHOSTDOWN = libc::EHOSTDOWN,
19323da5c369Sopenharmony_ci        EHOSTUNREACH = libc::EHOSTUNREACH,
19333da5c369Sopenharmony_ci        ENOTEMPTY = libc::ENOTEMPTY,
19343da5c369Sopenharmony_ci        EPROCLIM = libc::EPROCLIM,
19353da5c369Sopenharmony_ci        EUSERS = libc::EUSERS,
19363da5c369Sopenharmony_ci        EDQUOT = libc::EDQUOT,
19373da5c369Sopenharmony_ci        ESTALE = libc::ESTALE,
19383da5c369Sopenharmony_ci        EREMOTE = libc::EREMOTE,
19393da5c369Sopenharmony_ci        EBADRPC = libc::EBADRPC,
19403da5c369Sopenharmony_ci        ERPCMISMATCH = libc::ERPCMISMATCH,
19413da5c369Sopenharmony_ci        EPROGUNAVAIL = libc::EPROGUNAVAIL,
19423da5c369Sopenharmony_ci        EPROGMISMATCH = libc::EPROGMISMATCH,
19433da5c369Sopenharmony_ci        EPROCUNAVAIL = libc::EPROCUNAVAIL,
19443da5c369Sopenharmony_ci        ENOLCK = libc::ENOLCK,
19453da5c369Sopenharmony_ci        ENOSYS = libc::ENOSYS,
19463da5c369Sopenharmony_ci        EFTYPE = libc::EFTYPE,
19473da5c369Sopenharmony_ci        EAUTH = libc::EAUTH,
19483da5c369Sopenharmony_ci        ENEEDAUTH = libc::ENEEDAUTH,
19493da5c369Sopenharmony_ci        EIDRM = libc::EIDRM,
19503da5c369Sopenharmony_ci        ENOMSG = libc::ENOMSG,
19513da5c369Sopenharmony_ci        EOVERFLOW = libc::EOVERFLOW,
19523da5c369Sopenharmony_ci        ECANCELED = libc::ECANCELED,
19533da5c369Sopenharmony_ci        EILSEQ = libc::EILSEQ,
19543da5c369Sopenharmony_ci        ENOATTR = libc::ENOATTR,
19553da5c369Sopenharmony_ci        EDOOFUS = libc::EDOOFUS,
19563da5c369Sopenharmony_ci        EBADMSG = libc::EBADMSG,
19573da5c369Sopenharmony_ci        EMULTIHOP = libc::EMULTIHOP,
19583da5c369Sopenharmony_ci        ENOLINK = libc::ENOLINK,
19593da5c369Sopenharmony_ci        EPROTO = libc::EPROTO,
19603da5c369Sopenharmony_ci        ENOMEDIUM = libc::ENOMEDIUM,
19613da5c369Sopenharmony_ci        ENOTRECOVERABLE = libc::ENOTRECOVERABLE,
19623da5c369Sopenharmony_ci        EOWNERDEAD = libc::EOWNERDEAD,
19633da5c369Sopenharmony_ci        EASYNC = libc::EASYNC,
19643da5c369Sopenharmony_ci    }
19653da5c369Sopenharmony_ci
19663da5c369Sopenharmony_ci    impl Errno {
19673da5c369Sopenharmony_ci        pub const ELAST: Errno = Errno::EASYNC;
19683da5c369Sopenharmony_ci        pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
19693da5c369Sopenharmony_ci        pub const EDEADLOCK: Errno = Errno::EDEADLK;
19703da5c369Sopenharmony_ci        pub const EOPNOTSUPP: Errno = Errno::ENOTSUP;
19713da5c369Sopenharmony_ci    }
19723da5c369Sopenharmony_ci
19733da5c369Sopenharmony_ci    pub const fn from_i32(e: i32) -> Errno {
19743da5c369Sopenharmony_ci        use self::Errno::*;
19753da5c369Sopenharmony_ci
19763da5c369Sopenharmony_ci        match e {
19773da5c369Sopenharmony_ci            libc::EPERM => EPERM,
19783da5c369Sopenharmony_ci            libc::ENOENT => ENOENT,
19793da5c369Sopenharmony_ci            libc::ESRCH => ESRCH,
19803da5c369Sopenharmony_ci            libc::EINTR => EINTR,
19813da5c369Sopenharmony_ci            libc::EIO => EIO,
19823da5c369Sopenharmony_ci            libc::ENXIO => ENXIO,
19833da5c369Sopenharmony_ci            libc::E2BIG => E2BIG,
19843da5c369Sopenharmony_ci            libc::ENOEXEC => ENOEXEC,
19853da5c369Sopenharmony_ci            libc::EBADF => EBADF,
19863da5c369Sopenharmony_ci            libc::ECHILD => ECHILD,
19873da5c369Sopenharmony_ci            libc::EDEADLK => EDEADLK,
19883da5c369Sopenharmony_ci            libc::ENOMEM => ENOMEM,
19893da5c369Sopenharmony_ci            libc::EACCES => EACCES,
19903da5c369Sopenharmony_ci            libc::EFAULT => EFAULT,
19913da5c369Sopenharmony_ci            libc::ENOTBLK => ENOTBLK,
19923da5c369Sopenharmony_ci            libc::EBUSY => EBUSY,
19933da5c369Sopenharmony_ci            libc::EEXIST => EEXIST,
19943da5c369Sopenharmony_ci            libc::EXDEV => EXDEV,
19953da5c369Sopenharmony_ci            libc::ENODEV => ENODEV,
19963da5c369Sopenharmony_ci            libc::ENOTDIR => ENOTDIR,
19973da5c369Sopenharmony_ci            libc::EISDIR => EISDIR,
19983da5c369Sopenharmony_ci            libc::EINVAL => EINVAL,
19993da5c369Sopenharmony_ci            libc::ENFILE => ENFILE,
20003da5c369Sopenharmony_ci            libc::EMFILE => EMFILE,
20013da5c369Sopenharmony_ci            libc::ENOTTY => ENOTTY,
20023da5c369Sopenharmony_ci            libc::ETXTBSY => ETXTBSY,
20033da5c369Sopenharmony_ci            libc::EFBIG => EFBIG,
20043da5c369Sopenharmony_ci            libc::ENOSPC => ENOSPC,
20053da5c369Sopenharmony_ci            libc::ESPIPE => ESPIPE,
20063da5c369Sopenharmony_ci            libc::EROFS => EROFS,
20073da5c369Sopenharmony_ci            libc::EMLINK => EMLINK,
20083da5c369Sopenharmony_ci            libc::EPIPE => EPIPE,
20093da5c369Sopenharmony_ci            libc::EDOM => EDOM,
20103da5c369Sopenharmony_ci            libc::ERANGE => ERANGE,
20113da5c369Sopenharmony_ci            libc::EAGAIN => EAGAIN,
20123da5c369Sopenharmony_ci            libc::EINPROGRESS => EINPROGRESS,
20133da5c369Sopenharmony_ci            libc::EALREADY => EALREADY,
20143da5c369Sopenharmony_ci            libc::ENOTSOCK => ENOTSOCK,
20153da5c369Sopenharmony_ci            libc::EDESTADDRREQ => EDESTADDRREQ,
20163da5c369Sopenharmony_ci            libc::EMSGSIZE => EMSGSIZE,
20173da5c369Sopenharmony_ci            libc::EPROTOTYPE => EPROTOTYPE,
20183da5c369Sopenharmony_ci            libc::ENOPROTOOPT => ENOPROTOOPT,
20193da5c369Sopenharmony_ci            libc::EPROTONOSUPPORT => EPROTONOSUPPORT,
20203da5c369Sopenharmony_ci            libc::ESOCKTNOSUPPORT => ESOCKTNOSUPPORT,
20213da5c369Sopenharmony_ci            libc::ENOTSUP => ENOTSUP,
20223da5c369Sopenharmony_ci            libc::EPFNOSUPPORT => EPFNOSUPPORT,
20233da5c369Sopenharmony_ci            libc::EAFNOSUPPORT => EAFNOSUPPORT,
20243da5c369Sopenharmony_ci            libc::EADDRINUSE => EADDRINUSE,
20253da5c369Sopenharmony_ci            libc::EADDRNOTAVAIL => EADDRNOTAVAIL,
20263da5c369Sopenharmony_ci            libc::ENETDOWN => ENETDOWN,
20273da5c369Sopenharmony_ci            libc::ENETUNREACH => ENETUNREACH,
20283da5c369Sopenharmony_ci            libc::ENETRESET => ENETRESET,
20293da5c369Sopenharmony_ci            libc::ECONNABORTED => ECONNABORTED,
20303da5c369Sopenharmony_ci            libc::ECONNRESET => ECONNRESET,
20313da5c369Sopenharmony_ci            libc::ENOBUFS => ENOBUFS,
20323da5c369Sopenharmony_ci            libc::EISCONN => EISCONN,
20333da5c369Sopenharmony_ci            libc::ENOTCONN => ENOTCONN,
20343da5c369Sopenharmony_ci            libc::ESHUTDOWN => ESHUTDOWN,
20353da5c369Sopenharmony_ci            libc::ETOOMANYREFS => ETOOMANYREFS,
20363da5c369Sopenharmony_ci            libc::ETIMEDOUT => ETIMEDOUT,
20373da5c369Sopenharmony_ci            libc::ECONNREFUSED => ECONNREFUSED,
20383da5c369Sopenharmony_ci            libc::ELOOP => ELOOP,
20393da5c369Sopenharmony_ci            libc::ENAMETOOLONG => ENAMETOOLONG,
20403da5c369Sopenharmony_ci            libc::EHOSTDOWN => EHOSTDOWN,
20413da5c369Sopenharmony_ci            libc::EHOSTUNREACH => EHOSTUNREACH,
20423da5c369Sopenharmony_ci            libc::ENOTEMPTY => ENOTEMPTY,
20433da5c369Sopenharmony_ci            libc::EPROCLIM => EPROCLIM,
20443da5c369Sopenharmony_ci            libc::EUSERS => EUSERS,
20453da5c369Sopenharmony_ci            libc::EDQUOT => EDQUOT,
20463da5c369Sopenharmony_ci            libc::ESTALE => ESTALE,
20473da5c369Sopenharmony_ci            libc::EREMOTE => EREMOTE,
20483da5c369Sopenharmony_ci            libc::EBADRPC => EBADRPC,
20493da5c369Sopenharmony_ci            libc::ERPCMISMATCH => ERPCMISMATCH,
20503da5c369Sopenharmony_ci            libc::EPROGUNAVAIL => EPROGUNAVAIL,
20513da5c369Sopenharmony_ci            libc::EPROGMISMATCH => EPROGMISMATCH,
20523da5c369Sopenharmony_ci            libc::EPROCUNAVAIL => EPROCUNAVAIL,
20533da5c369Sopenharmony_ci            libc::ENOLCK => ENOLCK,
20543da5c369Sopenharmony_ci            libc::ENOSYS => ENOSYS,
20553da5c369Sopenharmony_ci            libc::EFTYPE => EFTYPE,
20563da5c369Sopenharmony_ci            libc::EAUTH => EAUTH,
20573da5c369Sopenharmony_ci            libc::ENEEDAUTH => ENEEDAUTH,
20583da5c369Sopenharmony_ci            libc::EIDRM => EIDRM,
20593da5c369Sopenharmony_ci            libc::ENOMSG => ENOMSG,
20603da5c369Sopenharmony_ci            libc::EOVERFLOW => EOVERFLOW,
20613da5c369Sopenharmony_ci            libc::ECANCELED => ECANCELED,
20623da5c369Sopenharmony_ci            libc::EILSEQ => EILSEQ,
20633da5c369Sopenharmony_ci            libc::ENOATTR => ENOATTR,
20643da5c369Sopenharmony_ci            libc::EDOOFUS => EDOOFUS,
20653da5c369Sopenharmony_ci            libc::EBADMSG => EBADMSG,
20663da5c369Sopenharmony_ci            libc::EMULTIHOP => EMULTIHOP,
20673da5c369Sopenharmony_ci            libc::ENOLINK => ENOLINK,
20683da5c369Sopenharmony_ci            libc::EPROTO => EPROTO,
20693da5c369Sopenharmony_ci            libc::ENOMEDIUM => ENOMEDIUM,
20703da5c369Sopenharmony_ci            libc::EASYNC => EASYNC,
20713da5c369Sopenharmony_ci            _ => UnknownErrno,
20723da5c369Sopenharmony_ci        }
20733da5c369Sopenharmony_ci    }
20743da5c369Sopenharmony_ci}
20753da5c369Sopenharmony_ci
20763da5c369Sopenharmony_ci#[cfg(target_os = "openbsd")]
20773da5c369Sopenharmony_cimod consts {
20783da5c369Sopenharmony_ci    #[derive(Clone, Copy, Debug, Eq, PartialEq)]
20793da5c369Sopenharmony_ci    #[repr(i32)]
20803da5c369Sopenharmony_ci    #[non_exhaustive]
20813da5c369Sopenharmony_ci    pub enum Errno {
20823da5c369Sopenharmony_ci        UnknownErrno = 0,
20833da5c369Sopenharmony_ci        EPERM = libc::EPERM,
20843da5c369Sopenharmony_ci        ENOENT = libc::ENOENT,
20853da5c369Sopenharmony_ci        ESRCH = libc::ESRCH,
20863da5c369Sopenharmony_ci        EINTR = libc::EINTR,
20873da5c369Sopenharmony_ci        EIO = libc::EIO,
20883da5c369Sopenharmony_ci        ENXIO = libc::ENXIO,
20893da5c369Sopenharmony_ci        E2BIG = libc::E2BIG,
20903da5c369Sopenharmony_ci        ENOEXEC = libc::ENOEXEC,
20913da5c369Sopenharmony_ci        EBADF = libc::EBADF,
20923da5c369Sopenharmony_ci        ECHILD = libc::ECHILD,
20933da5c369Sopenharmony_ci        EDEADLK = libc::EDEADLK,
20943da5c369Sopenharmony_ci        ENOMEM = libc::ENOMEM,
20953da5c369Sopenharmony_ci        EACCES = libc::EACCES,
20963da5c369Sopenharmony_ci        EFAULT = libc::EFAULT,
20973da5c369Sopenharmony_ci        ENOTBLK = libc::ENOTBLK,
20983da5c369Sopenharmony_ci        EBUSY = libc::EBUSY,
20993da5c369Sopenharmony_ci        EEXIST = libc::EEXIST,
21003da5c369Sopenharmony_ci        EXDEV = libc::EXDEV,
21013da5c369Sopenharmony_ci        ENODEV = libc::ENODEV,
21023da5c369Sopenharmony_ci        ENOTDIR = libc::ENOTDIR,
21033da5c369Sopenharmony_ci        EISDIR = libc::EISDIR,
21043da5c369Sopenharmony_ci        EINVAL = libc::EINVAL,
21053da5c369Sopenharmony_ci        ENFILE = libc::ENFILE,
21063da5c369Sopenharmony_ci        EMFILE = libc::EMFILE,
21073da5c369Sopenharmony_ci        ENOTTY = libc::ENOTTY,
21083da5c369Sopenharmony_ci        ETXTBSY = libc::ETXTBSY,
21093da5c369Sopenharmony_ci        EFBIG = libc::EFBIG,
21103da5c369Sopenharmony_ci        ENOSPC = libc::ENOSPC,
21113da5c369Sopenharmony_ci        ESPIPE = libc::ESPIPE,
21123da5c369Sopenharmony_ci        EROFS = libc::EROFS,
21133da5c369Sopenharmony_ci        EMLINK = libc::EMLINK,
21143da5c369Sopenharmony_ci        EPIPE = libc::EPIPE,
21153da5c369Sopenharmony_ci        EDOM = libc::EDOM,
21163da5c369Sopenharmony_ci        ERANGE = libc::ERANGE,
21173da5c369Sopenharmony_ci        EAGAIN = libc::EAGAIN,
21183da5c369Sopenharmony_ci        EINPROGRESS = libc::EINPROGRESS,
21193da5c369Sopenharmony_ci        EALREADY = libc::EALREADY,
21203da5c369Sopenharmony_ci        ENOTSOCK = libc::ENOTSOCK,
21213da5c369Sopenharmony_ci        EDESTADDRREQ = libc::EDESTADDRREQ,
21223da5c369Sopenharmony_ci        EMSGSIZE = libc::EMSGSIZE,
21233da5c369Sopenharmony_ci        EPROTOTYPE = libc::EPROTOTYPE,
21243da5c369Sopenharmony_ci        ENOPROTOOPT = libc::ENOPROTOOPT,
21253da5c369Sopenharmony_ci        EPROTONOSUPPORT = libc::EPROTONOSUPPORT,
21263da5c369Sopenharmony_ci        ESOCKTNOSUPPORT = libc::ESOCKTNOSUPPORT,
21273da5c369Sopenharmony_ci        EOPNOTSUPP = libc::EOPNOTSUPP,
21283da5c369Sopenharmony_ci        EPFNOSUPPORT = libc::EPFNOSUPPORT,
21293da5c369Sopenharmony_ci        EAFNOSUPPORT = libc::EAFNOSUPPORT,
21303da5c369Sopenharmony_ci        EADDRINUSE = libc::EADDRINUSE,
21313da5c369Sopenharmony_ci        EADDRNOTAVAIL = libc::EADDRNOTAVAIL,
21323da5c369Sopenharmony_ci        ENETDOWN = libc::ENETDOWN,
21333da5c369Sopenharmony_ci        ENETUNREACH = libc::ENETUNREACH,
21343da5c369Sopenharmony_ci        ENETRESET = libc::ENETRESET,
21353da5c369Sopenharmony_ci        ECONNABORTED = libc::ECONNABORTED,
21363da5c369Sopenharmony_ci        ECONNRESET = libc::ECONNRESET,
21373da5c369Sopenharmony_ci        ENOBUFS = libc::ENOBUFS,
21383da5c369Sopenharmony_ci        EISCONN = libc::EISCONN,
21393da5c369Sopenharmony_ci        ENOTCONN = libc::ENOTCONN,
21403da5c369Sopenharmony_ci        ESHUTDOWN = libc::ESHUTDOWN,
21413da5c369Sopenharmony_ci        ETOOMANYREFS = libc::ETOOMANYREFS,
21423da5c369Sopenharmony_ci        ETIMEDOUT = libc::ETIMEDOUT,
21433da5c369Sopenharmony_ci        ECONNREFUSED = libc::ECONNREFUSED,
21443da5c369Sopenharmony_ci        ELOOP = libc::ELOOP,
21453da5c369Sopenharmony_ci        ENAMETOOLONG = libc::ENAMETOOLONG,
21463da5c369Sopenharmony_ci        EHOSTDOWN = libc::EHOSTDOWN,
21473da5c369Sopenharmony_ci        EHOSTUNREACH = libc::EHOSTUNREACH,
21483da5c369Sopenharmony_ci        ENOTEMPTY = libc::ENOTEMPTY,
21493da5c369Sopenharmony_ci        EPROCLIM = libc::EPROCLIM,
21503da5c369Sopenharmony_ci        EUSERS = libc::EUSERS,
21513da5c369Sopenharmony_ci        EDQUOT = libc::EDQUOT,
21523da5c369Sopenharmony_ci        ESTALE = libc::ESTALE,
21533da5c369Sopenharmony_ci        EREMOTE = libc::EREMOTE,
21543da5c369Sopenharmony_ci        EBADRPC = libc::EBADRPC,
21553da5c369Sopenharmony_ci        ERPCMISMATCH = libc::ERPCMISMATCH,
21563da5c369Sopenharmony_ci        EPROGUNAVAIL = libc::EPROGUNAVAIL,
21573da5c369Sopenharmony_ci        EPROGMISMATCH = libc::EPROGMISMATCH,
21583da5c369Sopenharmony_ci        EPROCUNAVAIL = libc::EPROCUNAVAIL,
21593da5c369Sopenharmony_ci        ENOLCK = libc::ENOLCK,
21603da5c369Sopenharmony_ci        ENOSYS = libc::ENOSYS,
21613da5c369Sopenharmony_ci        EFTYPE = libc::EFTYPE,
21623da5c369Sopenharmony_ci        EAUTH = libc::EAUTH,
21633da5c369Sopenharmony_ci        ENEEDAUTH = libc::ENEEDAUTH,
21643da5c369Sopenharmony_ci        EIPSEC = libc::EIPSEC,
21653da5c369Sopenharmony_ci        ENOATTR = libc::ENOATTR,
21663da5c369Sopenharmony_ci        EILSEQ = libc::EILSEQ,
21673da5c369Sopenharmony_ci        ENOMEDIUM = libc::ENOMEDIUM,
21683da5c369Sopenharmony_ci        EMEDIUMTYPE = libc::EMEDIUMTYPE,
21693da5c369Sopenharmony_ci        EOVERFLOW = libc::EOVERFLOW,
21703da5c369Sopenharmony_ci        ECANCELED = libc::ECANCELED,
21713da5c369Sopenharmony_ci        EIDRM = libc::EIDRM,
21723da5c369Sopenharmony_ci        ENOMSG = libc::ENOMSG,
21733da5c369Sopenharmony_ci        ENOTSUP = libc::ENOTSUP,
21743da5c369Sopenharmony_ci        EBADMSG = libc::EBADMSG,
21753da5c369Sopenharmony_ci        ENOTRECOVERABLE = libc::ENOTRECOVERABLE,
21763da5c369Sopenharmony_ci        EOWNERDEAD = libc::EOWNERDEAD,
21773da5c369Sopenharmony_ci        EPROTO = libc::EPROTO,
21783da5c369Sopenharmony_ci    }
21793da5c369Sopenharmony_ci
21803da5c369Sopenharmony_ci    impl Errno {
21813da5c369Sopenharmony_ci        pub const ELAST: Errno = Errno::ENOTSUP;
21823da5c369Sopenharmony_ci        pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
21833da5c369Sopenharmony_ci    }
21843da5c369Sopenharmony_ci
21853da5c369Sopenharmony_ci    pub const fn from_i32(e: i32) -> Errno {
21863da5c369Sopenharmony_ci        use self::Errno::*;
21873da5c369Sopenharmony_ci
21883da5c369Sopenharmony_ci        match e {
21893da5c369Sopenharmony_ci            libc::EPERM => EPERM,
21903da5c369Sopenharmony_ci            libc::ENOENT => ENOENT,
21913da5c369Sopenharmony_ci            libc::ESRCH => ESRCH,
21923da5c369Sopenharmony_ci            libc::EINTR => EINTR,
21933da5c369Sopenharmony_ci            libc::EIO => EIO,
21943da5c369Sopenharmony_ci            libc::ENXIO => ENXIO,
21953da5c369Sopenharmony_ci            libc::E2BIG => E2BIG,
21963da5c369Sopenharmony_ci            libc::ENOEXEC => ENOEXEC,
21973da5c369Sopenharmony_ci            libc::EBADF => EBADF,
21983da5c369Sopenharmony_ci            libc::ECHILD => ECHILD,
21993da5c369Sopenharmony_ci            libc::EDEADLK => EDEADLK,
22003da5c369Sopenharmony_ci            libc::ENOMEM => ENOMEM,
22013da5c369Sopenharmony_ci            libc::EACCES => EACCES,
22023da5c369Sopenharmony_ci            libc::EFAULT => EFAULT,
22033da5c369Sopenharmony_ci            libc::ENOTBLK => ENOTBLK,
22043da5c369Sopenharmony_ci            libc::EBUSY => EBUSY,
22053da5c369Sopenharmony_ci            libc::EEXIST => EEXIST,
22063da5c369Sopenharmony_ci            libc::EXDEV => EXDEV,
22073da5c369Sopenharmony_ci            libc::ENODEV => ENODEV,
22083da5c369Sopenharmony_ci            libc::ENOTDIR => ENOTDIR,
22093da5c369Sopenharmony_ci            libc::EISDIR => EISDIR,
22103da5c369Sopenharmony_ci            libc::EINVAL => EINVAL,
22113da5c369Sopenharmony_ci            libc::ENFILE => ENFILE,
22123da5c369Sopenharmony_ci            libc::EMFILE => EMFILE,
22133da5c369Sopenharmony_ci            libc::ENOTTY => ENOTTY,
22143da5c369Sopenharmony_ci            libc::ETXTBSY => ETXTBSY,
22153da5c369Sopenharmony_ci            libc::EFBIG => EFBIG,
22163da5c369Sopenharmony_ci            libc::ENOSPC => ENOSPC,
22173da5c369Sopenharmony_ci            libc::ESPIPE => ESPIPE,
22183da5c369Sopenharmony_ci            libc::EROFS => EROFS,
22193da5c369Sopenharmony_ci            libc::EMLINK => EMLINK,
22203da5c369Sopenharmony_ci            libc::EPIPE => EPIPE,
22213da5c369Sopenharmony_ci            libc::EDOM => EDOM,
22223da5c369Sopenharmony_ci            libc::ERANGE => ERANGE,
22233da5c369Sopenharmony_ci            libc::EAGAIN => EAGAIN,
22243da5c369Sopenharmony_ci            libc::EINPROGRESS => EINPROGRESS,
22253da5c369Sopenharmony_ci            libc::EALREADY => EALREADY,
22263da5c369Sopenharmony_ci            libc::ENOTSOCK => ENOTSOCK,
22273da5c369Sopenharmony_ci            libc::EDESTADDRREQ => EDESTADDRREQ,
22283da5c369Sopenharmony_ci            libc::EMSGSIZE => EMSGSIZE,
22293da5c369Sopenharmony_ci            libc::EPROTOTYPE => EPROTOTYPE,
22303da5c369Sopenharmony_ci            libc::ENOPROTOOPT => ENOPROTOOPT,
22313da5c369Sopenharmony_ci            libc::EPROTONOSUPPORT => EPROTONOSUPPORT,
22323da5c369Sopenharmony_ci            libc::ESOCKTNOSUPPORT => ESOCKTNOSUPPORT,
22333da5c369Sopenharmony_ci            libc::EOPNOTSUPP => EOPNOTSUPP,
22343da5c369Sopenharmony_ci            libc::EPFNOSUPPORT => EPFNOSUPPORT,
22353da5c369Sopenharmony_ci            libc::EAFNOSUPPORT => EAFNOSUPPORT,
22363da5c369Sopenharmony_ci            libc::EADDRINUSE => EADDRINUSE,
22373da5c369Sopenharmony_ci            libc::EADDRNOTAVAIL => EADDRNOTAVAIL,
22383da5c369Sopenharmony_ci            libc::ENETDOWN => ENETDOWN,
22393da5c369Sopenharmony_ci            libc::ENETUNREACH => ENETUNREACH,
22403da5c369Sopenharmony_ci            libc::ENETRESET => ENETRESET,
22413da5c369Sopenharmony_ci            libc::ECONNABORTED => ECONNABORTED,
22423da5c369Sopenharmony_ci            libc::ECONNRESET => ECONNRESET,
22433da5c369Sopenharmony_ci            libc::ENOBUFS => ENOBUFS,
22443da5c369Sopenharmony_ci            libc::EISCONN => EISCONN,
22453da5c369Sopenharmony_ci            libc::ENOTCONN => ENOTCONN,
22463da5c369Sopenharmony_ci            libc::ESHUTDOWN => ESHUTDOWN,
22473da5c369Sopenharmony_ci            libc::ETOOMANYREFS => ETOOMANYREFS,
22483da5c369Sopenharmony_ci            libc::ETIMEDOUT => ETIMEDOUT,
22493da5c369Sopenharmony_ci            libc::ECONNREFUSED => ECONNREFUSED,
22503da5c369Sopenharmony_ci            libc::ELOOP => ELOOP,
22513da5c369Sopenharmony_ci            libc::ENAMETOOLONG => ENAMETOOLONG,
22523da5c369Sopenharmony_ci            libc::EHOSTDOWN => EHOSTDOWN,
22533da5c369Sopenharmony_ci            libc::EHOSTUNREACH => EHOSTUNREACH,
22543da5c369Sopenharmony_ci            libc::ENOTEMPTY => ENOTEMPTY,
22553da5c369Sopenharmony_ci            libc::EPROCLIM => EPROCLIM,
22563da5c369Sopenharmony_ci            libc::EUSERS => EUSERS,
22573da5c369Sopenharmony_ci            libc::EDQUOT => EDQUOT,
22583da5c369Sopenharmony_ci            libc::ESTALE => ESTALE,
22593da5c369Sopenharmony_ci            libc::EREMOTE => EREMOTE,
22603da5c369Sopenharmony_ci            libc::EBADRPC => EBADRPC,
22613da5c369Sopenharmony_ci            libc::ERPCMISMATCH => ERPCMISMATCH,
22623da5c369Sopenharmony_ci            libc::EPROGUNAVAIL => EPROGUNAVAIL,
22633da5c369Sopenharmony_ci            libc::EPROGMISMATCH => EPROGMISMATCH,
22643da5c369Sopenharmony_ci            libc::EPROCUNAVAIL => EPROCUNAVAIL,
22653da5c369Sopenharmony_ci            libc::ENOLCK => ENOLCK,
22663da5c369Sopenharmony_ci            libc::ENOSYS => ENOSYS,
22673da5c369Sopenharmony_ci            libc::EFTYPE => EFTYPE,
22683da5c369Sopenharmony_ci            libc::EAUTH => EAUTH,
22693da5c369Sopenharmony_ci            libc::ENEEDAUTH => ENEEDAUTH,
22703da5c369Sopenharmony_ci            libc::EIPSEC => EIPSEC,
22713da5c369Sopenharmony_ci            libc::ENOATTR => ENOATTR,
22723da5c369Sopenharmony_ci            libc::EILSEQ => EILSEQ,
22733da5c369Sopenharmony_ci            libc::ENOMEDIUM => ENOMEDIUM,
22743da5c369Sopenharmony_ci            libc::EMEDIUMTYPE => EMEDIUMTYPE,
22753da5c369Sopenharmony_ci            libc::EOVERFLOW => EOVERFLOW,
22763da5c369Sopenharmony_ci            libc::ECANCELED => ECANCELED,
22773da5c369Sopenharmony_ci            libc::EIDRM => EIDRM,
22783da5c369Sopenharmony_ci            libc::ENOMSG => ENOMSG,
22793da5c369Sopenharmony_ci            libc::ENOTSUP => ENOTSUP,
22803da5c369Sopenharmony_ci            libc::EBADMSG => EBADMSG,
22813da5c369Sopenharmony_ci            libc::ENOTRECOVERABLE => ENOTRECOVERABLE,
22823da5c369Sopenharmony_ci            libc::EOWNERDEAD => EOWNERDEAD,
22833da5c369Sopenharmony_ci            libc::EPROTO => EPROTO,
22843da5c369Sopenharmony_ci            _ => UnknownErrno,
22853da5c369Sopenharmony_ci        }
22863da5c369Sopenharmony_ci    }
22873da5c369Sopenharmony_ci}
22883da5c369Sopenharmony_ci
22893da5c369Sopenharmony_ci#[cfg(target_os = "netbsd")]
22903da5c369Sopenharmony_cimod consts {
22913da5c369Sopenharmony_ci    #[derive(Clone, Copy, Debug, Eq, PartialEq)]
22923da5c369Sopenharmony_ci    #[repr(i32)]
22933da5c369Sopenharmony_ci    #[non_exhaustive]
22943da5c369Sopenharmony_ci    pub enum Errno {
22953da5c369Sopenharmony_ci        UnknownErrno = 0,
22963da5c369Sopenharmony_ci        EPERM = libc::EPERM,
22973da5c369Sopenharmony_ci        ENOENT = libc::ENOENT,
22983da5c369Sopenharmony_ci        ESRCH = libc::ESRCH,
22993da5c369Sopenharmony_ci        EINTR = libc::EINTR,
23003da5c369Sopenharmony_ci        EIO = libc::EIO,
23013da5c369Sopenharmony_ci        ENXIO = libc::ENXIO,
23023da5c369Sopenharmony_ci        E2BIG = libc::E2BIG,
23033da5c369Sopenharmony_ci        ENOEXEC = libc::ENOEXEC,
23043da5c369Sopenharmony_ci        EBADF = libc::EBADF,
23053da5c369Sopenharmony_ci        ECHILD = libc::ECHILD,
23063da5c369Sopenharmony_ci        EDEADLK = libc::EDEADLK,
23073da5c369Sopenharmony_ci        ENOMEM = libc::ENOMEM,
23083da5c369Sopenharmony_ci        EACCES = libc::EACCES,
23093da5c369Sopenharmony_ci        EFAULT = libc::EFAULT,
23103da5c369Sopenharmony_ci        ENOTBLK = libc::ENOTBLK,
23113da5c369Sopenharmony_ci        EBUSY = libc::EBUSY,
23123da5c369Sopenharmony_ci        EEXIST = libc::EEXIST,
23133da5c369Sopenharmony_ci        EXDEV = libc::EXDEV,
23143da5c369Sopenharmony_ci        ENODEV = libc::ENODEV,
23153da5c369Sopenharmony_ci        ENOTDIR = libc::ENOTDIR,
23163da5c369Sopenharmony_ci        EISDIR = libc::EISDIR,
23173da5c369Sopenharmony_ci        EINVAL = libc::EINVAL,
23183da5c369Sopenharmony_ci        ENFILE = libc::ENFILE,
23193da5c369Sopenharmony_ci        EMFILE = libc::EMFILE,
23203da5c369Sopenharmony_ci        ENOTTY = libc::ENOTTY,
23213da5c369Sopenharmony_ci        ETXTBSY = libc::ETXTBSY,
23223da5c369Sopenharmony_ci        EFBIG = libc::EFBIG,
23233da5c369Sopenharmony_ci        ENOSPC = libc::ENOSPC,
23243da5c369Sopenharmony_ci        ESPIPE = libc::ESPIPE,
23253da5c369Sopenharmony_ci        EROFS = libc::EROFS,
23263da5c369Sopenharmony_ci        EMLINK = libc::EMLINK,
23273da5c369Sopenharmony_ci        EPIPE = libc::EPIPE,
23283da5c369Sopenharmony_ci        EDOM = libc::EDOM,
23293da5c369Sopenharmony_ci        ERANGE = libc::ERANGE,
23303da5c369Sopenharmony_ci        EAGAIN = libc::EAGAIN,
23313da5c369Sopenharmony_ci        EINPROGRESS = libc::EINPROGRESS,
23323da5c369Sopenharmony_ci        EALREADY = libc::EALREADY,
23333da5c369Sopenharmony_ci        ENOTSOCK = libc::ENOTSOCK,
23343da5c369Sopenharmony_ci        EDESTADDRREQ = libc::EDESTADDRREQ,
23353da5c369Sopenharmony_ci        EMSGSIZE = libc::EMSGSIZE,
23363da5c369Sopenharmony_ci        EPROTOTYPE = libc::EPROTOTYPE,
23373da5c369Sopenharmony_ci        ENOPROTOOPT = libc::ENOPROTOOPT,
23383da5c369Sopenharmony_ci        EPROTONOSUPPORT = libc::EPROTONOSUPPORT,
23393da5c369Sopenharmony_ci        ESOCKTNOSUPPORT = libc::ESOCKTNOSUPPORT,
23403da5c369Sopenharmony_ci        EOPNOTSUPP = libc::EOPNOTSUPP,
23413da5c369Sopenharmony_ci        EPFNOSUPPORT = libc::EPFNOSUPPORT,
23423da5c369Sopenharmony_ci        EAFNOSUPPORT = libc::EAFNOSUPPORT,
23433da5c369Sopenharmony_ci        EADDRINUSE = libc::EADDRINUSE,
23443da5c369Sopenharmony_ci        EADDRNOTAVAIL = libc::EADDRNOTAVAIL,
23453da5c369Sopenharmony_ci        ENETDOWN = libc::ENETDOWN,
23463da5c369Sopenharmony_ci        ENETUNREACH = libc::ENETUNREACH,
23473da5c369Sopenharmony_ci        ENETRESET = libc::ENETRESET,
23483da5c369Sopenharmony_ci        ECONNABORTED = libc::ECONNABORTED,
23493da5c369Sopenharmony_ci        ECONNRESET = libc::ECONNRESET,
23503da5c369Sopenharmony_ci        ENOBUFS = libc::ENOBUFS,
23513da5c369Sopenharmony_ci        EISCONN = libc::EISCONN,
23523da5c369Sopenharmony_ci        ENOTCONN = libc::ENOTCONN,
23533da5c369Sopenharmony_ci        ESHUTDOWN = libc::ESHUTDOWN,
23543da5c369Sopenharmony_ci        ETOOMANYREFS = libc::ETOOMANYREFS,
23553da5c369Sopenharmony_ci        ETIMEDOUT = libc::ETIMEDOUT,
23563da5c369Sopenharmony_ci        ECONNREFUSED = libc::ECONNREFUSED,
23573da5c369Sopenharmony_ci        ELOOP = libc::ELOOP,
23583da5c369Sopenharmony_ci        ENAMETOOLONG = libc::ENAMETOOLONG,
23593da5c369Sopenharmony_ci        EHOSTDOWN = libc::EHOSTDOWN,
23603da5c369Sopenharmony_ci        EHOSTUNREACH = libc::EHOSTUNREACH,
23613da5c369Sopenharmony_ci        ENOTEMPTY = libc::ENOTEMPTY,
23623da5c369Sopenharmony_ci        EPROCLIM = libc::EPROCLIM,
23633da5c369Sopenharmony_ci        EUSERS = libc::EUSERS,
23643da5c369Sopenharmony_ci        EDQUOT = libc::EDQUOT,
23653da5c369Sopenharmony_ci        ESTALE = libc::ESTALE,
23663da5c369Sopenharmony_ci        EREMOTE = libc::EREMOTE,
23673da5c369Sopenharmony_ci        EBADRPC = libc::EBADRPC,
23683da5c369Sopenharmony_ci        ERPCMISMATCH = libc::ERPCMISMATCH,
23693da5c369Sopenharmony_ci        EPROGUNAVAIL = libc::EPROGUNAVAIL,
23703da5c369Sopenharmony_ci        EPROGMISMATCH = libc::EPROGMISMATCH,
23713da5c369Sopenharmony_ci        EPROCUNAVAIL = libc::EPROCUNAVAIL,
23723da5c369Sopenharmony_ci        ENOLCK = libc::ENOLCK,
23733da5c369Sopenharmony_ci        ENOSYS = libc::ENOSYS,
23743da5c369Sopenharmony_ci        EFTYPE = libc::EFTYPE,
23753da5c369Sopenharmony_ci        EAUTH = libc::EAUTH,
23763da5c369Sopenharmony_ci        ENEEDAUTH = libc::ENEEDAUTH,
23773da5c369Sopenharmony_ci        EIDRM = libc::EIDRM,
23783da5c369Sopenharmony_ci        ENOMSG = libc::ENOMSG,
23793da5c369Sopenharmony_ci        EOVERFLOW = libc::EOVERFLOW,
23803da5c369Sopenharmony_ci        EILSEQ = libc::EILSEQ,
23813da5c369Sopenharmony_ci        ENOTSUP = libc::ENOTSUP,
23823da5c369Sopenharmony_ci        ECANCELED = libc::ECANCELED,
23833da5c369Sopenharmony_ci        EBADMSG = libc::EBADMSG,
23843da5c369Sopenharmony_ci        ENODATA = libc::ENODATA,
23853da5c369Sopenharmony_ci        ENOSR = libc::ENOSR,
23863da5c369Sopenharmony_ci        ENOSTR = libc::ENOSTR,
23873da5c369Sopenharmony_ci        ETIME = libc::ETIME,
23883da5c369Sopenharmony_ci        ENOATTR = libc::ENOATTR,
23893da5c369Sopenharmony_ci        EMULTIHOP = libc::EMULTIHOP,
23903da5c369Sopenharmony_ci        ENOLINK = libc::ENOLINK,
23913da5c369Sopenharmony_ci        EPROTO = libc::EPROTO,
23923da5c369Sopenharmony_ci    }
23933da5c369Sopenharmony_ci
23943da5c369Sopenharmony_ci    impl Errno {
23953da5c369Sopenharmony_ci        pub const ELAST: Errno = Errno::ENOTSUP;
23963da5c369Sopenharmony_ci        pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
23973da5c369Sopenharmony_ci    }
23983da5c369Sopenharmony_ci
23993da5c369Sopenharmony_ci    pub const fn from_i32(e: i32) -> Errno {
24003da5c369Sopenharmony_ci        use self::Errno::*;
24013da5c369Sopenharmony_ci
24023da5c369Sopenharmony_ci        match e {
24033da5c369Sopenharmony_ci            libc::EPERM => EPERM,
24043da5c369Sopenharmony_ci            libc::ENOENT => ENOENT,
24053da5c369Sopenharmony_ci            libc::ESRCH => ESRCH,
24063da5c369Sopenharmony_ci            libc::EINTR => EINTR,
24073da5c369Sopenharmony_ci            libc::EIO => EIO,
24083da5c369Sopenharmony_ci            libc::ENXIO => ENXIO,
24093da5c369Sopenharmony_ci            libc::E2BIG => E2BIG,
24103da5c369Sopenharmony_ci            libc::ENOEXEC => ENOEXEC,
24113da5c369Sopenharmony_ci            libc::EBADF => EBADF,
24123da5c369Sopenharmony_ci            libc::ECHILD => ECHILD,
24133da5c369Sopenharmony_ci            libc::EDEADLK => EDEADLK,
24143da5c369Sopenharmony_ci            libc::ENOMEM => ENOMEM,
24153da5c369Sopenharmony_ci            libc::EACCES => EACCES,
24163da5c369Sopenharmony_ci            libc::EFAULT => EFAULT,
24173da5c369Sopenharmony_ci            libc::ENOTBLK => ENOTBLK,
24183da5c369Sopenharmony_ci            libc::EBUSY => EBUSY,
24193da5c369Sopenharmony_ci            libc::EEXIST => EEXIST,
24203da5c369Sopenharmony_ci            libc::EXDEV => EXDEV,
24213da5c369Sopenharmony_ci            libc::ENODEV => ENODEV,
24223da5c369Sopenharmony_ci            libc::ENOTDIR => ENOTDIR,
24233da5c369Sopenharmony_ci            libc::EISDIR => EISDIR,
24243da5c369Sopenharmony_ci            libc::EINVAL => EINVAL,
24253da5c369Sopenharmony_ci            libc::ENFILE => ENFILE,
24263da5c369Sopenharmony_ci            libc::EMFILE => EMFILE,
24273da5c369Sopenharmony_ci            libc::ENOTTY => ENOTTY,
24283da5c369Sopenharmony_ci            libc::ETXTBSY => ETXTBSY,
24293da5c369Sopenharmony_ci            libc::EFBIG => EFBIG,
24303da5c369Sopenharmony_ci            libc::ENOSPC => ENOSPC,
24313da5c369Sopenharmony_ci            libc::ESPIPE => ESPIPE,
24323da5c369Sopenharmony_ci            libc::EROFS => EROFS,
24333da5c369Sopenharmony_ci            libc::EMLINK => EMLINK,
24343da5c369Sopenharmony_ci            libc::EPIPE => EPIPE,
24353da5c369Sopenharmony_ci            libc::EDOM => EDOM,
24363da5c369Sopenharmony_ci            libc::ERANGE => ERANGE,
24373da5c369Sopenharmony_ci            libc::EAGAIN => EAGAIN,
24383da5c369Sopenharmony_ci            libc::EINPROGRESS => EINPROGRESS,
24393da5c369Sopenharmony_ci            libc::EALREADY => EALREADY,
24403da5c369Sopenharmony_ci            libc::ENOTSOCK => ENOTSOCK,
24413da5c369Sopenharmony_ci            libc::EDESTADDRREQ => EDESTADDRREQ,
24423da5c369Sopenharmony_ci            libc::EMSGSIZE => EMSGSIZE,
24433da5c369Sopenharmony_ci            libc::EPROTOTYPE => EPROTOTYPE,
24443da5c369Sopenharmony_ci            libc::ENOPROTOOPT => ENOPROTOOPT,
24453da5c369Sopenharmony_ci            libc::EPROTONOSUPPORT => EPROTONOSUPPORT,
24463da5c369Sopenharmony_ci            libc::ESOCKTNOSUPPORT => ESOCKTNOSUPPORT,
24473da5c369Sopenharmony_ci            libc::EOPNOTSUPP => EOPNOTSUPP,
24483da5c369Sopenharmony_ci            libc::EPFNOSUPPORT => EPFNOSUPPORT,
24493da5c369Sopenharmony_ci            libc::EAFNOSUPPORT => EAFNOSUPPORT,
24503da5c369Sopenharmony_ci            libc::EADDRINUSE => EADDRINUSE,
24513da5c369Sopenharmony_ci            libc::EADDRNOTAVAIL => EADDRNOTAVAIL,
24523da5c369Sopenharmony_ci            libc::ENETDOWN => ENETDOWN,
24533da5c369Sopenharmony_ci            libc::ENETUNREACH => ENETUNREACH,
24543da5c369Sopenharmony_ci            libc::ENETRESET => ENETRESET,
24553da5c369Sopenharmony_ci            libc::ECONNABORTED => ECONNABORTED,
24563da5c369Sopenharmony_ci            libc::ECONNRESET => ECONNRESET,
24573da5c369Sopenharmony_ci            libc::ENOBUFS => ENOBUFS,
24583da5c369Sopenharmony_ci            libc::EISCONN => EISCONN,
24593da5c369Sopenharmony_ci            libc::ENOTCONN => ENOTCONN,
24603da5c369Sopenharmony_ci            libc::ESHUTDOWN => ESHUTDOWN,
24613da5c369Sopenharmony_ci            libc::ETOOMANYREFS => ETOOMANYREFS,
24623da5c369Sopenharmony_ci            libc::ETIMEDOUT => ETIMEDOUT,
24633da5c369Sopenharmony_ci            libc::ECONNREFUSED => ECONNREFUSED,
24643da5c369Sopenharmony_ci            libc::ELOOP => ELOOP,
24653da5c369Sopenharmony_ci            libc::ENAMETOOLONG => ENAMETOOLONG,
24663da5c369Sopenharmony_ci            libc::EHOSTDOWN => EHOSTDOWN,
24673da5c369Sopenharmony_ci            libc::EHOSTUNREACH => EHOSTUNREACH,
24683da5c369Sopenharmony_ci            libc::ENOTEMPTY => ENOTEMPTY,
24693da5c369Sopenharmony_ci            libc::EPROCLIM => EPROCLIM,
24703da5c369Sopenharmony_ci            libc::EUSERS => EUSERS,
24713da5c369Sopenharmony_ci            libc::EDQUOT => EDQUOT,
24723da5c369Sopenharmony_ci            libc::ESTALE => ESTALE,
24733da5c369Sopenharmony_ci            libc::EREMOTE => EREMOTE,
24743da5c369Sopenharmony_ci            libc::EBADRPC => EBADRPC,
24753da5c369Sopenharmony_ci            libc::ERPCMISMATCH => ERPCMISMATCH,
24763da5c369Sopenharmony_ci            libc::EPROGUNAVAIL => EPROGUNAVAIL,
24773da5c369Sopenharmony_ci            libc::EPROGMISMATCH => EPROGMISMATCH,
24783da5c369Sopenharmony_ci            libc::EPROCUNAVAIL => EPROCUNAVAIL,
24793da5c369Sopenharmony_ci            libc::ENOLCK => ENOLCK,
24803da5c369Sopenharmony_ci            libc::ENOSYS => ENOSYS,
24813da5c369Sopenharmony_ci            libc::EFTYPE => EFTYPE,
24823da5c369Sopenharmony_ci            libc::EAUTH => EAUTH,
24833da5c369Sopenharmony_ci            libc::ENEEDAUTH => ENEEDAUTH,
24843da5c369Sopenharmony_ci            libc::EIDRM => EIDRM,
24853da5c369Sopenharmony_ci            libc::ENOMSG => ENOMSG,
24863da5c369Sopenharmony_ci            libc::EOVERFLOW => EOVERFLOW,
24873da5c369Sopenharmony_ci            libc::EILSEQ => EILSEQ,
24883da5c369Sopenharmony_ci            libc::ENOTSUP => ENOTSUP,
24893da5c369Sopenharmony_ci            libc::ECANCELED => ECANCELED,
24903da5c369Sopenharmony_ci            libc::EBADMSG => EBADMSG,
24913da5c369Sopenharmony_ci            libc::ENODATA => ENODATA,
24923da5c369Sopenharmony_ci            libc::ENOSR => ENOSR,
24933da5c369Sopenharmony_ci            libc::ENOSTR => ENOSTR,
24943da5c369Sopenharmony_ci            libc::ETIME => ETIME,
24953da5c369Sopenharmony_ci            libc::ENOATTR => ENOATTR,
24963da5c369Sopenharmony_ci            libc::EMULTIHOP => EMULTIHOP,
24973da5c369Sopenharmony_ci            libc::ENOLINK => ENOLINK,
24983da5c369Sopenharmony_ci            libc::EPROTO => EPROTO,
24993da5c369Sopenharmony_ci            _ => UnknownErrno,
25003da5c369Sopenharmony_ci        }
25013da5c369Sopenharmony_ci    }
25023da5c369Sopenharmony_ci}
25033da5c369Sopenharmony_ci
25043da5c369Sopenharmony_ci#[cfg(target_os = "redox")]
25053da5c369Sopenharmony_cimod consts {
25063da5c369Sopenharmony_ci    #[derive(Clone, Copy, Debug, Eq, PartialEq)]
25073da5c369Sopenharmony_ci    #[repr(i32)]
25083da5c369Sopenharmony_ci    #[non_exhaustive]
25093da5c369Sopenharmony_ci    pub enum Errno {
25103da5c369Sopenharmony_ci        UnknownErrno = 0,
25113da5c369Sopenharmony_ci        EPERM = libc::EPERM,
25123da5c369Sopenharmony_ci        ENOENT = libc::ENOENT,
25133da5c369Sopenharmony_ci        ESRCH = libc::ESRCH,
25143da5c369Sopenharmony_ci        EINTR = libc::EINTR,
25153da5c369Sopenharmony_ci        EIO = libc::EIO,
25163da5c369Sopenharmony_ci        ENXIO = libc::ENXIO,
25173da5c369Sopenharmony_ci        E2BIG = libc::E2BIG,
25183da5c369Sopenharmony_ci        ENOEXEC = libc::ENOEXEC,
25193da5c369Sopenharmony_ci        EBADF = libc::EBADF,
25203da5c369Sopenharmony_ci        ECHILD = libc::ECHILD,
25213da5c369Sopenharmony_ci        EDEADLK = libc::EDEADLK,
25223da5c369Sopenharmony_ci        ENOMEM = libc::ENOMEM,
25233da5c369Sopenharmony_ci        EACCES = libc::EACCES,
25243da5c369Sopenharmony_ci        EFAULT = libc::EFAULT,
25253da5c369Sopenharmony_ci        ENOTBLK = libc::ENOTBLK,
25263da5c369Sopenharmony_ci        EBUSY = libc::EBUSY,
25273da5c369Sopenharmony_ci        EEXIST = libc::EEXIST,
25283da5c369Sopenharmony_ci        EXDEV = libc::EXDEV,
25293da5c369Sopenharmony_ci        ENODEV = libc::ENODEV,
25303da5c369Sopenharmony_ci        ENOTDIR = libc::ENOTDIR,
25313da5c369Sopenharmony_ci        EISDIR = libc::EISDIR,
25323da5c369Sopenharmony_ci        EINVAL = libc::EINVAL,
25333da5c369Sopenharmony_ci        ENFILE = libc::ENFILE,
25343da5c369Sopenharmony_ci        EMFILE = libc::EMFILE,
25353da5c369Sopenharmony_ci        ENOTTY = libc::ENOTTY,
25363da5c369Sopenharmony_ci        ETXTBSY = libc::ETXTBSY,
25373da5c369Sopenharmony_ci        EFBIG = libc::EFBIG,
25383da5c369Sopenharmony_ci        ENOSPC = libc::ENOSPC,
25393da5c369Sopenharmony_ci        ESPIPE = libc::ESPIPE,
25403da5c369Sopenharmony_ci        EROFS = libc::EROFS,
25413da5c369Sopenharmony_ci        EMLINK = libc::EMLINK,
25423da5c369Sopenharmony_ci        EPIPE = libc::EPIPE,
25433da5c369Sopenharmony_ci        EDOM = libc::EDOM,
25443da5c369Sopenharmony_ci        ERANGE = libc::ERANGE,
25453da5c369Sopenharmony_ci        EAGAIN = libc::EAGAIN,
25463da5c369Sopenharmony_ci        EINPROGRESS = libc::EINPROGRESS,
25473da5c369Sopenharmony_ci        EALREADY = libc::EALREADY,
25483da5c369Sopenharmony_ci        ENOTSOCK = libc::ENOTSOCK,
25493da5c369Sopenharmony_ci        EDESTADDRREQ = libc::EDESTADDRREQ,
25503da5c369Sopenharmony_ci        EMSGSIZE = libc::EMSGSIZE,
25513da5c369Sopenharmony_ci        EPROTOTYPE = libc::EPROTOTYPE,
25523da5c369Sopenharmony_ci        ENOPROTOOPT = libc::ENOPROTOOPT,
25533da5c369Sopenharmony_ci        EPROTONOSUPPORT = libc::EPROTONOSUPPORT,
25543da5c369Sopenharmony_ci        ESOCKTNOSUPPORT = libc::ESOCKTNOSUPPORT,
25553da5c369Sopenharmony_ci        EOPNOTSUPP = libc::EOPNOTSUPP,
25563da5c369Sopenharmony_ci        EPFNOSUPPORT = libc::EPFNOSUPPORT,
25573da5c369Sopenharmony_ci        EAFNOSUPPORT = libc::EAFNOSUPPORT,
25583da5c369Sopenharmony_ci        EADDRINUSE = libc::EADDRINUSE,
25593da5c369Sopenharmony_ci        EADDRNOTAVAIL = libc::EADDRNOTAVAIL,
25603da5c369Sopenharmony_ci        ENETDOWN = libc::ENETDOWN,
25613da5c369Sopenharmony_ci        ENETUNREACH = libc::ENETUNREACH,
25623da5c369Sopenharmony_ci        ENETRESET = libc::ENETRESET,
25633da5c369Sopenharmony_ci        ECONNABORTED = libc::ECONNABORTED,
25643da5c369Sopenharmony_ci        ECONNRESET = libc::ECONNRESET,
25653da5c369Sopenharmony_ci        ENOBUFS = libc::ENOBUFS,
25663da5c369Sopenharmony_ci        EISCONN = libc::EISCONN,
25673da5c369Sopenharmony_ci        ENOTCONN = libc::ENOTCONN,
25683da5c369Sopenharmony_ci        ESHUTDOWN = libc::ESHUTDOWN,
25693da5c369Sopenharmony_ci        ETOOMANYREFS = libc::ETOOMANYREFS,
25703da5c369Sopenharmony_ci        ETIMEDOUT = libc::ETIMEDOUT,
25713da5c369Sopenharmony_ci        ECONNREFUSED = libc::ECONNREFUSED,
25723da5c369Sopenharmony_ci        ELOOP = libc::ELOOP,
25733da5c369Sopenharmony_ci        ENAMETOOLONG = libc::ENAMETOOLONG,
25743da5c369Sopenharmony_ci        EHOSTDOWN = libc::EHOSTDOWN,
25753da5c369Sopenharmony_ci        EHOSTUNREACH = libc::EHOSTUNREACH,
25763da5c369Sopenharmony_ci        ENOTEMPTY = libc::ENOTEMPTY,
25773da5c369Sopenharmony_ci        EUSERS = libc::EUSERS,
25783da5c369Sopenharmony_ci        EDQUOT = libc::EDQUOT,
25793da5c369Sopenharmony_ci        ESTALE = libc::ESTALE,
25803da5c369Sopenharmony_ci        EREMOTE = libc::EREMOTE,
25813da5c369Sopenharmony_ci        ENOLCK = libc::ENOLCK,
25823da5c369Sopenharmony_ci        ENOSYS = libc::ENOSYS,
25833da5c369Sopenharmony_ci        EIDRM = libc::EIDRM,
25843da5c369Sopenharmony_ci        ENOMSG = libc::ENOMSG,
25853da5c369Sopenharmony_ci        EOVERFLOW = libc::EOVERFLOW,
25863da5c369Sopenharmony_ci        EILSEQ = libc::EILSEQ,
25873da5c369Sopenharmony_ci        ECANCELED = libc::ECANCELED,
25883da5c369Sopenharmony_ci        EBADMSG = libc::EBADMSG,
25893da5c369Sopenharmony_ci        ENODATA = libc::ENODATA,
25903da5c369Sopenharmony_ci        ENOSR = libc::ENOSR,
25913da5c369Sopenharmony_ci        ENOSTR = libc::ENOSTR,
25923da5c369Sopenharmony_ci        ETIME = libc::ETIME,
25933da5c369Sopenharmony_ci        EMULTIHOP = libc::EMULTIHOP,
25943da5c369Sopenharmony_ci        ENOLINK = libc::ENOLINK,
25953da5c369Sopenharmony_ci        EPROTO = libc::EPROTO,
25963da5c369Sopenharmony_ci    }
25973da5c369Sopenharmony_ci
25983da5c369Sopenharmony_ci    impl Errno {
25993da5c369Sopenharmony_ci        pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
26003da5c369Sopenharmony_ci    }
26013da5c369Sopenharmony_ci
26023da5c369Sopenharmony_ci    pub const fn from_i32(e: i32) -> Errno {
26033da5c369Sopenharmony_ci        use self::Errno::*;
26043da5c369Sopenharmony_ci
26053da5c369Sopenharmony_ci        match e {
26063da5c369Sopenharmony_ci            libc::EPERM => EPERM,
26073da5c369Sopenharmony_ci            libc::ENOENT => ENOENT,
26083da5c369Sopenharmony_ci            libc::ESRCH => ESRCH,
26093da5c369Sopenharmony_ci            libc::EINTR => EINTR,
26103da5c369Sopenharmony_ci            libc::EIO => EIO,
26113da5c369Sopenharmony_ci            libc::ENXIO => ENXIO,
26123da5c369Sopenharmony_ci            libc::E2BIG => E2BIG,
26133da5c369Sopenharmony_ci            libc::ENOEXEC => ENOEXEC,
26143da5c369Sopenharmony_ci            libc::EBADF => EBADF,
26153da5c369Sopenharmony_ci            libc::ECHILD => ECHILD,
26163da5c369Sopenharmony_ci            libc::EDEADLK => EDEADLK,
26173da5c369Sopenharmony_ci            libc::ENOMEM => ENOMEM,
26183da5c369Sopenharmony_ci            libc::EACCES => EACCES,
26193da5c369Sopenharmony_ci            libc::EFAULT => EFAULT,
26203da5c369Sopenharmony_ci            libc::ENOTBLK => ENOTBLK,
26213da5c369Sopenharmony_ci            libc::EBUSY => EBUSY,
26223da5c369Sopenharmony_ci            libc::EEXIST => EEXIST,
26233da5c369Sopenharmony_ci            libc::EXDEV => EXDEV,
26243da5c369Sopenharmony_ci            libc::ENODEV => ENODEV,
26253da5c369Sopenharmony_ci            libc::ENOTDIR => ENOTDIR,
26263da5c369Sopenharmony_ci            libc::EISDIR => EISDIR,
26273da5c369Sopenharmony_ci            libc::EINVAL => EINVAL,
26283da5c369Sopenharmony_ci            libc::ENFILE => ENFILE,
26293da5c369Sopenharmony_ci            libc::EMFILE => EMFILE,
26303da5c369Sopenharmony_ci            libc::ENOTTY => ENOTTY,
26313da5c369Sopenharmony_ci            libc::ETXTBSY => ETXTBSY,
26323da5c369Sopenharmony_ci            libc::EFBIG => EFBIG,
26333da5c369Sopenharmony_ci            libc::ENOSPC => ENOSPC,
26343da5c369Sopenharmony_ci            libc::ESPIPE => ESPIPE,
26353da5c369Sopenharmony_ci            libc::EROFS => EROFS,
26363da5c369Sopenharmony_ci            libc::EMLINK => EMLINK,
26373da5c369Sopenharmony_ci            libc::EPIPE => EPIPE,
26383da5c369Sopenharmony_ci            libc::EDOM => EDOM,
26393da5c369Sopenharmony_ci            libc::ERANGE => ERANGE,
26403da5c369Sopenharmony_ci            libc::EAGAIN => EAGAIN,
26413da5c369Sopenharmony_ci            libc::EINPROGRESS => EINPROGRESS,
26423da5c369Sopenharmony_ci            libc::EALREADY => EALREADY,
26433da5c369Sopenharmony_ci            libc::ENOTSOCK => ENOTSOCK,
26443da5c369Sopenharmony_ci            libc::EDESTADDRREQ => EDESTADDRREQ,
26453da5c369Sopenharmony_ci            libc::EMSGSIZE => EMSGSIZE,
26463da5c369Sopenharmony_ci            libc::EPROTOTYPE => EPROTOTYPE,
26473da5c369Sopenharmony_ci            libc::ENOPROTOOPT => ENOPROTOOPT,
26483da5c369Sopenharmony_ci            libc::EPROTONOSUPPORT => EPROTONOSUPPORT,
26493da5c369Sopenharmony_ci            libc::ESOCKTNOSUPPORT => ESOCKTNOSUPPORT,
26503da5c369Sopenharmony_ci            libc::EOPNOTSUPP => EOPNOTSUPP,
26513da5c369Sopenharmony_ci            libc::EPFNOSUPPORT => EPFNOSUPPORT,
26523da5c369Sopenharmony_ci            libc::EAFNOSUPPORT => EAFNOSUPPORT,
26533da5c369Sopenharmony_ci            libc::EADDRINUSE => EADDRINUSE,
26543da5c369Sopenharmony_ci            libc::EADDRNOTAVAIL => EADDRNOTAVAIL,
26553da5c369Sopenharmony_ci            libc::ENETDOWN => ENETDOWN,
26563da5c369Sopenharmony_ci            libc::ENETUNREACH => ENETUNREACH,
26573da5c369Sopenharmony_ci            libc::ENETRESET => ENETRESET,
26583da5c369Sopenharmony_ci            libc::ECONNABORTED => ECONNABORTED,
26593da5c369Sopenharmony_ci            libc::ECONNRESET => ECONNRESET,
26603da5c369Sopenharmony_ci            libc::ENOBUFS => ENOBUFS,
26613da5c369Sopenharmony_ci            libc::EISCONN => EISCONN,
26623da5c369Sopenharmony_ci            libc::ENOTCONN => ENOTCONN,
26633da5c369Sopenharmony_ci            libc::ESHUTDOWN => ESHUTDOWN,
26643da5c369Sopenharmony_ci            libc::ETOOMANYREFS => ETOOMANYREFS,
26653da5c369Sopenharmony_ci            libc::ETIMEDOUT => ETIMEDOUT,
26663da5c369Sopenharmony_ci            libc::ECONNREFUSED => ECONNREFUSED,
26673da5c369Sopenharmony_ci            libc::ELOOP => ELOOP,
26683da5c369Sopenharmony_ci            libc::ENAMETOOLONG => ENAMETOOLONG,
26693da5c369Sopenharmony_ci            libc::EHOSTDOWN => EHOSTDOWN,
26703da5c369Sopenharmony_ci            libc::EHOSTUNREACH => EHOSTUNREACH,
26713da5c369Sopenharmony_ci            libc::ENOTEMPTY => ENOTEMPTY,
26723da5c369Sopenharmony_ci            libc::EUSERS => EUSERS,
26733da5c369Sopenharmony_ci            libc::EDQUOT => EDQUOT,
26743da5c369Sopenharmony_ci            libc::ESTALE => ESTALE,
26753da5c369Sopenharmony_ci            libc::EREMOTE => EREMOTE,
26763da5c369Sopenharmony_ci            libc::ENOLCK => ENOLCK,
26773da5c369Sopenharmony_ci            libc::ENOSYS => ENOSYS,
26783da5c369Sopenharmony_ci            libc::EIDRM => EIDRM,
26793da5c369Sopenharmony_ci            libc::ENOMSG => ENOMSG,
26803da5c369Sopenharmony_ci            libc::EOVERFLOW => EOVERFLOW,
26813da5c369Sopenharmony_ci            libc::EILSEQ => EILSEQ,
26823da5c369Sopenharmony_ci            libc::ECANCELED => ECANCELED,
26833da5c369Sopenharmony_ci            libc::EBADMSG => EBADMSG,
26843da5c369Sopenharmony_ci            libc::ENODATA => ENODATA,
26853da5c369Sopenharmony_ci            libc::ENOSR => ENOSR,
26863da5c369Sopenharmony_ci            libc::ENOSTR => ENOSTR,
26873da5c369Sopenharmony_ci            libc::ETIME => ETIME,
26883da5c369Sopenharmony_ci            libc::EMULTIHOP => EMULTIHOP,
26893da5c369Sopenharmony_ci            libc::ENOLINK => ENOLINK,
26903da5c369Sopenharmony_ci            libc::EPROTO => EPROTO,
26913da5c369Sopenharmony_ci            _ => UnknownErrno,
26923da5c369Sopenharmony_ci        }
26933da5c369Sopenharmony_ci    }
26943da5c369Sopenharmony_ci}
26953da5c369Sopenharmony_ci
26963da5c369Sopenharmony_ci#[cfg(any(target_os = "illumos", target_os = "solaris"))]
26973da5c369Sopenharmony_cimod consts {
26983da5c369Sopenharmony_ci    #[derive(Clone, Copy, Debug, Eq, PartialEq)]
26993da5c369Sopenharmony_ci    #[repr(i32)]
27003da5c369Sopenharmony_ci    #[non_exhaustive]
27013da5c369Sopenharmony_ci    pub enum Errno {
27023da5c369Sopenharmony_ci        UnknownErrno = 0,
27033da5c369Sopenharmony_ci        EPERM = libc::EPERM,
27043da5c369Sopenharmony_ci        ENOENT = libc::ENOENT,
27053da5c369Sopenharmony_ci        ESRCH = libc::ESRCH,
27063da5c369Sopenharmony_ci        EINTR = libc::EINTR,
27073da5c369Sopenharmony_ci        EIO = libc::EIO,
27083da5c369Sopenharmony_ci        ENXIO = libc::ENXIO,
27093da5c369Sopenharmony_ci        E2BIG = libc::E2BIG,
27103da5c369Sopenharmony_ci        ENOEXEC = libc::ENOEXEC,
27113da5c369Sopenharmony_ci        EBADF = libc::EBADF,
27123da5c369Sopenharmony_ci        ECHILD = libc::ECHILD,
27133da5c369Sopenharmony_ci        EAGAIN = libc::EAGAIN,
27143da5c369Sopenharmony_ci        ENOMEM = libc::ENOMEM,
27153da5c369Sopenharmony_ci        EACCES = libc::EACCES,
27163da5c369Sopenharmony_ci        EFAULT = libc::EFAULT,
27173da5c369Sopenharmony_ci        ENOTBLK = libc::ENOTBLK,
27183da5c369Sopenharmony_ci        EBUSY = libc::EBUSY,
27193da5c369Sopenharmony_ci        EEXIST = libc::EEXIST,
27203da5c369Sopenharmony_ci        EXDEV = libc::EXDEV,
27213da5c369Sopenharmony_ci        ENODEV = libc::ENODEV,
27223da5c369Sopenharmony_ci        ENOTDIR = libc::ENOTDIR,
27233da5c369Sopenharmony_ci        EISDIR = libc::EISDIR,
27243da5c369Sopenharmony_ci        EINVAL = libc::EINVAL,
27253da5c369Sopenharmony_ci        ENFILE = libc::ENFILE,
27263da5c369Sopenharmony_ci        EMFILE = libc::EMFILE,
27273da5c369Sopenharmony_ci        ENOTTY = libc::ENOTTY,
27283da5c369Sopenharmony_ci        ETXTBSY = libc::ETXTBSY,
27293da5c369Sopenharmony_ci        EFBIG = libc::EFBIG,
27303da5c369Sopenharmony_ci        ENOSPC = libc::ENOSPC,
27313da5c369Sopenharmony_ci        ESPIPE = libc::ESPIPE,
27323da5c369Sopenharmony_ci        EROFS = libc::EROFS,
27333da5c369Sopenharmony_ci        EMLINK = libc::EMLINK,
27343da5c369Sopenharmony_ci        EPIPE = libc::EPIPE,
27353da5c369Sopenharmony_ci        EDOM = libc::EDOM,
27363da5c369Sopenharmony_ci        ERANGE = libc::ERANGE,
27373da5c369Sopenharmony_ci        ENOMSG = libc::ENOMSG,
27383da5c369Sopenharmony_ci        EIDRM = libc::EIDRM,
27393da5c369Sopenharmony_ci        ECHRNG = libc::ECHRNG,
27403da5c369Sopenharmony_ci        EL2NSYNC = libc::EL2NSYNC,
27413da5c369Sopenharmony_ci        EL3HLT = libc::EL3HLT,
27423da5c369Sopenharmony_ci        EL3RST = libc::EL3RST,
27433da5c369Sopenharmony_ci        ELNRNG = libc::ELNRNG,
27443da5c369Sopenharmony_ci        EUNATCH = libc::EUNATCH,
27453da5c369Sopenharmony_ci        ENOCSI = libc::ENOCSI,
27463da5c369Sopenharmony_ci        EL2HLT = libc::EL2HLT,
27473da5c369Sopenharmony_ci        EDEADLK = libc::EDEADLK,
27483da5c369Sopenharmony_ci        ENOLCK = libc::ENOLCK,
27493da5c369Sopenharmony_ci        ECANCELED = libc::ECANCELED,
27503da5c369Sopenharmony_ci        ENOTSUP = libc::ENOTSUP,
27513da5c369Sopenharmony_ci        EDQUOT = libc::EDQUOT,
27523da5c369Sopenharmony_ci        EBADE = libc::EBADE,
27533da5c369Sopenharmony_ci        EBADR = libc::EBADR,
27543da5c369Sopenharmony_ci        EXFULL = libc::EXFULL,
27553da5c369Sopenharmony_ci        ENOANO = libc::ENOANO,
27563da5c369Sopenharmony_ci        EBADRQC = libc::EBADRQC,
27573da5c369Sopenharmony_ci        EBADSLT = libc::EBADSLT,
27583da5c369Sopenharmony_ci        EDEADLOCK = libc::EDEADLOCK,
27593da5c369Sopenharmony_ci        EBFONT = libc::EBFONT,
27603da5c369Sopenharmony_ci        EOWNERDEAD = libc::EOWNERDEAD,
27613da5c369Sopenharmony_ci        ENOTRECOVERABLE = libc::ENOTRECOVERABLE,
27623da5c369Sopenharmony_ci        ENOSTR = libc::ENOSTR,
27633da5c369Sopenharmony_ci        ENODATA = libc::ENODATA,
27643da5c369Sopenharmony_ci        ETIME = libc::ETIME,
27653da5c369Sopenharmony_ci        ENOSR = libc::ENOSR,
27663da5c369Sopenharmony_ci        ENONET = libc::ENONET,
27673da5c369Sopenharmony_ci        ENOPKG = libc::ENOPKG,
27683da5c369Sopenharmony_ci        EREMOTE = libc::EREMOTE,
27693da5c369Sopenharmony_ci        ENOLINK = libc::ENOLINK,
27703da5c369Sopenharmony_ci        EADV = libc::EADV,
27713da5c369Sopenharmony_ci        ESRMNT = libc::ESRMNT,
27723da5c369Sopenharmony_ci        ECOMM = libc::ECOMM,
27733da5c369Sopenharmony_ci        EPROTO = libc::EPROTO,
27743da5c369Sopenharmony_ci        ELOCKUNMAPPED = libc::ELOCKUNMAPPED,
27753da5c369Sopenharmony_ci        ENOTACTIVE = libc::ENOTACTIVE,
27763da5c369Sopenharmony_ci        EMULTIHOP = libc::EMULTIHOP,
27773da5c369Sopenharmony_ci        EBADMSG = libc::EBADMSG,
27783da5c369Sopenharmony_ci        ENAMETOOLONG = libc::ENAMETOOLONG,
27793da5c369Sopenharmony_ci        EOVERFLOW = libc::EOVERFLOW,
27803da5c369Sopenharmony_ci        ENOTUNIQ = libc::ENOTUNIQ,
27813da5c369Sopenharmony_ci        EBADFD = libc::EBADFD,
27823da5c369Sopenharmony_ci        EREMCHG = libc::EREMCHG,
27833da5c369Sopenharmony_ci        ELIBACC = libc::ELIBACC,
27843da5c369Sopenharmony_ci        ELIBBAD = libc::ELIBBAD,
27853da5c369Sopenharmony_ci        ELIBSCN = libc::ELIBSCN,
27863da5c369Sopenharmony_ci        ELIBMAX = libc::ELIBMAX,
27873da5c369Sopenharmony_ci        ELIBEXEC = libc::ELIBEXEC,
27883da5c369Sopenharmony_ci        EILSEQ = libc::EILSEQ,
27893da5c369Sopenharmony_ci        ENOSYS = libc::ENOSYS,
27903da5c369Sopenharmony_ci        ELOOP = libc::ELOOP,
27913da5c369Sopenharmony_ci        ERESTART = libc::ERESTART,
27923da5c369Sopenharmony_ci        ESTRPIPE = libc::ESTRPIPE,
27933da5c369Sopenharmony_ci        ENOTEMPTY = libc::ENOTEMPTY,
27943da5c369Sopenharmony_ci        EUSERS = libc::EUSERS,
27953da5c369Sopenharmony_ci        ENOTSOCK = libc::ENOTSOCK,
27963da5c369Sopenharmony_ci        EDESTADDRREQ = libc::EDESTADDRREQ,
27973da5c369Sopenharmony_ci        EMSGSIZE = libc::EMSGSIZE,
27983da5c369Sopenharmony_ci        EPROTOTYPE = libc::EPROTOTYPE,
27993da5c369Sopenharmony_ci        ENOPROTOOPT = libc::ENOPROTOOPT,
28003da5c369Sopenharmony_ci        EPROTONOSUPPORT = libc::EPROTONOSUPPORT,
28013da5c369Sopenharmony_ci        ESOCKTNOSUPPORT = libc::ESOCKTNOSUPPORT,
28023da5c369Sopenharmony_ci        EOPNOTSUPP = libc::EOPNOTSUPP,
28033da5c369Sopenharmony_ci        EPFNOSUPPORT = libc::EPFNOSUPPORT,
28043da5c369Sopenharmony_ci        EAFNOSUPPORT = libc::EAFNOSUPPORT,
28053da5c369Sopenharmony_ci        EADDRINUSE = libc::EADDRINUSE,
28063da5c369Sopenharmony_ci        EADDRNOTAVAIL = libc::EADDRNOTAVAIL,
28073da5c369Sopenharmony_ci        ENETDOWN = libc::ENETDOWN,
28083da5c369Sopenharmony_ci        ENETUNREACH = libc::ENETUNREACH,
28093da5c369Sopenharmony_ci        ENETRESET = libc::ENETRESET,
28103da5c369Sopenharmony_ci        ECONNABORTED = libc::ECONNABORTED,
28113da5c369Sopenharmony_ci        ECONNRESET = libc::ECONNRESET,
28123da5c369Sopenharmony_ci        ENOBUFS = libc::ENOBUFS,
28133da5c369Sopenharmony_ci        EISCONN = libc::EISCONN,
28143da5c369Sopenharmony_ci        ENOTCONN = libc::ENOTCONN,
28153da5c369Sopenharmony_ci        ESHUTDOWN = libc::ESHUTDOWN,
28163da5c369Sopenharmony_ci        ETOOMANYREFS = libc::ETOOMANYREFS,
28173da5c369Sopenharmony_ci        ETIMEDOUT = libc::ETIMEDOUT,
28183da5c369Sopenharmony_ci        ECONNREFUSED = libc::ECONNREFUSED,
28193da5c369Sopenharmony_ci        EHOSTDOWN = libc::EHOSTDOWN,
28203da5c369Sopenharmony_ci        EHOSTUNREACH = libc::EHOSTUNREACH,
28213da5c369Sopenharmony_ci        EALREADY = libc::EALREADY,
28223da5c369Sopenharmony_ci        EINPROGRESS = libc::EINPROGRESS,
28233da5c369Sopenharmony_ci        ESTALE = libc::ESTALE,
28243da5c369Sopenharmony_ci    }
28253da5c369Sopenharmony_ci
28263da5c369Sopenharmony_ci    impl Errno {
28273da5c369Sopenharmony_ci        pub const ELAST: Errno = Errno::ESTALE;
28283da5c369Sopenharmony_ci        pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
28293da5c369Sopenharmony_ci    }
28303da5c369Sopenharmony_ci
28313da5c369Sopenharmony_ci    pub const fn from_i32(e: i32) -> Errno {
28323da5c369Sopenharmony_ci        use self::Errno::*;
28333da5c369Sopenharmony_ci
28343da5c369Sopenharmony_ci        match e {
28353da5c369Sopenharmony_ci            libc::EPERM => EPERM,
28363da5c369Sopenharmony_ci            libc::ENOENT => ENOENT,
28373da5c369Sopenharmony_ci            libc::ESRCH => ESRCH,
28383da5c369Sopenharmony_ci            libc::EINTR => EINTR,
28393da5c369Sopenharmony_ci            libc::EIO => EIO,
28403da5c369Sopenharmony_ci            libc::ENXIO => ENXIO,
28413da5c369Sopenharmony_ci            libc::E2BIG => E2BIG,
28423da5c369Sopenharmony_ci            libc::ENOEXEC => ENOEXEC,
28433da5c369Sopenharmony_ci            libc::EBADF => EBADF,
28443da5c369Sopenharmony_ci            libc::ECHILD => ECHILD,
28453da5c369Sopenharmony_ci            libc::EAGAIN => EAGAIN,
28463da5c369Sopenharmony_ci            libc::ENOMEM => ENOMEM,
28473da5c369Sopenharmony_ci            libc::EACCES => EACCES,
28483da5c369Sopenharmony_ci            libc::EFAULT => EFAULT,
28493da5c369Sopenharmony_ci            libc::ENOTBLK => ENOTBLK,
28503da5c369Sopenharmony_ci            libc::EBUSY => EBUSY,
28513da5c369Sopenharmony_ci            libc::EEXIST => EEXIST,
28523da5c369Sopenharmony_ci            libc::EXDEV => EXDEV,
28533da5c369Sopenharmony_ci            libc::ENODEV => ENODEV,
28543da5c369Sopenharmony_ci            libc::ENOTDIR => ENOTDIR,
28553da5c369Sopenharmony_ci            libc::EISDIR => EISDIR,
28563da5c369Sopenharmony_ci            libc::EINVAL => EINVAL,
28573da5c369Sopenharmony_ci            libc::ENFILE => ENFILE,
28583da5c369Sopenharmony_ci            libc::EMFILE => EMFILE,
28593da5c369Sopenharmony_ci            libc::ENOTTY => ENOTTY,
28603da5c369Sopenharmony_ci            libc::ETXTBSY => ETXTBSY,
28613da5c369Sopenharmony_ci            libc::EFBIG => EFBIG,
28623da5c369Sopenharmony_ci            libc::ENOSPC => ENOSPC,
28633da5c369Sopenharmony_ci            libc::ESPIPE => ESPIPE,
28643da5c369Sopenharmony_ci            libc::EROFS => EROFS,
28653da5c369Sopenharmony_ci            libc::EMLINK => EMLINK,
28663da5c369Sopenharmony_ci            libc::EPIPE => EPIPE,
28673da5c369Sopenharmony_ci            libc::EDOM => EDOM,
28683da5c369Sopenharmony_ci            libc::ERANGE => ERANGE,
28693da5c369Sopenharmony_ci            libc::ENOMSG => ENOMSG,
28703da5c369Sopenharmony_ci            libc::EIDRM => EIDRM,
28713da5c369Sopenharmony_ci            libc::ECHRNG => ECHRNG,
28723da5c369Sopenharmony_ci            libc::EL2NSYNC => EL2NSYNC,
28733da5c369Sopenharmony_ci            libc::EL3HLT => EL3HLT,
28743da5c369Sopenharmony_ci            libc::EL3RST => EL3RST,
28753da5c369Sopenharmony_ci            libc::ELNRNG => ELNRNG,
28763da5c369Sopenharmony_ci            libc::EUNATCH => EUNATCH,
28773da5c369Sopenharmony_ci            libc::ENOCSI => ENOCSI,
28783da5c369Sopenharmony_ci            libc::EL2HLT => EL2HLT,
28793da5c369Sopenharmony_ci            libc::EDEADLK => EDEADLK,
28803da5c369Sopenharmony_ci            libc::ENOLCK => ENOLCK,
28813da5c369Sopenharmony_ci            libc::ECANCELED => ECANCELED,
28823da5c369Sopenharmony_ci            libc::ENOTSUP => ENOTSUP,
28833da5c369Sopenharmony_ci            libc::EDQUOT => EDQUOT,
28843da5c369Sopenharmony_ci            libc::EBADE => EBADE,
28853da5c369Sopenharmony_ci            libc::EBADR => EBADR,
28863da5c369Sopenharmony_ci            libc::EXFULL => EXFULL,
28873da5c369Sopenharmony_ci            libc::ENOANO => ENOANO,
28883da5c369Sopenharmony_ci            libc::EBADRQC => EBADRQC,
28893da5c369Sopenharmony_ci            libc::EBADSLT => EBADSLT,
28903da5c369Sopenharmony_ci            libc::EDEADLOCK => EDEADLOCK,
28913da5c369Sopenharmony_ci            libc::EBFONT => EBFONT,
28923da5c369Sopenharmony_ci            libc::EOWNERDEAD => EOWNERDEAD,
28933da5c369Sopenharmony_ci            libc::ENOTRECOVERABLE => ENOTRECOVERABLE,
28943da5c369Sopenharmony_ci            libc::ENOSTR => ENOSTR,
28953da5c369Sopenharmony_ci            libc::ENODATA => ENODATA,
28963da5c369Sopenharmony_ci            libc::ETIME => ETIME,
28973da5c369Sopenharmony_ci            libc::ENOSR => ENOSR,
28983da5c369Sopenharmony_ci            libc::ENONET => ENONET,
28993da5c369Sopenharmony_ci            libc::ENOPKG => ENOPKG,
29003da5c369Sopenharmony_ci            libc::EREMOTE => EREMOTE,
29013da5c369Sopenharmony_ci            libc::ENOLINK => ENOLINK,
29023da5c369Sopenharmony_ci            libc::EADV => EADV,
29033da5c369Sopenharmony_ci            libc::ESRMNT => ESRMNT,
29043da5c369Sopenharmony_ci            libc::ECOMM => ECOMM,
29053da5c369Sopenharmony_ci            libc::EPROTO => EPROTO,
29063da5c369Sopenharmony_ci            libc::ELOCKUNMAPPED => ELOCKUNMAPPED,
29073da5c369Sopenharmony_ci            libc::ENOTACTIVE => ENOTACTIVE,
29083da5c369Sopenharmony_ci            libc::EMULTIHOP => EMULTIHOP,
29093da5c369Sopenharmony_ci            libc::EBADMSG => EBADMSG,
29103da5c369Sopenharmony_ci            libc::ENAMETOOLONG => ENAMETOOLONG,
29113da5c369Sopenharmony_ci            libc::EOVERFLOW => EOVERFLOW,
29123da5c369Sopenharmony_ci            libc::ENOTUNIQ => ENOTUNIQ,
29133da5c369Sopenharmony_ci            libc::EBADFD => EBADFD,
29143da5c369Sopenharmony_ci            libc::EREMCHG => EREMCHG,
29153da5c369Sopenharmony_ci            libc::ELIBACC => ELIBACC,
29163da5c369Sopenharmony_ci            libc::ELIBBAD => ELIBBAD,
29173da5c369Sopenharmony_ci            libc::ELIBSCN => ELIBSCN,
29183da5c369Sopenharmony_ci            libc::ELIBMAX => ELIBMAX,
29193da5c369Sopenharmony_ci            libc::ELIBEXEC => ELIBEXEC,
29203da5c369Sopenharmony_ci            libc::EILSEQ => EILSEQ,
29213da5c369Sopenharmony_ci            libc::ENOSYS => ENOSYS,
29223da5c369Sopenharmony_ci            libc::ELOOP => ELOOP,
29233da5c369Sopenharmony_ci            libc::ERESTART => ERESTART,
29243da5c369Sopenharmony_ci            libc::ESTRPIPE => ESTRPIPE,
29253da5c369Sopenharmony_ci            libc::ENOTEMPTY => ENOTEMPTY,
29263da5c369Sopenharmony_ci            libc::EUSERS => EUSERS,
29273da5c369Sopenharmony_ci            libc::ENOTSOCK => ENOTSOCK,
29283da5c369Sopenharmony_ci            libc::EDESTADDRREQ => EDESTADDRREQ,
29293da5c369Sopenharmony_ci            libc::EMSGSIZE => EMSGSIZE,
29303da5c369Sopenharmony_ci            libc::EPROTOTYPE => EPROTOTYPE,
29313da5c369Sopenharmony_ci            libc::ENOPROTOOPT => ENOPROTOOPT,
29323da5c369Sopenharmony_ci            libc::EPROTONOSUPPORT => EPROTONOSUPPORT,
29333da5c369Sopenharmony_ci            libc::ESOCKTNOSUPPORT => ESOCKTNOSUPPORT,
29343da5c369Sopenharmony_ci            libc::EOPNOTSUPP => EOPNOTSUPP,
29353da5c369Sopenharmony_ci            libc::EPFNOSUPPORT => EPFNOSUPPORT,
29363da5c369Sopenharmony_ci            libc::EAFNOSUPPORT => EAFNOSUPPORT,
29373da5c369Sopenharmony_ci            libc::EADDRINUSE => EADDRINUSE,
29383da5c369Sopenharmony_ci            libc::EADDRNOTAVAIL => EADDRNOTAVAIL,
29393da5c369Sopenharmony_ci            libc::ENETDOWN => ENETDOWN,
29403da5c369Sopenharmony_ci            libc::ENETUNREACH => ENETUNREACH,
29413da5c369Sopenharmony_ci            libc::ENETRESET => ENETRESET,
29423da5c369Sopenharmony_ci            libc::ECONNABORTED => ECONNABORTED,
29433da5c369Sopenharmony_ci            libc::ECONNRESET => ECONNRESET,
29443da5c369Sopenharmony_ci            libc::ENOBUFS => ENOBUFS,
29453da5c369Sopenharmony_ci            libc::EISCONN => EISCONN,
29463da5c369Sopenharmony_ci            libc::ENOTCONN => ENOTCONN,
29473da5c369Sopenharmony_ci            libc::ESHUTDOWN => ESHUTDOWN,
29483da5c369Sopenharmony_ci            libc::ETOOMANYREFS => ETOOMANYREFS,
29493da5c369Sopenharmony_ci            libc::ETIMEDOUT => ETIMEDOUT,
29503da5c369Sopenharmony_ci            libc::ECONNREFUSED => ECONNREFUSED,
29513da5c369Sopenharmony_ci            libc::EHOSTDOWN => EHOSTDOWN,
29523da5c369Sopenharmony_ci            libc::EHOSTUNREACH => EHOSTUNREACH,
29533da5c369Sopenharmony_ci            libc::EALREADY => EALREADY,
29543da5c369Sopenharmony_ci            libc::EINPROGRESS => EINPROGRESS,
29553da5c369Sopenharmony_ci            libc::ESTALE => ESTALE,
29563da5c369Sopenharmony_ci            _ => UnknownErrno,
29573da5c369Sopenharmony_ci        }
29583da5c369Sopenharmony_ci    }
29593da5c369Sopenharmony_ci}
29603da5c369Sopenharmony_ci
29613da5c369Sopenharmony_ci#[cfg(target_os = "haiku")]
29623da5c369Sopenharmony_cimod consts {
29633da5c369Sopenharmony_ci    #[derive(Clone, Copy, Debug, Eq, PartialEq)]
29643da5c369Sopenharmony_ci    #[repr(i32)]
29653da5c369Sopenharmony_ci    #[non_exhaustive]
29663da5c369Sopenharmony_ci    pub enum Errno {
29673da5c369Sopenharmony_ci        UnknownErrno = 0,
29683da5c369Sopenharmony_ci        EPERM = libc::EPERM,
29693da5c369Sopenharmony_ci        ENOENT = libc::ENOENT,
29703da5c369Sopenharmony_ci        ESRCH = libc::ESRCH,
29713da5c369Sopenharmony_ci        EINTR = libc::EINTR,
29723da5c369Sopenharmony_ci        EIO = libc::EIO,
29733da5c369Sopenharmony_ci        ENXIO = libc::ENXIO,
29743da5c369Sopenharmony_ci        E2BIG = libc::E2BIG,
29753da5c369Sopenharmony_ci        ENOEXEC = libc::ENOEXEC,
29763da5c369Sopenharmony_ci        EBADF = libc::EBADF,
29773da5c369Sopenharmony_ci        ECHILD = libc::ECHILD,
29783da5c369Sopenharmony_ci        EDEADLK = libc::EDEADLK,
29793da5c369Sopenharmony_ci        ENOMEM = libc::ENOMEM,
29803da5c369Sopenharmony_ci        EACCES = libc::EACCES,
29813da5c369Sopenharmony_ci        EFAULT = libc::EFAULT,
29823da5c369Sopenharmony_ci        EBUSY = libc::EBUSY,
29833da5c369Sopenharmony_ci        EEXIST = libc::EEXIST,
29843da5c369Sopenharmony_ci        EXDEV = libc::EXDEV,
29853da5c369Sopenharmony_ci        ENODEV = libc::ENODEV,
29863da5c369Sopenharmony_ci        ENOTDIR = libc::ENOTDIR,
29873da5c369Sopenharmony_ci        EISDIR = libc::EISDIR,
29883da5c369Sopenharmony_ci        EINVAL = libc::EINVAL,
29893da5c369Sopenharmony_ci        ENFILE = libc::ENFILE,
29903da5c369Sopenharmony_ci        EMFILE = libc::EMFILE,
29913da5c369Sopenharmony_ci        ENOTTY = libc::ENOTTY,
29923da5c369Sopenharmony_ci        ETXTBSY = libc::ETXTBSY,
29933da5c369Sopenharmony_ci        EFBIG = libc::EFBIG,
29943da5c369Sopenharmony_ci        ENOSPC = libc::ENOSPC,
29953da5c369Sopenharmony_ci        ESPIPE = libc::ESPIPE,
29963da5c369Sopenharmony_ci        EROFS = libc::EROFS,
29973da5c369Sopenharmony_ci        EMLINK = libc::EMLINK,
29983da5c369Sopenharmony_ci        EPIPE = libc::EPIPE,
29993da5c369Sopenharmony_ci        EDOM = libc::EDOM,
30003da5c369Sopenharmony_ci        ERANGE = libc::ERANGE,
30013da5c369Sopenharmony_ci        EAGAIN = libc::EAGAIN,
30023da5c369Sopenharmony_ci        EINPROGRESS = libc::EINPROGRESS,
30033da5c369Sopenharmony_ci        EALREADY = libc::EALREADY,
30043da5c369Sopenharmony_ci        ENOTSOCK = libc::ENOTSOCK,
30053da5c369Sopenharmony_ci        EDESTADDRREQ = libc::EDESTADDRREQ,
30063da5c369Sopenharmony_ci        EMSGSIZE = libc::EMSGSIZE,
30073da5c369Sopenharmony_ci        EPROTOTYPE = libc::EPROTOTYPE,
30083da5c369Sopenharmony_ci        ENOPROTOOPT = libc::ENOPROTOOPT,
30093da5c369Sopenharmony_ci        EPROTONOSUPPORT = libc::EPROTONOSUPPORT,
30103da5c369Sopenharmony_ci        ENOTSUP = libc::ENOTSUP,
30113da5c369Sopenharmony_ci        EADDRINUSE = libc::EADDRINUSE,
30123da5c369Sopenharmony_ci        EADDRNOTAVAIL = libc::EADDRNOTAVAIL,
30133da5c369Sopenharmony_ci        ENETDOWN = libc::ENETDOWN,
30143da5c369Sopenharmony_ci        ENETUNREACH = libc::ENETUNREACH,
30153da5c369Sopenharmony_ci        ENETRESET = libc::ENETRESET,
30163da5c369Sopenharmony_ci        ECONNABORTED = libc::ECONNABORTED,
30173da5c369Sopenharmony_ci        ECONNRESET = libc::ECONNRESET,
30183da5c369Sopenharmony_ci        ENOBUFS = libc::ENOBUFS,
30193da5c369Sopenharmony_ci        EISCONN = libc::EISCONN,
30203da5c369Sopenharmony_ci        ENOTCONN = libc::ENOTCONN,
30213da5c369Sopenharmony_ci        ESHUTDOWN = libc::ESHUTDOWN,
30223da5c369Sopenharmony_ci        ETIMEDOUT = libc::ETIMEDOUT,
30233da5c369Sopenharmony_ci        ECONNREFUSED = libc::ECONNREFUSED,
30243da5c369Sopenharmony_ci        ELOOP = libc::ELOOP,
30253da5c369Sopenharmony_ci        ENAMETOOLONG = libc::ENAMETOOLONG,
30263da5c369Sopenharmony_ci        EHOSTDOWN = libc::EHOSTDOWN,
30273da5c369Sopenharmony_ci        EHOSTUNREACH = libc::EHOSTUNREACH,
30283da5c369Sopenharmony_ci        ENOTEMPTY = libc::ENOTEMPTY,
30293da5c369Sopenharmony_ci        EDQUOT = libc::EDQUOT,
30303da5c369Sopenharmony_ci        ESTALE = libc::ESTALE,
30313da5c369Sopenharmony_ci        ENOLCK = libc::ENOLCK,
30323da5c369Sopenharmony_ci        ENOSYS = libc::ENOSYS,
30333da5c369Sopenharmony_ci        EIDRM = libc::EIDRM,
30343da5c369Sopenharmony_ci        ENOMSG = libc::ENOMSG,
30353da5c369Sopenharmony_ci        EOVERFLOW = libc::EOVERFLOW,
30363da5c369Sopenharmony_ci        ECANCELED = libc::ECANCELED,
30373da5c369Sopenharmony_ci        EILSEQ = libc::EILSEQ,
30383da5c369Sopenharmony_ci        ENOATTR = libc::ENOATTR,
30393da5c369Sopenharmony_ci        EBADMSG = libc::EBADMSG,
30403da5c369Sopenharmony_ci        EMULTIHOP = libc::EMULTIHOP,
30413da5c369Sopenharmony_ci        ENOLINK = libc::ENOLINK,
30423da5c369Sopenharmony_ci        EPROTO = libc::EPROTO,
30433da5c369Sopenharmony_ci    }
30443da5c369Sopenharmony_ci
30453da5c369Sopenharmony_ci    impl Errno {
30463da5c369Sopenharmony_ci        pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
30473da5c369Sopenharmony_ci        pub const EDEADLOCK: Errno = Errno::EDEADLK;
30483da5c369Sopenharmony_ci        pub const EOPNOTSUPP: Errno = Errno::ENOTSUP;
30493da5c369Sopenharmony_ci    }
30503da5c369Sopenharmony_ci
30513da5c369Sopenharmony_ci    pub const fn from_i32(e: i32) -> Errno {
30523da5c369Sopenharmony_ci        use self::Errno::*;
30533da5c369Sopenharmony_ci
30543da5c369Sopenharmony_ci        match e {
30553da5c369Sopenharmony_ci            libc::EPERM => EPERM,
30563da5c369Sopenharmony_ci            libc::ENOENT => ENOENT,
30573da5c369Sopenharmony_ci            libc::ESRCH => ESRCH,
30583da5c369Sopenharmony_ci            libc::EINTR => EINTR,
30593da5c369Sopenharmony_ci            libc::EIO => EIO,
30603da5c369Sopenharmony_ci            libc::ENXIO => ENXIO,
30613da5c369Sopenharmony_ci            libc::E2BIG => E2BIG,
30623da5c369Sopenharmony_ci            libc::ENOEXEC => ENOEXEC,
30633da5c369Sopenharmony_ci            libc::EBADF => EBADF,
30643da5c369Sopenharmony_ci            libc::ECHILD => ECHILD,
30653da5c369Sopenharmony_ci            libc::EDEADLK => EDEADLK,
30663da5c369Sopenharmony_ci            libc::ENOMEM => ENOMEM,
30673da5c369Sopenharmony_ci            libc::EACCES => EACCES,
30683da5c369Sopenharmony_ci            libc::EFAULT => EFAULT,
30693da5c369Sopenharmony_ci            libc::EBUSY => EBUSY,
30703da5c369Sopenharmony_ci            libc::EEXIST => EEXIST,
30713da5c369Sopenharmony_ci            libc::EXDEV => EXDEV,
30723da5c369Sopenharmony_ci            libc::ENODEV => ENODEV,
30733da5c369Sopenharmony_ci            libc::ENOTDIR => ENOTDIR,
30743da5c369Sopenharmony_ci            libc::EISDIR => EISDIR,
30753da5c369Sopenharmony_ci            libc::EINVAL => EINVAL,
30763da5c369Sopenharmony_ci            libc::ENFILE => ENFILE,
30773da5c369Sopenharmony_ci            libc::EMFILE => EMFILE,
30783da5c369Sopenharmony_ci            libc::ENOTTY => ENOTTY,
30793da5c369Sopenharmony_ci            libc::ETXTBSY => ETXTBSY,
30803da5c369Sopenharmony_ci            libc::EFBIG => EFBIG,
30813da5c369Sopenharmony_ci            libc::ENOSPC => ENOSPC,
30823da5c369Sopenharmony_ci            libc::ESPIPE => ESPIPE,
30833da5c369Sopenharmony_ci            libc::EROFS => EROFS,
30843da5c369Sopenharmony_ci            libc::EMLINK => EMLINK,
30853da5c369Sopenharmony_ci            libc::EPIPE => EPIPE,
30863da5c369Sopenharmony_ci            libc::EDOM => EDOM,
30873da5c369Sopenharmony_ci            libc::ERANGE => ERANGE,
30883da5c369Sopenharmony_ci            libc::EAGAIN => EAGAIN,
30893da5c369Sopenharmony_ci            libc::EINPROGRESS => EINPROGRESS,
30903da5c369Sopenharmony_ci            libc::EALREADY => EALREADY,
30913da5c369Sopenharmony_ci            libc::ENOTSOCK => ENOTSOCK,
30923da5c369Sopenharmony_ci            libc::EDESTADDRREQ => EDESTADDRREQ,
30933da5c369Sopenharmony_ci            libc::EMSGSIZE => EMSGSIZE,
30943da5c369Sopenharmony_ci            libc::EPROTOTYPE => EPROTOTYPE,
30953da5c369Sopenharmony_ci            libc::ENOPROTOOPT => ENOPROTOOPT,
30963da5c369Sopenharmony_ci            libc::EPROTONOSUPPORT => EPROTONOSUPPORT,
30973da5c369Sopenharmony_ci            libc::ENOTSUP => ENOTSUP,
30983da5c369Sopenharmony_ci            libc::EADDRINUSE => EADDRINUSE,
30993da5c369Sopenharmony_ci            libc::EADDRNOTAVAIL => EADDRNOTAVAIL,
31003da5c369Sopenharmony_ci            libc::ENETDOWN => ENETDOWN,
31013da5c369Sopenharmony_ci            libc::ENETUNREACH => ENETUNREACH,
31023da5c369Sopenharmony_ci            libc::ENETRESET => ENETRESET,
31033da5c369Sopenharmony_ci            libc::ECONNABORTED => ECONNABORTED,
31043da5c369Sopenharmony_ci            libc::ECONNRESET => ECONNRESET,
31053da5c369Sopenharmony_ci            libc::ENOBUFS => ENOBUFS,
31063da5c369Sopenharmony_ci            libc::EISCONN => EISCONN,
31073da5c369Sopenharmony_ci            libc::ENOTCONN => ENOTCONN,
31083da5c369Sopenharmony_ci            libc::ESHUTDOWN => ESHUTDOWN,
31093da5c369Sopenharmony_ci            libc::ETIMEDOUT => ETIMEDOUT,
31103da5c369Sopenharmony_ci            libc::ECONNREFUSED => ECONNREFUSED,
31113da5c369Sopenharmony_ci            libc::ELOOP => ELOOP,
31123da5c369Sopenharmony_ci            libc::ENAMETOOLONG => ENAMETOOLONG,
31133da5c369Sopenharmony_ci            libc::EHOSTDOWN => EHOSTDOWN,
31143da5c369Sopenharmony_ci            libc::EHOSTUNREACH => EHOSTUNREACH,
31153da5c369Sopenharmony_ci            libc::ENOTEMPTY => ENOTEMPTY,
31163da5c369Sopenharmony_ci            libc::EDQUOT => EDQUOT,
31173da5c369Sopenharmony_ci            libc::ESTALE => ESTALE,
31183da5c369Sopenharmony_ci            libc::ENOLCK => ENOLCK,
31193da5c369Sopenharmony_ci            libc::ENOSYS => ENOSYS,
31203da5c369Sopenharmony_ci            libc::EIDRM => EIDRM,
31213da5c369Sopenharmony_ci            libc::ENOMSG => ENOMSG,
31223da5c369Sopenharmony_ci            libc::EOVERFLOW => EOVERFLOW,
31233da5c369Sopenharmony_ci            libc::ECANCELED => ECANCELED,
31243da5c369Sopenharmony_ci            libc::EILSEQ => EILSEQ,
31253da5c369Sopenharmony_ci            libc::ENOATTR => ENOATTR,
31263da5c369Sopenharmony_ci            libc::EBADMSG => EBADMSG,
31273da5c369Sopenharmony_ci            libc::EMULTIHOP => EMULTIHOP,
31283da5c369Sopenharmony_ci            libc::ENOLINK => ENOLINK,
31293da5c369Sopenharmony_ci            libc::EPROTO => EPROTO,
31303da5c369Sopenharmony_ci            _ => UnknownErrno,
31313da5c369Sopenharmony_ci        }
31323da5c369Sopenharmony_ci    }
31333da5c369Sopenharmony_ci}
3134