std/os/android/
raw.rs

1//! Android-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_long;
14
15#[stable(feature = "pthread_t", since = "1.8.0")]
16pub type pthread_t = c_long;
17
18#[doc(inline)]
19#[stable(feature = "raw_ext", since = "1.1.0")]
20pub use self::arch::{blkcnt_t, blksize_t, dev_t, ino_t, mode_t, nlink_t, off_t, stat, time_t};
21
22#[cfg(any(target_arch = "arm", target_arch = "x86"))]
23mod arch {
24    use crate::os::raw::{c_long, c_longlong, c_uchar, c_uint, c_ulong, c_ulonglong};
25    use crate::os::unix::raw::{gid_t, uid_t};
26
27    #[stable(feature = "raw_ext", since = "1.1.0")]
28    pub type dev_t = u32;
29    #[stable(feature = "raw_ext", since = "1.1.0")]
30    pub type mode_t = c_uint;
31
32    #[stable(feature = "raw_ext", since = "1.1.0")]
33    pub type blkcnt_t = c_ulong;
34    #[stable(feature = "raw_ext", since = "1.1.0")]
35    pub type blksize_t = c_ulong;
36    #[stable(feature = "raw_ext", since = "1.1.0")]
37    pub type ino_t = c_ulong;
38    #[stable(feature = "raw_ext", since = "1.1.0")]
39    pub type nlink_t = u32;
40    #[stable(feature = "raw_ext", since = "1.1.0")]
41    pub type off_t = i32;
42    #[stable(feature = "raw_ext", since = "1.1.0")]
43    pub type time_t = c_long;
44
45    #[repr(C)]
46    #[derive(Clone)]
47    #[stable(feature = "raw_ext", since = "1.1.0")]
48    pub struct stat {
49        #[stable(feature = "raw_ext", since = "1.1.0")]
50        pub st_dev: c_ulonglong,
51        #[stable(feature = "raw_ext", since = "1.1.0")]
52        pub __pad0: [c_uchar; 4],
53        #[stable(feature = "raw_ext", since = "1.1.0")]
54        pub __st_ino: u32,
55        #[stable(feature = "raw_ext", since = "1.1.0")]
56        pub st_mode: c_uint,
57        #[stable(feature = "raw_ext", since = "1.1.0")]
58        pub st_nlink: c_uint,
59        #[stable(feature = "raw_ext", since = "1.1.0")]
60        pub st_uid: uid_t,
61        #[stable(feature = "raw_ext", since = "1.1.0")]
62        pub st_gid: gid_t,
63        #[stable(feature = "raw_ext", since = "1.1.0")]
64        pub st_rdev: c_ulonglong,
65        #[stable(feature = "raw_ext", since = "1.1.0")]
66        pub __pad3: [c_uchar; 4],
67        #[stable(feature = "raw_ext", since = "1.1.0")]
68        pub st_size: c_longlong,
69        #[stable(feature = "raw_ext", since = "1.1.0")]
70        pub st_blksize: u32,
71        #[stable(feature = "raw_ext", since = "1.1.0")]
72        pub st_blocks: c_ulonglong,
73
74        #[stable(feature = "raw_ext", since = "1.1.0")]
75        pub st_atime: time_t,
76        #[stable(feature = "raw_ext", since = "1.1.0")]
77        pub st_atime_nsec: c_long,
78        #[stable(feature = "raw_ext", since = "1.1.0")]
79        pub st_mtime: time_t,
80        #[stable(feature = "raw_ext", since = "1.1.0")]
81        pub st_mtime_nsec: c_long,
82        #[stable(feature = "raw_ext", since = "1.1.0")]
83        pub st_ctime: time_t,
84        #[stable(feature = "raw_ext", since = "1.1.0")]
85        pub st_ctime_nsec: c_long,
86
87        #[stable(feature = "raw_ext", since = "1.1.0")]
88        pub st_ino: c_ulonglong,
89    }
90}
91
92#[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))]
93mod arch {
94    use crate::os::raw::{c_int, c_long, c_uint, c_ulong};
95    use crate::os::unix::raw::{gid_t, uid_t};
96
97    #[stable(feature = "raw_ext", since = "1.1.0")]
98    pub type dev_t = u64;
99    #[stable(feature = "raw_ext", since = "1.1.0")]
100    pub type mode_t = c_uint;
101
102    #[stable(feature = "raw_ext", since = "1.1.0")]
103    pub type blkcnt_t = c_ulong;
104    #[stable(feature = "raw_ext", since = "1.1.0")]
105    pub type blksize_t = c_ulong;
106    #[stable(feature = "raw_ext", since = "1.1.0")]
107    pub type ino_t = c_ulong;
108    #[stable(feature = "raw_ext", since = "1.1.0")]
109    pub type nlink_t = u32;
110    #[stable(feature = "raw_ext", since = "1.1.0")]
111    pub type off_t = i64;
112    #[stable(feature = "raw_ext", since = "1.1.0")]
113    pub type time_t = c_long;
114
115    #[repr(C)]
116    #[derive(Clone)]
117    #[stable(feature = "raw_ext", since = "1.1.0")]
118    pub struct stat {
119        #[stable(feature = "raw_ext", since = "1.1.0")]
120        pub st_dev: dev_t,
121        #[stable(feature = "raw_ext", since = "1.1.0")]
122        pub st_ino: ino_t,
123        #[stable(feature = "raw_ext", since = "1.1.0")]
124        pub st_mode: mode_t,
125        #[stable(feature = "raw_ext", since = "1.1.0")]
126        pub st_nlink: nlink_t,
127        #[stable(feature = "raw_ext", since = "1.1.0")]
128        pub st_uid: uid_t,
129        #[stable(feature = "raw_ext", since = "1.1.0")]
130        pub st_gid: gid_t,
131        #[stable(feature = "raw_ext", since = "1.1.0")]
132        pub st_rdev: dev_t,
133        #[stable(feature = "raw_ext", since = "1.1.0")]
134        pub __pad1: c_ulong,
135        #[stable(feature = "raw_ext", since = "1.1.0")]
136        pub st_size: off_t,
137        #[stable(feature = "raw_ext", since = "1.1.0")]
138        pub st_blksize: c_int,
139        #[stable(feature = "raw_ext", since = "1.1.0")]
140        pub __pad2: c_int,
141        #[stable(feature = "raw_ext", since = "1.1.0")]
142        pub st_blocks: c_long,
143
144        #[stable(feature = "raw_ext", since = "1.1.0")]
145        pub st_atime: time_t,
146        #[stable(feature = "raw_ext", since = "1.1.0")]
147        pub st_atime_nsec: c_long,
148        #[stable(feature = "raw_ext", since = "1.1.0")]
149        pub st_mtime: time_t,
150        #[stable(feature = "raw_ext", since = "1.1.0")]
151        pub st_mtime_nsec: c_long,
152        #[stable(feature = "raw_ext", since = "1.1.0")]
153        pub st_ctime: time_t,
154        #[stable(feature = "raw_ext", since = "1.1.0")]
155        pub st_ctime_nsec: c_long,
156
157        #[stable(feature = "raw_ext", since = "1.1.0")]
158        pub __unused4: c_uint,
159        #[stable(feature = "raw_ext", since = "1.1.0")]
160        pub __unused5: c_uint,
161    }
162}
163
164#[cfg(target_arch = "x86_64")]
165mod arch {
166    use crate::os::raw::{c_long, c_uint, c_ulong};
167    use crate::os::unix::raw::{gid_t, uid_t};
168
169    #[stable(feature = "raw_ext", since = "1.1.0")]
170    pub type dev_t = u64;
171    #[stable(feature = "raw_ext", since = "1.1.0")]
172    pub type mode_t = c_uint;
173
174    #[stable(feature = "raw_ext", since = "1.1.0")]
175    pub type blkcnt_t = c_ulong;
176    #[stable(feature = "raw_ext", since = "1.1.0")]
177    pub type blksize_t = c_ulong;
178    #[stable(feature = "raw_ext", since = "1.1.0")]
179    pub type ino_t = c_ulong;
180    #[stable(feature = "raw_ext", since = "1.1.0")]
181    pub type nlink_t = u32;
182    #[stable(feature = "raw_ext", since = "1.1.0")]
183    pub type off_t = i64;
184    #[stable(feature = "raw_ext", since = "1.1.0")]
185    pub type time_t = c_long;
186
187    #[repr(C)]
188    #[derive(Clone)]
189    #[stable(feature = "raw_ext", since = "1.1.0")]
190    pub struct stat {
191        #[stable(feature = "raw_ext", since = "1.1.0")]
192        pub st_dev: dev_t,
193        #[stable(feature = "raw_ext", since = "1.1.0")]
194        pub st_ino: ino_t,
195        #[stable(feature = "raw_ext", since = "1.1.0")]
196        pub st_nlink: c_ulong,
197        #[stable(feature = "raw_ext", since = "1.1.0")]
198        pub st_mode: c_uint,
199        #[stable(feature = "raw_ext", since = "1.1.0")]
200        pub st_uid: uid_t,
201        #[stable(feature = "raw_ext", since = "1.1.0")]
202        pub st_gid: gid_t,
203        #[stable(feature = "raw_ext", since = "1.1.0")]
204        pub __pad0: c_uint,
205        #[stable(feature = "raw_ext", since = "1.1.0")]
206        pub st_rdev: dev_t,
207        #[stable(feature = "raw_ext", since = "1.1.0")]
208        pub st_size: off_t,
209        #[stable(feature = "raw_ext", since = "1.1.0")]
210        pub st_blksize: c_long,
211        #[stable(feature = "raw_ext", since = "1.1.0")]
212        pub st_blocks: c_long,
213
214        #[stable(feature = "raw_ext", since = "1.1.0")]
215        pub st_atime: time_t,
216        #[stable(feature = "raw_ext", since = "1.1.0")]
217        pub st_atime_nsec: c_long,
218        #[stable(feature = "raw_ext", since = "1.1.0")]
219        pub st_mtime: time_t,
220        #[stable(feature = "raw_ext", since = "1.1.0")]
221        pub st_mtime_nsec: c_long,
222        #[stable(feature = "raw_ext", since = "1.1.0")]
223        pub st_ctime: time_t,
224        #[stable(feature = "raw_ext", since = "1.1.0")]
225        pub st_ctime_nsec: c_long,
226
227        #[stable(feature = "raw_ext", since = "1.1.0")]
228        pub __pad3: [c_long; 3],
229    }
230}