Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 1 | use cfg_if::cfg_if; |
| 2 | use libc::{c_int, c_void}; |
Joel Galenson | 981b40a | 2021-08-09 10:34:35 -0700 | [diff] [blame] | 3 | use std::convert::TryFrom; |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 4 | use std::{fmt, io, error}; |
| 5 | use crate::{Error, Result}; |
| 6 | |
| 7 | pub use self::consts::*; |
| 8 | |
| 9 | cfg_if! { |
| 10 | if #[cfg(any(target_os = "freebsd", |
| 11 | target_os = "ios", |
| 12 | target_os = "macos"))] { |
| 13 | unsafe fn errno_location() -> *mut c_int { |
| 14 | libc::__error() |
| 15 | } |
| 16 | } else if #[cfg(any(target_os = "android", |
| 17 | target_os = "netbsd", |
| 18 | target_os = "openbsd"))] { |
| 19 | unsafe fn errno_location() -> *mut c_int { |
| 20 | libc::__errno() |
| 21 | } |
| 22 | } else if #[cfg(any(target_os = "linux", |
| 23 | target_os = "redox", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 24 | target_os = "dragonfly", |
| 25 | target_os = "fuchsia"))] { |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 26 | unsafe fn errno_location() -> *mut c_int { |
| 27 | libc::__errno_location() |
| 28 | } |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 29 | } else if #[cfg(any(target_os = "illumos", target_os = "solaris"))] { |
| 30 | unsafe fn errno_location() -> *mut c_int { |
| 31 | libc::___errno() |
| 32 | } |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 33 | } |
| 34 | } |
| 35 | |
| 36 | /// Sets the platform-specific errno to no-error |
| 37 | fn clear() { |
| 38 | // Safe because errno is a thread-local variable |
| 39 | unsafe { |
| 40 | *errno_location() = 0; |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | /// Returns the platform-specific value of errno |
| 45 | pub fn errno() -> i32 { |
| 46 | unsafe { |
| 47 | (*errno_location()) as i32 |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | impl Errno { |
Joel Galenson | 981b40a | 2021-08-09 10:34:35 -0700 | [diff] [blame] | 52 | /// Convert this `Error` to an [`Errno`](enum.Errno.html). |
| 53 | /// |
| 54 | /// # Example |
| 55 | /// |
| 56 | /// ``` |
| 57 | /// # use nix::Error; |
| 58 | /// # use nix::errno::Errno; |
| 59 | /// let e = Error::from(Errno::EPERM); |
| 60 | /// assert_eq!(Some(Errno::EPERM), e.as_errno()); |
| 61 | /// ``` |
| 62 | #[deprecated( |
| 63 | since = "0.22.0", |
| 64 | note = "It's a no-op now; just delete it." |
| 65 | )] |
| 66 | pub fn as_errno(self) -> Option<Self> { |
| 67 | Some(self) |
| 68 | } |
| 69 | |
| 70 | /// Create a nix Error from a given errno |
| 71 | #[deprecated( |
| 72 | since = "0.22.0", |
| 73 | note = "It's a no-op now; just delete it." |
| 74 | )] |
| 75 | pub fn from_errno(errno: Errno) -> Error { |
| 76 | Error::from(errno) |
| 77 | } |
| 78 | |
| 79 | /// Create a new invalid argument error (`EINVAL`) |
| 80 | #[deprecated( |
| 81 | since = "0.22.0", |
| 82 | note = "Use Errno::EINVAL instead" |
| 83 | )] |
| 84 | pub fn invalid_argument() -> Error { |
| 85 | Errno::EINVAL |
| 86 | } |
| 87 | |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 88 | pub fn last() -> Self { |
| 89 | last() |
| 90 | } |
| 91 | |
| 92 | pub fn desc(self) -> &'static str { |
| 93 | desc(self) |
| 94 | } |
| 95 | |
| 96 | pub fn from_i32(err: i32) -> Errno { |
| 97 | from_i32(err) |
| 98 | } |
| 99 | |
| 100 | pub fn clear() { |
| 101 | clear() |
| 102 | } |
| 103 | |
| 104 | /// Returns `Ok(value)` if it does not contain the sentinel value. This |
| 105 | /// should not be used when `-1` is not the errno sentinel value. |
| 106 | pub fn result<S: ErrnoSentinel + PartialEq<S>>(value: S) -> Result<S> { |
| 107 | if value == S::sentinel() { |
Joel Galenson | 981b40a | 2021-08-09 10:34:35 -0700 | [diff] [blame] | 108 | Err(Self::last()) |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 109 | } else { |
| 110 | Ok(value) |
| 111 | } |
| 112 | } |
Joel Galenson | 981b40a | 2021-08-09 10:34:35 -0700 | [diff] [blame] | 113 | |
| 114 | /// Backwards compatibility hack for Nix <= 0.21.0 users |
| 115 | /// |
| 116 | /// In older versions of Nix, `Error::Sys` was an enum variant. Now it's a |
| 117 | /// function, which is compatible with most of the former use cases of the |
| 118 | /// enum variant. But you should use `Error(Errno::...)` instead. |
| 119 | #[deprecated( |
| 120 | since = "0.22.0", |
| 121 | note = "Use Errno::... instead" |
| 122 | )] |
| 123 | #[allow(non_snake_case)] |
| 124 | #[inline] |
| 125 | pub fn Sys(errno: Errno) -> Error { |
| 126 | errno |
| 127 | } |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 128 | } |
| 129 | |
| 130 | /// The sentinel value indicates that a function failed and more detailed |
| 131 | /// information about the error can be found in `errno` |
| 132 | pub trait ErrnoSentinel: Sized { |
| 133 | fn sentinel() -> Self; |
| 134 | } |
| 135 | |
| 136 | impl ErrnoSentinel for isize { |
| 137 | fn sentinel() -> Self { -1 } |
| 138 | } |
| 139 | |
| 140 | impl ErrnoSentinel for i32 { |
| 141 | fn sentinel() -> Self { -1 } |
| 142 | } |
| 143 | |
| 144 | impl ErrnoSentinel for i64 { |
| 145 | fn sentinel() -> Self { -1 } |
| 146 | } |
| 147 | |
| 148 | impl ErrnoSentinel for *mut c_void { |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 149 | fn sentinel() -> Self { -1isize as *mut c_void } |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 150 | } |
| 151 | |
| 152 | impl ErrnoSentinel for libc::sighandler_t { |
| 153 | fn sentinel() -> Self { libc::SIG_ERR } |
| 154 | } |
| 155 | |
| 156 | impl error::Error for Errno {} |
| 157 | |
| 158 | impl fmt::Display for Errno { |
| 159 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
| 160 | write!(f, "{:?}: {}", self, self.desc()) |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | impl From<Errno> for io::Error { |
| 165 | fn from(err: Errno) -> Self { |
| 166 | io::Error::from_raw_os_error(err as i32) |
| 167 | } |
| 168 | } |
| 169 | |
Joel Galenson | 981b40a | 2021-08-09 10:34:35 -0700 | [diff] [blame] | 170 | impl TryFrom<io::Error> for Errno { |
| 171 | type Error = io::Error; |
| 172 | |
| 173 | fn try_from(ioerror: io::Error) -> std::result::Result<Self, io::Error> { |
| 174 | ioerror.raw_os_error() |
| 175 | .map(Errno::from_i32) |
| 176 | .ok_or(ioerror) |
| 177 | } |
| 178 | } |
| 179 | |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 180 | fn last() -> Errno { |
| 181 | Errno::from_i32(errno()) |
| 182 | } |
| 183 | |
| 184 | fn desc(errno: Errno) -> &'static str { |
| 185 | use self::Errno::*; |
| 186 | match errno { |
| 187 | UnknownErrno => "Unknown errno", |
| 188 | EPERM => "Operation not permitted", |
| 189 | ENOENT => "No such file or directory", |
| 190 | ESRCH => "No such process", |
| 191 | EINTR => "Interrupted system call", |
| 192 | EIO => "I/O error", |
| 193 | ENXIO => "No such device or address", |
| 194 | E2BIG => "Argument list too long", |
| 195 | ENOEXEC => "Exec format error", |
| 196 | EBADF => "Bad file number", |
| 197 | ECHILD => "No child processes", |
| 198 | EAGAIN => "Try again", |
| 199 | ENOMEM => "Out of memory", |
| 200 | EACCES => "Permission denied", |
| 201 | EFAULT => "Bad address", |
| 202 | ENOTBLK => "Block device required", |
| 203 | EBUSY => "Device or resource busy", |
| 204 | EEXIST => "File exists", |
| 205 | EXDEV => "Cross-device link", |
| 206 | ENODEV => "No such device", |
| 207 | ENOTDIR => "Not a directory", |
| 208 | EISDIR => "Is a directory", |
| 209 | EINVAL => "Invalid argument", |
| 210 | ENFILE => "File table overflow", |
| 211 | EMFILE => "Too many open files", |
| 212 | ENOTTY => "Not a typewriter", |
| 213 | ETXTBSY => "Text file busy", |
| 214 | EFBIG => "File too large", |
| 215 | ENOSPC => "No space left on device", |
| 216 | ESPIPE => "Illegal seek", |
| 217 | EROFS => "Read-only file system", |
| 218 | EMLINK => "Too many links", |
| 219 | EPIPE => "Broken pipe", |
| 220 | EDOM => "Math argument out of domain of func", |
| 221 | ERANGE => "Math result not representable", |
| 222 | EDEADLK => "Resource deadlock would occur", |
| 223 | ENAMETOOLONG => "File name too long", |
| 224 | ENOLCK => "No record locks available", |
| 225 | ENOSYS => "Function not implemented", |
| 226 | ENOTEMPTY => "Directory not empty", |
| 227 | ELOOP => "Too many symbolic links encountered", |
| 228 | ENOMSG => "No message of desired type", |
| 229 | EIDRM => "Identifier removed", |
| 230 | EINPROGRESS => "Operation now in progress", |
| 231 | EALREADY => "Operation already in progress", |
| 232 | ENOTSOCK => "Socket operation on non-socket", |
| 233 | EDESTADDRREQ => "Destination address required", |
| 234 | EMSGSIZE => "Message too long", |
| 235 | EPROTOTYPE => "Protocol wrong type for socket", |
| 236 | ENOPROTOOPT => "Protocol not available", |
| 237 | EPROTONOSUPPORT => "Protocol not supported", |
| 238 | ESOCKTNOSUPPORT => "Socket type not supported", |
| 239 | EPFNOSUPPORT => "Protocol family not supported", |
| 240 | EAFNOSUPPORT => "Address family not supported by protocol", |
| 241 | EADDRINUSE => "Address already in use", |
| 242 | EADDRNOTAVAIL => "Cannot assign requested address", |
| 243 | ENETDOWN => "Network is down", |
| 244 | ENETUNREACH => "Network is unreachable", |
| 245 | ENETRESET => "Network dropped connection because of reset", |
| 246 | ECONNABORTED => "Software caused connection abort", |
| 247 | ECONNRESET => "Connection reset by peer", |
| 248 | ENOBUFS => "No buffer space available", |
| 249 | EISCONN => "Transport endpoint is already connected", |
| 250 | ENOTCONN => "Transport endpoint is not connected", |
| 251 | ESHUTDOWN => "Cannot send after transport endpoint shutdown", |
| 252 | ETOOMANYREFS => "Too many references: cannot splice", |
| 253 | ETIMEDOUT => "Connection timed out", |
| 254 | ECONNREFUSED => "Connection refused", |
| 255 | EHOSTDOWN => "Host is down", |
| 256 | EHOSTUNREACH => "No route to host", |
| 257 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 258 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 259 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 260 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 261 | ECHRNG => "Channel number out of range", |
| 262 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 263 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 264 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 265 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 266 | EL2NSYNC => "Level 2 not synchronized", |
| 267 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 268 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 269 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 270 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 271 | EL3HLT => "Level 3 halted", |
| 272 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 273 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 274 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 275 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 276 | EL3RST => "Level 3 reset", |
| 277 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 278 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 279 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 280 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 281 | ELNRNG => "Link number out of range", |
| 282 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 283 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 284 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 285 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 286 | EUNATCH => "Protocol driver not attached", |
| 287 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 288 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 289 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 290 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 291 | ENOCSI => "No CSI structure available", |
| 292 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 293 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 294 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 295 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 296 | EL2HLT => "Level 2 halted", |
| 297 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 298 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 299 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 300 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 301 | EBADE => "Invalid exchange", |
| 302 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 303 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 304 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 305 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 306 | EBADR => "Invalid request descriptor", |
| 307 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 308 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 309 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 310 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 311 | EXFULL => "Exchange full", |
| 312 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 313 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 314 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 315 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 316 | ENOANO => "No anode", |
| 317 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 318 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 319 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 320 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 321 | EBADRQC => "Invalid request code", |
| 322 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 323 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 324 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 325 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 326 | EBADSLT => "Invalid slot", |
| 327 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 328 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 329 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 330 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 331 | EBFONT => "Bad font file format", |
| 332 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 333 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 334 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 335 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 336 | ENOSTR => "Device not a stream", |
| 337 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 338 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 339 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 340 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 341 | ENODATA => "No data available", |
| 342 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 343 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 344 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 345 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 346 | ETIME => "Timer expired", |
| 347 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 348 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 349 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 350 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 351 | ENOSR => "Out of streams resources", |
| 352 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 353 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 354 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 355 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 356 | ENONET => "Machine is not on the network", |
| 357 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 358 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 359 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 360 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 361 | ENOPKG => "Package not installed", |
| 362 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 363 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 364 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 365 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 366 | EREMOTE => "Object is remote", |
| 367 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 368 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 369 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 370 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 371 | ENOLINK => "Link has been severed", |
| 372 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 373 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 374 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 375 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 376 | EADV => "Advertise error", |
| 377 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 378 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 379 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 380 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 381 | ESRMNT => "Srmount error", |
| 382 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 383 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 384 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 385 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 386 | ECOMM => "Communication error on send", |
| 387 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 388 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 389 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 390 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 391 | EPROTO => "Protocol error", |
| 392 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 393 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 394 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 395 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 396 | EMULTIHOP => "Multihop attempted", |
| 397 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 398 | #[cfg(any(target_os = "linux", target_os = "android", |
| 399 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 400 | EDOTDOT => "RFS specific error", |
| 401 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 402 | #[cfg(any(target_os = "linux", target_os = "android", |
| 403 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 404 | EBADMSG => "Not a data message", |
| 405 | |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 406 | #[cfg(any(target_os = "illumos", target_os = "solaris"))] |
| 407 | EBADMSG => "Trying to read unreadable message", |
| 408 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 409 | #[cfg(any(target_os = "linux", target_os = "android", |
| 410 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 411 | EOVERFLOW => "Value too large for defined data type", |
| 412 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 413 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 414 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 415 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 416 | ENOTUNIQ => "Name not unique on network", |
| 417 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 418 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 419 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 420 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 421 | EBADFD => "File descriptor in bad state", |
| 422 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 423 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 424 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 425 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 426 | EREMCHG => "Remote address changed", |
| 427 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 428 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 429 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 430 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 431 | ELIBACC => "Can not access a needed shared library", |
| 432 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 433 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 434 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 435 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 436 | ELIBBAD => "Accessing a corrupted shared library", |
| 437 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 438 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 439 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 440 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 441 | ELIBSCN => ".lib section in a.out corrupted", |
| 442 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 443 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 444 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 445 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 446 | ELIBMAX => "Attempting to link in too many shared libraries", |
| 447 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 448 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 449 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 450 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 451 | ELIBEXEC => "Cannot exec a shared library directly", |
| 452 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 453 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 454 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 455 | target_os = "fuchsia", target_os = "openbsd"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 456 | EILSEQ => "Illegal byte sequence", |
| 457 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 458 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 459 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 460 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 461 | ERESTART => "Interrupted system call should be restarted", |
| 462 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 463 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 464 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 465 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 466 | ESTRPIPE => "Streams pipe error", |
| 467 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 468 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 469 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 470 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 471 | EUSERS => "Too many users", |
| 472 | |
| 473 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 474 | target_os = "fuchsia", target_os = "netbsd", |
| 475 | target_os = "redox"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 476 | EOPNOTSUPP => "Operation not supported on transport endpoint", |
| 477 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 478 | #[cfg(any(target_os = "linux", target_os = "android", |
| 479 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 480 | ESTALE => "Stale file handle", |
| 481 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 482 | #[cfg(any(target_os = "linux", target_os = "android", |
| 483 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 484 | EUCLEAN => "Structure needs cleaning", |
| 485 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 486 | #[cfg(any(target_os = "linux", target_os = "android", |
| 487 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 488 | ENOTNAM => "Not a XENIX named type file", |
| 489 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 490 | #[cfg(any(target_os = "linux", target_os = "android", |
| 491 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 492 | ENAVAIL => "No XENIX semaphores available", |
| 493 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 494 | #[cfg(any(target_os = "linux", target_os = "android", |
| 495 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 496 | EISNAM => "Is a named type file", |
| 497 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 498 | #[cfg(any(target_os = "linux", target_os = "android", |
| 499 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 500 | EREMOTEIO => "Remote I/O error", |
| 501 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 502 | #[cfg(any(target_os = "linux", target_os = "android", |
| 503 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 504 | EDQUOT => "Quota exceeded", |
| 505 | |
| 506 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 507 | target_os = "fuchsia", target_os = "openbsd", |
| 508 | target_os = "dragonfly"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 509 | ENOMEDIUM => "No medium found", |
| 510 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 511 | #[cfg(any(target_os = "linux", target_os = "android", |
| 512 | target_os = "fuchsia", target_os = "openbsd"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 513 | EMEDIUMTYPE => "Wrong medium type", |
| 514 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 515 | #[cfg(any(target_os = "linux", target_os = "android", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 516 | target_os = "illumos", target_os = "solaris", |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 517 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 518 | ECANCELED => "Operation canceled", |
| 519 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 520 | #[cfg(any(target_os = "linux", target_os = "android", |
| 521 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 522 | ENOKEY => "Required key not available", |
| 523 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 524 | #[cfg(any(target_os = "linux", target_os = "android", |
| 525 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 526 | EKEYEXPIRED => "Key has expired", |
| 527 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 528 | #[cfg(any(target_os = "linux", target_os = "android", |
| 529 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 530 | EKEYREVOKED => "Key has been revoked", |
| 531 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 532 | #[cfg(any(target_os = "linux", target_os = "android", |
| 533 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 534 | EKEYREJECTED => "Key was rejected by service", |
| 535 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 536 | #[cfg(any(target_os = "linux", target_os = "android", |
| 537 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 538 | EOWNERDEAD => "Owner died", |
| 539 | |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 540 | #[cfg(any( target_os = "illumos", target_os = "solaris"))] |
| 541 | EOWNERDEAD => "Process died with lock", |
| 542 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 543 | #[cfg(any(target_os = "linux", target_os = "android", |
| 544 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 545 | ENOTRECOVERABLE => "State not recoverable", |
| 546 | |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 547 | #[cfg(any(target_os = "illumos", target_os = "solaris"))] |
| 548 | ENOTRECOVERABLE => "Lock is not recoverable", |
| 549 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 550 | #[cfg(any(all(target_os = "linux", not(target_arch="mips")), |
| 551 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 552 | ERFKILL => "Operation not possible due to RF-kill", |
| 553 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 554 | #[cfg(any(all(target_os = "linux", not(target_arch="mips")), |
| 555 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 556 | EHWPOISON => "Memory page has hardware error", |
| 557 | |
| 558 | #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))] |
| 559 | EDOOFUS => "Programming error", |
| 560 | |
| 561 | #[cfg(any(target_os = "freebsd", target_os = "dragonfly", target_os = "redox"))] |
| 562 | EMULTIHOP => "Multihop attempted", |
| 563 | |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 564 | #[cfg(any(target_os = "freebsd", target_os = "dragonfly", |
| 565 | target_os = "redox"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 566 | ENOLINK => "Link has been severed", |
| 567 | |
| 568 | #[cfg(target_os = "freebsd")] |
| 569 | ENOTCAPABLE => "Capabilities insufficient", |
| 570 | |
| 571 | #[cfg(target_os = "freebsd")] |
| 572 | ECAPMODE => "Not permitted in capability mode", |
| 573 | |
| 574 | #[cfg(any(target_os = "macos", target_os = "freebsd", |
| 575 | target_os = "dragonfly", target_os = "ios", |
| 576 | target_os = "openbsd", target_os = "netbsd"))] |
| 577 | ENEEDAUTH => "Need authenticator", |
| 578 | |
| 579 | #[cfg(any(target_os = "macos", target_os = "freebsd", |
| 580 | target_os = "dragonfly", target_os = "ios", |
| 581 | target_os = "openbsd", target_os = "netbsd", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 582 | target_os = "redox", target_os = "illumos", |
| 583 | target_os = "solaris"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 584 | EOVERFLOW => "Value too large to be stored in data type", |
| 585 | |
| 586 | #[cfg(any(target_os = "macos", target_os = "freebsd", |
| 587 | target_os = "dragonfly", target_os = "ios", |
| 588 | target_os = "netbsd", target_os = "redox"))] |
| 589 | EILSEQ => "Illegal byte sequence", |
| 590 | |
| 591 | #[cfg(any(target_os = "macos", target_os = "freebsd", |
| 592 | target_os = "dragonfly", target_os = "ios", |
| 593 | target_os = "openbsd", target_os = "netbsd"))] |
| 594 | ENOATTR => "Attribute not found", |
| 595 | |
| 596 | #[cfg(any(target_os = "macos", target_os = "freebsd", |
| 597 | target_os = "dragonfly", target_os = "ios", |
| 598 | target_os = "openbsd", target_os = "netbsd", |
| 599 | target_os = "redox"))] |
| 600 | EBADMSG => "Bad message", |
| 601 | |
| 602 | #[cfg(any(target_os = "macos", target_os = "freebsd", |
| 603 | target_os = "dragonfly", target_os = "ios", |
| 604 | target_os = "openbsd", target_os = "netbsd", |
| 605 | target_os = "redox"))] |
| 606 | EPROTO => "Protocol error", |
| 607 | |
| 608 | #[cfg(any(target_os = "macos", target_os = "freebsd", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 609 | target_os = "ios", target_os = "openbsd"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 610 | ENOTRECOVERABLE => "State not recoverable", |
| 611 | |
| 612 | #[cfg(any(target_os = "macos", target_os = "freebsd", |
| 613 | target_os = "ios", target_os = "openbsd"))] |
| 614 | EOWNERDEAD => "Previous owner died", |
| 615 | |
| 616 | #[cfg(any(target_os = "macos", target_os = "freebsd", |
| 617 | target_os = "dragonfly", target_os = "ios", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 618 | target_os = "openbsd", target_os = "netbsd", |
| 619 | target_os = "illumos", target_os = "solaris"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 620 | ENOTSUP => "Operation not supported", |
| 621 | |
| 622 | #[cfg(any(target_os = "macos", target_os = "freebsd", |
| 623 | target_os = "dragonfly", target_os = "ios", |
| 624 | target_os = "openbsd", target_os = "netbsd"))] |
| 625 | EPROCLIM => "Too many processes", |
| 626 | |
| 627 | #[cfg(any(target_os = "macos", target_os = "freebsd", |
| 628 | target_os = "dragonfly", target_os = "ios", |
| 629 | target_os = "openbsd", target_os = "netbsd", |
| 630 | target_os = "redox"))] |
| 631 | EUSERS => "Too many users", |
| 632 | |
| 633 | #[cfg(any(target_os = "macos", target_os = "freebsd", |
| 634 | target_os = "dragonfly", target_os = "ios", |
| 635 | target_os = "openbsd", target_os = "netbsd", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 636 | target_os = "redox", target_os = "illumos", |
| 637 | target_os = "solaris"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 638 | EDQUOT => "Disc quota exceeded", |
| 639 | |
| 640 | #[cfg(any(target_os = "macos", target_os = "freebsd", |
| 641 | target_os = "dragonfly", target_os = "ios", |
| 642 | target_os = "openbsd", target_os = "netbsd", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 643 | target_os = "redox", target_os = "illumos", |
| 644 | target_os = "solaris"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 645 | ESTALE => "Stale NFS file handle", |
| 646 | |
| 647 | #[cfg(any(target_os = "macos", target_os = "freebsd", |
| 648 | target_os = "dragonfly", target_os = "ios", |
| 649 | target_os = "openbsd", target_os = "netbsd", |
| 650 | target_os = "redox"))] |
| 651 | EREMOTE => "Too many levels of remote in path", |
| 652 | |
| 653 | #[cfg(any(target_os = "macos", target_os = "freebsd", |
| 654 | target_os = "dragonfly", target_os = "ios", |
| 655 | target_os = "openbsd", target_os = "netbsd"))] |
| 656 | EBADRPC => "RPC struct is bad", |
| 657 | |
| 658 | #[cfg(any(target_os = "macos", target_os = "freebsd", |
| 659 | target_os = "dragonfly", target_os = "ios", |
| 660 | target_os = "openbsd", target_os = "netbsd"))] |
| 661 | ERPCMISMATCH => "RPC version wrong", |
| 662 | |
| 663 | #[cfg(any(target_os = "macos", target_os = "freebsd", |
| 664 | target_os = "dragonfly", target_os = "ios", |
| 665 | target_os = "openbsd", target_os = "netbsd"))] |
| 666 | EPROGUNAVAIL => "RPC prog. not avail", |
| 667 | |
| 668 | #[cfg(any(target_os = "macos", target_os = "freebsd", |
| 669 | target_os = "dragonfly", target_os = "ios", |
| 670 | target_os = "openbsd", target_os = "netbsd"))] |
| 671 | EPROGMISMATCH => "Program version wrong", |
| 672 | |
| 673 | #[cfg(any(target_os = "macos", target_os = "freebsd", |
| 674 | target_os = "dragonfly", target_os = "ios", |
| 675 | target_os = "openbsd", target_os = "netbsd"))] |
| 676 | EPROCUNAVAIL => "Bad procedure for program", |
| 677 | |
| 678 | #[cfg(any(target_os = "macos", target_os = "freebsd", |
| 679 | target_os = "dragonfly", target_os = "ios", |
| 680 | target_os = "openbsd", target_os = "netbsd"))] |
| 681 | EFTYPE => "Inappropriate file type or format", |
| 682 | |
| 683 | #[cfg(any(target_os = "macos", target_os = "freebsd", |
| 684 | target_os = "dragonfly", target_os = "ios", |
| 685 | target_os = "openbsd", target_os = "netbsd"))] |
| 686 | EAUTH => "Authentication error", |
| 687 | |
| 688 | #[cfg(any(target_os = "macos", target_os = "freebsd", |
| 689 | target_os = "dragonfly", target_os = "ios", |
| 690 | target_os = "openbsd", target_os = "netbsd", |
| 691 | target_os = "redox"))] |
| 692 | ECANCELED => "Operation canceled", |
| 693 | |
| 694 | #[cfg(any(target_os = "macos", target_os = "ios"))] |
| 695 | EPWROFF => "Device power is off", |
| 696 | |
| 697 | #[cfg(any(target_os = "macos", target_os = "ios"))] |
| 698 | EDEVERR => "Device error, e.g. paper out", |
| 699 | |
| 700 | #[cfg(any(target_os = "macos", target_os = "ios"))] |
| 701 | EBADEXEC => "Bad executable", |
| 702 | |
| 703 | #[cfg(any(target_os = "macos", target_os = "ios"))] |
| 704 | EBADARCH => "Bad CPU type in executable", |
| 705 | |
| 706 | #[cfg(any(target_os = "macos", target_os = "ios"))] |
| 707 | ESHLIBVERS => "Shared library version mismatch", |
| 708 | |
| 709 | #[cfg(any(target_os = "macos", target_os = "ios"))] |
| 710 | EBADMACHO => "Malformed Macho file", |
| 711 | |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 712 | #[cfg(any(target_os = "macos", target_os = "ios", |
| 713 | target_os = "netbsd"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 714 | EMULTIHOP => "Reserved", |
| 715 | |
| 716 | #[cfg(any(target_os = "macos", target_os = "ios", |
| 717 | target_os = "netbsd", target_os = "redox"))] |
| 718 | ENODATA => "No message available on STREAM", |
| 719 | |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 720 | #[cfg(any(target_os = "macos", target_os = "ios", |
| 721 | target_os = "netbsd"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 722 | ENOLINK => "Reserved", |
| 723 | |
| 724 | #[cfg(any(target_os = "macos", target_os = "ios", |
| 725 | target_os = "netbsd", target_os = "redox"))] |
| 726 | ENOSR => "No STREAM resources", |
| 727 | |
| 728 | #[cfg(any(target_os = "macos", target_os = "ios", |
| 729 | target_os = "netbsd", target_os = "redox"))] |
| 730 | ENOSTR => "Not a STREAM", |
| 731 | |
| 732 | #[cfg(any(target_os = "macos", target_os = "ios", |
| 733 | target_os = "netbsd", target_os = "redox"))] |
| 734 | ETIME => "STREAM ioctl timeout", |
| 735 | |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 736 | #[cfg(any(target_os = "macos", target_os = "ios", |
| 737 | target_os = "illumos", target_os = "solaris"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 738 | EOPNOTSUPP => "Operation not supported on socket", |
| 739 | |
| 740 | #[cfg(any(target_os = "macos", target_os = "ios"))] |
| 741 | ENOPOLICY => "No such policy registered", |
| 742 | |
| 743 | #[cfg(any(target_os = "macos", target_os = "ios"))] |
| 744 | EQFULL => "Interface output queue is full", |
| 745 | |
| 746 | #[cfg(target_os = "openbsd")] |
| 747 | EOPNOTSUPP => "Operation not supported", |
| 748 | |
| 749 | #[cfg(target_os = "openbsd")] |
| 750 | EIPSEC => "IPsec processing failure", |
| 751 | |
| 752 | #[cfg(target_os = "dragonfly")] |
| 753 | EASYNC => "Async", |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 754 | |
| 755 | #[cfg(any(target_os = "illumos", target_os = "solaris"))] |
| 756 | EDEADLOCK => "Resource deadlock would occur", |
| 757 | |
| 758 | #[cfg(any(target_os = "illumos", target_os = "solaris"))] |
| 759 | ELOCKUNMAPPED => "Locked lock was unmapped", |
| 760 | |
| 761 | #[cfg(any(target_os = "illumos", target_os = "solaris"))] |
| 762 | ENOTACTIVE => "Facility is not active", |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 763 | } |
| 764 | } |
| 765 | |
Joel Galenson | 4727c11 | 2021-04-02 12:22:24 -0700 | [diff] [blame] | 766 | #[cfg(any(target_os = "linux", target_os = "android", |
| 767 | target_os = "fuchsia"))] |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 768 | mod consts { |
| 769 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
| 770 | #[repr(i32)] |
| 771 | pub enum Errno { |
| 772 | UnknownErrno = 0, |
| 773 | EPERM = libc::EPERM, |
| 774 | ENOENT = libc::ENOENT, |
| 775 | ESRCH = libc::ESRCH, |
| 776 | EINTR = libc::EINTR, |
| 777 | EIO = libc::EIO, |
| 778 | ENXIO = libc::ENXIO, |
| 779 | E2BIG = libc::E2BIG, |
| 780 | ENOEXEC = libc::ENOEXEC, |
| 781 | EBADF = libc::EBADF, |
| 782 | ECHILD = libc::ECHILD, |
| 783 | EAGAIN = libc::EAGAIN, |
| 784 | ENOMEM = libc::ENOMEM, |
| 785 | EACCES = libc::EACCES, |
| 786 | EFAULT = libc::EFAULT, |
| 787 | ENOTBLK = libc::ENOTBLK, |
| 788 | EBUSY = libc::EBUSY, |
| 789 | EEXIST = libc::EEXIST, |
| 790 | EXDEV = libc::EXDEV, |
| 791 | ENODEV = libc::ENODEV, |
| 792 | ENOTDIR = libc::ENOTDIR, |
| 793 | EISDIR = libc::EISDIR, |
| 794 | EINVAL = libc::EINVAL, |
| 795 | ENFILE = libc::ENFILE, |
| 796 | EMFILE = libc::EMFILE, |
| 797 | ENOTTY = libc::ENOTTY, |
| 798 | ETXTBSY = libc::ETXTBSY, |
| 799 | EFBIG = libc::EFBIG, |
| 800 | ENOSPC = libc::ENOSPC, |
| 801 | ESPIPE = libc::ESPIPE, |
| 802 | EROFS = libc::EROFS, |
| 803 | EMLINK = libc::EMLINK, |
| 804 | EPIPE = libc::EPIPE, |
| 805 | EDOM = libc::EDOM, |
| 806 | ERANGE = libc::ERANGE, |
| 807 | EDEADLK = libc::EDEADLK, |
| 808 | ENAMETOOLONG = libc::ENAMETOOLONG, |
| 809 | ENOLCK = libc::ENOLCK, |
| 810 | ENOSYS = libc::ENOSYS, |
| 811 | ENOTEMPTY = libc::ENOTEMPTY, |
| 812 | ELOOP = libc::ELOOP, |
| 813 | ENOMSG = libc::ENOMSG, |
| 814 | EIDRM = libc::EIDRM, |
| 815 | ECHRNG = libc::ECHRNG, |
| 816 | EL2NSYNC = libc::EL2NSYNC, |
| 817 | EL3HLT = libc::EL3HLT, |
| 818 | EL3RST = libc::EL3RST, |
| 819 | ELNRNG = libc::ELNRNG, |
| 820 | EUNATCH = libc::EUNATCH, |
| 821 | ENOCSI = libc::ENOCSI, |
| 822 | EL2HLT = libc::EL2HLT, |
| 823 | EBADE = libc::EBADE, |
| 824 | EBADR = libc::EBADR, |
| 825 | EXFULL = libc::EXFULL, |
| 826 | ENOANO = libc::ENOANO, |
| 827 | EBADRQC = libc::EBADRQC, |
| 828 | EBADSLT = libc::EBADSLT, |
| 829 | EBFONT = libc::EBFONT, |
| 830 | ENOSTR = libc::ENOSTR, |
| 831 | ENODATA = libc::ENODATA, |
| 832 | ETIME = libc::ETIME, |
| 833 | ENOSR = libc::ENOSR, |
| 834 | ENONET = libc::ENONET, |
| 835 | ENOPKG = libc::ENOPKG, |
| 836 | EREMOTE = libc::EREMOTE, |
| 837 | ENOLINK = libc::ENOLINK, |
| 838 | EADV = libc::EADV, |
| 839 | ESRMNT = libc::ESRMNT, |
| 840 | ECOMM = libc::ECOMM, |
| 841 | EPROTO = libc::EPROTO, |
| 842 | EMULTIHOP = libc::EMULTIHOP, |
| 843 | EDOTDOT = libc::EDOTDOT, |
| 844 | EBADMSG = libc::EBADMSG, |
| 845 | EOVERFLOW = libc::EOVERFLOW, |
| 846 | ENOTUNIQ = libc::ENOTUNIQ, |
| 847 | EBADFD = libc::EBADFD, |
| 848 | EREMCHG = libc::EREMCHG, |
| 849 | ELIBACC = libc::ELIBACC, |
| 850 | ELIBBAD = libc::ELIBBAD, |
| 851 | ELIBSCN = libc::ELIBSCN, |
| 852 | ELIBMAX = libc::ELIBMAX, |
| 853 | ELIBEXEC = libc::ELIBEXEC, |
| 854 | EILSEQ = libc::EILSEQ, |
| 855 | ERESTART = libc::ERESTART, |
| 856 | ESTRPIPE = libc::ESTRPIPE, |
| 857 | EUSERS = libc::EUSERS, |
| 858 | ENOTSOCK = libc::ENOTSOCK, |
| 859 | EDESTADDRREQ = libc::EDESTADDRREQ, |
| 860 | EMSGSIZE = libc::EMSGSIZE, |
| 861 | EPROTOTYPE = libc::EPROTOTYPE, |
| 862 | ENOPROTOOPT = libc::ENOPROTOOPT, |
| 863 | EPROTONOSUPPORT = libc::EPROTONOSUPPORT, |
| 864 | ESOCKTNOSUPPORT = libc::ESOCKTNOSUPPORT, |
| 865 | EOPNOTSUPP = libc::EOPNOTSUPP, |
| 866 | EPFNOSUPPORT = libc::EPFNOSUPPORT, |
| 867 | EAFNOSUPPORT = libc::EAFNOSUPPORT, |
| 868 | EADDRINUSE = libc::EADDRINUSE, |
| 869 | EADDRNOTAVAIL = libc::EADDRNOTAVAIL, |
| 870 | ENETDOWN = libc::ENETDOWN, |
| 871 | ENETUNREACH = libc::ENETUNREACH, |
| 872 | ENETRESET = libc::ENETRESET, |
| 873 | ECONNABORTED = libc::ECONNABORTED, |
| 874 | ECONNRESET = libc::ECONNRESET, |
| 875 | ENOBUFS = libc::ENOBUFS, |
| 876 | EISCONN = libc::EISCONN, |
| 877 | ENOTCONN = libc::ENOTCONN, |
| 878 | ESHUTDOWN = libc::ESHUTDOWN, |
| 879 | ETOOMANYREFS = libc::ETOOMANYREFS, |
| 880 | ETIMEDOUT = libc::ETIMEDOUT, |
| 881 | ECONNREFUSED = libc::ECONNREFUSED, |
| 882 | EHOSTDOWN = libc::EHOSTDOWN, |
| 883 | EHOSTUNREACH = libc::EHOSTUNREACH, |
| 884 | EALREADY = libc::EALREADY, |
| 885 | EINPROGRESS = libc::EINPROGRESS, |
| 886 | ESTALE = libc::ESTALE, |
| 887 | EUCLEAN = libc::EUCLEAN, |
| 888 | ENOTNAM = libc::ENOTNAM, |
| 889 | ENAVAIL = libc::ENAVAIL, |
| 890 | EISNAM = libc::EISNAM, |
| 891 | EREMOTEIO = libc::EREMOTEIO, |
| 892 | EDQUOT = libc::EDQUOT, |
| 893 | ENOMEDIUM = libc::ENOMEDIUM, |
| 894 | EMEDIUMTYPE = libc::EMEDIUMTYPE, |
| 895 | ECANCELED = libc::ECANCELED, |
| 896 | ENOKEY = libc::ENOKEY, |
| 897 | EKEYEXPIRED = libc::EKEYEXPIRED, |
| 898 | EKEYREVOKED = libc::EKEYREVOKED, |
| 899 | EKEYREJECTED = libc::EKEYREJECTED, |
| 900 | EOWNERDEAD = libc::EOWNERDEAD, |
| 901 | ENOTRECOVERABLE = libc::ENOTRECOVERABLE, |
| 902 | #[cfg(not(any(target_os = "android", target_arch="mips")))] |
| 903 | ERFKILL = libc::ERFKILL, |
| 904 | #[cfg(not(any(target_os = "android", target_arch="mips")))] |
| 905 | EHWPOISON = libc::EHWPOISON, |
| 906 | } |
| 907 | |
Joel Galenson | 981b40a | 2021-08-09 10:34:35 -0700 | [diff] [blame] | 908 | impl Errno { |
| 909 | pub const EWOULDBLOCK: Errno = Errno::EAGAIN; |
| 910 | pub const EDEADLOCK: Errno = Errno::EDEADLK; |
| 911 | pub const ENOTSUP: Errno = Errno::EOPNOTSUPP; |
| 912 | } |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 913 | |
| 914 | pub fn from_i32(e: i32) -> Errno { |
| 915 | use self::Errno::*; |
| 916 | |
| 917 | match e { |
| 918 | libc::EPERM => EPERM, |
| 919 | libc::ENOENT => ENOENT, |
| 920 | libc::ESRCH => ESRCH, |
| 921 | libc::EINTR => EINTR, |
| 922 | libc::EIO => EIO, |
| 923 | libc::ENXIO => ENXIO, |
| 924 | libc::E2BIG => E2BIG, |
| 925 | libc::ENOEXEC => ENOEXEC, |
| 926 | libc::EBADF => EBADF, |
| 927 | libc::ECHILD => ECHILD, |
| 928 | libc::EAGAIN => EAGAIN, |
| 929 | libc::ENOMEM => ENOMEM, |
| 930 | libc::EACCES => EACCES, |
| 931 | libc::EFAULT => EFAULT, |
| 932 | libc::ENOTBLK => ENOTBLK, |
| 933 | libc::EBUSY => EBUSY, |
| 934 | libc::EEXIST => EEXIST, |
| 935 | libc::EXDEV => EXDEV, |
| 936 | libc::ENODEV => ENODEV, |
| 937 | libc::ENOTDIR => ENOTDIR, |
| 938 | libc::EISDIR => EISDIR, |
| 939 | libc::EINVAL => EINVAL, |
| 940 | libc::ENFILE => ENFILE, |
| 941 | libc::EMFILE => EMFILE, |
| 942 | libc::ENOTTY => ENOTTY, |
| 943 | libc::ETXTBSY => ETXTBSY, |
| 944 | libc::EFBIG => EFBIG, |
| 945 | libc::ENOSPC => ENOSPC, |
| 946 | libc::ESPIPE => ESPIPE, |
| 947 | libc::EROFS => EROFS, |
| 948 | libc::EMLINK => EMLINK, |
| 949 | libc::EPIPE => EPIPE, |
| 950 | libc::EDOM => EDOM, |
| 951 | libc::ERANGE => ERANGE, |
| 952 | libc::EDEADLK => EDEADLK, |
| 953 | libc::ENAMETOOLONG => ENAMETOOLONG, |
| 954 | libc::ENOLCK => ENOLCK, |
| 955 | libc::ENOSYS => ENOSYS, |
| 956 | libc::ENOTEMPTY => ENOTEMPTY, |
| 957 | libc::ELOOP => ELOOP, |
| 958 | libc::ENOMSG => ENOMSG, |
| 959 | libc::EIDRM => EIDRM, |
| 960 | libc::ECHRNG => ECHRNG, |
| 961 | libc::EL2NSYNC => EL2NSYNC, |
| 962 | libc::EL3HLT => EL3HLT, |
| 963 | libc::EL3RST => EL3RST, |
| 964 | libc::ELNRNG => ELNRNG, |
| 965 | libc::EUNATCH => EUNATCH, |
| 966 | libc::ENOCSI => ENOCSI, |
| 967 | libc::EL2HLT => EL2HLT, |
| 968 | libc::EBADE => EBADE, |
| 969 | libc::EBADR => EBADR, |
| 970 | libc::EXFULL => EXFULL, |
| 971 | libc::ENOANO => ENOANO, |
| 972 | libc::EBADRQC => EBADRQC, |
| 973 | libc::EBADSLT => EBADSLT, |
| 974 | libc::EBFONT => EBFONT, |
| 975 | libc::ENOSTR => ENOSTR, |
| 976 | libc::ENODATA => ENODATA, |
| 977 | libc::ETIME => ETIME, |
| 978 | libc::ENOSR => ENOSR, |
| 979 | libc::ENONET => ENONET, |
| 980 | libc::ENOPKG => ENOPKG, |
| 981 | libc::EREMOTE => EREMOTE, |
| 982 | libc::ENOLINK => ENOLINK, |
| 983 | libc::EADV => EADV, |
| 984 | libc::ESRMNT => ESRMNT, |
| 985 | libc::ECOMM => ECOMM, |
| 986 | libc::EPROTO => EPROTO, |
| 987 | libc::EMULTIHOP => EMULTIHOP, |
| 988 | libc::EDOTDOT => EDOTDOT, |
| 989 | libc::EBADMSG => EBADMSG, |
| 990 | libc::EOVERFLOW => EOVERFLOW, |
| 991 | libc::ENOTUNIQ => ENOTUNIQ, |
| 992 | libc::EBADFD => EBADFD, |
| 993 | libc::EREMCHG => EREMCHG, |
| 994 | libc::ELIBACC => ELIBACC, |
| 995 | libc::ELIBBAD => ELIBBAD, |
| 996 | libc::ELIBSCN => ELIBSCN, |
| 997 | libc::ELIBMAX => ELIBMAX, |
| 998 | libc::ELIBEXEC => ELIBEXEC, |
| 999 | libc::EILSEQ => EILSEQ, |
| 1000 | libc::ERESTART => ERESTART, |
| 1001 | libc::ESTRPIPE => ESTRPIPE, |
| 1002 | libc::EUSERS => EUSERS, |
| 1003 | libc::ENOTSOCK => ENOTSOCK, |
| 1004 | libc::EDESTADDRREQ => EDESTADDRREQ, |
| 1005 | libc::EMSGSIZE => EMSGSIZE, |
| 1006 | libc::EPROTOTYPE => EPROTOTYPE, |
| 1007 | libc::ENOPROTOOPT => ENOPROTOOPT, |
| 1008 | libc::EPROTONOSUPPORT => EPROTONOSUPPORT, |
| 1009 | libc::ESOCKTNOSUPPORT => ESOCKTNOSUPPORT, |
| 1010 | libc::EOPNOTSUPP => EOPNOTSUPP, |
| 1011 | libc::EPFNOSUPPORT => EPFNOSUPPORT, |
| 1012 | libc::EAFNOSUPPORT => EAFNOSUPPORT, |
| 1013 | libc::EADDRINUSE => EADDRINUSE, |
| 1014 | libc::EADDRNOTAVAIL => EADDRNOTAVAIL, |
| 1015 | libc::ENETDOWN => ENETDOWN, |
| 1016 | libc::ENETUNREACH => ENETUNREACH, |
| 1017 | libc::ENETRESET => ENETRESET, |
| 1018 | libc::ECONNABORTED => ECONNABORTED, |
| 1019 | libc::ECONNRESET => ECONNRESET, |
| 1020 | libc::ENOBUFS => ENOBUFS, |
| 1021 | libc::EISCONN => EISCONN, |
| 1022 | libc::ENOTCONN => ENOTCONN, |
| 1023 | libc::ESHUTDOWN => ESHUTDOWN, |
| 1024 | libc::ETOOMANYREFS => ETOOMANYREFS, |
| 1025 | libc::ETIMEDOUT => ETIMEDOUT, |
| 1026 | libc::ECONNREFUSED => ECONNREFUSED, |
| 1027 | libc::EHOSTDOWN => EHOSTDOWN, |
| 1028 | libc::EHOSTUNREACH => EHOSTUNREACH, |
| 1029 | libc::EALREADY => EALREADY, |
| 1030 | libc::EINPROGRESS => EINPROGRESS, |
| 1031 | libc::ESTALE => ESTALE, |
| 1032 | libc::EUCLEAN => EUCLEAN, |
| 1033 | libc::ENOTNAM => ENOTNAM, |
| 1034 | libc::ENAVAIL => ENAVAIL, |
| 1035 | libc::EISNAM => EISNAM, |
| 1036 | libc::EREMOTEIO => EREMOTEIO, |
| 1037 | libc::EDQUOT => EDQUOT, |
| 1038 | libc::ENOMEDIUM => ENOMEDIUM, |
| 1039 | libc::EMEDIUMTYPE => EMEDIUMTYPE, |
| 1040 | libc::ECANCELED => ECANCELED, |
| 1041 | libc::ENOKEY => ENOKEY, |
| 1042 | libc::EKEYEXPIRED => EKEYEXPIRED, |
| 1043 | libc::EKEYREVOKED => EKEYREVOKED, |
| 1044 | libc::EKEYREJECTED => EKEYREJECTED, |
| 1045 | libc::EOWNERDEAD => EOWNERDEAD, |
| 1046 | libc::ENOTRECOVERABLE => ENOTRECOVERABLE, |
| 1047 | #[cfg(not(any(target_os = "android", target_arch="mips")))] |
| 1048 | libc::ERFKILL => ERFKILL, |
| 1049 | #[cfg(not(any(target_os = "android", target_arch="mips")))] |
| 1050 | libc::EHWPOISON => EHWPOISON, |
| 1051 | _ => UnknownErrno, |
| 1052 | } |
| 1053 | } |
| 1054 | } |
| 1055 | |
| 1056 | #[cfg(any(target_os = "macos", target_os = "ios"))] |
| 1057 | mod consts { |
| 1058 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
| 1059 | #[repr(i32)] |
| 1060 | pub enum Errno { |
| 1061 | UnknownErrno = 0, |
| 1062 | EPERM = libc::EPERM, |
| 1063 | ENOENT = libc::ENOENT, |
| 1064 | ESRCH = libc::ESRCH, |
| 1065 | EINTR = libc::EINTR, |
| 1066 | EIO = libc::EIO, |
| 1067 | ENXIO = libc::ENXIO, |
| 1068 | E2BIG = libc::E2BIG, |
| 1069 | ENOEXEC = libc::ENOEXEC, |
| 1070 | EBADF = libc::EBADF, |
| 1071 | ECHILD = libc::ECHILD, |
| 1072 | EDEADLK = libc::EDEADLK, |
| 1073 | ENOMEM = libc::ENOMEM, |
| 1074 | EACCES = libc::EACCES, |
| 1075 | EFAULT = libc::EFAULT, |
| 1076 | ENOTBLK = libc::ENOTBLK, |
| 1077 | EBUSY = libc::EBUSY, |
| 1078 | EEXIST = libc::EEXIST, |
| 1079 | EXDEV = libc::EXDEV, |
| 1080 | ENODEV = libc::ENODEV, |
| 1081 | ENOTDIR = libc::ENOTDIR, |
| 1082 | EISDIR = libc::EISDIR, |
| 1083 | EINVAL = libc::EINVAL, |
| 1084 | ENFILE = libc::ENFILE, |
| 1085 | EMFILE = libc::EMFILE, |
| 1086 | ENOTTY = libc::ENOTTY, |
| 1087 | ETXTBSY = libc::ETXTBSY, |
| 1088 | EFBIG = libc::EFBIG, |
| 1089 | ENOSPC = libc::ENOSPC, |
| 1090 | ESPIPE = libc::ESPIPE, |
| 1091 | EROFS = libc::EROFS, |
| 1092 | EMLINK = libc::EMLINK, |
| 1093 | EPIPE = libc::EPIPE, |
| 1094 | EDOM = libc::EDOM, |
| 1095 | ERANGE = libc::ERANGE, |
| 1096 | EAGAIN = libc::EAGAIN, |
| 1097 | EINPROGRESS = libc::EINPROGRESS, |
| 1098 | EALREADY = libc::EALREADY, |
| 1099 | ENOTSOCK = libc::ENOTSOCK, |
| 1100 | EDESTADDRREQ = libc::EDESTADDRREQ, |
| 1101 | EMSGSIZE = libc::EMSGSIZE, |
| 1102 | EPROTOTYPE = libc::EPROTOTYPE, |
| 1103 | ENOPROTOOPT = libc::ENOPROTOOPT, |
| 1104 | EPROTONOSUPPORT = libc::EPROTONOSUPPORT, |
| 1105 | ESOCKTNOSUPPORT = libc::ESOCKTNOSUPPORT, |
| 1106 | ENOTSUP = libc::ENOTSUP, |
| 1107 | EPFNOSUPPORT = libc::EPFNOSUPPORT, |
| 1108 | EAFNOSUPPORT = libc::EAFNOSUPPORT, |
| 1109 | EADDRINUSE = libc::EADDRINUSE, |
| 1110 | EADDRNOTAVAIL = libc::EADDRNOTAVAIL, |
| 1111 | ENETDOWN = libc::ENETDOWN, |
| 1112 | ENETUNREACH = libc::ENETUNREACH, |
| 1113 | ENETRESET = libc::ENETRESET, |
| 1114 | ECONNABORTED = libc::ECONNABORTED, |
| 1115 | ECONNRESET = libc::ECONNRESET, |
| 1116 | ENOBUFS = libc::ENOBUFS, |
| 1117 | EISCONN = libc::EISCONN, |
| 1118 | ENOTCONN = libc::ENOTCONN, |
| 1119 | ESHUTDOWN = libc::ESHUTDOWN, |
| 1120 | ETOOMANYREFS = libc::ETOOMANYREFS, |
| 1121 | ETIMEDOUT = libc::ETIMEDOUT, |
| 1122 | ECONNREFUSED = libc::ECONNREFUSED, |
| 1123 | ELOOP = libc::ELOOP, |
| 1124 | ENAMETOOLONG = libc::ENAMETOOLONG, |
| 1125 | EHOSTDOWN = libc::EHOSTDOWN, |
| 1126 | EHOSTUNREACH = libc::EHOSTUNREACH, |
| 1127 | ENOTEMPTY = libc::ENOTEMPTY, |
| 1128 | EPROCLIM = libc::EPROCLIM, |
| 1129 | EUSERS = libc::EUSERS, |
| 1130 | EDQUOT = libc::EDQUOT, |
| 1131 | ESTALE = libc::ESTALE, |
| 1132 | EREMOTE = libc::EREMOTE, |
| 1133 | EBADRPC = libc::EBADRPC, |
| 1134 | ERPCMISMATCH = libc::ERPCMISMATCH, |
| 1135 | EPROGUNAVAIL = libc::EPROGUNAVAIL, |
| 1136 | EPROGMISMATCH = libc::EPROGMISMATCH, |
| 1137 | EPROCUNAVAIL = libc::EPROCUNAVAIL, |
| 1138 | ENOLCK = libc::ENOLCK, |
| 1139 | ENOSYS = libc::ENOSYS, |
| 1140 | EFTYPE = libc::EFTYPE, |
| 1141 | EAUTH = libc::EAUTH, |
| 1142 | ENEEDAUTH = libc::ENEEDAUTH, |
| 1143 | EPWROFF = libc::EPWROFF, |
| 1144 | EDEVERR = libc::EDEVERR, |
| 1145 | EOVERFLOW = libc::EOVERFLOW, |
| 1146 | EBADEXEC = libc::EBADEXEC, |
| 1147 | EBADARCH = libc::EBADARCH, |
| 1148 | ESHLIBVERS = libc::ESHLIBVERS, |
| 1149 | EBADMACHO = libc::EBADMACHO, |
| 1150 | ECANCELED = libc::ECANCELED, |
| 1151 | EIDRM = libc::EIDRM, |
| 1152 | ENOMSG = libc::ENOMSG, |
| 1153 | EILSEQ = libc::EILSEQ, |
| 1154 | ENOATTR = libc::ENOATTR, |
| 1155 | EBADMSG = libc::EBADMSG, |
| 1156 | EMULTIHOP = libc::EMULTIHOP, |
| 1157 | ENODATA = libc::ENODATA, |
| 1158 | ENOLINK = libc::ENOLINK, |
| 1159 | ENOSR = libc::ENOSR, |
| 1160 | ENOSTR = libc::ENOSTR, |
| 1161 | EPROTO = libc::EPROTO, |
| 1162 | ETIME = libc::ETIME, |
| 1163 | EOPNOTSUPP = libc::EOPNOTSUPP, |
| 1164 | ENOPOLICY = libc::ENOPOLICY, |
| 1165 | ENOTRECOVERABLE = libc::ENOTRECOVERABLE, |
| 1166 | EOWNERDEAD = libc::EOWNERDEAD, |
| 1167 | EQFULL = libc::EQFULL, |
| 1168 | } |
| 1169 | |
Joel Galenson | 981b40a | 2021-08-09 10:34:35 -0700 | [diff] [blame] | 1170 | impl Errno { |
| 1171 | pub const ELAST: Errno = Errno::EQFULL; |
| 1172 | pub const EWOULDBLOCK: Errno = Errno::EAGAIN; |
| 1173 | pub const EDEADLOCK: Errno = Errno::EDEADLK; |
| 1174 | } |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 1175 | |
| 1176 | pub fn from_i32(e: i32) -> Errno { |
| 1177 | use self::Errno::*; |
| 1178 | |
| 1179 | match e { |
| 1180 | libc::EPERM => EPERM, |
| 1181 | libc::ENOENT => ENOENT, |
| 1182 | libc::ESRCH => ESRCH, |
| 1183 | libc::EINTR => EINTR, |
| 1184 | libc::EIO => EIO, |
| 1185 | libc::ENXIO => ENXIO, |
| 1186 | libc::E2BIG => E2BIG, |
| 1187 | libc::ENOEXEC => ENOEXEC, |
| 1188 | libc::EBADF => EBADF, |
| 1189 | libc::ECHILD => ECHILD, |
| 1190 | libc::EDEADLK => EDEADLK, |
| 1191 | libc::ENOMEM => ENOMEM, |
| 1192 | libc::EACCES => EACCES, |
| 1193 | libc::EFAULT => EFAULT, |
| 1194 | libc::ENOTBLK => ENOTBLK, |
| 1195 | libc::EBUSY => EBUSY, |
| 1196 | libc::EEXIST => EEXIST, |
| 1197 | libc::EXDEV => EXDEV, |
| 1198 | libc::ENODEV => ENODEV, |
| 1199 | libc::ENOTDIR => ENOTDIR, |
| 1200 | libc::EISDIR => EISDIR, |
| 1201 | libc::EINVAL => EINVAL, |
| 1202 | libc::ENFILE => ENFILE, |
| 1203 | libc::EMFILE => EMFILE, |
| 1204 | libc::ENOTTY => ENOTTY, |
| 1205 | libc::ETXTBSY => ETXTBSY, |
| 1206 | libc::EFBIG => EFBIG, |
| 1207 | libc::ENOSPC => ENOSPC, |
| 1208 | libc::ESPIPE => ESPIPE, |
| 1209 | libc::EROFS => EROFS, |
| 1210 | libc::EMLINK => EMLINK, |
| 1211 | libc::EPIPE => EPIPE, |
| 1212 | libc::EDOM => EDOM, |
| 1213 | libc::ERANGE => ERANGE, |
| 1214 | libc::EAGAIN => EAGAIN, |
| 1215 | libc::EINPROGRESS => EINPROGRESS, |
| 1216 | libc::EALREADY => EALREADY, |
| 1217 | libc::ENOTSOCK => ENOTSOCK, |
| 1218 | libc::EDESTADDRREQ => EDESTADDRREQ, |
| 1219 | libc::EMSGSIZE => EMSGSIZE, |
| 1220 | libc::EPROTOTYPE => EPROTOTYPE, |
| 1221 | libc::ENOPROTOOPT => ENOPROTOOPT, |
| 1222 | libc::EPROTONOSUPPORT => EPROTONOSUPPORT, |
| 1223 | libc::ESOCKTNOSUPPORT => ESOCKTNOSUPPORT, |
| 1224 | libc::ENOTSUP => ENOTSUP, |
| 1225 | libc::EPFNOSUPPORT => EPFNOSUPPORT, |
| 1226 | libc::EAFNOSUPPORT => EAFNOSUPPORT, |
| 1227 | libc::EADDRINUSE => EADDRINUSE, |
| 1228 | libc::EADDRNOTAVAIL => EADDRNOTAVAIL, |
| 1229 | libc::ENETDOWN => ENETDOWN, |
| 1230 | libc::ENETUNREACH => ENETUNREACH, |
| 1231 | libc::ENETRESET => ENETRESET, |
| 1232 | libc::ECONNABORTED => ECONNABORTED, |
| 1233 | libc::ECONNRESET => ECONNRESET, |
| 1234 | libc::ENOBUFS => ENOBUFS, |
| 1235 | libc::EISCONN => EISCONN, |
| 1236 | libc::ENOTCONN => ENOTCONN, |
| 1237 | libc::ESHUTDOWN => ESHUTDOWN, |
| 1238 | libc::ETOOMANYREFS => ETOOMANYREFS, |
| 1239 | libc::ETIMEDOUT => ETIMEDOUT, |
| 1240 | libc::ECONNREFUSED => ECONNREFUSED, |
| 1241 | libc::ELOOP => ELOOP, |
| 1242 | libc::ENAMETOOLONG => ENAMETOOLONG, |
| 1243 | libc::EHOSTDOWN => EHOSTDOWN, |
| 1244 | libc::EHOSTUNREACH => EHOSTUNREACH, |
| 1245 | libc::ENOTEMPTY => ENOTEMPTY, |
| 1246 | libc::EPROCLIM => EPROCLIM, |
| 1247 | libc::EUSERS => EUSERS, |
| 1248 | libc::EDQUOT => EDQUOT, |
| 1249 | libc::ESTALE => ESTALE, |
| 1250 | libc::EREMOTE => EREMOTE, |
| 1251 | libc::EBADRPC => EBADRPC, |
| 1252 | libc::ERPCMISMATCH => ERPCMISMATCH, |
| 1253 | libc::EPROGUNAVAIL => EPROGUNAVAIL, |
| 1254 | libc::EPROGMISMATCH => EPROGMISMATCH, |
| 1255 | libc::EPROCUNAVAIL => EPROCUNAVAIL, |
| 1256 | libc::ENOLCK => ENOLCK, |
| 1257 | libc::ENOSYS => ENOSYS, |
| 1258 | libc::EFTYPE => EFTYPE, |
| 1259 | libc::EAUTH => EAUTH, |
| 1260 | libc::ENEEDAUTH => ENEEDAUTH, |
| 1261 | libc::EPWROFF => EPWROFF, |
| 1262 | libc::EDEVERR => EDEVERR, |
| 1263 | libc::EOVERFLOW => EOVERFLOW, |
| 1264 | libc::EBADEXEC => EBADEXEC, |
| 1265 | libc::EBADARCH => EBADARCH, |
| 1266 | libc::ESHLIBVERS => ESHLIBVERS, |
| 1267 | libc::EBADMACHO => EBADMACHO, |
| 1268 | libc::ECANCELED => ECANCELED, |
| 1269 | libc::EIDRM => EIDRM, |
| 1270 | libc::ENOMSG => ENOMSG, |
| 1271 | libc::EILSEQ => EILSEQ, |
| 1272 | libc::ENOATTR => ENOATTR, |
| 1273 | libc::EBADMSG => EBADMSG, |
| 1274 | libc::EMULTIHOP => EMULTIHOP, |
| 1275 | libc::ENODATA => ENODATA, |
| 1276 | libc::ENOLINK => ENOLINK, |
| 1277 | libc::ENOSR => ENOSR, |
| 1278 | libc::ENOSTR => ENOSTR, |
| 1279 | libc::EPROTO => EPROTO, |
| 1280 | libc::ETIME => ETIME, |
| 1281 | libc::EOPNOTSUPP => EOPNOTSUPP, |
| 1282 | libc::ENOPOLICY => ENOPOLICY, |
| 1283 | libc::ENOTRECOVERABLE => ENOTRECOVERABLE, |
| 1284 | libc::EOWNERDEAD => EOWNERDEAD, |
| 1285 | libc::EQFULL => EQFULL, |
| 1286 | _ => UnknownErrno, |
| 1287 | } |
| 1288 | } |
| 1289 | } |
| 1290 | |
| 1291 | #[cfg(target_os = "freebsd")] |
| 1292 | mod consts { |
| 1293 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
| 1294 | #[repr(i32)] |
| 1295 | pub enum Errno { |
| 1296 | UnknownErrno = 0, |
| 1297 | EPERM = libc::EPERM, |
| 1298 | ENOENT = libc::ENOENT, |
| 1299 | ESRCH = libc::ESRCH, |
| 1300 | EINTR = libc::EINTR, |
| 1301 | EIO = libc::EIO, |
| 1302 | ENXIO = libc::ENXIO, |
| 1303 | E2BIG = libc::E2BIG, |
| 1304 | ENOEXEC = libc::ENOEXEC, |
| 1305 | EBADF = libc::EBADF, |
| 1306 | ECHILD = libc::ECHILD, |
| 1307 | EDEADLK = libc::EDEADLK, |
| 1308 | ENOMEM = libc::ENOMEM, |
| 1309 | EACCES = libc::EACCES, |
| 1310 | EFAULT = libc::EFAULT, |
| 1311 | ENOTBLK = libc::ENOTBLK, |
| 1312 | EBUSY = libc::EBUSY, |
| 1313 | EEXIST = libc::EEXIST, |
| 1314 | EXDEV = libc::EXDEV, |
| 1315 | ENODEV = libc::ENODEV, |
| 1316 | ENOTDIR = libc::ENOTDIR, |
| 1317 | EISDIR = libc::EISDIR, |
| 1318 | EINVAL = libc::EINVAL, |
| 1319 | ENFILE = libc::ENFILE, |
| 1320 | EMFILE = libc::EMFILE, |
| 1321 | ENOTTY = libc::ENOTTY, |
| 1322 | ETXTBSY = libc::ETXTBSY, |
| 1323 | EFBIG = libc::EFBIG, |
| 1324 | ENOSPC = libc::ENOSPC, |
| 1325 | ESPIPE = libc::ESPIPE, |
| 1326 | EROFS = libc::EROFS, |
| 1327 | EMLINK = libc::EMLINK, |
| 1328 | EPIPE = libc::EPIPE, |
| 1329 | EDOM = libc::EDOM, |
| 1330 | ERANGE = libc::ERANGE, |
| 1331 | EAGAIN = libc::EAGAIN, |
| 1332 | EINPROGRESS = libc::EINPROGRESS, |
| 1333 | EALREADY = libc::EALREADY, |
| 1334 | ENOTSOCK = libc::ENOTSOCK, |
| 1335 | EDESTADDRREQ = libc::EDESTADDRREQ, |
| 1336 | EMSGSIZE = libc::EMSGSIZE, |
| 1337 | EPROTOTYPE = libc::EPROTOTYPE, |
| 1338 | ENOPROTOOPT = libc::ENOPROTOOPT, |
| 1339 | EPROTONOSUPPORT = libc::EPROTONOSUPPORT, |
| 1340 | ESOCKTNOSUPPORT = libc::ESOCKTNOSUPPORT, |
| 1341 | ENOTSUP = libc::ENOTSUP, |
| 1342 | EPFNOSUPPORT = libc::EPFNOSUPPORT, |
| 1343 | EAFNOSUPPORT = libc::EAFNOSUPPORT, |
| 1344 | EADDRINUSE = libc::EADDRINUSE, |
| 1345 | EADDRNOTAVAIL = libc::EADDRNOTAVAIL, |
| 1346 | ENETDOWN = libc::ENETDOWN, |
| 1347 | ENETUNREACH = libc::ENETUNREACH, |
| 1348 | ENETRESET = libc::ENETRESET, |
| 1349 | ECONNABORTED = libc::ECONNABORTED, |
| 1350 | ECONNRESET = libc::ECONNRESET, |
| 1351 | ENOBUFS = libc::ENOBUFS, |
| 1352 | EISCONN = libc::EISCONN, |
| 1353 | ENOTCONN = libc::ENOTCONN, |
| 1354 | ESHUTDOWN = libc::ESHUTDOWN, |
| 1355 | ETOOMANYREFS = libc::ETOOMANYREFS, |
| 1356 | ETIMEDOUT = libc::ETIMEDOUT, |
| 1357 | ECONNREFUSED = libc::ECONNREFUSED, |
| 1358 | ELOOP = libc::ELOOP, |
| 1359 | ENAMETOOLONG = libc::ENAMETOOLONG, |
| 1360 | EHOSTDOWN = libc::EHOSTDOWN, |
| 1361 | EHOSTUNREACH = libc::EHOSTUNREACH, |
| 1362 | ENOTEMPTY = libc::ENOTEMPTY, |
| 1363 | EPROCLIM = libc::EPROCLIM, |
| 1364 | EUSERS = libc::EUSERS, |
| 1365 | EDQUOT = libc::EDQUOT, |
| 1366 | ESTALE = libc::ESTALE, |
| 1367 | EREMOTE = libc::EREMOTE, |
| 1368 | EBADRPC = libc::EBADRPC, |
| 1369 | ERPCMISMATCH = libc::ERPCMISMATCH, |
| 1370 | EPROGUNAVAIL = libc::EPROGUNAVAIL, |
| 1371 | EPROGMISMATCH = libc::EPROGMISMATCH, |
| 1372 | EPROCUNAVAIL = libc::EPROCUNAVAIL, |
| 1373 | ENOLCK = libc::ENOLCK, |
| 1374 | ENOSYS = libc::ENOSYS, |
| 1375 | EFTYPE = libc::EFTYPE, |
| 1376 | EAUTH = libc::EAUTH, |
| 1377 | ENEEDAUTH = libc::ENEEDAUTH, |
| 1378 | EIDRM = libc::EIDRM, |
| 1379 | ENOMSG = libc::ENOMSG, |
| 1380 | EOVERFLOW = libc::EOVERFLOW, |
| 1381 | ECANCELED = libc::ECANCELED, |
| 1382 | EILSEQ = libc::EILSEQ, |
| 1383 | ENOATTR = libc::ENOATTR, |
| 1384 | EDOOFUS = libc::EDOOFUS, |
| 1385 | EBADMSG = libc::EBADMSG, |
| 1386 | EMULTIHOP = libc::EMULTIHOP, |
| 1387 | ENOLINK = libc::ENOLINK, |
| 1388 | EPROTO = libc::EPROTO, |
| 1389 | ENOTCAPABLE = libc::ENOTCAPABLE, |
| 1390 | ECAPMODE = libc::ECAPMODE, |
| 1391 | ENOTRECOVERABLE = libc::ENOTRECOVERABLE, |
| 1392 | EOWNERDEAD = libc::EOWNERDEAD, |
| 1393 | } |
| 1394 | |
Joel Galenson | 981b40a | 2021-08-09 10:34:35 -0700 | [diff] [blame] | 1395 | impl Errno { |
| 1396 | pub const ELAST: Errno = Errno::EOWNERDEAD; |
| 1397 | pub const EWOULDBLOCK: Errno = Errno::EAGAIN; |
| 1398 | pub const EDEADLOCK: Errno = Errno::EDEADLK; |
| 1399 | pub const EOPNOTSUPP: Errno = Errno::ENOTSUP; |
| 1400 | } |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 1401 | |
| 1402 | pub fn from_i32(e: i32) -> Errno { |
| 1403 | use self::Errno::*; |
| 1404 | |
| 1405 | match e { |
| 1406 | libc::EPERM => EPERM, |
| 1407 | libc::ENOENT => ENOENT, |
| 1408 | libc::ESRCH => ESRCH, |
| 1409 | libc::EINTR => EINTR, |
| 1410 | libc::EIO => EIO, |
| 1411 | libc::ENXIO => ENXIO, |
| 1412 | libc::E2BIG => E2BIG, |
| 1413 | libc::ENOEXEC => ENOEXEC, |
| 1414 | libc::EBADF => EBADF, |
| 1415 | libc::ECHILD => ECHILD, |
| 1416 | libc::EDEADLK => EDEADLK, |
| 1417 | libc::ENOMEM => ENOMEM, |
| 1418 | libc::EACCES => EACCES, |
| 1419 | libc::EFAULT => EFAULT, |
| 1420 | libc::ENOTBLK => ENOTBLK, |
| 1421 | libc::EBUSY => EBUSY, |
| 1422 | libc::EEXIST => EEXIST, |
| 1423 | libc::EXDEV => EXDEV, |
| 1424 | libc::ENODEV => ENODEV, |
| 1425 | libc::ENOTDIR => ENOTDIR, |
| 1426 | libc::EISDIR => EISDIR, |
| 1427 | libc::EINVAL => EINVAL, |
| 1428 | libc::ENFILE => ENFILE, |
| 1429 | libc::EMFILE => EMFILE, |
| 1430 | libc::ENOTTY => ENOTTY, |
| 1431 | libc::ETXTBSY => ETXTBSY, |
| 1432 | libc::EFBIG => EFBIG, |
| 1433 | libc::ENOSPC => ENOSPC, |
| 1434 | libc::ESPIPE => ESPIPE, |
| 1435 | libc::EROFS => EROFS, |
| 1436 | libc::EMLINK => EMLINK, |
| 1437 | libc::EPIPE => EPIPE, |
| 1438 | libc::EDOM => EDOM, |
| 1439 | libc::ERANGE => ERANGE, |
| 1440 | libc::EAGAIN => EAGAIN, |
| 1441 | libc::EINPROGRESS => EINPROGRESS, |
| 1442 | libc::EALREADY => EALREADY, |
| 1443 | libc::ENOTSOCK => ENOTSOCK, |
| 1444 | libc::EDESTADDRREQ => EDESTADDRREQ, |
| 1445 | libc::EMSGSIZE => EMSGSIZE, |
| 1446 | libc::EPROTOTYPE => EPROTOTYPE, |
| 1447 | libc::ENOPROTOOPT => ENOPROTOOPT, |
| 1448 | libc::EPROTONOSUPPORT => EPROTONOSUPPORT, |
| 1449 | libc::ESOCKTNOSUPPORT => ESOCKTNOSUPPORT, |
| 1450 | libc::ENOTSUP => ENOTSUP, |
| 1451 | libc::EPFNOSUPPORT => EPFNOSUPPORT, |
| 1452 | libc::EAFNOSUPPORT => EAFNOSUPPORT, |
| 1453 | libc::EADDRINUSE => EADDRINUSE, |
| 1454 | libc::EADDRNOTAVAIL => EADDRNOTAVAIL, |
| 1455 | libc::ENETDOWN => ENETDOWN, |
| 1456 | libc::ENETUNREACH => ENETUNREACH, |
| 1457 | libc::ENETRESET => ENETRESET, |
| 1458 | libc::ECONNABORTED => ECONNABORTED, |
| 1459 | libc::ECONNRESET => ECONNRESET, |
| 1460 | libc::ENOBUFS => ENOBUFS, |
| 1461 | libc::EISCONN => EISCONN, |
| 1462 | libc::ENOTCONN => ENOTCONN, |
| 1463 | libc::ESHUTDOWN => ESHUTDOWN, |
| 1464 | libc::ETOOMANYREFS => ETOOMANYREFS, |
| 1465 | libc::ETIMEDOUT => ETIMEDOUT, |
| 1466 | libc::ECONNREFUSED => ECONNREFUSED, |
| 1467 | libc::ELOOP => ELOOP, |
| 1468 | libc::ENAMETOOLONG => ENAMETOOLONG, |
| 1469 | libc::EHOSTDOWN => EHOSTDOWN, |
| 1470 | libc::EHOSTUNREACH => EHOSTUNREACH, |
| 1471 | libc::ENOTEMPTY => ENOTEMPTY, |
| 1472 | libc::EPROCLIM => EPROCLIM, |
| 1473 | libc::EUSERS => EUSERS, |
| 1474 | libc::EDQUOT => EDQUOT, |
| 1475 | libc::ESTALE => ESTALE, |
| 1476 | libc::EREMOTE => EREMOTE, |
| 1477 | libc::EBADRPC => EBADRPC, |
| 1478 | libc::ERPCMISMATCH => ERPCMISMATCH, |
| 1479 | libc::EPROGUNAVAIL => EPROGUNAVAIL, |
| 1480 | libc::EPROGMISMATCH => EPROGMISMATCH, |
| 1481 | libc::EPROCUNAVAIL => EPROCUNAVAIL, |
| 1482 | libc::ENOLCK => ENOLCK, |
| 1483 | libc::ENOSYS => ENOSYS, |
| 1484 | libc::EFTYPE => EFTYPE, |
| 1485 | libc::EAUTH => EAUTH, |
| 1486 | libc::ENEEDAUTH => ENEEDAUTH, |
| 1487 | libc::EIDRM => EIDRM, |
| 1488 | libc::ENOMSG => ENOMSG, |
| 1489 | libc::EOVERFLOW => EOVERFLOW, |
| 1490 | libc::ECANCELED => ECANCELED, |
| 1491 | libc::EILSEQ => EILSEQ, |
| 1492 | libc::ENOATTR => ENOATTR, |
| 1493 | libc::EDOOFUS => EDOOFUS, |
| 1494 | libc::EBADMSG => EBADMSG, |
| 1495 | libc::EMULTIHOP => EMULTIHOP, |
| 1496 | libc::ENOLINK => ENOLINK, |
| 1497 | libc::EPROTO => EPROTO, |
| 1498 | libc::ENOTCAPABLE => ENOTCAPABLE, |
| 1499 | libc::ECAPMODE => ECAPMODE, |
| 1500 | libc::ENOTRECOVERABLE => ENOTRECOVERABLE, |
| 1501 | libc::EOWNERDEAD => EOWNERDEAD, |
| 1502 | _ => UnknownErrno, |
| 1503 | } |
| 1504 | } |
| 1505 | } |
| 1506 | |
| 1507 | |
| 1508 | #[cfg(target_os = "dragonfly")] |
| 1509 | mod consts { |
| 1510 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
| 1511 | #[repr(i32)] |
| 1512 | pub enum Errno { |
| 1513 | UnknownErrno = 0, |
| 1514 | EPERM = libc::EPERM, |
| 1515 | ENOENT = libc::ENOENT, |
| 1516 | ESRCH = libc::ESRCH, |
| 1517 | EINTR = libc::EINTR, |
| 1518 | EIO = libc::EIO, |
| 1519 | ENXIO = libc::ENXIO, |
| 1520 | E2BIG = libc::E2BIG, |
| 1521 | ENOEXEC = libc::ENOEXEC, |
| 1522 | EBADF = libc::EBADF, |
| 1523 | ECHILD = libc::ECHILD, |
| 1524 | EDEADLK = libc::EDEADLK, |
| 1525 | ENOMEM = libc::ENOMEM, |
| 1526 | EACCES = libc::EACCES, |
| 1527 | EFAULT = libc::EFAULT, |
| 1528 | ENOTBLK = libc::ENOTBLK, |
| 1529 | EBUSY = libc::EBUSY, |
| 1530 | EEXIST = libc::EEXIST, |
| 1531 | EXDEV = libc::EXDEV, |
| 1532 | ENODEV = libc::ENODEV, |
| 1533 | ENOTDIR = libc::ENOTDIR, |
| 1534 | EISDIR = libc::EISDIR, |
| 1535 | EINVAL = libc::EINVAL, |
| 1536 | ENFILE = libc::ENFILE, |
| 1537 | EMFILE = libc::EMFILE, |
| 1538 | ENOTTY = libc::ENOTTY, |
| 1539 | ETXTBSY = libc::ETXTBSY, |
| 1540 | EFBIG = libc::EFBIG, |
| 1541 | ENOSPC = libc::ENOSPC, |
| 1542 | ESPIPE = libc::ESPIPE, |
| 1543 | EROFS = libc::EROFS, |
| 1544 | EMLINK = libc::EMLINK, |
| 1545 | EPIPE = libc::EPIPE, |
| 1546 | EDOM = libc::EDOM, |
| 1547 | ERANGE = libc::ERANGE, |
| 1548 | EAGAIN = libc::EAGAIN, |
| 1549 | EINPROGRESS = libc::EINPROGRESS, |
| 1550 | EALREADY = libc::EALREADY, |
| 1551 | ENOTSOCK = libc::ENOTSOCK, |
| 1552 | EDESTADDRREQ = libc::EDESTADDRREQ, |
| 1553 | EMSGSIZE = libc::EMSGSIZE, |
| 1554 | EPROTOTYPE = libc::EPROTOTYPE, |
| 1555 | ENOPROTOOPT = libc::ENOPROTOOPT, |
| 1556 | EPROTONOSUPPORT = libc::EPROTONOSUPPORT, |
| 1557 | ESOCKTNOSUPPORT = libc::ESOCKTNOSUPPORT, |
| 1558 | ENOTSUP = libc::ENOTSUP, |
| 1559 | EPFNOSUPPORT = libc::EPFNOSUPPORT, |
| 1560 | EAFNOSUPPORT = libc::EAFNOSUPPORT, |
| 1561 | EADDRINUSE = libc::EADDRINUSE, |
| 1562 | EADDRNOTAVAIL = libc::EADDRNOTAVAIL, |
| 1563 | ENETDOWN = libc::ENETDOWN, |
| 1564 | ENETUNREACH = libc::ENETUNREACH, |
| 1565 | ENETRESET = libc::ENETRESET, |
| 1566 | ECONNABORTED = libc::ECONNABORTED, |
| 1567 | ECONNRESET = libc::ECONNRESET, |
| 1568 | ENOBUFS = libc::ENOBUFS, |
| 1569 | EISCONN = libc::EISCONN, |
| 1570 | ENOTCONN = libc::ENOTCONN, |
| 1571 | ESHUTDOWN = libc::ESHUTDOWN, |
| 1572 | ETOOMANYREFS = libc::ETOOMANYREFS, |
| 1573 | ETIMEDOUT = libc::ETIMEDOUT, |
| 1574 | ECONNREFUSED = libc::ECONNREFUSED, |
| 1575 | ELOOP = libc::ELOOP, |
| 1576 | ENAMETOOLONG = libc::ENAMETOOLONG, |
| 1577 | EHOSTDOWN = libc::EHOSTDOWN, |
| 1578 | EHOSTUNREACH = libc::EHOSTUNREACH, |
| 1579 | ENOTEMPTY = libc::ENOTEMPTY, |
| 1580 | EPROCLIM = libc::EPROCLIM, |
| 1581 | EUSERS = libc::EUSERS, |
| 1582 | EDQUOT = libc::EDQUOT, |
| 1583 | ESTALE = libc::ESTALE, |
| 1584 | EREMOTE = libc::EREMOTE, |
| 1585 | EBADRPC = libc::EBADRPC, |
| 1586 | ERPCMISMATCH = libc::ERPCMISMATCH, |
| 1587 | EPROGUNAVAIL = libc::EPROGUNAVAIL, |
| 1588 | EPROGMISMATCH = libc::EPROGMISMATCH, |
| 1589 | EPROCUNAVAIL = libc::EPROCUNAVAIL, |
| 1590 | ENOLCK = libc::ENOLCK, |
| 1591 | ENOSYS = libc::ENOSYS, |
| 1592 | EFTYPE = libc::EFTYPE, |
| 1593 | EAUTH = libc::EAUTH, |
| 1594 | ENEEDAUTH = libc::ENEEDAUTH, |
| 1595 | EIDRM = libc::EIDRM, |
| 1596 | ENOMSG = libc::ENOMSG, |
| 1597 | EOVERFLOW = libc::EOVERFLOW, |
| 1598 | ECANCELED = libc::ECANCELED, |
| 1599 | EILSEQ = libc::EILSEQ, |
| 1600 | ENOATTR = libc::ENOATTR, |
| 1601 | EDOOFUS = libc::EDOOFUS, |
| 1602 | EBADMSG = libc::EBADMSG, |
| 1603 | EMULTIHOP = libc::EMULTIHOP, |
| 1604 | ENOLINK = libc::ENOLINK, |
| 1605 | EPROTO = libc::EPROTO, |
| 1606 | ENOMEDIUM = libc::ENOMEDIUM, |
| 1607 | EASYNC = libc::EASYNC, |
| 1608 | } |
| 1609 | |
Joel Galenson | 981b40a | 2021-08-09 10:34:35 -0700 | [diff] [blame] | 1610 | impl Errno { |
| 1611 | pub const ELAST: Errno = Errno::EASYNC; |
| 1612 | pub const EWOULDBLOCK: Errno = Errno::EAGAIN; |
| 1613 | pub const EDEADLOCK: Errno = Errno::EDEADLK; |
| 1614 | pub const EOPNOTSUPP: Errno = Errno::ENOTSUP; |
| 1615 | } |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 1616 | |
| 1617 | pub fn from_i32(e: i32) -> Errno { |
| 1618 | use self::Errno::*; |
| 1619 | |
| 1620 | match e { |
| 1621 | libc::EPERM => EPERM, |
| 1622 | libc::ENOENT => ENOENT, |
| 1623 | libc::ESRCH => ESRCH, |
| 1624 | libc::EINTR => EINTR, |
| 1625 | libc::EIO => EIO, |
| 1626 | libc::ENXIO => ENXIO, |
| 1627 | libc::E2BIG => E2BIG, |
| 1628 | libc::ENOEXEC => ENOEXEC, |
| 1629 | libc::EBADF => EBADF, |
| 1630 | libc::ECHILD => ECHILD, |
| 1631 | libc::EDEADLK => EDEADLK, |
| 1632 | libc::ENOMEM => ENOMEM, |
| 1633 | libc::EACCES => EACCES, |
| 1634 | libc::EFAULT => EFAULT, |
| 1635 | libc::ENOTBLK => ENOTBLK, |
| 1636 | libc::EBUSY => EBUSY, |
| 1637 | libc::EEXIST => EEXIST, |
| 1638 | libc::EXDEV => EXDEV, |
| 1639 | libc::ENODEV => ENODEV, |
| 1640 | libc::ENOTDIR => ENOTDIR, |
| 1641 | libc::EISDIR=> EISDIR, |
| 1642 | libc::EINVAL => EINVAL, |
| 1643 | libc::ENFILE => ENFILE, |
| 1644 | libc::EMFILE => EMFILE, |
| 1645 | libc::ENOTTY => ENOTTY, |
| 1646 | libc::ETXTBSY => ETXTBSY, |
| 1647 | libc::EFBIG => EFBIG, |
| 1648 | libc::ENOSPC => ENOSPC, |
| 1649 | libc::ESPIPE => ESPIPE, |
| 1650 | libc::EROFS => EROFS, |
| 1651 | libc::EMLINK => EMLINK, |
| 1652 | libc::EPIPE => EPIPE, |
| 1653 | libc::EDOM => EDOM, |
| 1654 | libc::ERANGE => ERANGE, |
| 1655 | libc::EAGAIN => EAGAIN, |
| 1656 | libc::EINPROGRESS => EINPROGRESS, |
| 1657 | libc::EALREADY => EALREADY, |
| 1658 | libc::ENOTSOCK => ENOTSOCK, |
| 1659 | libc::EDESTADDRREQ => EDESTADDRREQ, |
| 1660 | libc::EMSGSIZE => EMSGSIZE, |
| 1661 | libc::EPROTOTYPE => EPROTOTYPE, |
| 1662 | libc::ENOPROTOOPT => ENOPROTOOPT, |
| 1663 | libc::EPROTONOSUPPORT => EPROTONOSUPPORT, |
| 1664 | libc::ESOCKTNOSUPPORT => ESOCKTNOSUPPORT, |
| 1665 | libc::ENOTSUP => ENOTSUP, |
| 1666 | libc::EPFNOSUPPORT => EPFNOSUPPORT, |
| 1667 | libc::EAFNOSUPPORT => EAFNOSUPPORT, |
| 1668 | libc::EADDRINUSE => EADDRINUSE, |
| 1669 | libc::EADDRNOTAVAIL => EADDRNOTAVAIL, |
| 1670 | libc::ENETDOWN => ENETDOWN, |
| 1671 | libc::ENETUNREACH => ENETUNREACH, |
| 1672 | libc::ENETRESET => ENETRESET, |
| 1673 | libc::ECONNABORTED => ECONNABORTED, |
| 1674 | libc::ECONNRESET => ECONNRESET, |
| 1675 | libc::ENOBUFS => ENOBUFS, |
| 1676 | libc::EISCONN => EISCONN, |
| 1677 | libc::ENOTCONN => ENOTCONN, |
| 1678 | libc::ESHUTDOWN => ESHUTDOWN, |
| 1679 | libc::ETOOMANYREFS => ETOOMANYREFS, |
| 1680 | libc::ETIMEDOUT => ETIMEDOUT, |
| 1681 | libc::ECONNREFUSED => ECONNREFUSED, |
| 1682 | libc::ELOOP => ELOOP, |
| 1683 | libc::ENAMETOOLONG => ENAMETOOLONG, |
| 1684 | libc::EHOSTDOWN => EHOSTDOWN, |
| 1685 | libc::EHOSTUNREACH => EHOSTUNREACH, |
| 1686 | libc::ENOTEMPTY => ENOTEMPTY, |
| 1687 | libc::EPROCLIM => EPROCLIM, |
| 1688 | libc::EUSERS => EUSERS, |
| 1689 | libc::EDQUOT => EDQUOT, |
| 1690 | libc::ESTALE => ESTALE, |
| 1691 | libc::EREMOTE => EREMOTE, |
| 1692 | libc::EBADRPC => EBADRPC, |
| 1693 | libc::ERPCMISMATCH => ERPCMISMATCH, |
| 1694 | libc::EPROGUNAVAIL => EPROGUNAVAIL, |
| 1695 | libc::EPROGMISMATCH => EPROGMISMATCH, |
| 1696 | libc::EPROCUNAVAIL => EPROCUNAVAIL, |
| 1697 | libc::ENOLCK => ENOLCK, |
| 1698 | libc::ENOSYS => ENOSYS, |
| 1699 | libc::EFTYPE => EFTYPE, |
| 1700 | libc::EAUTH => EAUTH, |
| 1701 | libc::ENEEDAUTH => ENEEDAUTH, |
| 1702 | libc::EIDRM => EIDRM, |
| 1703 | libc::ENOMSG => ENOMSG, |
| 1704 | libc::EOVERFLOW => EOVERFLOW, |
| 1705 | libc::ECANCELED => ECANCELED, |
| 1706 | libc::EILSEQ => EILSEQ, |
| 1707 | libc::ENOATTR => ENOATTR, |
| 1708 | libc::EDOOFUS => EDOOFUS, |
| 1709 | libc::EBADMSG => EBADMSG, |
| 1710 | libc::EMULTIHOP => EMULTIHOP, |
| 1711 | libc::ENOLINK => ENOLINK, |
| 1712 | libc::EPROTO => EPROTO, |
| 1713 | libc::ENOMEDIUM => ENOMEDIUM, |
| 1714 | libc::EASYNC => EASYNC, |
| 1715 | _ => UnknownErrno, |
| 1716 | } |
| 1717 | } |
| 1718 | } |
| 1719 | |
| 1720 | |
| 1721 | #[cfg(target_os = "openbsd")] |
| 1722 | mod consts { |
| 1723 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
| 1724 | #[repr(i32)] |
| 1725 | pub enum Errno { |
| 1726 | UnknownErrno = 0, |
| 1727 | EPERM = libc::EPERM, |
| 1728 | ENOENT = libc::ENOENT, |
| 1729 | ESRCH = libc::ESRCH, |
| 1730 | EINTR = libc::EINTR, |
| 1731 | EIO = libc::EIO, |
| 1732 | ENXIO = libc::ENXIO, |
| 1733 | E2BIG = libc::E2BIG, |
| 1734 | ENOEXEC = libc::ENOEXEC, |
| 1735 | EBADF = libc::EBADF, |
| 1736 | ECHILD = libc::ECHILD, |
| 1737 | EDEADLK = libc::EDEADLK, |
| 1738 | ENOMEM = libc::ENOMEM, |
| 1739 | EACCES = libc::EACCES, |
| 1740 | EFAULT = libc::EFAULT, |
| 1741 | ENOTBLK = libc::ENOTBLK, |
| 1742 | EBUSY = libc::EBUSY, |
| 1743 | EEXIST = libc::EEXIST, |
| 1744 | EXDEV = libc::EXDEV, |
| 1745 | ENODEV = libc::ENODEV, |
| 1746 | ENOTDIR = libc::ENOTDIR, |
| 1747 | EISDIR = libc::EISDIR, |
| 1748 | EINVAL = libc::EINVAL, |
| 1749 | ENFILE = libc::ENFILE, |
| 1750 | EMFILE = libc::EMFILE, |
| 1751 | ENOTTY = libc::ENOTTY, |
| 1752 | ETXTBSY = libc::ETXTBSY, |
| 1753 | EFBIG = libc::EFBIG, |
| 1754 | ENOSPC = libc::ENOSPC, |
| 1755 | ESPIPE = libc::ESPIPE, |
| 1756 | EROFS = libc::EROFS, |
| 1757 | EMLINK = libc::EMLINK, |
| 1758 | EPIPE = libc::EPIPE, |
| 1759 | EDOM = libc::EDOM, |
| 1760 | ERANGE = libc::ERANGE, |
| 1761 | EAGAIN = libc::EAGAIN, |
| 1762 | EINPROGRESS = libc::EINPROGRESS, |
| 1763 | EALREADY = libc::EALREADY, |
| 1764 | ENOTSOCK = libc::ENOTSOCK, |
| 1765 | EDESTADDRREQ = libc::EDESTADDRREQ, |
| 1766 | EMSGSIZE = libc::EMSGSIZE, |
| 1767 | EPROTOTYPE = libc::EPROTOTYPE, |
| 1768 | ENOPROTOOPT = libc::ENOPROTOOPT, |
| 1769 | EPROTONOSUPPORT = libc::EPROTONOSUPPORT, |
| 1770 | ESOCKTNOSUPPORT = libc::ESOCKTNOSUPPORT, |
| 1771 | EOPNOTSUPP = libc::EOPNOTSUPP, |
| 1772 | EPFNOSUPPORT = libc::EPFNOSUPPORT, |
| 1773 | EAFNOSUPPORT = libc::EAFNOSUPPORT, |
| 1774 | EADDRINUSE = libc::EADDRINUSE, |
| 1775 | EADDRNOTAVAIL = libc::EADDRNOTAVAIL, |
| 1776 | ENETDOWN = libc::ENETDOWN, |
| 1777 | ENETUNREACH = libc::ENETUNREACH, |
| 1778 | ENETRESET = libc::ENETRESET, |
| 1779 | ECONNABORTED = libc::ECONNABORTED, |
| 1780 | ECONNRESET = libc::ECONNRESET, |
| 1781 | ENOBUFS = libc::ENOBUFS, |
| 1782 | EISCONN = libc::EISCONN, |
| 1783 | ENOTCONN = libc::ENOTCONN, |
| 1784 | ESHUTDOWN = libc::ESHUTDOWN, |
| 1785 | ETOOMANYREFS = libc::ETOOMANYREFS, |
| 1786 | ETIMEDOUT = libc::ETIMEDOUT, |
| 1787 | ECONNREFUSED = libc::ECONNREFUSED, |
| 1788 | ELOOP = libc::ELOOP, |
| 1789 | ENAMETOOLONG = libc::ENAMETOOLONG, |
| 1790 | EHOSTDOWN = libc::EHOSTDOWN, |
| 1791 | EHOSTUNREACH = libc::EHOSTUNREACH, |
| 1792 | ENOTEMPTY = libc::ENOTEMPTY, |
| 1793 | EPROCLIM = libc::EPROCLIM, |
| 1794 | EUSERS = libc::EUSERS, |
| 1795 | EDQUOT = libc::EDQUOT, |
| 1796 | ESTALE = libc::ESTALE, |
| 1797 | EREMOTE = libc::EREMOTE, |
| 1798 | EBADRPC = libc::EBADRPC, |
| 1799 | ERPCMISMATCH = libc::ERPCMISMATCH, |
| 1800 | EPROGUNAVAIL = libc::EPROGUNAVAIL, |
| 1801 | EPROGMISMATCH = libc::EPROGMISMATCH, |
| 1802 | EPROCUNAVAIL = libc::EPROCUNAVAIL, |
| 1803 | ENOLCK = libc::ENOLCK, |
| 1804 | ENOSYS = libc::ENOSYS, |
| 1805 | EFTYPE = libc::EFTYPE, |
| 1806 | EAUTH = libc::EAUTH, |
| 1807 | ENEEDAUTH = libc::ENEEDAUTH, |
| 1808 | EIPSEC = libc::EIPSEC, |
| 1809 | ENOATTR = libc::ENOATTR, |
| 1810 | EILSEQ = libc::EILSEQ, |
| 1811 | ENOMEDIUM = libc::ENOMEDIUM, |
| 1812 | EMEDIUMTYPE = libc::EMEDIUMTYPE, |
| 1813 | EOVERFLOW = libc::EOVERFLOW, |
| 1814 | ECANCELED = libc::ECANCELED, |
| 1815 | EIDRM = libc::EIDRM, |
| 1816 | ENOMSG = libc::ENOMSG, |
| 1817 | ENOTSUP = libc::ENOTSUP, |
| 1818 | EBADMSG = libc::EBADMSG, |
| 1819 | ENOTRECOVERABLE = libc::ENOTRECOVERABLE, |
| 1820 | EOWNERDEAD = libc::EOWNERDEAD, |
| 1821 | EPROTO = libc::EPROTO, |
| 1822 | } |
| 1823 | |
Joel Galenson | 981b40a | 2021-08-09 10:34:35 -0700 | [diff] [blame] | 1824 | impl Errno { |
| 1825 | pub const ELAST: Errno = Errno::ENOTSUP; |
| 1826 | pub const EWOULDBLOCK: Errno = Errno::EAGAIN; |
| 1827 | } |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 1828 | |
| 1829 | pub fn from_i32(e: i32) -> Errno { |
| 1830 | use self::Errno::*; |
| 1831 | |
| 1832 | match e { |
| 1833 | libc::EPERM => EPERM, |
| 1834 | libc::ENOENT => ENOENT, |
| 1835 | libc::ESRCH => ESRCH, |
| 1836 | libc::EINTR => EINTR, |
| 1837 | libc::EIO => EIO, |
| 1838 | libc::ENXIO => ENXIO, |
| 1839 | libc::E2BIG => E2BIG, |
| 1840 | libc::ENOEXEC => ENOEXEC, |
| 1841 | libc::EBADF => EBADF, |
| 1842 | libc::ECHILD => ECHILD, |
| 1843 | libc::EDEADLK => EDEADLK, |
| 1844 | libc::ENOMEM => ENOMEM, |
| 1845 | libc::EACCES => EACCES, |
| 1846 | libc::EFAULT => EFAULT, |
| 1847 | libc::ENOTBLK => ENOTBLK, |
| 1848 | libc::EBUSY => EBUSY, |
| 1849 | libc::EEXIST => EEXIST, |
| 1850 | libc::EXDEV => EXDEV, |
| 1851 | libc::ENODEV => ENODEV, |
| 1852 | libc::ENOTDIR => ENOTDIR, |
| 1853 | libc::EISDIR => EISDIR, |
| 1854 | libc::EINVAL => EINVAL, |
| 1855 | libc::ENFILE => ENFILE, |
| 1856 | libc::EMFILE => EMFILE, |
| 1857 | libc::ENOTTY => ENOTTY, |
| 1858 | libc::ETXTBSY => ETXTBSY, |
| 1859 | libc::EFBIG => EFBIG, |
| 1860 | libc::ENOSPC => ENOSPC, |
| 1861 | libc::ESPIPE => ESPIPE, |
| 1862 | libc::EROFS => EROFS, |
| 1863 | libc::EMLINK => EMLINK, |
| 1864 | libc::EPIPE => EPIPE, |
| 1865 | libc::EDOM => EDOM, |
| 1866 | libc::ERANGE => ERANGE, |
| 1867 | libc::EAGAIN => EAGAIN, |
| 1868 | libc::EINPROGRESS => EINPROGRESS, |
| 1869 | libc::EALREADY => EALREADY, |
| 1870 | libc::ENOTSOCK => ENOTSOCK, |
| 1871 | libc::EDESTADDRREQ => EDESTADDRREQ, |
| 1872 | libc::EMSGSIZE => EMSGSIZE, |
| 1873 | libc::EPROTOTYPE => EPROTOTYPE, |
| 1874 | libc::ENOPROTOOPT => ENOPROTOOPT, |
| 1875 | libc::EPROTONOSUPPORT => EPROTONOSUPPORT, |
| 1876 | libc::ESOCKTNOSUPPORT => ESOCKTNOSUPPORT, |
| 1877 | libc::EOPNOTSUPP => EOPNOTSUPP, |
| 1878 | libc::EPFNOSUPPORT => EPFNOSUPPORT, |
| 1879 | libc::EAFNOSUPPORT => EAFNOSUPPORT, |
| 1880 | libc::EADDRINUSE => EADDRINUSE, |
| 1881 | libc::EADDRNOTAVAIL => EADDRNOTAVAIL, |
| 1882 | libc::ENETDOWN => ENETDOWN, |
| 1883 | libc::ENETUNREACH => ENETUNREACH, |
| 1884 | libc::ENETRESET => ENETRESET, |
| 1885 | libc::ECONNABORTED => ECONNABORTED, |
| 1886 | libc::ECONNRESET => ECONNRESET, |
| 1887 | libc::ENOBUFS => ENOBUFS, |
| 1888 | libc::EISCONN => EISCONN, |
| 1889 | libc::ENOTCONN => ENOTCONN, |
| 1890 | libc::ESHUTDOWN => ESHUTDOWN, |
| 1891 | libc::ETOOMANYREFS => ETOOMANYREFS, |
| 1892 | libc::ETIMEDOUT => ETIMEDOUT, |
| 1893 | libc::ECONNREFUSED => ECONNREFUSED, |
| 1894 | libc::ELOOP => ELOOP, |
| 1895 | libc::ENAMETOOLONG => ENAMETOOLONG, |
| 1896 | libc::EHOSTDOWN => EHOSTDOWN, |
| 1897 | libc::EHOSTUNREACH => EHOSTUNREACH, |
| 1898 | libc::ENOTEMPTY => ENOTEMPTY, |
| 1899 | libc::EPROCLIM => EPROCLIM, |
| 1900 | libc::EUSERS => EUSERS, |
| 1901 | libc::EDQUOT => EDQUOT, |
| 1902 | libc::ESTALE => ESTALE, |
| 1903 | libc::EREMOTE => EREMOTE, |
| 1904 | libc::EBADRPC => EBADRPC, |
| 1905 | libc::ERPCMISMATCH => ERPCMISMATCH, |
| 1906 | libc::EPROGUNAVAIL => EPROGUNAVAIL, |
| 1907 | libc::EPROGMISMATCH => EPROGMISMATCH, |
| 1908 | libc::EPROCUNAVAIL => EPROCUNAVAIL, |
| 1909 | libc::ENOLCK => ENOLCK, |
| 1910 | libc::ENOSYS => ENOSYS, |
| 1911 | libc::EFTYPE => EFTYPE, |
| 1912 | libc::EAUTH => EAUTH, |
| 1913 | libc::ENEEDAUTH => ENEEDAUTH, |
| 1914 | libc::EIPSEC => EIPSEC, |
| 1915 | libc::ENOATTR => ENOATTR, |
| 1916 | libc::EILSEQ => EILSEQ, |
| 1917 | libc::ENOMEDIUM => ENOMEDIUM, |
| 1918 | libc::EMEDIUMTYPE => EMEDIUMTYPE, |
| 1919 | libc::EOVERFLOW => EOVERFLOW, |
| 1920 | libc::ECANCELED => ECANCELED, |
| 1921 | libc::EIDRM => EIDRM, |
| 1922 | libc::ENOMSG => ENOMSG, |
| 1923 | libc::ENOTSUP => ENOTSUP, |
| 1924 | libc::EBADMSG => EBADMSG, |
| 1925 | libc::ENOTRECOVERABLE => ENOTRECOVERABLE, |
| 1926 | libc::EOWNERDEAD => EOWNERDEAD, |
| 1927 | libc::EPROTO => EPROTO, |
| 1928 | _ => UnknownErrno, |
| 1929 | } |
| 1930 | } |
| 1931 | } |
| 1932 | |
| 1933 | #[cfg(target_os = "netbsd")] |
| 1934 | mod consts { |
| 1935 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
| 1936 | #[repr(i32)] |
| 1937 | pub enum Errno { |
| 1938 | UnknownErrno = 0, |
| 1939 | EPERM = libc::EPERM, |
| 1940 | ENOENT = libc::ENOENT, |
| 1941 | ESRCH = libc::ESRCH, |
| 1942 | EINTR = libc::EINTR, |
| 1943 | EIO = libc::EIO, |
| 1944 | ENXIO = libc::ENXIO, |
| 1945 | E2BIG = libc::E2BIG, |
| 1946 | ENOEXEC = libc::ENOEXEC, |
| 1947 | EBADF = libc::EBADF, |
| 1948 | ECHILD = libc::ECHILD, |
| 1949 | EDEADLK = libc::EDEADLK, |
| 1950 | ENOMEM = libc::ENOMEM, |
| 1951 | EACCES = libc::EACCES, |
| 1952 | EFAULT = libc::EFAULT, |
| 1953 | ENOTBLK = libc::ENOTBLK, |
| 1954 | EBUSY = libc::EBUSY, |
| 1955 | EEXIST = libc::EEXIST, |
| 1956 | EXDEV = libc::EXDEV, |
| 1957 | ENODEV = libc::ENODEV, |
| 1958 | ENOTDIR = libc::ENOTDIR, |
| 1959 | EISDIR = libc::EISDIR, |
| 1960 | EINVAL = libc::EINVAL, |
| 1961 | ENFILE = libc::ENFILE, |
| 1962 | EMFILE = libc::EMFILE, |
| 1963 | ENOTTY = libc::ENOTTY, |
| 1964 | ETXTBSY = libc::ETXTBSY, |
| 1965 | EFBIG = libc::EFBIG, |
| 1966 | ENOSPC = libc::ENOSPC, |
| 1967 | ESPIPE = libc::ESPIPE, |
| 1968 | EROFS = libc::EROFS, |
| 1969 | EMLINK = libc::EMLINK, |
| 1970 | EPIPE = libc::EPIPE, |
| 1971 | EDOM = libc::EDOM, |
| 1972 | ERANGE = libc::ERANGE, |
| 1973 | EAGAIN = libc::EAGAIN, |
| 1974 | EINPROGRESS = libc::EINPROGRESS, |
| 1975 | EALREADY = libc::EALREADY, |
| 1976 | ENOTSOCK = libc::ENOTSOCK, |
| 1977 | EDESTADDRREQ = libc::EDESTADDRREQ, |
| 1978 | EMSGSIZE = libc::EMSGSIZE, |
| 1979 | EPROTOTYPE = libc::EPROTOTYPE, |
| 1980 | ENOPROTOOPT = libc::ENOPROTOOPT, |
| 1981 | EPROTONOSUPPORT = libc::EPROTONOSUPPORT, |
| 1982 | ESOCKTNOSUPPORT = libc::ESOCKTNOSUPPORT, |
| 1983 | EOPNOTSUPP = libc::EOPNOTSUPP, |
| 1984 | EPFNOSUPPORT = libc::EPFNOSUPPORT, |
| 1985 | EAFNOSUPPORT = libc::EAFNOSUPPORT, |
| 1986 | EADDRINUSE = libc::EADDRINUSE, |
| 1987 | EADDRNOTAVAIL = libc::EADDRNOTAVAIL, |
| 1988 | ENETDOWN = libc::ENETDOWN, |
| 1989 | ENETUNREACH = libc::ENETUNREACH, |
| 1990 | ENETRESET = libc::ENETRESET, |
| 1991 | ECONNABORTED = libc::ECONNABORTED, |
| 1992 | ECONNRESET = libc::ECONNRESET, |
| 1993 | ENOBUFS = libc::ENOBUFS, |
| 1994 | EISCONN = libc::EISCONN, |
| 1995 | ENOTCONN = libc::ENOTCONN, |
| 1996 | ESHUTDOWN = libc::ESHUTDOWN, |
| 1997 | ETOOMANYREFS = libc::ETOOMANYREFS, |
| 1998 | ETIMEDOUT = libc::ETIMEDOUT, |
| 1999 | ECONNREFUSED = libc::ECONNREFUSED, |
| 2000 | ELOOP = libc::ELOOP, |
| 2001 | ENAMETOOLONG = libc::ENAMETOOLONG, |
| 2002 | EHOSTDOWN = libc::EHOSTDOWN, |
| 2003 | EHOSTUNREACH = libc::EHOSTUNREACH, |
| 2004 | ENOTEMPTY = libc::ENOTEMPTY, |
| 2005 | EPROCLIM = libc::EPROCLIM, |
| 2006 | EUSERS = libc::EUSERS, |
| 2007 | EDQUOT = libc::EDQUOT, |
| 2008 | ESTALE = libc::ESTALE, |
| 2009 | EREMOTE = libc::EREMOTE, |
| 2010 | EBADRPC = libc::EBADRPC, |
| 2011 | ERPCMISMATCH = libc::ERPCMISMATCH, |
| 2012 | EPROGUNAVAIL = libc::EPROGUNAVAIL, |
| 2013 | EPROGMISMATCH = libc::EPROGMISMATCH, |
| 2014 | EPROCUNAVAIL = libc::EPROCUNAVAIL, |
| 2015 | ENOLCK = libc::ENOLCK, |
| 2016 | ENOSYS = libc::ENOSYS, |
| 2017 | EFTYPE = libc::EFTYPE, |
| 2018 | EAUTH = libc::EAUTH, |
| 2019 | ENEEDAUTH = libc::ENEEDAUTH, |
| 2020 | EIDRM = libc::EIDRM, |
| 2021 | ENOMSG = libc::ENOMSG, |
| 2022 | EOVERFLOW = libc::EOVERFLOW, |
| 2023 | EILSEQ = libc::EILSEQ, |
| 2024 | ENOTSUP = libc::ENOTSUP, |
| 2025 | ECANCELED = libc::ECANCELED, |
| 2026 | EBADMSG = libc::EBADMSG, |
| 2027 | ENODATA = libc::ENODATA, |
| 2028 | ENOSR = libc::ENOSR, |
| 2029 | ENOSTR = libc::ENOSTR, |
| 2030 | ETIME = libc::ETIME, |
| 2031 | ENOATTR = libc::ENOATTR, |
| 2032 | EMULTIHOP = libc::EMULTIHOP, |
| 2033 | ENOLINK = libc::ENOLINK, |
| 2034 | EPROTO = libc::EPROTO, |
| 2035 | } |
| 2036 | |
Joel Galenson | 981b40a | 2021-08-09 10:34:35 -0700 | [diff] [blame] | 2037 | impl Errno { |
| 2038 | pub const ELAST: Errno = Errno::ENOTSUP; |
| 2039 | pub const EWOULDBLOCK: Errno = Errno::EAGAIN; |
| 2040 | } |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 2041 | |
| 2042 | pub fn from_i32(e: i32) -> Errno { |
| 2043 | use self::Errno::*; |
| 2044 | |
| 2045 | match e { |
| 2046 | libc::EPERM => EPERM, |
| 2047 | libc::ENOENT => ENOENT, |
| 2048 | libc::ESRCH => ESRCH, |
| 2049 | libc::EINTR => EINTR, |
| 2050 | libc::EIO => EIO, |
| 2051 | libc::ENXIO => ENXIO, |
| 2052 | libc::E2BIG => E2BIG, |
| 2053 | libc::ENOEXEC => ENOEXEC, |
| 2054 | libc::EBADF => EBADF, |
| 2055 | libc::ECHILD => ECHILD, |
| 2056 | libc::EDEADLK => EDEADLK, |
| 2057 | libc::ENOMEM => ENOMEM, |
| 2058 | libc::EACCES => EACCES, |
| 2059 | libc::EFAULT => EFAULT, |
| 2060 | libc::ENOTBLK => ENOTBLK, |
| 2061 | libc::EBUSY => EBUSY, |
| 2062 | libc::EEXIST => EEXIST, |
| 2063 | libc::EXDEV => EXDEV, |
| 2064 | libc::ENODEV => ENODEV, |
| 2065 | libc::ENOTDIR => ENOTDIR, |
| 2066 | libc::EISDIR => EISDIR, |
| 2067 | libc::EINVAL => EINVAL, |
| 2068 | libc::ENFILE => ENFILE, |
| 2069 | libc::EMFILE => EMFILE, |
| 2070 | libc::ENOTTY => ENOTTY, |
| 2071 | libc::ETXTBSY => ETXTBSY, |
| 2072 | libc::EFBIG => EFBIG, |
| 2073 | libc::ENOSPC => ENOSPC, |
| 2074 | libc::ESPIPE => ESPIPE, |
| 2075 | libc::EROFS => EROFS, |
| 2076 | libc::EMLINK => EMLINK, |
| 2077 | libc::EPIPE => EPIPE, |
| 2078 | libc::EDOM => EDOM, |
| 2079 | libc::ERANGE => ERANGE, |
| 2080 | libc::EAGAIN => EAGAIN, |
| 2081 | libc::EINPROGRESS => EINPROGRESS, |
| 2082 | libc::EALREADY => EALREADY, |
| 2083 | libc::ENOTSOCK => ENOTSOCK, |
| 2084 | libc::EDESTADDRREQ => EDESTADDRREQ, |
| 2085 | libc::EMSGSIZE => EMSGSIZE, |
| 2086 | libc::EPROTOTYPE => EPROTOTYPE, |
| 2087 | libc::ENOPROTOOPT => ENOPROTOOPT, |
| 2088 | libc::EPROTONOSUPPORT => EPROTONOSUPPORT, |
| 2089 | libc::ESOCKTNOSUPPORT => ESOCKTNOSUPPORT, |
| 2090 | libc::EOPNOTSUPP => EOPNOTSUPP, |
| 2091 | libc::EPFNOSUPPORT => EPFNOSUPPORT, |
| 2092 | libc::EAFNOSUPPORT => EAFNOSUPPORT, |
| 2093 | libc::EADDRINUSE => EADDRINUSE, |
| 2094 | libc::EADDRNOTAVAIL => EADDRNOTAVAIL, |
| 2095 | libc::ENETDOWN => ENETDOWN, |
| 2096 | libc::ENETUNREACH => ENETUNREACH, |
| 2097 | libc::ENETRESET => ENETRESET, |
| 2098 | libc::ECONNABORTED => ECONNABORTED, |
| 2099 | libc::ECONNRESET => ECONNRESET, |
| 2100 | libc::ENOBUFS => ENOBUFS, |
| 2101 | libc::EISCONN => EISCONN, |
| 2102 | libc::ENOTCONN => ENOTCONN, |
| 2103 | libc::ESHUTDOWN => ESHUTDOWN, |
| 2104 | libc::ETOOMANYREFS => ETOOMANYREFS, |
| 2105 | libc::ETIMEDOUT => ETIMEDOUT, |
| 2106 | libc::ECONNREFUSED => ECONNREFUSED, |
| 2107 | libc::ELOOP => ELOOP, |
| 2108 | libc::ENAMETOOLONG => ENAMETOOLONG, |
| 2109 | libc::EHOSTDOWN => EHOSTDOWN, |
| 2110 | libc::EHOSTUNREACH => EHOSTUNREACH, |
| 2111 | libc::ENOTEMPTY => ENOTEMPTY, |
| 2112 | libc::EPROCLIM => EPROCLIM, |
| 2113 | libc::EUSERS => EUSERS, |
| 2114 | libc::EDQUOT => EDQUOT, |
| 2115 | libc::ESTALE => ESTALE, |
| 2116 | libc::EREMOTE => EREMOTE, |
| 2117 | libc::EBADRPC => EBADRPC, |
| 2118 | libc::ERPCMISMATCH => ERPCMISMATCH, |
| 2119 | libc::EPROGUNAVAIL => EPROGUNAVAIL, |
| 2120 | libc::EPROGMISMATCH => EPROGMISMATCH, |
| 2121 | libc::EPROCUNAVAIL => EPROCUNAVAIL, |
| 2122 | libc::ENOLCK => ENOLCK, |
| 2123 | libc::ENOSYS => ENOSYS, |
| 2124 | libc::EFTYPE => EFTYPE, |
| 2125 | libc::EAUTH => EAUTH, |
| 2126 | libc::ENEEDAUTH => ENEEDAUTH, |
| 2127 | libc::EIDRM => EIDRM, |
| 2128 | libc::ENOMSG => ENOMSG, |
| 2129 | libc::EOVERFLOW => EOVERFLOW, |
| 2130 | libc::EILSEQ => EILSEQ, |
| 2131 | libc::ENOTSUP => ENOTSUP, |
| 2132 | libc::ECANCELED => ECANCELED, |
| 2133 | libc::EBADMSG => EBADMSG, |
| 2134 | libc::ENODATA => ENODATA, |
| 2135 | libc::ENOSR => ENOSR, |
| 2136 | libc::ENOSTR => ENOSTR, |
| 2137 | libc::ETIME => ETIME, |
| 2138 | libc::ENOATTR => ENOATTR, |
| 2139 | libc::EMULTIHOP => EMULTIHOP, |
| 2140 | libc::ENOLINK => ENOLINK, |
| 2141 | libc::EPROTO => EPROTO, |
| 2142 | _ => UnknownErrno, |
| 2143 | } |
| 2144 | } |
| 2145 | } |
| 2146 | |
| 2147 | #[cfg(target_os = "redox")] |
| 2148 | mod consts { |
| 2149 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
| 2150 | #[repr(i32)] |
| 2151 | pub enum Errno { |
| 2152 | UnknownErrno = 0, |
| 2153 | EPERM = libc::EPERM, |
| 2154 | ENOENT = libc::ENOENT, |
| 2155 | ESRCH = libc::ESRCH, |
| 2156 | EINTR = libc::EINTR, |
| 2157 | EIO = libc::EIO, |
| 2158 | ENXIO = libc::ENXIO, |
| 2159 | E2BIG = libc::E2BIG, |
| 2160 | ENOEXEC = libc::ENOEXEC, |
| 2161 | EBADF = libc::EBADF, |
| 2162 | ECHILD = libc::ECHILD, |
| 2163 | EDEADLK = libc::EDEADLK, |
| 2164 | ENOMEM = libc::ENOMEM, |
| 2165 | EACCES = libc::EACCES, |
| 2166 | EFAULT = libc::EFAULT, |
| 2167 | ENOTBLK = libc::ENOTBLK, |
| 2168 | EBUSY = libc::EBUSY, |
| 2169 | EEXIST = libc::EEXIST, |
| 2170 | EXDEV = libc::EXDEV, |
| 2171 | ENODEV = libc::ENODEV, |
| 2172 | ENOTDIR = libc::ENOTDIR, |
| 2173 | EISDIR = libc::EISDIR, |
| 2174 | EINVAL = libc::EINVAL, |
| 2175 | ENFILE = libc::ENFILE, |
| 2176 | EMFILE = libc::EMFILE, |
| 2177 | ENOTTY = libc::ENOTTY, |
| 2178 | ETXTBSY = libc::ETXTBSY, |
| 2179 | EFBIG = libc::EFBIG, |
| 2180 | ENOSPC = libc::ENOSPC, |
| 2181 | ESPIPE = libc::ESPIPE, |
| 2182 | EROFS = libc::EROFS, |
| 2183 | EMLINK = libc::EMLINK, |
| 2184 | EPIPE = libc::EPIPE, |
| 2185 | EDOM = libc::EDOM, |
| 2186 | ERANGE = libc::ERANGE, |
| 2187 | EAGAIN = libc::EAGAIN, |
| 2188 | EINPROGRESS = libc::EINPROGRESS, |
| 2189 | EALREADY = libc::EALREADY, |
| 2190 | ENOTSOCK = libc::ENOTSOCK, |
| 2191 | EDESTADDRREQ = libc::EDESTADDRREQ, |
| 2192 | EMSGSIZE = libc::EMSGSIZE, |
| 2193 | EPROTOTYPE = libc::EPROTOTYPE, |
| 2194 | ENOPROTOOPT = libc::ENOPROTOOPT, |
| 2195 | EPROTONOSUPPORT = libc::EPROTONOSUPPORT, |
| 2196 | ESOCKTNOSUPPORT = libc::ESOCKTNOSUPPORT, |
| 2197 | EOPNOTSUPP = libc::EOPNOTSUPP, |
| 2198 | EPFNOSUPPORT = libc::EPFNOSUPPORT, |
| 2199 | EAFNOSUPPORT = libc::EAFNOSUPPORT, |
| 2200 | EADDRINUSE = libc::EADDRINUSE, |
| 2201 | EADDRNOTAVAIL = libc::EADDRNOTAVAIL, |
| 2202 | ENETDOWN = libc::ENETDOWN, |
| 2203 | ENETUNREACH = libc::ENETUNREACH, |
| 2204 | ENETRESET = libc::ENETRESET, |
| 2205 | ECONNABORTED = libc::ECONNABORTED, |
| 2206 | ECONNRESET = libc::ECONNRESET, |
| 2207 | ENOBUFS = libc::ENOBUFS, |
| 2208 | EISCONN = libc::EISCONN, |
| 2209 | ENOTCONN = libc::ENOTCONN, |
| 2210 | ESHUTDOWN = libc::ESHUTDOWN, |
| 2211 | ETOOMANYREFS = libc::ETOOMANYREFS, |
| 2212 | ETIMEDOUT = libc::ETIMEDOUT, |
| 2213 | ECONNREFUSED = libc::ECONNREFUSED, |
| 2214 | ELOOP = libc::ELOOP, |
| 2215 | ENAMETOOLONG = libc::ENAMETOOLONG, |
| 2216 | EHOSTDOWN = libc::EHOSTDOWN, |
| 2217 | EHOSTUNREACH = libc::EHOSTUNREACH, |
| 2218 | ENOTEMPTY = libc::ENOTEMPTY, |
| 2219 | EUSERS = libc::EUSERS, |
| 2220 | EDQUOT = libc::EDQUOT, |
| 2221 | ESTALE = libc::ESTALE, |
| 2222 | EREMOTE = libc::EREMOTE, |
| 2223 | ENOLCK = libc::ENOLCK, |
| 2224 | ENOSYS = libc::ENOSYS, |
| 2225 | EIDRM = libc::EIDRM, |
| 2226 | ENOMSG = libc::ENOMSG, |
| 2227 | EOVERFLOW = libc::EOVERFLOW, |
| 2228 | EILSEQ = libc::EILSEQ, |
| 2229 | ECANCELED = libc::ECANCELED, |
| 2230 | EBADMSG = libc::EBADMSG, |
| 2231 | ENODATA = libc::ENODATA, |
| 2232 | ENOSR = libc::ENOSR, |
| 2233 | ENOSTR = libc::ENOSTR, |
| 2234 | ETIME = libc::ETIME, |
| 2235 | EMULTIHOP = libc::EMULTIHOP, |
| 2236 | ENOLINK = libc::ENOLINK, |
| 2237 | EPROTO = libc::EPROTO, |
| 2238 | } |
| 2239 | |
Joel Galenson | 981b40a | 2021-08-09 10:34:35 -0700 | [diff] [blame] | 2240 | impl Errno { |
| 2241 | pub const EWOULDBLOCK: Errno = Errno::EAGAIN; |
| 2242 | } |
Andrew Walbran | 12f6140 | 2020-10-14 11:10:53 +0100 | [diff] [blame] | 2243 | |
| 2244 | pub fn from_i32(e: i32) -> Errno { |
| 2245 | use self::Errno::*; |
| 2246 | |
| 2247 | match e { |
| 2248 | libc::EPERM => EPERM, |
| 2249 | libc::ENOENT => ENOENT, |
| 2250 | libc::ESRCH => ESRCH, |
| 2251 | libc::EINTR => EINTR, |
| 2252 | libc::EIO => EIO, |
| 2253 | libc::ENXIO => ENXIO, |
| 2254 | libc::E2BIG => E2BIG, |
| 2255 | libc::ENOEXEC => ENOEXEC, |
| 2256 | libc::EBADF => EBADF, |
| 2257 | libc::ECHILD => ECHILD, |
| 2258 | libc::EDEADLK => EDEADLK, |
| 2259 | libc::ENOMEM => ENOMEM, |
| 2260 | libc::EACCES => EACCES, |
| 2261 | libc::EFAULT => EFAULT, |
| 2262 | libc::ENOTBLK => ENOTBLK, |
| 2263 | libc::EBUSY => EBUSY, |
| 2264 | libc::EEXIST => EEXIST, |
| 2265 | libc::EXDEV => EXDEV, |
| 2266 | libc::ENODEV => ENODEV, |
| 2267 | libc::ENOTDIR => ENOTDIR, |
| 2268 | libc::EISDIR => EISDIR, |
| 2269 | libc::EINVAL => EINVAL, |
| 2270 | libc::ENFILE => ENFILE, |
| 2271 | libc::EMFILE => EMFILE, |
| 2272 | libc::ENOTTY => ENOTTY, |
| 2273 | libc::ETXTBSY => ETXTBSY, |
| 2274 | libc::EFBIG => EFBIG, |
| 2275 | libc::ENOSPC => ENOSPC, |
| 2276 | libc::ESPIPE => ESPIPE, |
| 2277 | libc::EROFS => EROFS, |
| 2278 | libc::EMLINK => EMLINK, |
| 2279 | libc::EPIPE => EPIPE, |
| 2280 | libc::EDOM => EDOM, |
| 2281 | libc::ERANGE => ERANGE, |
| 2282 | libc::EAGAIN => EAGAIN, |
| 2283 | libc::EINPROGRESS => EINPROGRESS, |
| 2284 | libc::EALREADY => EALREADY, |
| 2285 | libc::ENOTSOCK => ENOTSOCK, |
| 2286 | libc::EDESTADDRREQ => EDESTADDRREQ, |
| 2287 | libc::EMSGSIZE => EMSGSIZE, |
| 2288 | libc::EPROTOTYPE => EPROTOTYPE, |
| 2289 | libc::ENOPROTOOPT => ENOPROTOOPT, |
| 2290 | libc::EPROTONOSUPPORT => EPROTONOSUPPORT, |
| 2291 | libc::ESOCKTNOSUPPORT => ESOCKTNOSUPPORT, |
| 2292 | libc::EOPNOTSUPP => EOPNOTSUPP, |
| 2293 | libc::EPFNOSUPPORT => EPFNOSUPPORT, |
| 2294 | libc::EAFNOSUPPORT => EAFNOSUPPORT, |
| 2295 | libc::EADDRINUSE => EADDRINUSE, |
| 2296 | libc::EADDRNOTAVAIL => EADDRNOTAVAIL, |
| 2297 | libc::ENETDOWN => ENETDOWN, |
| 2298 | libc::ENETUNREACH => ENETUNREACH, |
| 2299 | libc::ENETRESET => ENETRESET, |
| 2300 | libc::ECONNABORTED => ECONNABORTED, |
| 2301 | libc::ECONNRESET => ECONNRESET, |
| 2302 | libc::ENOBUFS => ENOBUFS, |
| 2303 | libc::EISCONN => EISCONN, |
| 2304 | libc::ENOTCONN => ENOTCONN, |
| 2305 | libc::ESHUTDOWN => ESHUTDOWN, |
| 2306 | libc::ETOOMANYREFS => ETOOMANYREFS, |
| 2307 | libc::ETIMEDOUT => ETIMEDOUT, |
| 2308 | libc::ECONNREFUSED => ECONNREFUSED, |
| 2309 | libc::ELOOP => ELOOP, |
| 2310 | libc::ENAMETOOLONG => ENAMETOOLONG, |
| 2311 | libc::EHOSTDOWN => EHOSTDOWN, |
| 2312 | libc::EHOSTUNREACH => EHOSTUNREACH, |
| 2313 | libc::ENOTEMPTY => ENOTEMPTY, |
| 2314 | libc::EUSERS => EUSERS, |
| 2315 | libc::EDQUOT => EDQUOT, |
| 2316 | libc::ESTALE => ESTALE, |
| 2317 | libc::EREMOTE => EREMOTE, |
| 2318 | libc::ENOLCK => ENOLCK, |
| 2319 | libc::ENOSYS => ENOSYS, |
| 2320 | libc::EIDRM => EIDRM, |
| 2321 | libc::ENOMSG => ENOMSG, |
| 2322 | libc::EOVERFLOW => EOVERFLOW, |
| 2323 | libc::EILSEQ => EILSEQ, |
| 2324 | libc::ECANCELED => ECANCELED, |
| 2325 | libc::EBADMSG => EBADMSG, |
| 2326 | libc::ENODATA => ENODATA, |
| 2327 | libc::ENOSR => ENOSR, |
| 2328 | libc::ENOSTR => ENOSTR, |
| 2329 | libc::ETIME => ETIME, |
| 2330 | libc::EMULTIHOP => EMULTIHOP, |
| 2331 | libc::ENOLINK => ENOLINK, |
| 2332 | libc::EPROTO => EPROTO, |
| 2333 | _ => UnknownErrno, |
| 2334 | } |
| 2335 | } |
| 2336 | } |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 2337 | |
| 2338 | #[cfg(any(target_os = "illumos", target_os = "solaris"))] |
| 2339 | mod consts { |
| 2340 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
| 2341 | #[repr(i32)] |
| 2342 | pub enum Errno { |
| 2343 | UnknownErrno = 0, |
| 2344 | EPERM = libc::EPERM, |
| 2345 | ENOENT = libc::ENOENT, |
| 2346 | ESRCH = libc::ESRCH, |
| 2347 | EINTR = libc::EINTR, |
| 2348 | EIO = libc::EIO, |
| 2349 | ENXIO = libc::ENXIO, |
| 2350 | E2BIG = libc::E2BIG, |
| 2351 | ENOEXEC = libc::ENOEXEC, |
| 2352 | EBADF = libc::EBADF, |
| 2353 | ECHILD = libc::ECHILD, |
| 2354 | EAGAIN = libc::EAGAIN, |
| 2355 | ENOMEM = libc::ENOMEM, |
| 2356 | EACCES = libc::EACCES, |
| 2357 | EFAULT = libc::EFAULT, |
| 2358 | ENOTBLK = libc::ENOTBLK, |
| 2359 | EBUSY = libc::EBUSY, |
| 2360 | EEXIST = libc::EEXIST, |
| 2361 | EXDEV = libc::EXDEV, |
| 2362 | ENODEV = libc::ENODEV, |
| 2363 | ENOTDIR = libc::ENOTDIR, |
| 2364 | EISDIR = libc::EISDIR, |
| 2365 | EINVAL = libc::EINVAL, |
| 2366 | ENFILE = libc::ENFILE, |
| 2367 | EMFILE = libc::EMFILE, |
| 2368 | ENOTTY = libc::ENOTTY, |
| 2369 | ETXTBSY = libc::ETXTBSY, |
| 2370 | EFBIG = libc::EFBIG, |
| 2371 | ENOSPC = libc::ENOSPC, |
| 2372 | ESPIPE = libc::ESPIPE, |
| 2373 | EROFS = libc::EROFS, |
| 2374 | EMLINK = libc::EMLINK, |
| 2375 | EPIPE = libc::EPIPE, |
| 2376 | EDOM = libc::EDOM, |
| 2377 | ERANGE = libc::ERANGE, |
| 2378 | ENOMSG = libc::ENOMSG, |
| 2379 | EIDRM = libc::EIDRM, |
| 2380 | ECHRNG = libc::ECHRNG, |
| 2381 | EL2NSYNC = libc::EL2NSYNC, |
| 2382 | EL3HLT = libc::EL3HLT, |
| 2383 | EL3RST = libc::EL3RST, |
| 2384 | ELNRNG = libc::ELNRNG, |
| 2385 | EUNATCH = libc::EUNATCH, |
| 2386 | ENOCSI = libc::ENOCSI, |
| 2387 | EL2HLT = libc::EL2HLT, |
| 2388 | EDEADLK = libc::EDEADLK, |
| 2389 | ENOLCK = libc::ENOLCK, |
| 2390 | ECANCELED = libc::ECANCELED, |
| 2391 | ENOTSUP = libc::ENOTSUP, |
| 2392 | EDQUOT = libc::EDQUOT, |
| 2393 | EBADE = libc::EBADE, |
| 2394 | EBADR = libc::EBADR, |
| 2395 | EXFULL = libc::EXFULL, |
| 2396 | ENOANO = libc::ENOANO, |
| 2397 | EBADRQC = libc::EBADRQC, |
| 2398 | EBADSLT = libc::EBADSLT, |
| 2399 | EDEADLOCK = libc::EDEADLOCK, |
| 2400 | EBFONT = libc::EBFONT, |
| 2401 | EOWNERDEAD = libc::EOWNERDEAD, |
| 2402 | ENOTRECOVERABLE = libc::ENOTRECOVERABLE, |
| 2403 | ENOSTR = libc::ENOSTR, |
| 2404 | ENODATA = libc::ENODATA, |
| 2405 | ETIME = libc::ETIME, |
| 2406 | ENOSR = libc::ENOSR, |
| 2407 | ENONET = libc::ENONET, |
| 2408 | ENOPKG = libc::ENOPKG, |
| 2409 | EREMOTE = libc::EREMOTE, |
| 2410 | ENOLINK = libc::ENOLINK, |
| 2411 | EADV = libc::EADV, |
| 2412 | ESRMNT = libc::ESRMNT, |
| 2413 | ECOMM = libc::ECOMM, |
| 2414 | EPROTO = libc::EPROTO, |
| 2415 | ELOCKUNMAPPED = libc::ELOCKUNMAPPED, |
| 2416 | ENOTACTIVE = libc::ENOTACTIVE, |
| 2417 | EMULTIHOP = libc::EMULTIHOP, |
| 2418 | EBADMSG = libc::EBADMSG, |
| 2419 | ENAMETOOLONG = libc::ENAMETOOLONG, |
| 2420 | EOVERFLOW = libc::EOVERFLOW, |
| 2421 | ENOTUNIQ = libc::ENOTUNIQ, |
| 2422 | EBADFD = libc::EBADFD, |
| 2423 | EREMCHG = libc::EREMCHG, |
| 2424 | ELIBACC = libc::ELIBACC, |
| 2425 | ELIBBAD = libc::ELIBBAD, |
| 2426 | ELIBSCN = libc::ELIBSCN, |
| 2427 | ELIBMAX = libc::ELIBMAX, |
| 2428 | ELIBEXEC = libc::ELIBEXEC, |
| 2429 | EILSEQ = libc::EILSEQ, |
| 2430 | ENOSYS = libc::ENOSYS, |
| 2431 | ELOOP = libc::ELOOP, |
| 2432 | ERESTART = libc::ERESTART, |
| 2433 | ESTRPIPE = libc::ESTRPIPE, |
| 2434 | ENOTEMPTY = libc::ENOTEMPTY, |
| 2435 | EUSERS = libc::EUSERS, |
| 2436 | ENOTSOCK = libc::ENOTSOCK, |
| 2437 | EDESTADDRREQ = libc::EDESTADDRREQ, |
| 2438 | EMSGSIZE = libc::EMSGSIZE, |
| 2439 | EPROTOTYPE = libc::EPROTOTYPE, |
| 2440 | ENOPROTOOPT = libc::ENOPROTOOPT, |
| 2441 | EPROTONOSUPPORT = libc::EPROTONOSUPPORT, |
| 2442 | ESOCKTNOSUPPORT = libc::ESOCKTNOSUPPORT, |
| 2443 | EOPNOTSUPP = libc::EOPNOTSUPP, |
| 2444 | EPFNOSUPPORT = libc::EPFNOSUPPORT, |
| 2445 | EAFNOSUPPORT = libc::EAFNOSUPPORT, |
| 2446 | EADDRINUSE = libc::EADDRINUSE, |
| 2447 | EADDRNOTAVAIL = libc::EADDRNOTAVAIL, |
| 2448 | ENETDOWN = libc::ENETDOWN, |
| 2449 | ENETUNREACH = libc::ENETUNREACH, |
| 2450 | ENETRESET = libc::ENETRESET, |
| 2451 | ECONNABORTED = libc::ECONNABORTED, |
| 2452 | ECONNRESET = libc::ECONNRESET, |
| 2453 | ENOBUFS = libc::ENOBUFS, |
| 2454 | EISCONN = libc::EISCONN, |
| 2455 | ENOTCONN = libc::ENOTCONN, |
| 2456 | ESHUTDOWN = libc::ESHUTDOWN, |
| 2457 | ETOOMANYREFS = libc::ETOOMANYREFS, |
| 2458 | ETIMEDOUT = libc::ETIMEDOUT, |
| 2459 | ECONNREFUSED = libc::ECONNREFUSED, |
| 2460 | EHOSTDOWN = libc::EHOSTDOWN, |
| 2461 | EHOSTUNREACH = libc::EHOSTUNREACH, |
| 2462 | EALREADY = libc::EALREADY, |
| 2463 | EINPROGRESS = libc::EINPROGRESS, |
| 2464 | ESTALE = libc::ESTALE, |
| 2465 | } |
| 2466 | |
Joel Galenson | 981b40a | 2021-08-09 10:34:35 -0700 | [diff] [blame] | 2467 | impl Errno { |
| 2468 | pub const ELAST: Errno = Errno::ESTALE; |
| 2469 | pub const EWOULDBLOCK: Errno = Errno::EAGAIN; |
| 2470 | } |
Joel Galenson | e7950d9 | 2021-06-21 14:41:02 -0700 | [diff] [blame] | 2471 | |
| 2472 | pub fn from_i32(e: i32) -> Errno { |
| 2473 | use self::Errno::*; |
| 2474 | |
| 2475 | match e { |
| 2476 | libc::EPERM => EPERM, |
| 2477 | libc::ENOENT => ENOENT, |
| 2478 | libc::ESRCH => ESRCH, |
| 2479 | libc::EINTR => EINTR, |
| 2480 | libc::EIO => EIO, |
| 2481 | libc::ENXIO => ENXIO, |
| 2482 | libc::E2BIG => E2BIG, |
| 2483 | libc::ENOEXEC => ENOEXEC, |
| 2484 | libc::EBADF => EBADF, |
| 2485 | libc::ECHILD => ECHILD, |
| 2486 | libc::EAGAIN => EAGAIN, |
| 2487 | libc::ENOMEM => ENOMEM, |
| 2488 | libc::EACCES => EACCES, |
| 2489 | libc::EFAULT => EFAULT, |
| 2490 | libc::ENOTBLK => ENOTBLK, |
| 2491 | libc::EBUSY => EBUSY, |
| 2492 | libc::EEXIST => EEXIST, |
| 2493 | libc::EXDEV => EXDEV, |
| 2494 | libc::ENODEV => ENODEV, |
| 2495 | libc::ENOTDIR => ENOTDIR, |
| 2496 | libc::EISDIR => EISDIR, |
| 2497 | libc::EINVAL => EINVAL, |
| 2498 | libc::ENFILE => ENFILE, |
| 2499 | libc::EMFILE => EMFILE, |
| 2500 | libc::ENOTTY => ENOTTY, |
| 2501 | libc::ETXTBSY => ETXTBSY, |
| 2502 | libc::EFBIG => EFBIG, |
| 2503 | libc::ENOSPC => ENOSPC, |
| 2504 | libc::ESPIPE => ESPIPE, |
| 2505 | libc::EROFS => EROFS, |
| 2506 | libc::EMLINK => EMLINK, |
| 2507 | libc::EPIPE => EPIPE, |
| 2508 | libc::EDOM => EDOM, |
| 2509 | libc::ERANGE => ERANGE, |
| 2510 | libc::ENOMSG => ENOMSG, |
| 2511 | libc::EIDRM => EIDRM, |
| 2512 | libc::ECHRNG => ECHRNG, |
| 2513 | libc::EL2NSYNC => EL2NSYNC, |
| 2514 | libc::EL3HLT => EL3HLT, |
| 2515 | libc::EL3RST => EL3RST, |
| 2516 | libc::ELNRNG => ELNRNG, |
| 2517 | libc::EUNATCH => EUNATCH, |
| 2518 | libc::ENOCSI => ENOCSI, |
| 2519 | libc::EL2HLT => EL2HLT, |
| 2520 | libc::EDEADLK => EDEADLK, |
| 2521 | libc::ENOLCK => ENOLCK, |
| 2522 | libc::ECANCELED => ECANCELED, |
| 2523 | libc::ENOTSUP => ENOTSUP, |
| 2524 | libc::EDQUOT => EDQUOT, |
| 2525 | libc::EBADE => EBADE, |
| 2526 | libc::EBADR => EBADR, |
| 2527 | libc::EXFULL => EXFULL, |
| 2528 | libc::ENOANO => ENOANO, |
| 2529 | libc::EBADRQC => EBADRQC, |
| 2530 | libc::EBADSLT => EBADSLT, |
| 2531 | libc::EDEADLOCK => EDEADLOCK, |
| 2532 | libc::EBFONT => EBFONT, |
| 2533 | libc::EOWNERDEAD => EOWNERDEAD, |
| 2534 | libc::ENOTRECOVERABLE => ENOTRECOVERABLE, |
| 2535 | libc::ENOSTR => ENOSTR, |
| 2536 | libc::ENODATA => ENODATA, |
| 2537 | libc::ETIME => ETIME, |
| 2538 | libc::ENOSR => ENOSR, |
| 2539 | libc::ENONET => ENONET, |
| 2540 | libc::ENOPKG => ENOPKG, |
| 2541 | libc::EREMOTE => EREMOTE, |
| 2542 | libc::ENOLINK => ENOLINK, |
| 2543 | libc::EADV => EADV, |
| 2544 | libc::ESRMNT => ESRMNT, |
| 2545 | libc::ECOMM => ECOMM, |
| 2546 | libc::EPROTO => EPROTO, |
| 2547 | libc::ELOCKUNMAPPED => ELOCKUNMAPPED, |
| 2548 | libc::ENOTACTIVE => ENOTACTIVE, |
| 2549 | libc::EMULTIHOP => EMULTIHOP, |
| 2550 | libc::EBADMSG => EBADMSG, |
| 2551 | libc::ENAMETOOLONG => ENAMETOOLONG, |
| 2552 | libc::EOVERFLOW => EOVERFLOW, |
| 2553 | libc::ENOTUNIQ => ENOTUNIQ, |
| 2554 | libc::EBADFD => EBADFD, |
| 2555 | libc::EREMCHG => EREMCHG, |
| 2556 | libc::ELIBACC => ELIBACC, |
| 2557 | libc::ELIBBAD => ELIBBAD, |
| 2558 | libc::ELIBSCN => ELIBSCN, |
| 2559 | libc::ELIBMAX => ELIBMAX, |
| 2560 | libc::ELIBEXEC => ELIBEXEC, |
| 2561 | libc::EILSEQ => EILSEQ, |
| 2562 | libc::ENOSYS => ENOSYS, |
| 2563 | libc::ELOOP => ELOOP, |
| 2564 | libc::ERESTART => ERESTART, |
| 2565 | libc::ESTRPIPE => ESTRPIPE, |
| 2566 | libc::ENOTEMPTY => ENOTEMPTY, |
| 2567 | libc::EUSERS => EUSERS, |
| 2568 | libc::ENOTSOCK => ENOTSOCK, |
| 2569 | libc::EDESTADDRREQ => EDESTADDRREQ, |
| 2570 | libc::EMSGSIZE => EMSGSIZE, |
| 2571 | libc::EPROTOTYPE => EPROTOTYPE, |
| 2572 | libc::ENOPROTOOPT => ENOPROTOOPT, |
| 2573 | libc::EPROTONOSUPPORT => EPROTONOSUPPORT, |
| 2574 | libc::ESOCKTNOSUPPORT => ESOCKTNOSUPPORT, |
| 2575 | libc::EOPNOTSUPP => EOPNOTSUPP, |
| 2576 | libc::EPFNOSUPPORT => EPFNOSUPPORT, |
| 2577 | libc::EAFNOSUPPORT => EAFNOSUPPORT, |
| 2578 | libc::EADDRINUSE => EADDRINUSE, |
| 2579 | libc::EADDRNOTAVAIL => EADDRNOTAVAIL, |
| 2580 | libc::ENETDOWN => ENETDOWN, |
| 2581 | libc::ENETUNREACH => ENETUNREACH, |
| 2582 | libc::ENETRESET => ENETRESET, |
| 2583 | libc::ECONNABORTED => ECONNABORTED, |
| 2584 | libc::ECONNRESET => ECONNRESET, |
| 2585 | libc::ENOBUFS => ENOBUFS, |
| 2586 | libc::EISCONN => EISCONN, |
| 2587 | libc::ENOTCONN => ENOTCONN, |
| 2588 | libc::ESHUTDOWN => ESHUTDOWN, |
| 2589 | libc::ETOOMANYREFS => ETOOMANYREFS, |
| 2590 | libc::ETIMEDOUT => ETIMEDOUT, |
| 2591 | libc::ECONNREFUSED => ECONNREFUSED, |
| 2592 | libc::EHOSTDOWN => EHOSTDOWN, |
| 2593 | libc::EHOSTUNREACH => EHOSTUNREACH, |
| 2594 | libc::EALREADY => EALREADY, |
| 2595 | libc::EINPROGRESS => EINPROGRESS, |
| 2596 | libc::ESTALE => ESTALE, |
| 2597 | _ => UnknownErrno, |
| 2598 | } |
| 2599 | } |
| 2600 | } |