]> git.proxmox.com Git - rustc.git/blob - src/libstd/os/linux/raw.rs
Imported Upstream version 1.6.0+dfsg1
[rustc.git] / src / libstd / os / linux / raw.rs
1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 //! Linux-specific raw type definitions
12
13 #![stable(feature = "raw_ext", since = "1.1.0")]
14
15 use os::raw::c_ulong;
16
17 #[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = u64;
18 #[stable(feature = "raw_ext", since = "1.1.0")] pub type mode_t = u32;
19
20 #[unstable(feature = "pthread_t", issue = "29791")] pub type pthread_t = c_ulong;
21
22 #[doc(inline)]
23 #[stable(feature = "raw_ext", since = "1.1.0")]
24 pub use self::arch::{off_t, ino_t, nlink_t, blksize_t, blkcnt_t, stat, time_t};
25
26 #[cfg(any(target_arch = "x86",
27 target_arch = "le32",
28 target_arch = "powerpc",
29 target_arch = "arm"))]
30 mod arch {
31 use super::{dev_t, mode_t};
32 use os::raw::{c_long, c_short};
33 use os::unix::raw::{gid_t, uid_t};
34
35 #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = i32;
36 #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = i32;
37 #[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = u32;
38 #[stable(feature = "raw_ext", since = "1.1.0")] pub type nlink_t = u32;
39 #[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = i32;
40 #[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i32;
41
42 #[repr(C)]
43 #[derive(Clone)]
44 #[stable(feature = "raw_ext", since = "1.1.0")]
45 pub struct stat {
46 #[stable(feature = "raw_ext", since = "1.1.0")]
47 pub st_dev: dev_t,
48 #[stable(feature = "raw_ext", since = "1.1.0")]
49 pub __pad1: c_short,
50 #[stable(feature = "raw_ext", since = "1.1.0")]
51 pub st_ino: ino_t,
52 #[stable(feature = "raw_ext", since = "1.1.0")]
53 pub st_mode: mode_t,
54 #[stable(feature = "raw_ext", since = "1.1.0")]
55 pub st_nlink: nlink_t,
56 #[stable(feature = "raw_ext", since = "1.1.0")]
57 pub st_uid: uid_t,
58 #[stable(feature = "raw_ext", since = "1.1.0")]
59 pub st_gid: gid_t,
60 #[stable(feature = "raw_ext", since = "1.1.0")]
61 pub st_rdev: dev_t,
62 #[stable(feature = "raw_ext", since = "1.1.0")]
63 pub __pad2: c_short,
64 #[stable(feature = "raw_ext", since = "1.1.0")]
65 pub st_size: off_t,
66 #[stable(feature = "raw_ext", since = "1.1.0")]
67 pub st_blksize: blksize_t,
68 #[stable(feature = "raw_ext", since = "1.1.0")]
69 pub st_blocks: blkcnt_t,
70 #[stable(feature = "raw_ext", since = "1.1.0")]
71 pub st_atime: time_t,
72 #[stable(feature = "raw_ext", since = "1.1.0")]
73 pub st_atime_nsec: c_long,
74 #[stable(feature = "raw_ext", since = "1.1.0")]
75 pub st_mtime: time_t,
76 #[stable(feature = "raw_ext", since = "1.1.0")]
77 pub st_mtime_nsec: c_long,
78 #[stable(feature = "raw_ext", since = "1.1.0")]
79 pub st_ctime: time_t,
80 #[stable(feature = "raw_ext", since = "1.1.0")]
81 pub st_ctime_nsec: c_long,
82 #[stable(feature = "raw_ext", since = "1.1.0")]
83 pub __unused4: c_long,
84 #[stable(feature = "raw_ext", since = "1.1.0")]
85 pub __unused5: c_long,
86 }
87 }
88
89 #[cfg(any(target_arch = "mips",
90 target_arch = "mipsel"))]
91 mod arch {
92 use super::mode_t;
93 use os::raw::{c_long, c_ulong};
94 use os::unix::raw::{gid_t, uid_t};
95
96 #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = i32;
97 #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = i32;
98 #[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = u32;
99 #[stable(feature = "raw_ext", since = "1.1.0")] pub type nlink_t = u32;
100 #[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = i32;
101 #[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i32;
102
103 #[repr(C)]
104 #[derive(Clone)]
105 #[stable(feature = "raw_ext", since = "1.1.0")]
106 pub struct stat {
107 #[stable(feature = "raw_ext", since = "1.1.0")]
108 pub st_dev: c_ulong,
109 #[stable(feature = "raw_ext", since = "1.1.0")]
110 pub st_pad1: [c_long; 3],
111 #[stable(feature = "raw_ext", since = "1.1.0")]
112 pub st_ino: ino_t,
113 #[stable(feature = "raw_ext", since = "1.1.0")]
114 pub st_mode: mode_t,
115 #[stable(feature = "raw_ext", since = "1.1.0")]
116 pub st_nlink: nlink_t,
117 #[stable(feature = "raw_ext", since = "1.1.0")]
118 pub st_uid: uid_t,
119 #[stable(feature = "raw_ext", since = "1.1.0")]
120 pub st_gid: gid_t,
121 #[stable(feature = "raw_ext", since = "1.1.0")]
122 pub st_rdev: c_ulong,
123 #[stable(feature = "raw_ext", since = "1.1.0")]
124 pub st_pad2: [c_long; 2],
125 #[stable(feature = "raw_ext", since = "1.1.0")]
126 pub st_size: off_t,
127 #[stable(feature = "raw_ext", since = "1.1.0")]
128 pub st_pad3: c_long,
129 #[stable(feature = "raw_ext", since = "1.1.0")]
130 pub st_atime: time_t,
131 #[stable(feature = "raw_ext", since = "1.1.0")]
132 pub st_atime_nsec: c_long,
133 #[stable(feature = "raw_ext", since = "1.1.0")]
134 pub st_mtime: time_t,
135 #[stable(feature = "raw_ext", since = "1.1.0")]
136 pub st_mtime_nsec: c_long,
137 #[stable(feature = "raw_ext", since = "1.1.0")]
138 pub st_ctime: time_t,
139 #[stable(feature = "raw_ext", since = "1.1.0")]
140 pub st_ctime_nsec: c_long,
141 #[stable(feature = "raw_ext", since = "1.1.0")]
142 pub st_blksize: blksize_t,
143 #[stable(feature = "raw_ext", since = "1.1.0")]
144 pub st_blocks: blkcnt_t,
145 #[stable(feature = "raw_ext", since = "1.1.0")]
146 pub st_pad5: [c_long; 14],
147 }
148 }
149
150 #[cfg(target_arch = "aarch64")]
151 mod arch {
152 use super::{dev_t, mode_t};
153 use os::raw::{c_long, c_int};
154 use os::unix::raw::{gid_t, uid_t};
155
156 #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = i64;
157 #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = i32;
158 #[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = u64;
159 #[stable(feature = "raw_ext", since = "1.1.0")] pub type nlink_t = u32;
160 #[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = i64;
161 #[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i64;
162
163 #[repr(C)]
164 #[derive(Clone)]
165 #[stable(feature = "raw_ext", since = "1.1.0")]
166 pub struct stat {
167 #[stable(feature = "raw_ext", since = "1.1.0")]
168 pub st_dev: dev_t,
169 #[stable(feature = "raw_ext", since = "1.1.0")]
170 pub st_ino: ino_t,
171 #[stable(feature = "raw_ext", since = "1.1.0")]
172 pub st_mode: mode_t,
173 #[stable(feature = "raw_ext", since = "1.1.0")]
174 pub st_nlink: nlink_t,
175 #[stable(feature = "raw_ext", since = "1.1.0")]
176 pub st_uid: uid_t,
177 #[stable(feature = "raw_ext", since = "1.1.0")]
178 pub st_gid: gid_t,
179 #[stable(feature = "raw_ext", since = "1.1.0")]
180 pub st_rdev: dev_t,
181 #[stable(feature = "raw_ext", since = "1.1.0")]
182 pub __pad1: dev_t,
183 #[stable(feature = "raw_ext", since = "1.1.0")]
184 pub st_size: off_t,
185 #[stable(feature = "raw_ext", since = "1.1.0")]
186 pub st_blksize: blksize_t,
187 #[stable(feature = "raw_ext", since = "1.1.0")]
188 pub __pad2: c_int,
189 #[stable(feature = "raw_ext", since = "1.1.0")]
190 pub st_blocks: blkcnt_t,
191 #[stable(feature = "raw_ext", since = "1.1.0")]
192 pub st_atime: time_t,
193 #[stable(feature = "raw_ext", since = "1.1.0")]
194 pub st_atime_nsec: c_long,
195 #[stable(feature = "raw_ext", since = "1.1.0")]
196 pub st_mtime: time_t,
197 #[stable(feature = "raw_ext", since = "1.1.0")]
198 pub st_mtime_nsec: c_long,
199 #[stable(feature = "raw_ext", since = "1.1.0")]
200 pub st_ctime: time_t,
201 #[stable(feature = "raw_ext", since = "1.1.0")]
202 pub st_ctime_nsec: c_long,
203 #[stable(feature = "raw_ext", since = "1.1.0")]
204 pub __unused: [c_int; 2],
205 }
206 }
207
208 #[cfg(target_arch = "x86_64")]
209 mod arch {
210 use super::{dev_t, mode_t};
211 use os::raw::{c_long, c_int};
212 use os::unix::raw::{gid_t, uid_t};
213
214 #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = i64;
215 #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = i64;
216 #[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = u64;
217 #[stable(feature = "raw_ext", since = "1.1.0")] pub type nlink_t = u64;
218 #[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = i64;
219 #[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i64;
220
221 #[repr(C)]
222 #[derive(Clone)]
223 #[stable(feature = "raw_ext", since = "1.1.0")]
224 pub struct stat {
225 #[stable(feature = "raw_ext", since = "1.1.0")]
226 pub st_dev: dev_t,
227 #[stable(feature = "raw_ext", since = "1.1.0")]
228 pub st_ino: ino_t,
229 #[stable(feature = "raw_ext", since = "1.1.0")]
230 pub st_nlink: nlink_t,
231 #[stable(feature = "raw_ext", since = "1.1.0")]
232 pub st_mode: mode_t,
233 #[stable(feature = "raw_ext", since = "1.1.0")]
234 pub st_uid: uid_t,
235 #[stable(feature = "raw_ext", since = "1.1.0")]
236 pub st_gid: gid_t,
237 #[stable(feature = "raw_ext", since = "1.1.0")]
238 pub __pad0: c_int,
239 #[stable(feature = "raw_ext", since = "1.1.0")]
240 pub st_rdev: dev_t,
241 #[stable(feature = "raw_ext", since = "1.1.0")]
242 pub st_size: off_t,
243 #[stable(feature = "raw_ext", since = "1.1.0")]
244 pub st_blksize: blksize_t,
245 #[stable(feature = "raw_ext", since = "1.1.0")]
246 pub st_blocks: blkcnt_t,
247 #[stable(feature = "raw_ext", since = "1.1.0")]
248 pub st_atime: time_t,
249 #[stable(feature = "raw_ext", since = "1.1.0")]
250 pub st_atime_nsec: c_long,
251 #[stable(feature = "raw_ext", since = "1.1.0")]
252 pub st_mtime: time_t,
253 #[stable(feature = "raw_ext", since = "1.1.0")]
254 pub st_mtime_nsec: c_long,
255 #[stable(feature = "raw_ext", since = "1.1.0")]
256 pub st_ctime: time_t,
257 #[stable(feature = "raw_ext", since = "1.1.0")]
258 pub st_ctime_nsec: c_long,
259 #[stable(feature = "raw_ext", since = "1.1.0")]
260 pub __unused: [c_long; 3],
261 }
262 }