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