]> git.proxmox.com Git - rustc.git/blob - library/std/src/os/linux/raw.rs
New upstream version 1.62.1+dfsg1
[rustc.git] / library / std / src / 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
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 #[stable(feature = "raw_ext", since = "1.1.0")]
243 pub use libc::{blkcnt_t, blksize_t, ino_t, nlink_t, off_t, stat, time_t};
244 }
245
246 #[cfg(target_arch = "aarch64")]
247 mod arch {
248 use crate::os::raw::{c_int, c_long};
249
250 #[stable(feature = "raw_ext", since = "1.1.0")]
251 pub type blkcnt_t = i64;
252 #[stable(feature = "raw_ext", since = "1.1.0")]
253 pub type blksize_t = i32;
254 #[stable(feature = "raw_ext", since = "1.1.0")]
255 pub type ino_t = u64;
256 #[stable(feature = "raw_ext", since = "1.1.0")]
257 pub type nlink_t = u32;
258 #[stable(feature = "raw_ext", since = "1.1.0")]
259 pub type off_t = i64;
260 #[stable(feature = "raw_ext", since = "1.1.0")]
261 pub type time_t = c_long;
262
263 #[repr(C)]
264 #[derive(Clone)]
265 #[stable(feature = "raw_ext", since = "1.1.0")]
266 pub struct stat {
267 #[stable(feature = "raw_ext", since = "1.1.0")]
268 pub st_dev: u64,
269 #[stable(feature = "raw_ext", since = "1.1.0")]
270 pub st_ino: u64,
271 #[stable(feature = "raw_ext", since = "1.1.0")]
272 pub st_mode: u32,
273 #[stable(feature = "raw_ext", since = "1.1.0")]
274 pub st_nlink: u32,
275 #[stable(feature = "raw_ext", since = "1.1.0")]
276 pub st_uid: u32,
277 #[stable(feature = "raw_ext", since = "1.1.0")]
278 pub st_gid: u32,
279 #[stable(feature = "raw_ext", since = "1.1.0")]
280 pub st_rdev: u64,
281 #[stable(feature = "raw_ext", since = "1.1.0")]
282 pub __pad1: u64,
283 #[stable(feature = "raw_ext", since = "1.1.0")]
284 pub st_size: i64,
285 #[stable(feature = "raw_ext", since = "1.1.0")]
286 pub st_blksize: i32,
287 #[stable(feature = "raw_ext", since = "1.1.0")]
288 pub __pad2: c_int,
289 #[stable(feature = "raw_ext", since = "1.1.0")]
290 pub st_blocks: i64,
291 #[stable(feature = "raw_ext", since = "1.1.0")]
292 pub st_atime: time_t,
293 #[stable(feature = "raw_ext", since = "1.1.0")]
294 pub st_atime_nsec: c_long,
295 #[stable(feature = "raw_ext", since = "1.1.0")]
296 pub st_mtime: time_t,
297 #[stable(feature = "raw_ext", since = "1.1.0")]
298 pub st_mtime_nsec: c_long,
299 #[stable(feature = "raw_ext", since = "1.1.0")]
300 pub st_ctime: time_t,
301 #[stable(feature = "raw_ext", since = "1.1.0")]
302 pub st_ctime_nsec: c_long,
303 #[stable(feature = "raw_ext", since = "1.1.0")]
304 pub __unused: [c_int; 2],
305 }
306 }
307
308 #[cfg(any(target_arch = "x86_64", target_arch = "powerpc64"))]
309 mod arch {
310 use crate::os::raw::{c_int, c_long};
311
312 #[stable(feature = "raw_ext", since = "1.1.0")]
313 pub type blkcnt_t = u64;
314 #[stable(feature = "raw_ext", since = "1.1.0")]
315 pub type blksize_t = u64;
316 #[stable(feature = "raw_ext", since = "1.1.0")]
317 pub type ino_t = u64;
318 #[stable(feature = "raw_ext", since = "1.1.0")]
319 pub type nlink_t = u64;
320 #[stable(feature = "raw_ext", since = "1.1.0")]
321 pub type off_t = u64;
322 #[stable(feature = "raw_ext", since = "1.1.0")]
323 pub type time_t = i64;
324
325 #[repr(C)]
326 #[derive(Clone)]
327 #[stable(feature = "raw_ext", since = "1.1.0")]
328 pub struct stat {
329 #[stable(feature = "raw_ext", since = "1.1.0")]
330 pub st_dev: u64,
331 #[stable(feature = "raw_ext", since = "1.1.0")]
332 pub st_ino: u64,
333 #[stable(feature = "raw_ext", since = "1.1.0")]
334 pub st_nlink: u64,
335 #[stable(feature = "raw_ext", since = "1.1.0")]
336 pub st_mode: u32,
337 #[stable(feature = "raw_ext", since = "1.1.0")]
338 pub st_uid: u32,
339 #[stable(feature = "raw_ext", since = "1.1.0")]
340 pub st_gid: u32,
341 #[stable(feature = "raw_ext", since = "1.1.0")]
342 pub __pad0: c_int,
343 #[stable(feature = "raw_ext", since = "1.1.0")]
344 pub st_rdev: u64,
345 #[stable(feature = "raw_ext", since = "1.1.0")]
346 pub st_size: i64,
347 #[stable(feature = "raw_ext", since = "1.1.0")]
348 pub st_blksize: i64,
349 #[stable(feature = "raw_ext", since = "1.1.0")]
350 pub st_blocks: i64,
351 #[stable(feature = "raw_ext", since = "1.1.0")]
352 pub st_atime: i64,
353 #[stable(feature = "raw_ext", since = "1.1.0")]
354 pub st_atime_nsec: c_long,
355 #[stable(feature = "raw_ext", since = "1.1.0")]
356 pub st_mtime: i64,
357 #[stable(feature = "raw_ext", since = "1.1.0")]
358 pub st_mtime_nsec: c_long,
359 #[stable(feature = "raw_ext", since = "1.1.0")]
360 pub st_ctime: i64,
361 #[stable(feature = "raw_ext", since = "1.1.0")]
362 pub st_ctime_nsec: c_long,
363 #[stable(feature = "raw_ext", since = "1.1.0")]
364 pub __unused: [c_long; 3],
365 }
366 }