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