1 //! Linux-specific raw type definitions. 2 3 #![deprecated( 4 since = "1.8.0", 5 note = "these type aliases are no longer supported by \ 6 the standard library, the `libc` crate on \ 7 crates.io should be used instead for the correct \ 8 definitions" 9 )] 10 #![allow(deprecated)] 11 12 use crate::std::os::raw::c_ulong; 13 14 pub type dev_t = u64; 15 pub type mode_t = u32; 16 17 pub type pthread_t = c_ulong; 18 19 #[doc(inline)] 20 pub use self::arch::{blkcnt_t, blksize_t, ino_t, nlink_t, off_t, stat, time_t}; 21 22 #[cfg(any( 23 target_arch = "x86", 24 target_arch = "m68k", 25 target_arch = "csky", 26 target_arch = "powerpc", 27 target_arch = "sparc", 28 target_arch = "arm", 29 target_arch = "asmjs", 30 target_arch = "wasm32" 31 ))] 32 mod arch { 33 use crate::std::os::raw::{c_long, c_short, c_uint}; 34 35 pub type blkcnt_t = u64; 36 pub type blksize_t = u64; 37 pub type ino_t = u64; 38 pub type nlink_t = u64; 39 pub type off_t = u64; 40 pub type time_t = i64; 41 42 #[repr(C)] 43 #[derive(Clone)] 44 pub struct stat { 45 pub st_dev: u64, 46 pub __pad1: c_short, 47 pub __st_ino: u32, 48 pub st_mode: u32, 49 pub st_nlink: u32, 50 pub st_uid: u32, 51 pub st_gid: u32, 52 pub st_rdev: u64, 53 pub __pad2: c_uint, 54 pub st_size: i64, 55 pub st_blksize: i32, 56 pub st_blocks: i64, 57 pub st_atime: i32, 58 pub st_atime_nsec: c_long, 59 pub st_mtime: i32, 60 pub st_mtime_nsec: c_long, 61 pub st_ctime: i32, 62 pub st_ctime_nsec: c_long, 63 pub st_ino: u64, 64 } 65 } 66 67 #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] 68 mod arch { 69 use crate::std::os::raw::{c_long, c_ulong}; 70 71 #[cfg(target_env = "musl")] 72 pub type blkcnt_t = i64; 73 #[cfg(not(target_env = "musl"))] 74 pub type blkcnt_t = u64; 75 pub type blksize_t = u64; 76 #[cfg(target_env = "musl")] 77 pub type ino_t = u64; 78 #[cfg(not(target_env = "musl"))] 79 pub type ino_t = u64; 80 pub type nlink_t = u64; 81 #[cfg(target_env = "musl")] 82 pub type off_t = u64; 83 #[cfg(not(target_env = "musl"))] 84 pub type off_t = u64; 85 pub type time_t = i64; 86 87 #[repr(C)] 88 #[derive(Clone)] 89 pub struct stat { 90 pub st_dev: c_ulong, 91 pub st_pad1: [c_long; 3], 92 pub st_ino: u64, 93 pub st_mode: u32, 94 pub st_nlink: u32, 95 pub st_uid: u32, 96 pub st_gid: u32, 97 pub st_rdev: c_ulong, 98 pub st_pad2: [c_long; 2], 99 pub st_size: i64, 100 pub st_atime: i32, 101 pub st_atime_nsec: c_long, 102 pub st_mtime: i32, 103 pub st_mtime_nsec: c_long, 104 pub st_ctime: i32, 105 pub st_ctime_nsec: c_long, 106 pub st_blksize: i32, 107 pub st_blocks: i64, 108 pub st_pad5: [c_long; 14], 109 } 110 } 111 112 #[cfg(target_arch = "hexagon")] 113 mod arch { 114 use crate::std::os::raw::{c_int, c_long, c_uint}; 115 116 pub type blkcnt_t = i64; 117 pub type blksize_t = c_long; 118 pub type ino_t = u64; 119 pub type nlink_t = c_uint; 120 pub type off_t = i64; 121 pub type time_t = i64; 122 123 #[repr(C)] 124 #[derive(Clone)] 125 pub struct stat { 126 pub st_dev: u64, 127 pub st_ino: u64, 128 pub st_mode: u32, 129 pub st_nlink: u32, 130 pub st_uid: u32, 131 pub st_gid: u32, 132 pub st_rdev: u64, 133 pub __pad1: u32, 134 pub st_size: i64, 135 pub st_blksize: i32, 136 pub __pad2: i32, 137 pub st_blocks: i64, 138 pub st_atime: i64, 139 pub st_atime_nsec: c_long, 140 pub st_mtime: i64, 141 pub st_mtime_nsec: c_long, 142 pub st_ctime: i64, 143 pub st_ctime_nsec: c_long, 144 pub __pad3: [c_int; 2], 145 } 146 } 147 148 #[cfg(any( 149 target_arch = "loongarch64", 150 target_arch = "mips64", 151 target_arch = "mips64r6", 152 target_arch = "s390x", 153 target_arch = "sparc64", 154 target_arch = "riscv64", 155 target_arch = "riscv32" 156 ))] 157 mod arch { 158 pub use dlibc::{blkcnt_t, blksize_t, ino_t, nlink_t, off_t, stat, time_t}; 159 } 160 161 #[cfg(target_arch = "aarch64")] 162 mod arch { 163 use crate::std::os::raw::{c_int, c_long}; 164 165 pub type blkcnt_t = i64; 166 pub type blksize_t = i32; 167 pub type ino_t = u64; 168 pub type nlink_t = u32; 169 pub type off_t = i64; 170 pub type time_t = c_long; 171 172 #[repr(C)] 173 #[derive(Clone)] 174 pub struct stat { 175 pub st_dev: u64, 176 pub st_ino: u64, 177 pub st_mode: u32, 178 pub st_nlink: u32, 179 pub st_uid: u32, 180 pub st_gid: u32, 181 pub st_rdev: u64, 182 pub __pad1: u64, 183 pub st_size: i64, 184 pub st_blksize: i32, 185 pub __pad2: c_int, 186 pub st_blocks: i64, 187 pub st_atime: time_t, 188 pub st_atime_nsec: c_long, 189 pub st_mtime: time_t, 190 pub st_mtime_nsec: c_long, 191 pub st_ctime: time_t, 192 pub st_ctime_nsec: c_long, 193 pub __unused: [c_int; 2], 194 } 195 } 196 197 #[cfg(any(target_arch = "x86_64", target_arch = "powerpc64"))] 198 mod arch { 199 use crate::std::os::raw::{c_int, c_long}; 200 201 pub type blkcnt_t = u64; 202 pub type blksize_t = u64; 203 pub type ino_t = u64; 204 pub type nlink_t = u64; 205 pub type off_t = u64; 206 pub type time_t = i64; 207 208 #[repr(C)] 209 #[derive(Clone)] 210 pub struct stat { 211 pub st_dev: u64, 212 pub st_ino: u64, 213 pub st_nlink: u64, 214 pub st_mode: u32, 215 pub st_uid: u32, 216 pub st_gid: u32, 217 pub __pad0: c_int, 218 pub st_rdev: u64, 219 pub st_size: i64, 220 pub st_blksize: i64, 221 pub st_blocks: i64, 222 pub st_atime: i64, 223 pub st_atime_nsec: c_long, 224 pub st_mtime: i64, 225 pub st_mtime_nsec: c_long, 226 pub st_ctime: i64, 227 pub st_ctime_nsec: c_long, 228 pub __unused: [c_long; 3], 229 } 230 } 231