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