1 | //! 64-bit specific definitions for linux-like values |
2 | |
3 | use crate::prelude::*; |
4 | |
5 | pub type ino_t = u64; |
6 | pub type off_t = i64; |
7 | pub type blkcnt_t = i64; |
8 | pub type shmatt_t = u64; |
9 | pub type msgqnum_t = u64; |
10 | pub type msglen_t = u64; |
11 | pub type fsblkcnt_t = u64; |
12 | pub type fsfilcnt_t = u64; |
13 | pub type rlim_t = u64; |
14 | #[cfg (all(target_arch = "x86_64" , target_pointer_width = "32" ))] |
15 | pub type __syscall_ulong_t = c_ulonglong; |
16 | #[cfg (not(all(target_arch = "x86_64" , target_pointer_width = "32" )))] |
17 | pub type __syscall_ulong_t = c_ulong; |
18 | |
19 | cfg_if! { |
20 | if #[cfg(all(target_arch = "aarch64" , target_pointer_width = "32" ))] { |
21 | pub type clock_t = i32; |
22 | pub type time_t = i32; |
23 | pub type __fsword_t = i32; |
24 | } else { |
25 | pub type __fsword_t = i64; |
26 | pub type clock_t = i64; |
27 | pub type time_t = i64; |
28 | } |
29 | } |
30 | |
31 | s! { |
32 | pub struct sigset_t { |
33 | #[cfg (target_pointer_width = "32" )] |
34 | __val: [u32; 32], |
35 | #[cfg (target_pointer_width = "64" )] |
36 | __val: [u64; 16], |
37 | } |
38 | |
39 | pub struct sysinfo { |
40 | pub uptime: i64, |
41 | pub loads: [u64; 3], |
42 | pub totalram: u64, |
43 | pub freeram: u64, |
44 | pub sharedram: u64, |
45 | pub bufferram: u64, |
46 | pub totalswap: u64, |
47 | pub freeswap: u64, |
48 | pub procs: c_ushort, |
49 | pub pad: c_ushort, |
50 | pub totalhigh: u64, |
51 | pub freehigh: u64, |
52 | pub mem_unit: c_uint, |
53 | pub _f: [c_char; 0], |
54 | } |
55 | |
56 | pub struct msqid_ds { |
57 | pub msg_perm: crate::ipc_perm, |
58 | pub msg_stime: crate::time_t, |
59 | pub msg_rtime: crate::time_t, |
60 | pub msg_ctime: crate::time_t, |
61 | pub __msg_cbytes: u64, |
62 | pub msg_qnum: crate::msgqnum_t, |
63 | pub msg_qbytes: crate::msglen_t, |
64 | pub msg_lspid: crate::pid_t, |
65 | pub msg_lrpid: crate::pid_t, |
66 | __glibc_reserved4: u64, |
67 | __glibc_reserved5: u64, |
68 | } |
69 | |
70 | pub struct semid_ds { |
71 | pub sem_perm: ipc_perm, |
72 | pub sem_otime: crate::time_t, |
73 | #[cfg (not(any( |
74 | target_arch = "aarch64" , |
75 | target_arch = "loongarch64" , |
76 | target_arch = "mips64" , |
77 | target_arch = "mips64r6" , |
78 | target_arch = "powerpc64" , |
79 | target_arch = "riscv64" , |
80 | target_arch = "sparc64" , |
81 | target_arch = "s390x" , |
82 | )))] |
83 | __reserved: crate::__syscall_ulong_t, |
84 | pub sem_ctime: crate::time_t, |
85 | #[cfg (not(any( |
86 | target_arch = "aarch64" , |
87 | target_arch = "loongarch64" , |
88 | target_arch = "mips64" , |
89 | target_arch = "mips64r6" , |
90 | target_arch = "powerpc64" , |
91 | target_arch = "riscv64" , |
92 | target_arch = "sparc64" , |
93 | target_arch = "s390x" , |
94 | )))] |
95 | __reserved2: crate::__syscall_ulong_t, |
96 | pub sem_nsems: crate::__syscall_ulong_t, |
97 | __glibc_reserved3: crate::__syscall_ulong_t, |
98 | __glibc_reserved4: crate::__syscall_ulong_t, |
99 | } |
100 | } |
101 | |
102 | pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8; |
103 | |
104 | pub const O_LARGEFILE: c_int = 0; |
105 | |
106 | cfg_if! { |
107 | if #[cfg(target_arch = "aarch64" )] { |
108 | mod aarch64; |
109 | pub use self::aarch64::*; |
110 | } else if #[cfg(any(target_arch = "powerpc64" ))] { |
111 | mod powerpc64; |
112 | pub use self::powerpc64::*; |
113 | } else if #[cfg(any(target_arch = "sparc64" ))] { |
114 | mod sparc64; |
115 | pub use self::sparc64::*; |
116 | } else if #[cfg(any(target_arch = "mips64" , target_arch = "mips64r6" ))] { |
117 | mod mips64; |
118 | pub use self::mips64::*; |
119 | } else if #[cfg(any(target_arch = "s390x" ))] { |
120 | mod s390x; |
121 | pub use self::s390x::*; |
122 | } else if #[cfg(any(target_arch = "x86_64" ))] { |
123 | mod x86_64; |
124 | pub use self::x86_64::*; |
125 | } else if #[cfg(any(target_arch = "riscv64" ))] { |
126 | mod riscv64; |
127 | pub use self::riscv64::*; |
128 | } else if #[cfg(any(target_arch = "loongarch64" ))] { |
129 | mod loongarch64; |
130 | pub use self::loongarch64::*; |
131 | } else { |
132 | // Unknown target_arch |
133 | } |
134 | } |
135 | |