]> git.lizzy.rs Git - rust.git/blob - src/libstd/os/android/raw.rs
60ad8fcc54ccd6af6eec6072f78ba811072d4575
[rust.git] / src / libstd / os / android / 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 //! Android-specific raw type definitions
12
13 #![stable(feature = "raw_ext", since = "1.1.0")]
14 #![rustc_deprecated(since = "1.8.0",
15                     reason = "these type aliases are no longer supported by \
16                               the standard library, the `libc` crate on \
17                               crates.io should be used instead for the correct \
18                               definitions")]
19 #![allow(deprecated)]
20
21 use os::raw::c_long;
22
23 #[stable(feature = "pthread_t", since = "1.8.0")]
24 pub type pthread_t = c_long;
25
26 #[doc(inline)]
27 #[stable(feature = "raw_ext", since = "1.1.0")]
28 pub use self::arch::{dev_t, mode_t, blkcnt_t, blksize_t, ino_t, nlink_t, off_t, stat, time_t};
29
30 #[cfg(any(target_arch = "arm", target_arch = "x86"))]
31 mod arch {
32     use os::raw::{c_uint, c_uchar, c_ulonglong, c_longlong, c_ulong};
33     use os::unix::raw::{uid_t, gid_t};
34
35     #[stable(feature = "raw_ext", since = "1.1.0")]
36     pub type dev_t = u64;
37     #[stable(feature = "raw_ext", since = "1.1.0")]
38     pub type mode_t = u32;
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: c_ulonglong,
59         #[stable(feature = "raw_ext", since = "1.1.0")]
60         pub __pad0: [c_uchar; 4],
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: c_uint,
65         #[stable(feature = "raw_ext", since = "1.1.0")]
66         pub st_nlink: c_uint,
67         #[stable(feature = "raw_ext", since = "1.1.0")]
68         pub st_uid: uid_t,
69         #[stable(feature = "raw_ext", since = "1.1.0")]
70         pub st_gid: gid_t,
71         #[stable(feature = "raw_ext", since = "1.1.0")]
72         pub st_rdev: c_ulonglong,
73         #[stable(feature = "raw_ext", since = "1.1.0")]
74         pub __pad3: [c_uchar; 4],
75         #[stable(feature = "raw_ext", since = "1.1.0")]
76         pub st_size: c_longlong,
77         #[stable(feature = "raw_ext", since = "1.1.0")]
78         pub st_blksize: u32,
79         #[stable(feature = "raw_ext", since = "1.1.0")]
80         pub st_blocks: c_ulonglong,
81         #[stable(feature = "raw_ext", since = "1.1.0")]
82         pub st_atime: c_ulong,
83         #[stable(feature = "raw_ext", since = "1.1.0")]
84         pub st_atime_nsec: c_ulong,
85         #[stable(feature = "raw_ext", since = "1.1.0")]
86         pub st_mtime: c_ulong,
87         #[stable(feature = "raw_ext", since = "1.1.0")]
88         pub st_mtime_nsec: c_ulong,
89         #[stable(feature = "raw_ext", since = "1.1.0")]
90         pub st_ctime: c_ulong,
91         #[stable(feature = "raw_ext", since = "1.1.0")]
92         pub st_ctime_nsec: c_ulong,
93         #[stable(feature = "raw_ext", since = "1.1.0")]
94         pub st_ino: c_ulonglong,
95     }
96
97 }
98
99
100 #[cfg(target_arch = "aarch64")]
101 mod arch {
102     use os::raw::{c_uchar, c_ulong};
103     use os::unix::raw::{uid_t, gid_t};
104
105     #[stable(feature = "raw_ext", since = "1.1.0")]
106     pub type dev_t = u64;
107     #[stable(feature = "raw_ext", since = "1.1.0")]
108     pub type mode_t = u32;
109
110     #[stable(feature = "raw_ext", since = "1.1.0")]
111     pub type blkcnt_t = u64;
112     #[stable(feature = "raw_ext", since = "1.1.0")]
113     pub type blksize_t = u64;
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     #[stable(feature = "raw_ext", since = "1.1.0")]
119     pub type off_t = u64;
120     #[stable(feature = "raw_ext", since = "1.1.0")]
121     pub type time_t = i64;
122
123     #[repr(C)]
124     #[derive(Clone)]
125     #[stable(feature = "raw_ext", since = "1.1.0")]
126     pub struct stat {
127         #[stable(feature = "raw_ext", since = "1.1.0")]
128         pub st_dev: dev_t,
129         #[stable(feature = "raw_ext", since = "1.1.0")]
130         pub __pad0: [c_uchar; 4],
131         #[stable(feature = "raw_ext", since = "1.1.0")]
132         pub __st_ino: ino_t,
133         #[stable(feature = "raw_ext", since = "1.1.0")]
134         pub st_mode: mode_t,
135         #[stable(feature = "raw_ext", since = "1.1.0")]
136         pub st_nlink: nlink_t,
137         #[stable(feature = "raw_ext", since = "1.1.0")]
138         pub st_uid: uid_t,
139         #[stable(feature = "raw_ext", since = "1.1.0")]
140         pub st_gid: gid_t,
141         #[stable(feature = "raw_ext", since = "1.1.0")]
142         pub st_rdev: dev_t,
143         #[stable(feature = "raw_ext", since = "1.1.0")]
144         pub __pad3: [c_uchar; 4],
145         #[stable(feature = "raw_ext", since = "1.1.0")]
146         pub st_size: off_t,
147         #[stable(feature = "raw_ext", since = "1.1.0")]
148         pub st_blksize: blksize_t,
149         #[stable(feature = "raw_ext", since = "1.1.0")]
150         pub st_blocks: blkcnt_t,
151         #[stable(feature = "raw_ext", since = "1.1.0")]
152         pub st_atime: time_t,
153         #[stable(feature = "raw_ext", since = "1.1.0")]
154         pub st_atime_nsec: c_ulong,
155         #[stable(feature = "raw_ext", since = "1.1.0")]
156         pub st_mtime: time_t,
157         #[stable(feature = "raw_ext", since = "1.1.0")]
158         pub st_mtime_nsec: c_ulong,
159         #[stable(feature = "raw_ext", since = "1.1.0")]
160         pub st_ctime: time_t,
161         #[stable(feature = "raw_ext", since = "1.1.0")]
162         pub st_ctime_nsec: c_ulong,
163         #[stable(feature = "raw_ext", since = "1.1.0")]
164         pub st_ino: ino_t,
165     }
166 }
167
168 #[cfg(target_arch = "x86_64")]
169 mod arch {
170     use os::raw::{c_uint, c_long, c_ulong};
171     use os::unix::raw::{uid_t, gid_t};
172
173     #[stable(feature = "raw_ext", since = "1.1.0")]
174     pub type dev_t = u64;
175     #[stable(feature = "raw_ext", since = "1.1.0")]
176     pub type mode_t = u32;
177
178     #[stable(feature = "raw_ext", since = "1.1.0")]
179     pub type blkcnt_t = u64;
180     #[stable(feature = "raw_ext", since = "1.1.0")]
181     pub type blksize_t = u64;
182     #[stable(feature = "raw_ext", since = "1.1.0")]
183     pub type ino_t = u64;
184     #[stable(feature = "raw_ext", since = "1.1.0")]
185     pub type nlink_t = u32;
186     #[stable(feature = "raw_ext", since = "1.1.0")]
187     pub type off_t = u64;
188     #[stable(feature = "raw_ext", since = "1.1.0")]
189     pub type time_t = i64;
190
191     #[repr(C)]
192     #[derive(Clone)]
193     #[stable(feature = "raw_ext", since = "1.1.0")]
194     pub struct stat {
195         #[stable(feature = "raw_ext", since = "1.1.0")]
196         pub st_dev: dev_t,
197         #[stable(feature = "raw_ext", since = "1.1.0")]
198         pub st_ino: ino_t,
199         #[stable(feature = "raw_ext", since = "1.1.0")]
200         pub st_nlink: c_ulong,
201         #[stable(feature = "raw_ext", since = "1.1.0")]
202         pub st_mode: c_uint,
203         #[stable(feature = "raw_ext", since = "1.1.0")]
204         pub st_uid: uid_t,
205         #[stable(feature = "raw_ext", since = "1.1.0")]
206         pub st_gid: gid_t,
207         #[stable(feature = "raw_ext", since = "1.1.0")]
208         pub st_rdev: dev_t,
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: c_long,
213         #[stable(feature = "raw_ext", since = "1.1.0")]
214         pub st_blocks: c_long,
215         #[stable(feature = "raw_ext", since = "1.1.0")]
216         pub st_atime: c_ulong,
217         #[stable(feature = "raw_ext", since = "1.1.0")]
218         pub st_atime_nsec: c_ulong,
219         #[stable(feature = "raw_ext", since = "1.1.0")]
220         pub st_mtime: c_ulong,
221         #[stable(feature = "raw_ext", since = "1.1.0")]
222         pub st_mtime_nsec: c_ulong,
223         #[stable(feature = "raw_ext", since = "1.1.0")]
224         pub st_ctime: c_ulong,
225         #[stable(feature = "raw_ext", since = "1.1.0")]
226         pub st_ctime_nsec: c_ulong,
227         __unused: [c_long; 3],
228     }
229 }
230