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