| 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: Padding<u64>, |
| 67 |
__glibc_reserved5: Padding<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: Padding<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: Padding<crate::__syscall_ulong_t>, |
| 96 |
pub sem_nsems: crate::__syscall_ulong_t, |
| 97 |
__glibc_reserved3: Padding<crate::__syscall_ulong_t>, |
| 98 |
__glibc_reserved4: Padding<crate::__syscall_ulong_t>, |
| 99 |
} |
| 100 |
|
| 101 |
pub struct timex { |
| 102 |
pub modes: c_uint, |
| 103 |
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] |
| 104 |
pub offset: i64, |
| 105 |
#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] |
| 106 |
pub offset: c_long, |
| 107 |
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] |
| 108 |
pub freq: i64, |
| 109 |
#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] |
| 110 |
pub freq: c_long, |
| 111 |
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] |
| 112 |
pub maxerror: i64, |
| 113 |
#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] |
| 114 |
pub maxerror: c_long, |
| 115 |
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] |
| 116 |
pub esterror: i64, |
| 117 |
#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] |
| 118 |
pub esterror: c_long, |
| 119 |
pub status: c_int, |
| 120 |
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] |
| 121 |
pub constant: i64, |
| 122 |
#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] |
| 123 |
pub constant: c_long, |
| 124 |
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] |
| 125 |
pub precision: i64, |
| 126 |
#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] |
| 127 |
pub precision: c_long, |
| 128 |
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] |
| 129 |
pub tolerance: i64, |
| 130 |
#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] |
| 131 |
pub tolerance: c_long, |
| 132 |
pub time: crate::timeval, |
| 133 |
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] |
| 134 |
pub tick: i64, |
| 135 |
#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] |
| 136 |
pub tick: c_long, |
| 137 |
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] |
| 138 |
pub ppsfreq: i64, |
| 139 |
#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] |
| 140 |
pub ppsfreq: c_long, |
| 141 |
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] |
| 142 |
pub jitter: i64, |
| 143 |
#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] |
| 144 |
pub jitter: c_long, |
| 145 |
pub shift: c_int, |
| 146 |
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] |
| 147 |
pub stabil: i64, |
| 148 |
#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] |
| 149 |
pub stabil: c_long, |
| 150 |
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] |
| 151 |
pub jitcnt: i64, |
| 152 |
#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] |
| 153 |
pub jitcnt: c_long, |
| 154 |
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] |
| 155 |
pub calcnt: i64, |
| 156 |
#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] |
| 157 |
pub calcnt: c_long, |
| 158 |
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] |
| 159 |
pub errcnt: i64, |
| 160 |
#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] |
| 161 |
pub errcnt: c_long, |
| 162 |
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] |
| 163 |
pub stbcnt: i64, |
| 164 |
#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] |
| 165 |
pub stbcnt: c_long, |
| 166 |
pub tai: c_int, |
| 167 |
pub __unused1: i32, |
| 168 |
pub __unused2: i32, |
| 169 |
pub __unused3: i32, |
| 170 |
pub __unused4: i32, |
| 171 |
pub __unused5: i32, |
| 172 |
pub __unused6: i32, |
| 173 |
pub __unused7: i32, |
| 174 |
pub __unused8: i32, |
| 175 |
pub __unused9: i32, |
| 176 |
pub __unused10: i32, |
| 177 |
pub __unused11: i32, |
| 178 |
} |
| 179 |
} |
| 180 |
|
| 181 |
pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8; |
| 182 |
|
| 183 |
pub const O_LARGEFILE: c_int = 0; |
| 184 |
|
| 185 |
cfg_if! { |
| 186 |
if #[cfg(target_arch = "aarch64")] { |
| 187 |
mod aarch64; |
| 188 |
pub use self::aarch64::*; |
| 189 |
} else if #[cfg(any(target_arch = "powerpc64"))] { |
| 190 |
mod powerpc64; |
| 191 |
pub use self::powerpc64::*; |
| 192 |
} else if #[cfg(any(target_arch = "sparc64"))] { |
| 193 |
mod sparc64; |
| 194 |
pub use self::sparc64::*; |
| 195 |
} else if #[cfg(any(target_arch = "mips64", target_arch = "mips64r6"))] { |
| 196 |
mod mips64; |
| 197 |
pub use self::mips64::*; |
| 198 |
} else if #[cfg(any(target_arch = "s390x"))] { |
| 199 |
mod s390x; |
| 200 |
pub use self::s390x::*; |
| 201 |
} else if #[cfg(target_arch = "x86_64")] { |
| 202 |
mod x86_64; |
| 203 |
pub use self::x86_64::*; |
| 204 |
} else if #[cfg(any(target_arch = "riscv64"))] { |
| 205 |
mod riscv64; |
| 206 |
pub use self::riscv64::*; |
| 207 |
} else if #[cfg(any(target_arch = "loongarch64"))] { |
| 208 |
mod loongarch64; |
| 209 |
pub use self::loongarch64::*; |
| 210 |
} else { |
| 211 |
// Unknown target_arch |
| 212 |
} |
| 213 |
} |