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