std/os/linux/
raw.rs

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

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy