| 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 | __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 | )))] |
| 82 | __reserved: crate::__syscall_ulong_t, |
| 83 | pub sem_ctime: crate::time_t, |
| 84 | #[cfg (not(any( |
| 85 | target_arch = "aarch64" , |
| 86 | target_arch = "loongarch64" , |
| 87 | target_arch = "mips64" , |
| 88 | target_arch = "mips64r6" , |
| 89 | target_arch = "powerpc64" , |
| 90 | target_arch = "riscv64" , |
| 91 | target_arch = "sparc64" |
| 92 | )))] |
| 93 | __reserved2: crate::__syscall_ulong_t, |
| 94 | pub sem_nsems: crate::__syscall_ulong_t, |
| 95 | __glibc_reserved3: crate::__syscall_ulong_t, |
| 96 | __glibc_reserved4: crate::__syscall_ulong_t, |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8; |
| 101 | |
| 102 | pub const O_LARGEFILE: c_int = 0; |
| 103 | |
| 104 | cfg_if! { |
| 105 | if #[cfg(target_arch = "aarch64" )] { |
| 106 | mod aarch64; |
| 107 | pub use self::aarch64::*; |
| 108 | } else if #[cfg(any(target_arch = "powerpc64" ))] { |
| 109 | mod powerpc64; |
| 110 | pub use self::powerpc64::*; |
| 111 | } else if #[cfg(any(target_arch = "sparc64" ))] { |
| 112 | mod sparc64; |
| 113 | pub use self::sparc64::*; |
| 114 | } else if #[cfg(any(target_arch = "mips64" , target_arch = "mips64r6" ))] { |
| 115 | mod mips64; |
| 116 | pub use self::mips64::*; |
| 117 | } else if #[cfg(any(target_arch = "s390x" ))] { |
| 118 | mod s390x; |
| 119 | pub use self::s390x::*; |
| 120 | } else if #[cfg(any(target_arch = "x86_64" ))] { |
| 121 | mod x86_64; |
| 122 | pub use self::x86_64::*; |
| 123 | } else if #[cfg(any(target_arch = "riscv64" ))] { |
| 124 | mod riscv64; |
| 125 | pub use self::riscv64::*; |
| 126 | } else if #[cfg(any(target_arch = "loongarch64" ))] { |
| 127 | mod loongarch64; |
| 128 | pub use self::loongarch64::*; |
| 129 | } else { |
| 130 | // Unknown target_arch |
| 131 | } |
| 132 | } |
| 133 | |