| 1 | //! The `rustix` `Errno` type. |
| 2 | //! |
| 3 | //! This type holds an OS error code, which conceptually corresponds to an |
| 4 | //! `errno` value. |
| 5 | //! |
| 6 | //! # Safety |
| 7 | //! |
| 8 | //! Linux uses error codes in `-4095..0`; we use rustc attributes to describe |
| 9 | //! this restricted range of values. |
| 10 | #![allow (unsafe_code)] |
| 11 | #![cfg_attr (not(rustc_attrs), allow(unused_unsafe))] |
| 12 | |
| 13 | use crate::backend::c; |
| 14 | use crate::backend::fd::RawFd; |
| 15 | use crate::backend::reg::{RetNumber, RetReg}; |
| 16 | use crate::io; |
| 17 | use linux_raw_sys::errno; |
| 18 | |
| 19 | /// `errno`—An error code. |
| 20 | /// |
| 21 | /// The error type for `rustix` APIs. This is similar to [`std::io::Error`], |
| 22 | /// but only holds an OS error code, and no extra error value. |
| 23 | /// |
| 24 | /// # References |
| 25 | /// - [POSIX] |
| 26 | /// - [Linux] |
| 27 | /// - [Winsock] |
| 28 | /// - [FreeBSD] |
| 29 | /// - [NetBSD] |
| 30 | /// - [OpenBSD] |
| 31 | /// - [DragonFly BSD] |
| 32 | /// - [illumos] |
| 33 | /// - [glibc] |
| 34 | /// |
| 35 | /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/errno.html |
| 36 | /// [Linux]: https://man7.org/linux/man-pages/man3/errno.3.html |
| 37 | /// [Winsock]: https://learn.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2 |
| 38 | /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?errno |
| 39 | /// [NetBSD]: https://man.netbsd.org/errno.2 |
| 40 | /// [OpenBSD]: https://man.openbsd.org/errno.2 |
| 41 | /// [DragonFly BSD]: https://man.dragonflybsd.org/?command=errno§ion=2 |
| 42 | /// [illumos]: https://illumos.org/man/3C/errno |
| 43 | /// [glibc]: https://sourceware.org/glibc/manual/latest/html_node/Error-Codes.html |
| 44 | #[repr (transparent)] |
| 45 | #[doc (alias = "errno" )] |
| 46 | #[derive (Eq, PartialEq, Hash, Copy, Clone)] |
| 47 | // Linux returns negated error codes, and we leave them in negated form, so |
| 48 | // error codes are in `-4095..0`. |
| 49 | #[cfg_attr (rustc_attrs, rustc_layout_scalar_valid_range_start(0xf001))] |
| 50 | #[cfg_attr (rustc_attrs, rustc_layout_scalar_valid_range_end(0xffff))] |
| 51 | pub struct Errno(u16); |
| 52 | |
| 53 | impl Errno { |
| 54 | /// Extract an `Errno` value from a `std::io::Error`. |
| 55 | /// |
| 56 | /// This isn't a `From` conversion because it's expected to be relatively |
| 57 | /// uncommon. |
| 58 | #[cfg (feature = "std" )] |
| 59 | #[inline ] |
| 60 | pub fn from_io_error(io_err: &std::io::Error) -> Option<Self> { |
| 61 | io_err.raw_os_error().and_then(|raw| { |
| 62 | // `std::io::Error` could theoretically have arbitrary OS error |
| 63 | // values, so check that they're in Linux's range. |
| 64 | if (1..4096).contains(&raw) { |
| 65 | Some(Self::from_errno(raw as u32)) |
| 66 | } else { |
| 67 | None |
| 68 | } |
| 69 | }) |
| 70 | } |
| 71 | |
| 72 | /// Extract the raw OS error number from this error. |
| 73 | #[inline ] |
| 74 | pub const fn raw_os_error(self) -> i32 { |
| 75 | (self.0 as i16 as i32).wrapping_neg() |
| 76 | } |
| 77 | |
| 78 | /// Construct an `Errno` from a raw OS error number. |
| 79 | #[inline ] |
| 80 | pub const fn from_raw_os_error(raw: i32) -> Self { |
| 81 | Self::from_errno(raw as u32) |
| 82 | } |
| 83 | |
| 84 | /// Convert from a C `errno` value (which is positive) to an `Errno`. |
| 85 | const fn from_errno(raw: u32) -> Self { |
| 86 | // We store error values in negated form, so that we don't have to |
| 87 | // negate them after every syscall. |
| 88 | let encoded = raw.wrapping_neg() as u16; |
| 89 | |
| 90 | // TODO: Use Range::contains, once that's `const`. |
| 91 | assert!(encoded >= 0xf001); |
| 92 | |
| 93 | // SAFETY: Linux syscalls return negated error values in the range |
| 94 | // `-4095..0`, which we just asserted. |
| 95 | unsafe { Self(encoded) } |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | /// Check for an error from the result of a syscall which encodes a |
| 100 | /// `c::c_int` on success. |
| 101 | #[inline ] |
| 102 | pub(in crate::backend) fn try_decode_c_int<Num: RetNumber>( |
| 103 | raw: RetReg<Num>, |
| 104 | ) -> io::Result<c::c_int> { |
| 105 | if raw.is_in_range(-4095..0) { |
| 106 | // SAFETY: `raw` must be in `-4095..0`, and we just checked that raw is |
| 107 | // in that range. |
| 108 | return Err(unsafe { Errno(raw.decode_error_code()) }); |
| 109 | } |
| 110 | |
| 111 | Ok(raw.decode_c_int()) |
| 112 | } |
| 113 | |
| 114 | /// Check for an error from the result of a syscall which encodes a |
| 115 | /// `c::c_uint` on success. |
| 116 | #[inline ] |
| 117 | pub(in crate::backend) fn try_decode_c_uint<Num: RetNumber>( |
| 118 | raw: RetReg<Num>, |
| 119 | ) -> io::Result<c::c_uint> { |
| 120 | if raw.is_in_range(-4095..0) { |
| 121 | // SAFETY: `raw` must be in `-4095..0`, and we just checked that raw is |
| 122 | // in that range. |
| 123 | return Err(unsafe { Errno(raw.decode_error_code()) }); |
| 124 | } |
| 125 | |
| 126 | Ok(raw.decode_c_uint()) |
| 127 | } |
| 128 | |
| 129 | /// Check for an error from the result of a syscall which encodes a `usize` on |
| 130 | /// success. |
| 131 | #[inline ] |
| 132 | pub(in crate::backend) fn try_decode_usize<Num: RetNumber>(raw: RetReg<Num>) -> io::Result<usize> { |
| 133 | if raw.is_in_range(-4095..0) { |
| 134 | // SAFETY: `raw` must be in `-4095..0`, and we just checked that raw is |
| 135 | // in that range. |
| 136 | return Err(unsafe { Errno(raw.decode_error_code()) }); |
| 137 | } |
| 138 | |
| 139 | Ok(raw.decode_usize()) |
| 140 | } |
| 141 | |
| 142 | /// Check for an error from the result of a syscall which encodes a |
| 143 | /// `*mut c_void` on success. |
| 144 | #[inline ] |
| 145 | pub(in crate::backend) fn try_decode_void_star<Num: RetNumber>( |
| 146 | raw: RetReg<Num>, |
| 147 | ) -> io::Result<*mut c::c_void> { |
| 148 | if raw.is_in_range(-4095..0) { |
| 149 | // SAFETY: `raw` must be in `-4095..0`, and we just checked that raw is |
| 150 | // in that range. |
| 151 | return Err(unsafe { Errno(raw.decode_error_code()) }); |
| 152 | } |
| 153 | |
| 154 | Ok(raw.decode_void_star()) |
| 155 | } |
| 156 | |
| 157 | /// Check for an error from the result of a syscall which encodes a |
| 158 | /// `u64` on success. |
| 159 | #[cfg (target_pointer_width = "64" )] |
| 160 | #[inline ] |
| 161 | pub(in crate::backend) fn try_decode_u64<Num: RetNumber>(raw: RetReg<Num>) -> io::Result<u64> { |
| 162 | if raw.is_in_range(-4095..0) { |
| 163 | // SAFETY: `raw` must be in `-4095..0`, and we just checked that raw is |
| 164 | // in that range. |
| 165 | return Err(unsafe { Errno(raw.decode_error_code()) }); |
| 166 | } |
| 167 | |
| 168 | Ok(raw.decode_u64()) |
| 169 | } |
| 170 | |
| 171 | /// Check for an error from the result of a syscall which encodes a file |
| 172 | /// descriptor on success. |
| 173 | /// |
| 174 | /// # Safety |
| 175 | /// |
| 176 | /// This must only be used with syscalls which return file descriptors on |
| 177 | /// success. |
| 178 | #[inline ] |
| 179 | pub(in crate::backend) unsafe fn try_decode_raw_fd<Num: RetNumber>( |
| 180 | raw: RetReg<Num>, |
| 181 | ) -> io::Result<RawFd> { |
| 182 | // Instead of using `check_result` here, we just check for negative, since |
| 183 | // this function is only used for system calls which return file |
| 184 | // descriptors, and this produces smaller code. |
| 185 | if raw.is_negative() { |
| 186 | debug_assert!(raw.is_in_range(-4095..0)); |
| 187 | |
| 188 | // Tell the optimizer that we know the value is in the error range. |
| 189 | // This helps it avoid unnecessary integer conversions. |
| 190 | #[cfg (core_intrinsics)] |
| 191 | { |
| 192 | core::intrinsics::assume(raw.is_in_range(-4095..0)); |
| 193 | } |
| 194 | |
| 195 | return Err(Errno(raw.decode_error_code())); |
| 196 | } |
| 197 | |
| 198 | Ok(raw.decode_raw_fd()) |
| 199 | } |
| 200 | |
| 201 | /// Check for an error from the result of a syscall which encodes no value on |
| 202 | /// success. On success, return the unconsumed `raw` value. |
| 203 | /// |
| 204 | /// # Safety |
| 205 | /// |
| 206 | /// This must only be used with syscalls which return no value on success. |
| 207 | #[inline ] |
| 208 | pub(in crate::backend) unsafe fn try_decode_void<Num: RetNumber>( |
| 209 | raw: RetReg<Num>, |
| 210 | ) -> io::Result<()> { |
| 211 | // Instead of using `check_result` here, we just check for zero, since this |
| 212 | // function is only used for system calls which have no other return value, |
| 213 | // and this produces smaller code. |
| 214 | if raw.is_nonzero() { |
| 215 | debug_assert!(raw.is_in_range(-4095..0)); |
| 216 | |
| 217 | // Tell the optimizer that we know the value is in the error range. |
| 218 | // This helps it avoid unnecessary integer conversions. |
| 219 | #[cfg (core_intrinsics)] |
| 220 | { |
| 221 | core::intrinsics::assume(raw.is_in_range(-4095..0)); |
| 222 | } |
| 223 | |
| 224 | return Err(Errno(raw.decode_error_code())); |
| 225 | } |
| 226 | |
| 227 | raw.decode_void(); |
| 228 | |
| 229 | Ok(()) |
| 230 | } |
| 231 | |
| 232 | /// Check for an error from the result of a syscall which does not return on |
| 233 | /// success. On success, return the unconsumed `raw` value. |
| 234 | /// |
| 235 | /// # Safety |
| 236 | /// |
| 237 | /// This must only be used with syscalls which do not return on success. |
| 238 | #[cfg (any(feature = "event" , feature = "runtime" , feature = "system" ))] |
| 239 | #[inline ] |
| 240 | pub(in crate::backend) unsafe fn try_decode_error<Num: RetNumber>(raw: RetReg<Num>) -> io::Errno { |
| 241 | debug_assert!(raw.is_in_range(-4095..0)); |
| 242 | |
| 243 | // Tell the optimizer that we know the value is in the error range. |
| 244 | // This helps it avoid unnecessary integer conversions. |
| 245 | #[cfg (core_intrinsics)] |
| 246 | { |
| 247 | core::intrinsics::assume(raw.is_in_range(-4095..0)); |
| 248 | } |
| 249 | |
| 250 | Errno(raw.decode_error_code()) |
| 251 | } |
| 252 | |
| 253 | /// Return the contained `usize` value. |
| 254 | #[cfg (not(debug_assertions))] |
| 255 | #[inline ] |
| 256 | pub(in crate::backend) fn decode_usize_infallible<Num: RetNumber>(raw: RetReg<Num>) -> usize { |
| 257 | raw.decode_usize() |
| 258 | } |
| 259 | |
| 260 | /// Return the contained `c_int` value. |
| 261 | #[cfg (not(debug_assertions))] |
| 262 | #[inline ] |
| 263 | pub(in crate::backend) fn decode_c_int_infallible<Num: RetNumber>(raw: RetReg<Num>) -> c::c_int { |
| 264 | raw.decode_c_int() |
| 265 | } |
| 266 | |
| 267 | /// Return the contained `c_uint` value. |
| 268 | #[cfg (not(debug_assertions))] |
| 269 | #[inline ] |
| 270 | pub(in crate::backend) fn decode_c_uint_infallible<Num: RetNumber>(raw: RetReg<Num>) -> c::c_uint { |
| 271 | raw.decode_c_uint() |
| 272 | } |
| 273 | |
| 274 | impl Errno { |
| 275 | /// `EACCES` |
| 276 | #[doc (alias = "ACCES" )] |
| 277 | pub const ACCESS: Self = Self::from_errno(errno::EACCES); |
| 278 | /// `EADDRINUSE` |
| 279 | pub const ADDRINUSE: Self = Self::from_errno(errno::EADDRINUSE); |
| 280 | /// `EADDRNOTAVAIL` |
| 281 | pub const ADDRNOTAVAIL: Self = Self::from_errno(errno::EADDRNOTAVAIL); |
| 282 | /// `EADV` |
| 283 | pub const ADV: Self = Self::from_errno(errno::EADV); |
| 284 | /// `EAFNOSUPPORT` |
| 285 | pub const AFNOSUPPORT: Self = Self::from_errno(errno::EAFNOSUPPORT); |
| 286 | /// `EAGAIN` |
| 287 | pub const AGAIN: Self = Self::from_errno(errno::EAGAIN); |
| 288 | /// `EALREADY` |
| 289 | pub const ALREADY: Self = Self::from_errno(errno::EALREADY); |
| 290 | /// `EBADE` |
| 291 | pub const BADE: Self = Self::from_errno(errno::EBADE); |
| 292 | /// `EBADF` |
| 293 | pub const BADF: Self = Self::from_errno(errno::EBADF); |
| 294 | /// `EBADFD` |
| 295 | pub const BADFD: Self = Self::from_errno(errno::EBADFD); |
| 296 | /// `EBADMSG` |
| 297 | pub const BADMSG: Self = Self::from_errno(errno::EBADMSG); |
| 298 | /// `EBADR` |
| 299 | pub const BADR: Self = Self::from_errno(errno::EBADR); |
| 300 | /// `EBADRQC` |
| 301 | pub const BADRQC: Self = Self::from_errno(errno::EBADRQC); |
| 302 | /// `EBADSLT` |
| 303 | pub const BADSLT: Self = Self::from_errno(errno::EBADSLT); |
| 304 | /// `EBFONT` |
| 305 | pub const BFONT: Self = Self::from_errno(errno::EBFONT); |
| 306 | /// `EBUSY` |
| 307 | pub const BUSY: Self = Self::from_errno(errno::EBUSY); |
| 308 | /// `ECANCELED` |
| 309 | pub const CANCELED: Self = Self::from_errno(errno::ECANCELED); |
| 310 | /// `ECHILD` |
| 311 | pub const CHILD: Self = Self::from_errno(errno::ECHILD); |
| 312 | /// `ECHRNG` |
| 313 | pub const CHRNG: Self = Self::from_errno(errno::ECHRNG); |
| 314 | /// `ECOMM` |
| 315 | pub const COMM: Self = Self::from_errno(errno::ECOMM); |
| 316 | /// `ECONNABORTED` |
| 317 | pub const CONNABORTED: Self = Self::from_errno(errno::ECONNABORTED); |
| 318 | /// `ECONNREFUSED` |
| 319 | pub const CONNREFUSED: Self = Self::from_errno(errno::ECONNREFUSED); |
| 320 | /// `ECONNRESET` |
| 321 | pub const CONNRESET: Self = Self::from_errno(errno::ECONNRESET); |
| 322 | /// `EDEADLK` |
| 323 | pub const DEADLK: Self = Self::from_errno(errno::EDEADLK); |
| 324 | /// `EDEADLOCK` |
| 325 | pub const DEADLOCK: Self = Self::from_errno(errno::EDEADLOCK); |
| 326 | /// `EDESTADDRREQ` |
| 327 | pub const DESTADDRREQ: Self = Self::from_errno(errno::EDESTADDRREQ); |
| 328 | /// `EDOM` |
| 329 | pub const DOM: Self = Self::from_errno(errno::EDOM); |
| 330 | /// `EDOTDOT` |
| 331 | pub const DOTDOT: Self = Self::from_errno(errno::EDOTDOT); |
| 332 | /// `EDQUOT` |
| 333 | pub const DQUOT: Self = Self::from_errno(errno::EDQUOT); |
| 334 | /// `EEXIST` |
| 335 | pub const EXIST: Self = Self::from_errno(errno::EEXIST); |
| 336 | /// `EFAULT` |
| 337 | pub const FAULT: Self = Self::from_errno(errno::EFAULT); |
| 338 | /// `EFBIG` |
| 339 | pub const FBIG: Self = Self::from_errno(errno::EFBIG); |
| 340 | /// `EHOSTDOWN` |
| 341 | pub const HOSTDOWN: Self = Self::from_errno(errno::EHOSTDOWN); |
| 342 | /// `EHOSTUNREACH` |
| 343 | pub const HOSTUNREACH: Self = Self::from_errno(errno::EHOSTUNREACH); |
| 344 | /// `EHWPOISON` |
| 345 | pub const HWPOISON: Self = Self::from_errno(errno::EHWPOISON); |
| 346 | /// `EIDRM` |
| 347 | pub const IDRM: Self = Self::from_errno(errno::EIDRM); |
| 348 | /// `EILSEQ` |
| 349 | pub const ILSEQ: Self = Self::from_errno(errno::EILSEQ); |
| 350 | /// `EINPROGRESS` |
| 351 | pub const INPROGRESS: Self = Self::from_errno(errno::EINPROGRESS); |
| 352 | /// `EINTR`. |
| 353 | /// |
| 354 | /// For a convenient way to retry system calls that exit with `INTR`, use |
| 355 | /// [`retry_on_intr`]. |
| 356 | /// |
| 357 | /// [`retry_on_intr`]: io::retry_on_intr |
| 358 | pub const INTR: Self = Self::from_errno(errno::EINTR); |
| 359 | /// `EINVAL` |
| 360 | pub const INVAL: Self = Self::from_errno(errno::EINVAL); |
| 361 | /// `EIO` |
| 362 | pub const IO: Self = Self::from_errno(errno::EIO); |
| 363 | /// `EISCONN` |
| 364 | pub const ISCONN: Self = Self::from_errno(errno::EISCONN); |
| 365 | /// `EISDIR` |
| 366 | pub const ISDIR: Self = Self::from_errno(errno::EISDIR); |
| 367 | /// `EISNAM` |
| 368 | pub const ISNAM: Self = Self::from_errno(errno::EISNAM); |
| 369 | /// `EKEYEXPIRED` |
| 370 | pub const KEYEXPIRED: Self = Self::from_errno(errno::EKEYEXPIRED); |
| 371 | /// `EKEYREJECTED` |
| 372 | pub const KEYREJECTED: Self = Self::from_errno(errno::EKEYREJECTED); |
| 373 | /// `EKEYREVOKED` |
| 374 | pub const KEYREVOKED: Self = Self::from_errno(errno::EKEYREVOKED); |
| 375 | /// `EL2HLT` |
| 376 | pub const L2HLT: Self = Self::from_errno(errno::EL2HLT); |
| 377 | /// `EL2NSYNC` |
| 378 | pub const L2NSYNC: Self = Self::from_errno(errno::EL2NSYNC); |
| 379 | /// `EL3HLT` |
| 380 | pub const L3HLT: Self = Self::from_errno(errno::EL3HLT); |
| 381 | /// `EL3RST` |
| 382 | pub const L3RST: Self = Self::from_errno(errno::EL3RST); |
| 383 | /// `ELIBACC` |
| 384 | pub const LIBACC: Self = Self::from_errno(errno::ELIBACC); |
| 385 | /// `ELIBBAD` |
| 386 | pub const LIBBAD: Self = Self::from_errno(errno::ELIBBAD); |
| 387 | /// `ELIBEXEC` |
| 388 | pub const LIBEXEC: Self = Self::from_errno(errno::ELIBEXEC); |
| 389 | /// `ELIBMAX` |
| 390 | pub const LIBMAX: Self = Self::from_errno(errno::ELIBMAX); |
| 391 | /// `ELIBSCN` |
| 392 | pub const LIBSCN: Self = Self::from_errno(errno::ELIBSCN); |
| 393 | /// `ELNRNG` |
| 394 | pub const LNRNG: Self = Self::from_errno(errno::ELNRNG); |
| 395 | /// `ELOOP` |
| 396 | pub const LOOP: Self = Self::from_errno(errno::ELOOP); |
| 397 | /// `EMEDIUMTYPE` |
| 398 | pub const MEDIUMTYPE: Self = Self::from_errno(errno::EMEDIUMTYPE); |
| 399 | /// `EMFILE` |
| 400 | pub const MFILE: Self = Self::from_errno(errno::EMFILE); |
| 401 | /// `EMLINK` |
| 402 | pub const MLINK: Self = Self::from_errno(errno::EMLINK); |
| 403 | /// `EMSGSIZE` |
| 404 | pub const MSGSIZE: Self = Self::from_errno(errno::EMSGSIZE); |
| 405 | /// `EMULTIHOP` |
| 406 | pub const MULTIHOP: Self = Self::from_errno(errno::EMULTIHOP); |
| 407 | /// `ENAMETOOLONG` |
| 408 | pub const NAMETOOLONG: Self = Self::from_errno(errno::ENAMETOOLONG); |
| 409 | /// `ENAVAIL` |
| 410 | pub const NAVAIL: Self = Self::from_errno(errno::ENAVAIL); |
| 411 | /// `ENETDOWN` |
| 412 | pub const NETDOWN: Self = Self::from_errno(errno::ENETDOWN); |
| 413 | /// `ENETRESET` |
| 414 | pub const NETRESET: Self = Self::from_errno(errno::ENETRESET); |
| 415 | /// `ENETUNREACH` |
| 416 | pub const NETUNREACH: Self = Self::from_errno(errno::ENETUNREACH); |
| 417 | /// `ENFILE` |
| 418 | pub const NFILE: Self = Self::from_errno(errno::ENFILE); |
| 419 | /// `ENOANO` |
| 420 | pub const NOANO: Self = Self::from_errno(errno::ENOANO); |
| 421 | /// `ENOBUFS` |
| 422 | pub const NOBUFS: Self = Self::from_errno(errno::ENOBUFS); |
| 423 | /// `ENOCSI` |
| 424 | pub const NOCSI: Self = Self::from_errno(errno::ENOCSI); |
| 425 | /// `ENODATA` |
| 426 | #[doc (alias = "NOATTR" )] |
| 427 | pub const NODATA: Self = Self::from_errno(errno::ENODATA); |
| 428 | /// `ENODEV` |
| 429 | pub const NODEV: Self = Self::from_errno(errno::ENODEV); |
| 430 | /// `ENOENT` |
| 431 | pub const NOENT: Self = Self::from_errno(errno::ENOENT); |
| 432 | /// `ENOEXEC` |
| 433 | pub const NOEXEC: Self = Self::from_errno(errno::ENOEXEC); |
| 434 | /// `ENOKEY` |
| 435 | pub const NOKEY: Self = Self::from_errno(errno::ENOKEY); |
| 436 | /// `ENOLCK` |
| 437 | pub const NOLCK: Self = Self::from_errno(errno::ENOLCK); |
| 438 | /// `ENOLINK` |
| 439 | pub const NOLINK: Self = Self::from_errno(errno::ENOLINK); |
| 440 | /// `ENOMEDIUM` |
| 441 | pub const NOMEDIUM: Self = Self::from_errno(errno::ENOMEDIUM); |
| 442 | /// `ENOMEM` |
| 443 | pub const NOMEM: Self = Self::from_errno(errno::ENOMEM); |
| 444 | /// `ENOMSG` |
| 445 | pub const NOMSG: Self = Self::from_errno(errno::ENOMSG); |
| 446 | /// `ENONET` |
| 447 | pub const NONET: Self = Self::from_errno(errno::ENONET); |
| 448 | /// `ENOPKG` |
| 449 | pub const NOPKG: Self = Self::from_errno(errno::ENOPKG); |
| 450 | /// `ENOPROTOOPT` |
| 451 | pub const NOPROTOOPT: Self = Self::from_errno(errno::ENOPROTOOPT); |
| 452 | /// `ENOSPC` |
| 453 | pub const NOSPC: Self = Self::from_errno(errno::ENOSPC); |
| 454 | /// `ENOSR` |
| 455 | pub const NOSR: Self = Self::from_errno(errno::ENOSR); |
| 456 | /// `ENOSTR` |
| 457 | pub const NOSTR: Self = Self::from_errno(errno::ENOSTR); |
| 458 | /// `ENOSYS` |
| 459 | pub const NOSYS: Self = Self::from_errno(errno::ENOSYS); |
| 460 | /// `ENOTBLK` |
| 461 | pub const NOTBLK: Self = Self::from_errno(errno::ENOTBLK); |
| 462 | /// `ENOTCONN` |
| 463 | pub const NOTCONN: Self = Self::from_errno(errno::ENOTCONN); |
| 464 | /// `ENOTDIR` |
| 465 | pub const NOTDIR: Self = Self::from_errno(errno::ENOTDIR); |
| 466 | /// `ENOTEMPTY` |
| 467 | pub const NOTEMPTY: Self = Self::from_errno(errno::ENOTEMPTY); |
| 468 | /// `ENOTNAM` |
| 469 | pub const NOTNAM: Self = Self::from_errno(errno::ENOTNAM); |
| 470 | /// `ENOTRECOVERABLE` |
| 471 | pub const NOTRECOVERABLE: Self = Self::from_errno(errno::ENOTRECOVERABLE); |
| 472 | /// `ENOTSOCK` |
| 473 | pub const NOTSOCK: Self = Self::from_errno(errno::ENOTSOCK); |
| 474 | /// `ENOTSUP` |
| 475 | // On Linux, `ENOTSUP` has the same value as `EOPNOTSUPP`. |
| 476 | pub const NOTSUP: Self = Self::from_errno(errno::EOPNOTSUPP); |
| 477 | /// `ENOTTY` |
| 478 | pub const NOTTY: Self = Self::from_errno(errno::ENOTTY); |
| 479 | /// `ENOTUNIQ` |
| 480 | pub const NOTUNIQ: Self = Self::from_errno(errno::ENOTUNIQ); |
| 481 | /// `ENXIO` |
| 482 | pub const NXIO: Self = Self::from_errno(errno::ENXIO); |
| 483 | /// `EOPNOTSUPP` |
| 484 | pub const OPNOTSUPP: Self = Self::from_errno(errno::EOPNOTSUPP); |
| 485 | /// `EOVERFLOW` |
| 486 | pub const OVERFLOW: Self = Self::from_errno(errno::EOVERFLOW); |
| 487 | /// `EOWNERDEAD` |
| 488 | pub const OWNERDEAD: Self = Self::from_errno(errno::EOWNERDEAD); |
| 489 | /// `EPERM` |
| 490 | pub const PERM: Self = Self::from_errno(errno::EPERM); |
| 491 | /// `EPFNOSUPPORT` |
| 492 | pub const PFNOSUPPORT: Self = Self::from_errno(errno::EPFNOSUPPORT); |
| 493 | /// `EPIPE` |
| 494 | pub const PIPE: Self = Self::from_errno(errno::EPIPE); |
| 495 | /// `EPROTO` |
| 496 | pub const PROTO: Self = Self::from_errno(errno::EPROTO); |
| 497 | /// `EPROTONOSUPPORT` |
| 498 | pub const PROTONOSUPPORT: Self = Self::from_errno(errno::EPROTONOSUPPORT); |
| 499 | /// `EPROTOTYPE` |
| 500 | pub const PROTOTYPE: Self = Self::from_errno(errno::EPROTOTYPE); |
| 501 | /// `ERANGE` |
| 502 | pub const RANGE: Self = Self::from_errno(errno::ERANGE); |
| 503 | /// `EREMCHG` |
| 504 | pub const REMCHG: Self = Self::from_errno(errno::EREMCHG); |
| 505 | /// `EREMOTE` |
| 506 | pub const REMOTE: Self = Self::from_errno(errno::EREMOTE); |
| 507 | /// `EREMOTEIO` |
| 508 | pub const REMOTEIO: Self = Self::from_errno(errno::EREMOTEIO); |
| 509 | /// `ERESTART` |
| 510 | pub const RESTART: Self = Self::from_errno(errno::ERESTART); |
| 511 | /// `ERFKILL` |
| 512 | pub const RFKILL: Self = Self::from_errno(errno::ERFKILL); |
| 513 | /// `EROFS` |
| 514 | pub const ROFS: Self = Self::from_errno(errno::EROFS); |
| 515 | /// `ESHUTDOWN` |
| 516 | pub const SHUTDOWN: Self = Self::from_errno(errno::ESHUTDOWN); |
| 517 | /// `ESOCKTNOSUPPORT` |
| 518 | pub const SOCKTNOSUPPORT: Self = Self::from_errno(errno::ESOCKTNOSUPPORT); |
| 519 | /// `ESPIPE` |
| 520 | pub const SPIPE: Self = Self::from_errno(errno::ESPIPE); |
| 521 | /// `ESRCH` |
| 522 | pub const SRCH: Self = Self::from_errno(errno::ESRCH); |
| 523 | /// `ESRMNT` |
| 524 | pub const SRMNT: Self = Self::from_errno(errno::ESRMNT); |
| 525 | /// `ESTALE` |
| 526 | pub const STALE: Self = Self::from_errno(errno::ESTALE); |
| 527 | /// `ESTRPIPE` |
| 528 | pub const STRPIPE: Self = Self::from_errno(errno::ESTRPIPE); |
| 529 | /// `ETIME` |
| 530 | pub const TIME: Self = Self::from_errno(errno::ETIME); |
| 531 | /// `ETIMEDOUT` |
| 532 | pub const TIMEDOUT: Self = Self::from_errno(errno::ETIMEDOUT); |
| 533 | /// `E2BIG` |
| 534 | #[doc (alias = "2BIG" )] |
| 535 | pub const TOOBIG: Self = Self::from_errno(errno::E2BIG); |
| 536 | /// `ETOOMANYREFS` |
| 537 | pub const TOOMANYREFS: Self = Self::from_errno(errno::ETOOMANYREFS); |
| 538 | /// `ETXTBSY` |
| 539 | pub const TXTBSY: Self = Self::from_errno(errno::ETXTBSY); |
| 540 | /// `EUCLEAN` |
| 541 | pub const UCLEAN: Self = Self::from_errno(errno::EUCLEAN); |
| 542 | /// `EUNATCH` |
| 543 | pub const UNATCH: Self = Self::from_errno(errno::EUNATCH); |
| 544 | /// `EUSERS` |
| 545 | pub const USERS: Self = Self::from_errno(errno::EUSERS); |
| 546 | /// `EWOULDBLOCK` |
| 547 | pub const WOULDBLOCK: Self = Self::from_errno(errno::EWOULDBLOCK); |
| 548 | /// `EXDEV` |
| 549 | pub const XDEV: Self = Self::from_errno(errno::EXDEV); |
| 550 | /// `EXFULL` |
| 551 | pub const XFULL: Self = Self::from_errno(errno::EXFULL); |
| 552 | } |
| 553 | |