@@ -38,7 +38,7 @@ cfg_if! {
38
38
unsafe fn errno_location( ) -> * mut c_int {
39
39
libc:: __errno( )
40
40
}
41
- } else if #[ cfg( target_os = "linux" ) ] {
41
+ } else if #[ cfg( any ( target_os = "linux" , target_os = "redox" ) ) ] {
42
42
unsafe fn errno_location( ) -> * mut c_int {
43
43
libc:: __errno_location( )
44
44
}
@@ -332,7 +332,8 @@ fn desc(errno: Errno) -> &'static str {
332
332
#[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
333
333
EUSERS => "Too many users" ,
334
334
335
- #[ cfg( any( target_os = "linux" , target_os = "android" , target_os = "netbsd" ) ) ]
335
+ #[ cfg( any( target_os = "linux" , target_os = "android" ,
336
+ target_os = "netbsd" , target_os = "redox" ) ) ]
336
337
EOPNOTSUPP => "Operation not supported on transport endpoint" ,
337
338
338
339
#[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
@@ -393,10 +394,10 @@ fn desc(errno: Errno) -> &'static str {
393
394
#[ cfg( any( target_os = "freebsd" , target_os = "dragonfly" ) ) ]
394
395
EDOOFUS => "Programming error" ,
395
396
396
- #[ cfg( any( target_os = "freebsd" , target_os = "dragonfly" ) ) ]
397
+ #[ cfg( any( target_os = "freebsd" , target_os = "dragonfly" , target_os = "redox" ) ) ]
397
398
EMULTIHOP => "Multihop attempted" ,
398
399
399
- #[ cfg( any( target_os = "freebsd" , target_os = "dragonfly" ) ) ]
400
+ #[ cfg( any( target_os = "freebsd" , target_os = "dragonfly" , target_os = "redox" ) ) ]
400
401
ENOLINK => "Link has been severed" ,
401
402
402
403
#[ cfg( target_os = "freebsd" ) ]
@@ -412,12 +413,13 @@ fn desc(errno: Errno) -> &'static str {
412
413
413
414
#[ cfg( any( target_os = "macos" , target_os = "freebsd" ,
414
415
target_os = "dragonfly" , target_os = "ios" ,
415
- target_os = "openbsd" , target_os = "netbsd" ) ) ]
416
+ target_os = "openbsd" , target_os = "netbsd" ,
417
+ target_os = "redox" ) ) ]
416
418
EOVERFLOW => "Value too large to be stored in data type" ,
417
419
418
420
#[ cfg( any( target_os = "macos" , target_os = "freebsd" ,
419
421
target_os = "dragonfly" , target_os = "ios" ,
420
- target_os = "netbsd" ) ) ]
422
+ target_os = "netbsd" , target_os = "redox" ) ) ]
421
423
EILSEQ => "Illegal byte sequence" ,
422
424
423
425
#[ cfg( any( target_os = "macos" , target_os = "freebsd" ,
@@ -427,12 +429,14 @@ fn desc(errno: Errno) -> &'static str {
427
429
428
430
#[ cfg( any( target_os = "macos" , target_os = "freebsd" ,
429
431
target_os = "dragonfly" , target_os = "ios" ,
430
- target_os = "openbsd" , target_os = "netbsd" ) ) ]
432
+ target_os = "openbsd" , target_os = "netbsd" ,
433
+ target_os = "redox" ) ) ]
431
434
EBADMSG => "Bad message" ,
432
435
433
436
#[ cfg( any( target_os = "macos" , target_os = "freebsd" ,
434
437
target_os = "dragonfly" , target_os = "ios" ,
435
- target_os = "openbsd" , target_os = "netbsd" ) ) ]
438
+ target_os = "openbsd" , target_os = "netbsd" ,
439
+ target_os = "redox" ) ) ]
436
440
EPROTO => "Protocol error" ,
437
441
438
442
#[ cfg( any( target_os = "macos" , target_os = "freebsd" ,
@@ -455,22 +459,26 @@ fn desc(errno: Errno) -> &'static str {
455
459
456
460
#[ cfg( any( target_os = "macos" , target_os = "freebsd" ,
457
461
target_os = "dragonfly" , target_os = "ios" ,
458
- target_os = "openbsd" , target_os = "netbsd" ) ) ]
462
+ target_os = "openbsd" , target_os = "netbsd" ,
463
+ target_os = "redox" ) ) ]
459
464
EUSERS => "Too many users" ,
460
465
461
466
#[ cfg( any( target_os = "macos" , target_os = "freebsd" ,
462
467
target_os = "dragonfly" , target_os = "ios" ,
463
- target_os = "openbsd" , target_os = "netbsd" ) ) ]
468
+ target_os = "openbsd" , target_os = "netbsd" ,
469
+ target_os = "redox" ) ) ]
464
470
EDQUOT => "Disc quota exceeded" ,
465
471
466
472
#[ cfg( any( target_os = "macos" , target_os = "freebsd" ,
467
473
target_os = "dragonfly" , target_os = "ios" ,
468
- target_os = "openbsd" , target_os = "netbsd" ) ) ]
474
+ target_os = "openbsd" , target_os = "netbsd" ,
475
+ target_os = "redox" ) ) ]
469
476
ESTALE => "Stale NFS file handle" ,
470
477
471
478
#[ cfg( any( target_os = "macos" , target_os = "freebsd" ,
472
479
target_os = "dragonfly" , target_os = "ios" ,
473
- target_os = "openbsd" , target_os = "netbsd" ) ) ]
480
+ target_os = "openbsd" , target_os = "netbsd" ,
481
+ target_os = "redox" ) ) ]
474
482
EREMOTE => "Too many levels of remote in path" ,
475
483
476
484
#[ cfg( any( target_os = "macos" , target_os = "freebsd" ,
@@ -510,7 +518,8 @@ fn desc(errno: Errno) -> &'static str {
510
518
511
519
#[ cfg( any( target_os = "macos" , target_os = "freebsd" ,
512
520
target_os = "dragonfly" , target_os = "ios" ,
513
- target_os = "openbsd" , target_os = "netbsd" ) ) ]
521
+ target_os = "openbsd" , target_os = "netbsd" ,
522
+ target_os = "redox" ) ) ]
514
523
ECANCELED => "Operation canceled" ,
515
524
516
525
#[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
@@ -534,19 +543,23 @@ fn desc(errno: Errno) -> &'static str {
534
543
#[ cfg( any( target_os = "macos" , target_os = "ios" , target_os = "netbsd" ) ) ]
535
544
EMULTIHOP => "Reserved" ,
536
545
537
- #[ cfg( any( target_os = "macos" , target_os = "ios" , target_os = "netbsd" ) ) ]
546
+ #[ cfg( any( target_os = "macos" , target_os = "ios" ,
547
+ target_os = "netbsd" , target_os = "redox" ) ) ]
538
548
ENODATA => "No message available on STREAM" ,
539
549
540
550
#[ cfg( any( target_os = "macos" , target_os = "ios" , target_os = "netbsd" ) ) ]
541
551
ENOLINK => "Reserved" ,
542
552
543
- #[ cfg( any( target_os = "macos" , target_os = "ios" , target_os = "netbsd" ) ) ]
553
+ #[ cfg( any( target_os = "macos" , target_os = "ios" ,
554
+ target_os = "netbsd" , target_os = "redox" ) ) ]
544
555
ENOSR => "No STREAM resources" ,
545
556
546
- #[ cfg( any( target_os = "macos" , target_os = "ios" , target_os = "netbsd" ) ) ]
557
+ #[ cfg( any( target_os = "macos" , target_os = "ios" ,
558
+ target_os = "netbsd" , target_os = "redox" ) ) ]
547
559
ENOSTR => "Not a STREAM" ,
548
560
549
- #[ cfg( any( target_os = "macos" , target_os = "ios" , target_os = "netbsd" ) ) ]
561
+ #[ cfg( any( target_os = "macos" , target_os = "ios" ,
562
+ target_os = "netbsd" , target_os = "redox" ) ) ]
550
563
ETIME => "STREAM ioctl timeout" ,
551
564
552
565
#[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
@@ -1957,3 +1970,197 @@ mod consts {
1957
1970
}
1958
1971
}
1959
1972
}
1973
+
1974
+ #[ cfg( target_os = "redox" ) ]
1975
+ mod consts {
1976
+ use libc;
1977
+
1978
+ #[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
1979
+ #[ repr( i32 ) ]
1980
+ pub enum Errno {
1981
+ UnknownErrno = 0 ,
1982
+ EPERM = libc:: EPERM ,
1983
+ ENOENT = libc:: ENOENT ,
1984
+ ESRCH = libc:: ESRCH ,
1985
+ EINTR = libc:: EINTR ,
1986
+ EIO = libc:: EIO ,
1987
+ ENXIO = libc:: ENXIO ,
1988
+ E2BIG = libc:: E2BIG ,
1989
+ ENOEXEC = libc:: ENOEXEC ,
1990
+ EBADF = libc:: EBADF ,
1991
+ ECHILD = libc:: ECHILD ,
1992
+ EDEADLK = libc:: EDEADLK ,
1993
+ ENOMEM = libc:: ENOMEM ,
1994
+ EACCES = libc:: EACCES ,
1995
+ EFAULT = libc:: EFAULT ,
1996
+ ENOTBLK = libc:: ENOTBLK ,
1997
+ EBUSY = libc:: EBUSY ,
1998
+ EEXIST = libc:: EEXIST ,
1999
+ EXDEV = libc:: EXDEV ,
2000
+ ENODEV = libc:: ENODEV ,
2001
+ ENOTDIR = libc:: ENOTDIR ,
2002
+ EISDIR = libc:: EISDIR ,
2003
+ EINVAL = libc:: EINVAL ,
2004
+ ENFILE = libc:: ENFILE ,
2005
+ EMFILE = libc:: EMFILE ,
2006
+ ENOTTY = libc:: ENOTTY ,
2007
+ ETXTBSY = libc:: ETXTBSY ,
2008
+ EFBIG = libc:: EFBIG ,
2009
+ ENOSPC = libc:: ENOSPC ,
2010
+ ESPIPE = libc:: ESPIPE ,
2011
+ EROFS = libc:: EROFS ,
2012
+ EMLINK = libc:: EMLINK ,
2013
+ EPIPE = libc:: EPIPE ,
2014
+ EDOM = libc:: EDOM ,
2015
+ ERANGE = libc:: ERANGE ,
2016
+ EAGAIN = libc:: EAGAIN ,
2017
+ EINPROGRESS = libc:: EINPROGRESS ,
2018
+ EALREADY = libc:: EALREADY ,
2019
+ ENOTSOCK = libc:: ENOTSOCK ,
2020
+ EDESTADDRREQ = libc:: EDESTADDRREQ ,
2021
+ EMSGSIZE = libc:: EMSGSIZE ,
2022
+ EPROTOTYPE = libc:: EPROTOTYPE ,
2023
+ ENOPROTOOPT = libc:: ENOPROTOOPT ,
2024
+ EPROTONOSUPPORT = libc:: EPROTONOSUPPORT ,
2025
+ ESOCKTNOSUPPORT = libc:: ESOCKTNOSUPPORT ,
2026
+ EOPNOTSUPP = libc:: EOPNOTSUPP ,
2027
+ EPFNOSUPPORT = libc:: EPFNOSUPPORT ,
2028
+ EAFNOSUPPORT = libc:: EAFNOSUPPORT ,
2029
+ EADDRINUSE = libc:: EADDRINUSE ,
2030
+ EADDRNOTAVAIL = libc:: EADDRNOTAVAIL ,
2031
+ ENETDOWN = libc:: ENETDOWN ,
2032
+ ENETUNREACH = libc:: ENETUNREACH ,
2033
+ ENETRESET = libc:: ENETRESET ,
2034
+ ECONNABORTED = libc:: ECONNABORTED ,
2035
+ ECONNRESET = libc:: ECONNRESET ,
2036
+ ENOBUFS = libc:: ENOBUFS ,
2037
+ EISCONN = libc:: EISCONN ,
2038
+ ENOTCONN = libc:: ENOTCONN ,
2039
+ ESHUTDOWN = libc:: ESHUTDOWN ,
2040
+ ETOOMANYREFS = libc:: ETOOMANYREFS ,
2041
+ ETIMEDOUT = libc:: ETIMEDOUT ,
2042
+ ECONNREFUSED = libc:: ECONNREFUSED ,
2043
+ ELOOP = libc:: ELOOP ,
2044
+ ENAMETOOLONG = libc:: ENAMETOOLONG ,
2045
+ EHOSTDOWN = libc:: EHOSTDOWN ,
2046
+ EHOSTUNREACH = libc:: EHOSTUNREACH ,
2047
+ ENOTEMPTY = libc:: ENOTEMPTY ,
2048
+ EUSERS = libc:: EUSERS ,
2049
+ EDQUOT = libc:: EDQUOT ,
2050
+ ESTALE = libc:: ESTALE ,
2051
+ EREMOTE = libc:: EREMOTE ,
2052
+ ENOLCK = libc:: ENOLCK ,
2053
+ ENOSYS = libc:: ENOSYS ,
2054
+ EIDRM = libc:: EIDRM ,
2055
+ ENOMSG = libc:: ENOMSG ,
2056
+ EOVERFLOW = libc:: EOVERFLOW ,
2057
+ EILSEQ = libc:: EILSEQ ,
2058
+ ECANCELED = libc:: ECANCELED ,
2059
+ EBADMSG = libc:: EBADMSG ,
2060
+ ENODATA = libc:: ENODATA ,
2061
+ ENOSR = libc:: ENOSR ,
2062
+ ENOSTR = libc:: ENOSTR ,
2063
+ ETIME = libc:: ETIME ,
2064
+ EMULTIHOP = libc:: EMULTIHOP ,
2065
+ ENOLINK = libc:: ENOLINK ,
2066
+ EPROTO = libc:: EPROTO ,
2067
+ }
2068
+
2069
+ pub const ELAST : Errno = Errno :: UnknownErrno ;
2070
+ pub const EWOULDBLOCK : Errno = Errno :: EAGAIN ;
2071
+
2072
+ pub const EL2NSYNC : Errno = Errno :: UnknownErrno ;
2073
+
2074
+ pub fn from_i32 ( e : i32 ) -> Errno {
2075
+ use self :: Errno :: * ;
2076
+
2077
+ match e {
2078
+ libc:: EPERM => EPERM ,
2079
+ libc:: ENOENT => ENOENT ,
2080
+ libc:: ESRCH => ESRCH ,
2081
+ libc:: EINTR => EINTR ,
2082
+ libc:: EIO => EIO ,
2083
+ libc:: ENXIO => ENXIO ,
2084
+ libc:: E2BIG => E2BIG ,
2085
+ libc:: ENOEXEC => ENOEXEC ,
2086
+ libc:: EBADF => EBADF ,
2087
+ libc:: ECHILD => ECHILD ,
2088
+ libc:: EDEADLK => EDEADLK ,
2089
+ libc:: ENOMEM => ENOMEM ,
2090
+ libc:: EACCES => EACCES ,
2091
+ libc:: EFAULT => EFAULT ,
2092
+ libc:: ENOTBLK => ENOTBLK ,
2093
+ libc:: EBUSY => EBUSY ,
2094
+ libc:: EEXIST => EEXIST ,
2095
+ libc:: EXDEV => EXDEV ,
2096
+ libc:: ENODEV => ENODEV ,
2097
+ libc:: ENOTDIR => ENOTDIR ,
2098
+ libc:: EISDIR => EISDIR ,
2099
+ libc:: EINVAL => EINVAL ,
2100
+ libc:: ENFILE => ENFILE ,
2101
+ libc:: EMFILE => EMFILE ,
2102
+ libc:: ENOTTY => ENOTTY ,
2103
+ libc:: ETXTBSY => ETXTBSY ,
2104
+ libc:: EFBIG => EFBIG ,
2105
+ libc:: ENOSPC => ENOSPC ,
2106
+ libc:: ESPIPE => ESPIPE ,
2107
+ libc:: EROFS => EROFS ,
2108
+ libc:: EMLINK => EMLINK ,
2109
+ libc:: EPIPE => EPIPE ,
2110
+ libc:: EDOM => EDOM ,
2111
+ libc:: ERANGE => ERANGE ,
2112
+ libc:: EAGAIN => EAGAIN ,
2113
+ libc:: EINPROGRESS => EINPROGRESS ,
2114
+ libc:: EALREADY => EALREADY ,
2115
+ libc:: ENOTSOCK => ENOTSOCK ,
2116
+ libc:: EDESTADDRREQ => EDESTADDRREQ ,
2117
+ libc:: EMSGSIZE => EMSGSIZE ,
2118
+ libc:: EPROTOTYPE => EPROTOTYPE ,
2119
+ libc:: ENOPROTOOPT => ENOPROTOOPT ,
2120
+ libc:: EPROTONOSUPPORT => EPROTONOSUPPORT ,
2121
+ libc:: ESOCKTNOSUPPORT => ESOCKTNOSUPPORT ,
2122
+ libc:: EOPNOTSUPP => EOPNOTSUPP ,
2123
+ libc:: EPFNOSUPPORT => EPFNOSUPPORT ,
2124
+ libc:: EAFNOSUPPORT => EAFNOSUPPORT ,
2125
+ libc:: EADDRINUSE => EADDRINUSE ,
2126
+ libc:: EADDRNOTAVAIL => EADDRNOTAVAIL ,
2127
+ libc:: ENETDOWN => ENETDOWN ,
2128
+ libc:: ENETUNREACH => ENETUNREACH ,
2129
+ libc:: ENETRESET => ENETRESET ,
2130
+ libc:: ECONNABORTED => ECONNABORTED ,
2131
+ libc:: ECONNRESET => ECONNRESET ,
2132
+ libc:: ENOBUFS => ENOBUFS ,
2133
+ libc:: EISCONN => EISCONN ,
2134
+ libc:: ENOTCONN => ENOTCONN ,
2135
+ libc:: ESHUTDOWN => ESHUTDOWN ,
2136
+ libc:: ETOOMANYREFS => ETOOMANYREFS ,
2137
+ libc:: ETIMEDOUT => ETIMEDOUT ,
2138
+ libc:: ECONNREFUSED => ECONNREFUSED ,
2139
+ libc:: ELOOP => ELOOP ,
2140
+ libc:: ENAMETOOLONG => ENAMETOOLONG ,
2141
+ libc:: EHOSTDOWN => EHOSTDOWN ,
2142
+ libc:: EHOSTUNREACH => EHOSTUNREACH ,
2143
+ libc:: ENOTEMPTY => ENOTEMPTY ,
2144
+ libc:: EUSERS => EUSERS ,
2145
+ libc:: EDQUOT => EDQUOT ,
2146
+ libc:: ESTALE => ESTALE ,
2147
+ libc:: EREMOTE => EREMOTE ,
2148
+ libc:: ENOLCK => ENOLCK ,
2149
+ libc:: ENOSYS => ENOSYS ,
2150
+ libc:: EIDRM => EIDRM ,
2151
+ libc:: ENOMSG => ENOMSG ,
2152
+ libc:: EOVERFLOW => EOVERFLOW ,
2153
+ libc:: EILSEQ => EILSEQ ,
2154
+ libc:: ECANCELED => ECANCELED ,
2155
+ libc:: EBADMSG => EBADMSG ,
2156
+ libc:: ENODATA => ENODATA ,
2157
+ libc:: ENOSR => ENOSR ,
2158
+ libc:: ENOSTR => ENOSTR ,
2159
+ libc:: ETIME => ETIME ,
2160
+ libc:: EMULTIHOP => EMULTIHOP ,
2161
+ libc:: ENOLINK => ENOLINK ,
2162
+ libc:: EPROTO => EPROTO ,
2163
+ _ => UnknownErrno ,
2164
+ }
2165
+ }
2166
+ }
0 commit comments