|
1 | | -// The following definitions are correct for aarch64 and may be wrong for x86_64 |
| 1 | +// The following definitions are correct for aarch64 and x86_64, |
| 2 | +// but may be wrong for mips64 |
2 | 3 |
|
3 | | -pub type c_char = u8; |
4 | 4 | pub type c_long = i64; |
5 | 5 | pub type c_ulong = u64; |
6 | 6 | pub type mode_t = u32; |
7 | 7 | pub type off64_t = i64; |
8 | 8 | pub type socklen_t = u32; |
9 | | -pub type wchar_t = u32; |
10 | 9 |
|
11 | 10 | s! { |
12 | 11 | pub struct sigset_t { |
|
25 | 24 | pub rlim_max: ::c_ulonglong, |
26 | 25 | } |
27 | 26 |
|
28 | | - pub struct stat { |
29 | | - pub st_dev: ::dev_t, |
30 | | - pub st_ino: ::ino_t, |
31 | | - pub st_mode: ::c_uint, |
32 | | - pub st_nlink: ::c_uint, |
33 | | - pub st_uid: ::uid_t, |
34 | | - pub st_gid: ::gid_t, |
35 | | - pub st_rdev: ::dev_t, |
36 | | - __pad1: ::c_ulong, |
37 | | - pub st_size: ::off64_t, |
38 | | - pub st_blksize: ::c_int, |
39 | | - __pad2: ::c_int, |
40 | | - pub st_blocks: ::c_long, |
41 | | - pub st_atime: ::time_t, |
42 | | - pub st_atime_nsec: ::c_ulong, |
43 | | - pub st_mtime: ::time_t, |
44 | | - pub st_mtime_nsec: ::c_ulong, |
45 | | - pub st_ctime: ::time_t, |
46 | | - pub st_ctime_nsec: ::c_ulong, |
47 | | - __unused4: ::c_uint, |
48 | | - __unused5: ::c_uint, |
49 | | - } |
50 | | - |
51 | | - pub struct stat64 { |
52 | | - pub st_dev: ::dev_t, |
53 | | - pub st_ino: ::ino_t, |
54 | | - pub st_mode: ::c_uint, |
55 | | - pub st_nlink: ::c_uint, |
56 | | - pub st_uid: ::uid_t, |
57 | | - pub st_gid: ::gid_t, |
58 | | - pub st_rdev: ::dev_t, |
59 | | - __pad1: ::c_ulong, |
60 | | - pub st_size: ::off64_t, |
61 | | - pub st_blksize: ::c_int, |
62 | | - __pad2: ::c_int, |
63 | | - pub st_blocks: ::c_long, |
64 | | - pub st_atime: ::time_t, |
65 | | - pub st_atime_nsec: ::c_ulong, |
66 | | - pub st_mtime: ::time_t, |
67 | | - pub st_mtime_nsec: ::c_ulong, |
68 | | - pub st_ctime: ::time_t, |
69 | | - pub st_ctime_nsec: ::c_ulong, |
70 | | - __unused4: ::c_uint, |
71 | | - __unused5: ::c_uint, |
72 | | - } |
73 | | - |
74 | 27 | pub struct pthread_attr_t { |
75 | 28 | pub flags: ::uint32_t, |
76 | 29 | pub stack_base: *mut ::c_void, |
@@ -143,15 +96,10 @@ s! { |
143 | 96 | } |
144 | 97 | } |
145 | 98 |
|
146 | | -pub const O_DIRECT: ::c_int = 0x10000; |
147 | | -pub const O_DIRECTORY: ::c_int = 0x4000; |
148 | | -pub const O_NOFOLLOW: ::c_int = 0x8000; |
149 | | - |
150 | 99 | pub const RTLD_GLOBAL: ::c_int = 0x00100; |
151 | 100 | pub const RTLD_NOW: ::c_int = 2; |
152 | 101 | pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void; |
153 | 102 |
|
154 | | -pub const SYS_gettid: ::c_long = 178; |
155 | 103 | pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { |
156 | 104 | value: 0, |
157 | 105 | __reserved: [0; 36], |
@@ -200,3 +148,15 @@ extern { |
200 | 148 | // the return type should be ::ssize_t, but it is c_int! |
201 | 149 | pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::c_int; |
202 | 150 | } |
| 151 | + |
| 152 | +cfg_if! { |
| 153 | + if #[cfg(target_arch = "x86_64")] { |
| 154 | + mod x86_64; |
| 155 | + pub use self::x86_64::*; |
| 156 | + } else if #[cfg(target_arch = "aarch64")] { |
| 157 | + mod aarch64; |
| 158 | + pub use self::aarch64::*; |
| 159 | + } else { |
| 160 | + // Unknown target_arch |
| 161 | + } |
| 162 | +} |
0 commit comments