1 //! Linux-specific raw type definitions.
2 
3 #![stable(feature = "raw_ext", since = "1.1.0")]
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 )]
11 #![allow(deprecated)]
12 
13 use crate::os::raw::c_ulong;
14 
15 #[stable(feature = "raw_ext", since = "1.1.0")]
16 pub type dev_t = u64;
17 #[stable(feature = "raw_ext", since = "1.1.0")]
18 pub type mode_t = u32;
19 
20 #[stable(feature = "pthread_t", since = "1.8.0")]
21 pub type pthread_t = c_ulong;
22 
23 #[doc(inline)]
24 #[stable(feature = "raw_ext", since = "1.1.0")]
25 pub 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 = "le32",
30     target_arch = "m68k",
31     target_arch = "powerpc",
32     target_arch = "sparc",
33     target_arch = "arm",
34     target_arch = "asmjs",
35     target_arch = "wasm32"
36 ))]
37 mod arch {
38     use crate::os::raw::{c_long, c_short, c_uint};
39 
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;
52 
53     #[repr(C)]
54     #[derive(Clone)]
55     #[stable(feature = "raw_ext", since = "1.1.0")]
56     pub struct stat {
57         #[stable(feature = "raw_ext", since = "1.1.0")]
58         pub st_dev: u64,
59         #[stable(feature = "raw_ext", since = "1.1.0")]
60         pub __pad1: c_short,
61         #[stable(feature = "raw_ext", since = "1.1.0")]
62         pub __st_ino: u32,
63         #[stable(feature = "raw_ext", since = "1.1.0")]
64         pub st_mode: u32,
65         #[stable(feature = "raw_ext", since = "1.1.0")]
66         pub st_nlink: u32,
67         #[stable(feature = "raw_ext", since = "1.1.0")]
68         pub st_uid: u32,
69         #[stable(feature = "raw_ext", since = "1.1.0")]
70         pub st_gid: u32,
71         #[stable(feature = "raw_ext", since = "1.1.0")]
72         pub st_rdev: u64,
73         #[stable(feature = "raw_ext", since = "1.1.0")]
74         pub __pad2: c_uint,
75         #[stable(feature = "raw_ext", since = "1.1.0")]
76         pub st_size: i64,
77         #[stable(feature = "raw_ext", since = "1.1.0")]
78         pub st_blksize: i32,
79         #[stable(feature = "raw_ext", since = "1.1.0")]
80         pub st_blocks: i64,
81         #[stable(feature = "raw_ext", since = "1.1.0")]
82         pub st_atime: i32,
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")]
86         pub st_mtime: i32,
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")]
90         pub st_ctime: i32,
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")]
94         pub st_ino: u64,
95     }
96 }
97 
98 #[cfg(target_arch = "mips")]
99 mod arch {
100     use crate::os::raw::{c_long, c_ulong};
101 
102     #[cfg(target_env = "musl")]
103     #[stable(feature = "raw_ext", since = "1.1.0")]
104     pub type blkcnt_t = i64;
105     #[cfg(not(target_env = "musl"))]
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;
110     #[cfg(target_env = "musl")]
111     #[stable(feature = "raw_ext", since = "1.1.0")]
112     pub type ino_t = u64;
113     #[cfg(not(target_env = "musl"))]
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;
118     #[cfg(target_env = "musl")]
119     #[stable(feature = "raw_ext", since = "1.1.0")]
120     pub type off_t = u64;
121     #[cfg(not(target_env = "musl"))]
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;
126 
127     #[repr(C)]
128     #[derive(Clone)]
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")]
136         pub st_ino: u64,
137         #[stable(feature = "raw_ext", since = "1.1.0")]
138         pub st_mode: u32,
139         #[stable(feature = "raw_ext", since = "1.1.0")]
140         pub st_nlink: u32,
141         #[stable(feature = "raw_ext", since = "1.1.0")]
142         pub st_uid: u32,
143         #[stable(feature = "raw_ext", since = "1.1.0")]
144         pub st_gid: u32,
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")]
150         pub st_size: i64,
151         #[stable(feature = "raw_ext", since = "1.1.0")]
152         pub st_atime: i32,
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")]
156         pub st_mtime: i32,
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")]
160         pub st_ctime: i32,
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")]
164         pub st_blksize: i32,
165         #[stable(feature = "raw_ext", since = "1.1.0")]
166         pub st_blocks: i64,
167         #[stable(feature = "raw_ext", since = "1.1.0")]
168         pub st_pad5: [c_long; 14],
169     }
170 }
171 
172 #[cfg(target_arch = "hexagon")]
173 mod arch {
174     use crate::os::raw::{c_int, c_long, c_uint};
175 
176     #[stable(feature = "raw_ext", since = "1.1.0")]
177     pub type blkcnt_t = i64;
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")]
181     pub type ino_t = u64;
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")]
185     pub type off_t = i64;
186     #[stable(feature = "raw_ext", since = "1.1.0")]
187     pub type time_t = i64;
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")]
194         pub st_dev: u64,
195         #[stable(feature = "raw_ext", since = "1.1.0")]
196         pub st_ino: u64,
197         #[stable(feature = "raw_ext", since = "1.1.0")]
198         pub st_mode: u32,
199         #[stable(feature = "raw_ext", since = "1.1.0")]
200         pub st_nlink: u32,
201         #[stable(feature = "raw_ext", since = "1.1.0")]
202         pub st_uid: u32,
203         #[stable(feature = "raw_ext", since = "1.1.0")]
204         pub st_gid: u32,
205         #[stable(feature = "raw_ext", since = "1.1.0")]
206         pub st_rdev: u64,
207         #[stable(feature = "raw_ext", since = "1.1.0")]
208         pub __pad1: u32,
209         #[stable(feature = "raw_ext", since = "1.1.0")]
210         pub st_size: i64,
211         #[stable(feature = "raw_ext", since = "1.1.0")]
212         pub st_blksize: i32,
213         #[stable(feature = "raw_ext", since = "1.1.0")]
214         pub __pad2: i32,
215         #[stable(feature = "raw_ext", since = "1.1.0")]
216         pub st_blocks: i64,
217         #[stable(feature = "raw_ext", since = "1.1.0")]
218         pub st_atime: i64,
219         #[stable(feature = "raw_ext", since = "1.1.0")]
220         pub st_atime_nsec: c_long,
221         #[stable(feature = "raw_ext", since = "1.1.0")]
222         pub st_mtime: i64,
223         #[stable(feature = "raw_ext", since = "1.1.0")]
224         pub st_mtime_nsec: c_long,
225         #[stable(feature = "raw_ext", since = "1.1.0")]
226         pub st_ctime: i64,
227         #[stable(feature = "raw_ext", since = "1.1.0")]
228         pub st_ctime_nsec: c_long,
229         #[stable(feature = "raw_ext", since = "1.1.0")]
230         pub __pad3: [c_int; 2],
231     }
232 }
233 
234 #[cfg(any(
235     target_arch = "mips64",
236     target_arch = "s390x",
237     target_arch = "sparc64",
238     target_arch = "riscv64",
239     target_arch = "riscv32"
240 ))]
241 mod arch {
242     pub use libc::{blkcnt_t, blksize_t, ino_t, nlink_t, off_t, stat, time_t};
243 }
244 
245 #[cfg(target_arch = "aarch64")]
246 mod arch {
247     use crate::os::raw::{c_int, c_long};
248 
249     #[stable(feature = "raw_ext", since = "1.1.0")]
250     pub type blkcnt_t = i64;
251     #[stable(feature = "raw_ext", since = "1.1.0")]
252     pub type blksize_t = i32;
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 = u32;
257     #[stable(feature = "raw_ext", since = "1.1.0")]
258     pub type off_t = i64;
259     #[stable(feature = "raw_ext", since = "1.1.0")]
260     pub type time_t = c_long;
261 
262     #[repr(C)]
263     #[derive(Clone)]
264     #[stable(feature = "raw_ext", since = "1.1.0")]
265     pub struct stat {
266         #[stable(feature = "raw_ext", since = "1.1.0")]
267         pub st_dev: u64,
268         #[stable(feature = "raw_ext", since = "1.1.0")]
269         pub st_ino: u64,
270         #[stable(feature = "raw_ext", since = "1.1.0")]
271         pub st_mode: u32,
272         #[stable(feature = "raw_ext", since = "1.1.0")]
273         pub st_nlink: u32,
274         #[stable(feature = "raw_ext", since = "1.1.0")]
275         pub st_uid: u32,
276         #[stable(feature = "raw_ext", since = "1.1.0")]
277         pub st_gid: u32,
278         #[stable(feature = "raw_ext", since = "1.1.0")]
279         pub st_rdev: u64,
280         #[stable(feature = "raw_ext", since = "1.1.0")]
281         pub __pad1: u64,
282         #[stable(feature = "raw_ext", since = "1.1.0")]
283         pub st_size: i64,
284         #[stable(feature = "raw_ext", since = "1.1.0")]
285         pub st_blksize: i32,
286         #[stable(feature = "raw_ext", since = "1.1.0")]
287         pub __pad2: c_int,
288         #[stable(feature = "raw_ext", since = "1.1.0")]
289         pub st_blocks: i64,
290         #[stable(feature = "raw_ext", since = "1.1.0")]
291         pub st_atime: time_t,
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")]
295         pub st_mtime: time_t,
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")]
299         pub st_ctime: time_t,
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 
307 #[cfg(any(target_arch = "x86_64", target_arch = "powerpc64"))]
308 mod arch {
309     use crate::os::raw::{c_int, c_long};
310 
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;
323 
324     #[repr(C)]
325     #[derive(Clone)]
326     #[stable(feature = "raw_ext", since = "1.1.0")]
327     pub struct stat {
328         #[stable(feature = "raw_ext", since = "1.1.0")]
329         pub st_dev: u64,
330         #[stable(feature = "raw_ext", since = "1.1.0")]
331         pub st_ino: u64,
332         #[stable(feature = "raw_ext", since = "1.1.0")]
333         pub st_nlink: u64,
334         #[stable(feature = "raw_ext", since = "1.1.0")]
335         pub st_mode: u32,
336         #[stable(feature = "raw_ext", since = "1.1.0")]
337         pub st_uid: u32,
338         #[stable(feature = "raw_ext", since = "1.1.0")]
339         pub st_gid: u32,
340         #[stable(feature = "raw_ext", since = "1.1.0")]
341         pub __pad0: c_int,
342         #[stable(feature = "raw_ext", since = "1.1.0")]
343         pub st_rdev: u64,
344         #[stable(feature = "raw_ext", since = "1.1.0")]
345         pub st_size: i64,
346         #[stable(feature = "raw_ext", since = "1.1.0")]
347         pub st_blksize: i64,
348         #[stable(feature = "raw_ext", since = "1.1.0")]
349         pub st_blocks: i64,
350         #[stable(feature = "raw_ext", since = "1.1.0")]
351         pub st_atime: i64,
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")]
355         pub st_mtime: i64,
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")]
359         pub st_ctime: i64,
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 }
366