Skip to content

Commit 62f66a6

Browse files
author
Sae-bom Kim
committed
support aarch64-android raw type definitions
1 parent fe107b3 commit 62f66a6

File tree

1 file changed

+82
-33
lines changed

1 file changed

+82
-33
lines changed

src/libstd/os/android/raw.rs

Lines changed: 82 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,86 @@
1010

1111
//! Android-specific raw type definitions
1212
13-
use os::raw::{c_uint, c_uchar, c_ulonglong, c_longlong, c_ulong};
14-
use os::unix::raw::{uid_t, gid_t};
15-
16-
pub type blkcnt_t = u32;
17-
pub type blksize_t = u32;
18-
pub type dev_t = u32;
19-
pub type ino_t = u32;
20-
pub type mode_t = u16;
21-
pub type nlink_t = u16;
22-
pub type off_t = i32;
23-
pub type time_t = i32;
24-
25-
#[repr(C)]
26-
pub struct stat {
27-
pub st_dev: c_ulonglong,
28-
pub __pad0: [c_uchar; 4],
29-
pub __st_ino: ino_t,
30-
pub st_mode: c_uint,
31-
pub st_nlink: c_uint,
32-
pub st_uid: uid_t,
33-
pub st_gid: gid_t,
34-
pub st_rdev: c_ulonglong,
35-
pub __pad3: [c_uchar; 4],
36-
pub st_size: c_longlong,
37-
pub st_blksize: blksize_t,
38-
pub st_blocks: c_ulonglong,
39-
pub st_atime: time_t,
40-
pub st_atime_nsec: c_ulong,
41-
pub st_mtime: time_t,
42-
pub st_mtime_nsec: c_ulong,
43-
pub st_ctime: time_t,
44-
pub st_ctime_nsec: c_ulong,
45-
pub st_ino: c_ulonglong,
13+
#[doc(inline)]
14+
pub use self::arch::{dev_t, mode_t, blkcnt_t, blksize_t, ino_t, nlink_t, off_t, stat, time_t};
15+
16+
#[cfg(target_arch = "arm")]
17+
mod arch {
18+
use os::raw::{c_uint, c_uchar, c_ulonglong, c_longlong, c_ulong};
19+
use os::unix::raw::{uid_t, gid_t};
20+
21+
pub type dev_t = u32;
22+
pub type mode_t = u16;
23+
24+
pub type blkcnt_t = u32;
25+
pub type blksize_t = u32;
26+
pub type ino_t = u32;
27+
pub type nlink_t = u16;
28+
pub type off_t = i32;
29+
pub type time_t = i32;
30+
31+
#[repr(C)]
32+
pub struct stat {
33+
pub st_dev: c_ulonglong,
34+
pub __pad0: [c_uchar; 4],
35+
pub __st_ino: ino_t,
36+
pub st_mode: c_uint,
37+
pub st_nlink: c_uint,
38+
pub st_uid: uid_t,
39+
pub st_gid: gid_t,
40+
pub st_rdev: c_ulonglong,
41+
pub __pad3: [c_uchar; 4],
42+
pub st_size: c_longlong,
43+
pub st_blksize: blksize_t,
44+
pub st_blocks: c_ulonglong,
45+
pub st_atime: time_t,
46+
pub st_atime_nsec: c_ulong,
47+
pub st_mtime: time_t,
48+
pub st_mtime_nsec: c_ulong,
49+
pub st_ctime: time_t,
50+
pub st_ctime_nsec: c_ulong,
51+
pub st_ino: c_ulonglong,
52+
}
53+
54+
}
55+
56+
57+
#[cfg(target_arch = "aarch64")]
58+
mod arch {
59+
use os::raw::{c_uchar, c_ulong};
60+
use os::unix::raw::{uid_t, gid_t};
61+
62+
pub type dev_t = u64;
63+
pub type mode_t = u32;
64+
65+
pub type blkcnt_t = u64;
66+
pub type blksize_t = u32;
67+
pub type ino_t = u64;
68+
pub type nlink_t = u32;
69+
pub type off_t = i64;
70+
pub type time_t = i64;
71+
72+
#[repr(C)]
73+
pub struct stat {
74+
pub st_dev: dev_t,
75+
pub __pad0: [c_uchar; 4],
76+
pub __st_ino: ino_t,
77+
pub st_mode: mode_t,
78+
pub st_nlink: nlink_t,
79+
pub st_uid: uid_t,
80+
pub st_gid: gid_t,
81+
pub st_rdev: dev_t,
82+
pub __pad3: [c_uchar; 4],
83+
pub st_size: off_t,
84+
pub st_blksize: blksize_t,
85+
pub st_blocks: blkcnt_t,
86+
pub st_atime: time_t,
87+
pub st_atime_nsec: c_ulong,
88+
pub st_mtime: time_t,
89+
pub st_mtime_nsec: c_ulong,
90+
pub st_ctime: time_t,
91+
pub st_ctime_nsec: c_ulong,
92+
pub st_ino: ino_t,
93+
}
94+
4695
}

0 commit comments

Comments
 (0)