]>
Commit | Line | Data |
---|---|---|
1b1a35ee | 1 | //! Linux-specific raw type definitions. |
d9579d0f AL |
2 | |
3 | #![stable(feature = "raw_ext", since = "1.1.0")] | |
60c5eb7d XL |
4 | #![rustc_deprecated( |
5 | since = "1.8.0", | |
6 | reason = "these type aliases are no longer supported by \ | |
7 | the standard library, the `libc` crate on \ | |
8 | crates.io should be used instead for the correct \ | |
9 | definitions" | |
10 | )] | |
7453a54e | 11 | #![allow(deprecated)] |
32a655c1 | 12 | #![allow(missing_debug_implementations)] |
d9579d0f | 13 | |
532ac7d7 | 14 | use crate::os::raw::c_ulong; |
92a42be0 | 15 | |
60c5eb7d XL |
16 | #[stable(feature = "raw_ext", since = "1.1.0")] |
17 | pub type dev_t = u64; | |
18 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
19 | pub type mode_t = u32; | |
d9579d0f | 20 | |
3157f602 XL |
21 | #[stable(feature = "pthread_t", since = "1.8.0")] |
22 | pub type pthread_t = c_ulong; | |
92a42be0 | 23 | |
d9579d0f | 24 | #[doc(inline)] |
92a42be0 | 25 | #[stable(feature = "raw_ext", since = "1.1.0")] |
60c5eb7d | 26 | pub use self::arch::{blkcnt_t, blksize_t, ino_t, nlink_t, off_t, stat, time_t}; |
d9579d0f | 27 | |
60c5eb7d XL |
28 | #[cfg(any( |
29 | target_arch = "x86", | |
30 | target_arch = "le32", | |
31 | target_arch = "powerpc", | |
1b1a35ee | 32 | target_arch = "sparc", |
60c5eb7d XL |
33 | target_arch = "arm", |
34 | target_arch = "asmjs", | |
35 | target_arch = "wasm32" | |
36 | ))] | |
d9579d0f | 37 | mod arch { |
532ac7d7 | 38 | use crate::os::raw::{c_long, c_short, c_uint}; |
d9579d0f | 39 | |
60c5eb7d XL |
40 | #[stable(feature = "raw_ext", since = "1.1.0")] |
41 | pub type blkcnt_t = u64; | |
42 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
43 | pub type blksize_t = u64; | |
44 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
45 | pub type ino_t = u64; | |
46 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
47 | pub type nlink_t = u64; | |
48 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
49 | pub type off_t = u64; | |
50 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
51 | pub type time_t = i64; | |
d9579d0f AL |
52 | |
53 | #[repr(C)] | |
b039eaaf | 54 | #[derive(Clone)] |
d9579d0f AL |
55 | #[stable(feature = "raw_ext", since = "1.1.0")] |
56 | pub struct stat { | |
57 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
7453a54e | 58 | pub st_dev: u64, |
d9579d0f AL |
59 | #[stable(feature = "raw_ext", since = "1.1.0")] |
60 | pub __pad1: c_short, | |
61 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
7453a54e | 62 | pub __st_ino: u32, |
d9579d0f | 63 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 64 | pub st_mode: u32, |
d9579d0f | 65 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 66 | pub st_nlink: u32, |
d9579d0f | 67 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 68 | pub st_uid: u32, |
d9579d0f | 69 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 70 | pub st_gid: u32, |
d9579d0f | 71 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 72 | pub st_rdev: u64, |
d9579d0f | 73 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 74 | pub __pad2: c_uint, |
d9579d0f | 75 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 76 | pub st_size: i64, |
d9579d0f | 77 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 78 | pub st_blksize: i32, |
d9579d0f | 79 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 80 | pub st_blocks: i64, |
d9579d0f | 81 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 82 | pub st_atime: i32, |
d9579d0f AL |
83 | #[stable(feature = "raw_ext", since = "1.1.0")] |
84 | pub st_atime_nsec: c_long, | |
85 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
7453a54e | 86 | pub st_mtime: i32, |
d9579d0f AL |
87 | #[stable(feature = "raw_ext", since = "1.1.0")] |
88 | pub st_mtime_nsec: c_long, | |
89 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
7453a54e | 90 | pub st_ctime: i32, |
d9579d0f AL |
91 | #[stable(feature = "raw_ext", since = "1.1.0")] |
92 | pub st_ctime_nsec: c_long, | |
93 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
7453a54e | 94 | pub st_ino: u64, |
d9579d0f AL |
95 | } |
96 | } | |
97 | ||
7453a54e | 98 | #[cfg(target_arch = "mips")] |
d9579d0f | 99 | mod arch { |
532ac7d7 | 100 | use crate::os::raw::{c_long, c_ulong}; |
d9579d0f | 101 | |
7453a54e | 102 | #[cfg(target_env = "musl")] |
60c5eb7d XL |
103 | #[stable(feature = "raw_ext", since = "1.1.0")] |
104 | pub type blkcnt_t = i64; | |
7453a54e | 105 | #[cfg(not(target_env = "musl"))] |
60c5eb7d XL |
106 | #[stable(feature = "raw_ext", since = "1.1.0")] |
107 | pub type blkcnt_t = u64; | |
108 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
109 | pub type blksize_t = u64; | |
7453a54e | 110 | #[cfg(target_env = "musl")] |
60c5eb7d XL |
111 | #[stable(feature = "raw_ext", since = "1.1.0")] |
112 | pub type ino_t = u64; | |
7453a54e | 113 | #[cfg(not(target_env = "musl"))] |
60c5eb7d XL |
114 | #[stable(feature = "raw_ext", since = "1.1.0")] |
115 | pub type ino_t = u64; | |
116 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
117 | pub type nlink_t = u64; | |
7453a54e | 118 | #[cfg(target_env = "musl")] |
60c5eb7d XL |
119 | #[stable(feature = "raw_ext", since = "1.1.0")] |
120 | pub type off_t = u64; | |
7453a54e | 121 | #[cfg(not(target_env = "musl"))] |
60c5eb7d XL |
122 | #[stable(feature = "raw_ext", since = "1.1.0")] |
123 | pub type off_t = u64; | |
124 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
125 | pub type time_t = i64; | |
d9579d0f AL |
126 | |
127 | #[repr(C)] | |
b039eaaf | 128 | #[derive(Clone)] |
d9579d0f AL |
129 | #[stable(feature = "raw_ext", since = "1.1.0")] |
130 | pub struct stat { | |
131 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
132 | pub st_dev: c_ulong, | |
133 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
134 | pub st_pad1: [c_long; 3], | |
135 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
7453a54e | 136 | pub st_ino: u64, |
d9579d0f | 137 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 138 | pub st_mode: u32, |
d9579d0f | 139 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 140 | pub st_nlink: u32, |
d9579d0f | 141 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 142 | pub st_uid: u32, |
d9579d0f | 143 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 144 | pub st_gid: u32, |
d9579d0f AL |
145 | #[stable(feature = "raw_ext", since = "1.1.0")] |
146 | pub st_rdev: c_ulong, | |
147 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
148 | pub st_pad2: [c_long; 2], | |
149 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
7453a54e | 150 | pub st_size: i64, |
d9579d0f | 151 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 152 | pub st_atime: i32, |
d9579d0f AL |
153 | #[stable(feature = "raw_ext", since = "1.1.0")] |
154 | pub st_atime_nsec: c_long, | |
155 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
7453a54e | 156 | pub st_mtime: i32, |
d9579d0f AL |
157 | #[stable(feature = "raw_ext", since = "1.1.0")] |
158 | pub st_mtime_nsec: c_long, | |
159 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
7453a54e | 160 | pub st_ctime: i32, |
d9579d0f AL |
161 | #[stable(feature = "raw_ext", since = "1.1.0")] |
162 | pub st_ctime_nsec: c_long, | |
163 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
7453a54e | 164 | pub st_blksize: i32, |
d9579d0f | 165 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 166 | pub st_blocks: i64, |
d9579d0f AL |
167 | #[stable(feature = "raw_ext", since = "1.1.0")] |
168 | pub st_pad5: [c_long; 14], | |
169 | } | |
170 | } | |
171 | ||
416331ca XL |
172 | #[cfg(target_arch = "hexagon")] |
173 | mod arch { | |
1b1a35ee | 174 | use crate::os::raw::{c_int, c_long, c_uint}; |
416331ca | 175 | |
60c5eb7d | 176 | #[stable(feature = "raw_ext", since = "1.1.0")] |
1b1a35ee | 177 | pub type blkcnt_t = i64; |
60c5eb7d XL |
178 | #[stable(feature = "raw_ext", since = "1.1.0")] |
179 | pub type blksize_t = c_long; | |
180 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
1b1a35ee | 181 | pub type ino_t = u64; |
60c5eb7d XL |
182 | #[stable(feature = "raw_ext", since = "1.1.0")] |
183 | pub type nlink_t = c_uint; | |
184 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
1b1a35ee | 185 | pub type off_t = i64; |
60c5eb7d | 186 | #[stable(feature = "raw_ext", since = "1.1.0")] |
1b1a35ee | 187 | pub type time_t = i64; |
416331ca XL |
188 | |
189 | #[repr(C)] | |
190 | #[derive(Clone)] | |
191 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
192 | pub struct stat { | |
193 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
1b1a35ee | 194 | pub st_dev: u64, |
416331ca | 195 | #[stable(feature = "raw_ext", since = "1.1.0")] |
1b1a35ee | 196 | pub st_ino: u64, |
416331ca | 197 | #[stable(feature = "raw_ext", since = "1.1.0")] |
1b1a35ee | 198 | pub st_mode: u32, |
416331ca | 199 | #[stable(feature = "raw_ext", since = "1.1.0")] |
1b1a35ee | 200 | pub st_nlink: u32, |
416331ca | 201 | #[stable(feature = "raw_ext", since = "1.1.0")] |
1b1a35ee | 202 | pub st_uid: u32, |
416331ca | 203 | #[stable(feature = "raw_ext", since = "1.1.0")] |
1b1a35ee | 204 | pub st_gid: u32, |
416331ca | 205 | #[stable(feature = "raw_ext", since = "1.1.0")] |
1b1a35ee | 206 | pub st_rdev: u64, |
416331ca | 207 | #[stable(feature = "raw_ext", since = "1.1.0")] |
1b1a35ee | 208 | pub __pad1: u32, |
416331ca | 209 | #[stable(feature = "raw_ext", since = "1.1.0")] |
1b1a35ee | 210 | pub st_size: i64, |
416331ca | 211 | #[stable(feature = "raw_ext", since = "1.1.0")] |
1b1a35ee | 212 | pub st_blksize: i32, |
416331ca | 213 | #[stable(feature = "raw_ext", since = "1.1.0")] |
1b1a35ee | 214 | pub __pad2: i32, |
416331ca | 215 | #[stable(feature = "raw_ext", since = "1.1.0")] |
1b1a35ee | 216 | pub st_blocks: i64, |
416331ca | 217 | #[stable(feature = "raw_ext", since = "1.1.0")] |
1b1a35ee | 218 | pub st_atime: i64, |
416331ca | 219 | #[stable(feature = "raw_ext", since = "1.1.0")] |
1b1a35ee | 220 | pub st_atime_nsec: c_long, |
416331ca | 221 | #[stable(feature = "raw_ext", since = "1.1.0")] |
1b1a35ee | 222 | pub st_mtime: i64, |
416331ca | 223 | #[stable(feature = "raw_ext", since = "1.1.0")] |
1b1a35ee | 224 | pub st_mtime_nsec: c_long, |
416331ca | 225 | #[stable(feature = "raw_ext", since = "1.1.0")] |
1b1a35ee | 226 | pub st_ctime: i64, |
416331ca | 227 | #[stable(feature = "raw_ext", since = "1.1.0")] |
1b1a35ee | 228 | pub st_ctime_nsec: c_long, |
416331ca | 229 | #[stable(feature = "raw_ext", since = "1.1.0")] |
1b1a35ee | 230 | pub __pad3: [c_int; 2], |
416331ca XL |
231 | } |
232 | } | |
233 | ||
dfeec247 XL |
234 | #[cfg(any( |
235 | target_arch = "mips64", | |
236 | target_arch = "s390x", | |
237 | target_arch = "sparc64", | |
1b1a35ee XL |
238 | target_arch = "riscv64", |
239 | target_arch = "riscv32" | |
dfeec247 | 240 | ))] |
9e0c209e | 241 | mod arch { |
60c5eb7d | 242 | pub use libc::{blkcnt_t, blksize_t, ino_t, nlink_t, off_t, stat, time_t}; |
9e0c209e SL |
243 | } |
244 | ||
d9579d0f AL |
245 | #[cfg(target_arch = "aarch64")] |
246 | mod arch { | |
60c5eb7d | 247 | use crate::os::raw::{c_int, c_long}; |
d9579d0f | 248 | |
60c5eb7d XL |
249 | #[stable(feature = "raw_ext", since = "1.1.0")] |
250 | pub type blkcnt_t = u64; | |
251 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
252 | pub type blksize_t = u64; | |
253 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
254 | pub type ino_t = u64; | |
255 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
256 | pub type nlink_t = u64; | |
257 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
258 | pub type off_t = u64; | |
259 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
260 | pub type time_t = i64; | |
d9579d0f AL |
261 | |
262 | #[repr(C)] | |
b039eaaf | 263 | #[derive(Clone)] |
d9579d0f AL |
264 | #[stable(feature = "raw_ext", since = "1.1.0")] |
265 | pub struct stat { | |
266 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
7453a54e | 267 | pub st_dev: u64, |
d9579d0f | 268 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 269 | pub st_ino: u64, |
d9579d0f | 270 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 271 | pub st_mode: u32, |
d9579d0f | 272 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 273 | pub st_nlink: u32, |
d9579d0f | 274 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 275 | pub st_uid: u32, |
d9579d0f | 276 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 277 | pub st_gid: u32, |
d9579d0f | 278 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 279 | pub st_rdev: u64, |
d9579d0f | 280 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 281 | pub __pad1: u64, |
d9579d0f | 282 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 283 | pub st_size: i64, |
d9579d0f | 284 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 285 | pub st_blksize: i32, |
d9579d0f AL |
286 | #[stable(feature = "raw_ext", since = "1.1.0")] |
287 | pub __pad2: c_int, | |
288 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
7453a54e | 289 | pub st_blocks: i64, |
d9579d0f | 290 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 291 | pub st_atime: i64, |
d9579d0f AL |
292 | #[stable(feature = "raw_ext", since = "1.1.0")] |
293 | pub st_atime_nsec: c_long, | |
294 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
7453a54e | 295 | pub st_mtime: i64, |
d9579d0f AL |
296 | #[stable(feature = "raw_ext", since = "1.1.0")] |
297 | pub st_mtime_nsec: c_long, | |
298 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
7453a54e | 299 | pub st_ctime: i64, |
d9579d0f AL |
300 | #[stable(feature = "raw_ext", since = "1.1.0")] |
301 | pub st_ctime_nsec: c_long, | |
302 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
303 | pub __unused: [c_int; 2], | |
304 | } | |
305 | } | |
306 | ||
7453a54e | 307 | #[cfg(any(target_arch = "x86_64", target_arch = "powerpc64"))] |
d9579d0f | 308 | mod arch { |
60c5eb7d | 309 | use crate::os::raw::{c_int, c_long}; |
d9579d0f | 310 | |
60c5eb7d XL |
311 | #[stable(feature = "raw_ext", since = "1.1.0")] |
312 | pub type blkcnt_t = u64; | |
313 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
314 | pub type blksize_t = u64; | |
315 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
316 | pub type ino_t = u64; | |
317 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
318 | pub type nlink_t = u64; | |
319 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
320 | pub type off_t = u64; | |
321 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
322 | pub type time_t = i64; | |
d9579d0f AL |
323 | |
324 | #[repr(C)] | |
b039eaaf | 325 | #[derive(Clone)] |
d9579d0f AL |
326 | #[stable(feature = "raw_ext", since = "1.1.0")] |
327 | pub struct stat { | |
328 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
7453a54e | 329 | pub st_dev: u64, |
d9579d0f | 330 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 331 | pub st_ino: u64, |
d9579d0f | 332 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 333 | pub st_nlink: u64, |
d9579d0f | 334 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 335 | pub st_mode: u32, |
d9579d0f | 336 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 337 | pub st_uid: u32, |
d9579d0f | 338 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 339 | pub st_gid: u32, |
d9579d0f AL |
340 | #[stable(feature = "raw_ext", since = "1.1.0")] |
341 | pub __pad0: c_int, | |
342 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
7453a54e | 343 | pub st_rdev: u64, |
d9579d0f | 344 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 345 | pub st_size: i64, |
d9579d0f | 346 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 347 | pub st_blksize: i64, |
d9579d0f | 348 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 349 | pub st_blocks: i64, |
d9579d0f | 350 | #[stable(feature = "raw_ext", since = "1.1.0")] |
7453a54e | 351 | pub st_atime: i64, |
d9579d0f AL |
352 | #[stable(feature = "raw_ext", since = "1.1.0")] |
353 | pub st_atime_nsec: c_long, | |
354 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
7453a54e | 355 | pub st_mtime: i64, |
d9579d0f AL |
356 | #[stable(feature = "raw_ext", since = "1.1.0")] |
357 | pub st_mtime_nsec: c_long, | |
358 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
7453a54e | 359 | pub st_ctime: i64, |
d9579d0f AL |
360 | #[stable(feature = "raw_ext", since = "1.1.0")] |
361 | pub st_ctime_nsec: c_long, | |
362 | #[stable(feature = "raw_ext", since = "1.1.0")] | |
363 | pub __unused: [c_long; 3], | |
364 | } | |
365 | } |