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