|
| 1 | +#[cfg(any(target_arch = "x86", |
| 2 | + target_arch = "arm", |
| 3 | + target_arch = "asmjs"))] |
| 4 | +pub type c_long = i32; |
| 5 | +#[cfg(any(target_arch = "x86", |
| 6 | + target_arch = "arm", |
| 7 | + target_arch = "asmjs"))] |
| 8 | +pub type c_ulong = u32; |
| 9 | +#[cfg(any(target_arch = "x86_64"))] |
1 | 10 | pub type c_long = i64;
|
| 11 | +#[cfg(any(target_arch = "x86_64"))] |
2 | 12 | pub type c_ulong = u64;
|
3 |
| -pub type clock_t = i64; |
4 |
| -pub type time_t = i64; |
5 |
| -pub type suseconds_t = i64; |
| 13 | + |
| 14 | +pub type clock_t = c_long; |
| 15 | +pub type time_t = c_long; |
| 16 | +pub type suseconds_t = c_long; |
6 | 17 | pub type ino_t = u64;
|
7 | 18 | pub type off_t = i64;
|
8 | 19 | pub type blkcnt_t = i64;
|
| 20 | + |
| 21 | +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] |
9 | 22 | pub type c_char = i8;
|
| 23 | + |
| 24 | +#[cfg(any(target_arch = "arm", |
| 25 | + target_arch = "asmjs"))] |
| 26 | +pub type c_char = u8; |
| 27 | + |
| 28 | +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] |
10 | 29 | pub type wchar_t = i32;
|
11 |
| -pub type nlink_t = u64; |
12 |
| -pub type blksize_t = i64; |
13 | 30 |
|
14 |
| -s! { |
15 |
| - pub struct stat { |
16 |
| - pub st_dev: ::dev_t, |
17 |
| - pub st_ino: ::ino_t, |
18 |
| - pub st_nlink: ::nlink_t, |
19 |
| - pub st_mode: ::mode_t, |
20 |
| - pub st_uid: ::uid_t, |
21 |
| - pub st_gid: ::gid_t, |
22 |
| - __pad0: ::c_int, |
23 |
| - pub st_rdev: ::dev_t, |
24 |
| - pub st_size: ::off_t, |
25 |
| - pub st_blksize: ::blksize_t, |
26 |
| - pub st_blocks: ::blkcnt_t, |
27 |
| - pub st_atime: ::time_t, |
28 |
| - pub st_atime_nsec: ::c_long, |
29 |
| - pub st_mtime: ::time_t, |
30 |
| - pub st_mtime_nsec: ::c_long, |
31 |
| - pub st_ctime: ::time_t, |
32 |
| - pub st_ctime_nsec: ::c_long, |
33 |
| - __unused: [::c_long; 3], |
34 |
| - } |
| 31 | +#[cfg(any(target_arch = "arm", |
| 32 | + target_arch = "asmjs"))] |
| 33 | +pub type wchar_t = u32; |
35 | 34 |
|
36 |
| - pub struct stat64 { |
37 |
| - pub st_dev: ::dev_t, |
38 |
| - pub st_ino: ::ino64_t, |
39 |
| - pub st_nlink: ::nlink_t, |
40 |
| - pub st_mode: ::mode_t, |
41 |
| - pub st_uid: ::uid_t, |
42 |
| - pub st_gid: ::gid_t, |
43 |
| - __pad0: ::c_int, |
44 |
| - pub st_rdev: ::dev_t, |
45 |
| - pub st_size: ::off_t, |
46 |
| - pub st_blksize: ::blksize_t, |
47 |
| - pub st_blocks: ::blkcnt64_t, |
48 |
| - pub st_atime: ::time_t, |
49 |
| - pub st_atime_nsec: ::c_long, |
50 |
| - pub st_mtime: ::time_t, |
51 |
| - pub st_mtime_nsec: ::c_long, |
52 |
| - pub st_ctime: ::time_t, |
53 |
| - pub st_ctime_nsec: ::c_long, |
54 |
| - __reserved: [::c_long; 3], |
55 |
| - } |
| 35 | +pub type nlink_t = ::c_uint; |
56 | 36 |
|
57 |
| - pub struct pthread_attr_t { |
58 |
| - __size: [u64; 7] |
59 |
| - } |
| 37 | +#[cfg(not(target_arch = "aarch64"))] |
| 38 | +pub type blksize_t = c_long; |
60 | 39 |
|
61 |
| - pub struct sigset_t { |
62 |
| - __val: [::c_ulong; 16], |
63 |
| - } |
| 40 | +pub type fsblkcnt_t = ::c_ulonglong; |
| 41 | +pub type fsfilcnt_t = ::c_ulonglong; |
64 | 42 |
|
| 43 | +s! { |
65 | 44 | pub struct sigaction {
|
66 | 45 | pub sa_sigaction: ::sighandler_t,
|
67 | 46 | pub sa_mask: ::sigset_t,
|
|
95 | 74 | __unused2: ::c_long
|
96 | 75 | }
|
97 | 76 |
|
98 |
| - pub struct shmid_ds { |
99 |
| - pub shm_perm: ::ipc_perm, |
100 |
| - pub shm_segsz: ::size_t, |
101 |
| - pub shm_atime: ::time_t, |
102 |
| - pub shm_dtime: ::time_t, |
103 |
| - pub shm_ctime: ::time_t, |
104 |
| - pub shm_cpid: ::pid_t, |
105 |
| - pub shm_lpid: ::pid_t, |
106 |
| - pub shm_nattch: ::c_ulong, |
107 |
| - __pad1: ::c_ulong, |
108 |
| - __pad2: ::c_ulong, |
109 |
| - } |
110 |
| - |
111 | 77 | pub struct statfs {
|
112 | 78 | pub f_type: ::c_ulong,
|
113 | 79 | pub f_bsize: ::c_ulong,
|
|
123 | 89 | pub f_spare: [::c_ulong; 4],
|
124 | 90 | }
|
125 | 91 |
|
126 |
| - pub struct msghdr { |
127 |
| - pub msg_name: *mut ::c_void, |
128 |
| - pub msg_namelen: ::socklen_t, |
129 |
| - pub msg_iov: *mut ::iovec, |
130 |
| - pub msg_iovlen: ::c_int, |
131 |
| - __pad1: ::c_int, |
132 |
| - pub msg_control: *mut ::c_void, |
133 |
| - pub msg_controllen: ::socklen_t, |
134 |
| - __pad2: ::socklen_t, |
135 |
| - pub msg_flags: ::c_int, |
136 |
| - } |
137 |
| - |
138 | 92 | pub struct termios {
|
139 | 93 | pub c_iflag: ::tcflag_t,
|
140 | 94 | pub c_oflag: ::tcflag_t,
|
@@ -351,10 +305,18 @@ pub const SIG_UNBLOCK: ::c_int = 0x01;
|
351 | 305 | pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01;
|
352 | 306 | pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02;
|
353 | 307 |
|
354 |
| -pub const _SC_2_C_VERSION: ::c_int = 96; |
355 |
| - |
| 308 | +#[cfg(any(target_arch = "x86_64"))] |
356 | 309 | pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
|
| 310 | +#[cfg(any(target_arch = "x86", |
| 311 | + target_arch = "arm", |
| 312 | + target_arch = "asmjs"))] |
| 313 | +pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32; |
| 314 | +#[cfg(any(target_arch = "x86_64"))] |
357 | 315 | pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
|
| 316 | +#[cfg(any(target_arch = "x86", |
| 317 | + target_arch = "arm", |
| 318 | + target_arch = "asmjs"))] |
| 319 | +pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24; |
358 | 320 | pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
|
359 | 321 |
|
360 | 322 | pub const CPU_SETSIZE: ::c_int = 128;
|
@@ -408,7 +370,12 @@ pub const PTRACE_SETREGS: ::c_uint = 13;
|
408 | 370 |
|
409 | 371 | pub const EFD_NONBLOCK: ::c_int = 0x800;
|
410 | 372 |
|
| 373 | +#[cfg(any(target_arch = "x86_64"))] |
411 | 374 | pub const F_GETLK: ::c_int = 5;
|
| 375 | +#[cfg(any(target_arch = "x86", |
| 376 | + target_arch = "arm", |
| 377 | + target_arch = "asmjs"))] |
| 378 | +pub const F_GETLK: ::c_int = 12; |
412 | 379 | pub const F_GETOWN: ::c_int = 9;
|
413 | 380 | pub const F_SETOWN: ::c_int = 8;
|
414 | 381 |
|
@@ -438,3 +405,15 @@ extern {
|
438 | 405 | pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
|
439 | 406 | pub fn ptrace(request: ::c_int, ...) -> ::c_long;
|
440 | 407 | }
|
| 408 | + |
| 409 | +cfg_if! { |
| 410 | + if #[cfg(any(target_arch = "x86_64"))] { |
| 411 | + mod b64; |
| 412 | + pub use self::b64::*; |
| 413 | + } else if #[cfg(any(target_arch = "x86", |
| 414 | + target_arch = "arm", |
| 415 | + target_arch = "asmjs"))] { |
| 416 | + mod b32; |
| 417 | + pub use self::b32::*; |
| 418 | + } else { } |
| 419 | +} |
0 commit comments