1
- #[ cfg( feature = "trusty_sys" ) ]
2
- extern crate trusty_sys;
3
-
4
1
pub use core:: ffi:: c_void;
5
2
6
- #[ cfg( feature = "trusty_sys" ) ]
7
- pub const PROT_READ : i32 = self :: trusty_sys:: MMAP_FLAG_PROT_READ as i32 ;
8
-
9
- #[ cfg( feature = "trusty_sys" ) ]
10
- pub const PROT_WRITE : i32 = self :: trusty_sys:: MMAP_FLAG_PROT_WRITE as i32 ;
11
-
12
3
pub type size_t = usize ;
13
4
pub type ssize_t = isize ;
14
5
15
6
pub type off_t = i64 ;
16
7
17
- #[ cfg( any( target_arch = "aarch64" , target_arch = "arm" ) ) ]
18
- pub type c_char = u8 ;
19
- #[ cfg( target_arch = "x86_64" ) ]
20
- pub type c_char = i8 ;
8
+ cfg_if ! {
9
+ if #[ cfg( any( target_arch = "aarch64" , target_arch = "arm" ) ) ] {
10
+ pub type c_char = u8 ;
11
+ } else if #[ cfg( target_arch = "x86_64" ) ] {
12
+ pub type c_char = i8 ;
13
+ }
14
+ }
21
15
22
16
pub type c_schar = i8 ;
23
17
pub type c_uchar = u8 ;
@@ -26,15 +20,15 @@ pub type c_ushort = u16;
26
20
pub type c_int = i32 ;
27
21
pub type c_uint = u32 ;
28
22
29
- # [ cfg ( target_pointer_width = "32" ) ]
30
- pub type c_long = i32 ;
31
- # [ cfg ( target_pointer_width = "64" ) ]
32
- pub type c_long = i64 ;
33
-
34
- # [ cfg ( target_pointer_width = "32" ) ]
35
- pub type c_ulong = u32 ;
36
- # [ cfg ( target_pointer_width = "64" ) ]
37
- pub type c_ulong = u64 ;
23
+ cfg_if ! {
24
+ if # [ cfg ( target_pointer_width = "32" ) ] {
25
+ pub type c_long = i32 ;
26
+ pub type c_ulong = u32 ;
27
+ } else if # [ cfg ( target_pointer_width = "64" ) ] {
28
+ pub type c_long = i64 ;
29
+ pub type c_ulong = u64 ;
30
+ }
31
+ }
38
32
39
33
pub type c_longlong = i64 ;
40
34
pub type c_ulonglong = u64 ;
@@ -52,15 +46,21 @@ pub type c_int64_t = i64;
52
46
pub type time_t = c_long ;
53
47
54
48
pub type clockid_t = c_int ;
55
- pub const CLOCK_REALTIME : clockid_t = 0 ;
56
49
57
50
s ! {
51
+ pub struct iovec {
52
+ pub iov_base: * mut :: c_void,
53
+ pub iov_len: :: size_t,
54
+ }
55
+
58
56
pub struct timespec {
59
57
pub tv_sec: time_t,
60
58
pub tv_nsec: c_long,
61
59
}
62
60
}
63
61
62
+ pub const CLOCK_REALTIME : clockid_t = 0 ;
63
+
64
64
pub const STDOUT_FILENO : :: c_int = 1 ;
65
65
pub const STDERR_FILENO : :: c_int = 2 ;
66
66
@@ -92,10 +92,3 @@ extern "C" {
92
92
pub fn clock_gettime ( clk_id : :: clockid_t , tp : * mut :: timespec ) -> :: c_int ;
93
93
pub fn nanosleep ( rqtp : * const :: timespec , rmtp : * mut :: timespec ) -> :: c_int ;
94
94
}
95
-
96
- s ! {
97
- pub struct iovec {
98
- pub iov_base: * mut :: c_void,
99
- pub iov_len: :: size_t,
100
- }
101
- }
0 commit comments