Skip to content

Commit 9a31934

Browse files
devnexentgross35
authored andcommitted
adding few android api 30 calls.
close rust-lang#3598. (backport <rust-lang#3604>) (cherry picked from commit 7de9061)
1 parent 78d6dcb commit 9a31934

File tree

7 files changed

+59
-2
lines changed

7 files changed

+59
-2
lines changed

libc-test/build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2075,7 +2075,7 @@ fn test_android(target: &str) {
20752075
"__system_property_wait" => true,
20762076

20772077
// Added in API level 30, but tests use level 28.
2078-
"mlock2" => true,
2078+
"memfd_create" | "mlock2" | "renameat2" | "statx" | "statx_timestamp" => true,
20792079

20802080
// Added in glibc 2.25.
20812081
"getentropy" => true,

libc-test/semver/android.txt

+5
Original file line numberDiff line numberDiff line change
@@ -3469,6 +3469,7 @@ memalign
34693469
memchr
34703470
memcmp
34713471
memcpy
3472+
memfd_create
34723473
memmem
34733474
memmove
34743475
memrchr
@@ -3484,6 +3485,7 @@ mknodat
34843485
mkstemp
34853486
mktime
34863487
mlock
3488+
mlock2
34873489
mlockall
34883490
mmap
34893491
mmap64
@@ -3672,6 +3674,7 @@ remove
36723674
removexattr
36733675
rename
36743676
renameat
3677+
renameat2
36753678
res_init
36763679
rewind
36773680
rewinddir
@@ -3797,6 +3800,8 @@ statfs
37973800
statfs64
37983801
statvfs
37993802
statvfs64
3803+
statx
3804+
statx_timestamp
38003805
strcasecmp
38013806
strcasestr
38023807
strcat

src/unix/linux_like/android/b32/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ pub type sigset_t = ::c_ulong;
99
pub type socklen_t = i32;
1010
pub type time64_t = i64;
1111
pub type __u64 = ::c_ulonglong;
12+
pub type __s64 = ::c_longlong;
1213

1314
s! {
1415
pub struct sigaction {

src/unix/linux_like/android/b64/aarch64/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
pub type c_char = u8;
22
pub type wchar_t = u32;
33
pub type __u64 = ::c_ulonglong;
4+
pub type __s64 = ::c_longlong;
45

56
s! {
67
pub struct stat {

src/unix/linux_like/android/b64/riscv64/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ pub type c_char = i8;
22
pub type wchar_t = u32;
33
pub type greg_t = i64;
44
pub type __u64 = ::c_ulonglong;
5+
pub type __s64 = ::c_longlong;
56

67
s! {
78
pub struct stat {

src/unix/linux_like/android/b64/x86_64/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ pub type c_char = i8;
22
pub type wchar_t = i32;
33
pub type greg_t = i64;
44
pub type __u64 = ::c_ulonglong;
5+
pub type __s64 = ::c_longlong;
56

67
s! {
78
pub struct stat {

src/unix/linux_like/android/mod.rs

+49-1
Original file line numberDiff line numberDiff line change
@@ -514,8 +514,40 @@ s! {
514514
pub ifr6_addr: ::in6_addr,
515515
pub ifr6_prefixlen: u32,
516516
pub ifr6_ifindex: ::c_int,
517-
}
517+
}
518+
519+
pub struct statx {
520+
pub stx_mask: ::__u32,
521+
pub stx_blksize: ::__u32,
522+
pub stx_attributes: ::__u64,
523+
pub stx_nlink: ::__u32,
524+
pub stx_uid: ::__u32,
525+
pub stx_gid: ::__u32,
526+
pub stx_mode: ::__u16,
527+
__statx_pad1: [::__u16; 1],
528+
pub stx_ino: ::__u64,
529+
pub stx_size: ::__u64,
530+
pub stx_blocks: ::__u64,
531+
pub stx_attributes_mask: ::__u64,
532+
pub stx_atime: ::statx_timestamp,
533+
pub stx_btime: ::statx_timestamp,
534+
pub stx_ctime: ::statx_timestamp,
535+
pub stx_mtime: ::statx_timestamp,
536+
pub stx_rdev_major: ::__u32,
537+
pub stx_rdev_minor: ::__u32,
538+
pub stx_dev_major: ::__u32,
539+
pub stx_dev_minor: ::__u32,
540+
pub stx_mnt_id: ::__u64,
541+
pub stx_dio_mem_align: ::__u32,
542+
pub stx_dio_offset_align: ::__u32,
543+
__statx_pad3: [::__u64; 12],
544+
}
518545

546+
pub struct statx_timestamp {
547+
pub tv_sec: ::__s64,
548+
pub tv_nsec: ::__u32,
549+
pub __reserved: ::__s32,
550+
}
519551
}
520552

521553
s_no_extra_traits! {
@@ -4169,6 +4201,22 @@ extern "C" {
41694201
pub fn fgets_unlocked(buf: *mut ::c_char, size: ::c_int, stream: *mut ::FILE) -> *mut ::c_char;
41704202

41714203
pub fn klogctl(syslog_type: ::c_int, bufp: *mut ::c_char, len: ::c_int) -> ::c_int;
4204+
4205+
pub fn memfd_create(name: *const ::c_char, flags: ::c_uint) -> ::c_int;
4206+
pub fn renameat2(
4207+
olddirfd: ::c_int,
4208+
oldpath: *const ::c_char,
4209+
newdirfd: ::c_int,
4210+
newpath: *const ::c_char,
4211+
flags: ::c_uint,
4212+
) -> ::c_int;
4213+
pub fn statx(
4214+
dirfd: ::c_int,
4215+
pathname: *const c_char,
4216+
flags: ::c_int,
4217+
mask: ::c_uint,
4218+
statxbuf: *mut statx,
4219+
) -> ::c_int;
41724220
}
41734221

41744222
cfg_if! {

0 commit comments

Comments
 (0)