Skip to content

Commit 7d6a090

Browse files
authored
Merge pull request rust-lang#3604 from devnexen/android30_newcalls
adding few android api 30 calls.
2 parents 6f47f51 + 7de9061 commit 7d6a090

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
@@ -1913,7 +1913,7 @@ fn test_android(target: &str) {
19131913
"__system_property_wait" => true,
19141914

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

19181918
// Added in glibc 2.25.
19191919
"getentropy" => true,

libc-test/semver/android.txt

+5
Original file line numberDiff line numberDiff line change
@@ -3370,6 +3370,7 @@ memalign
33703370
memchr
33713371
memcmp
33723372
memcpy
3373+
memfd_create
33733374
memmem
33743375
memmove
33753376
memrchr
@@ -3385,6 +3386,7 @@ mknodat
33853386
mkstemp
33863387
mktime
33873388
mlock
3389+
mlock2
33883390
mlockall
33893391
mmap
33903392
mmap64
@@ -3574,6 +3576,7 @@ remove
35743576
removexattr
35753577
rename
35763578
renameat
3579+
renameat2
35773580
res_init
35783581
rewind
35793582
rewinddir
@@ -3698,6 +3701,8 @@ statfs
36983701
statfs64
36993702
statvfs
37003703
statvfs64
3704+
statx
3705+
statx_timestamp
37013706
strcasecmp
37023707
strcasestr
37033708
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
@@ -510,8 +510,40 @@ s! {
510510
pub ifr6_addr: ::in6_addr,
511511
pub ifr6_prefixlen: u32,
512512
pub ifr6_ifindex: ::c_int,
513-
}
513+
}
514+
515+
pub struct statx {
516+
pub stx_mask: ::__u32,
517+
pub stx_blksize: ::__u32,
518+
pub stx_attributes: ::__u64,
519+
pub stx_nlink: ::__u32,
520+
pub stx_uid: ::__u32,
521+
pub stx_gid: ::__u32,
522+
pub stx_mode: ::__u16,
523+
__statx_pad1: [::__u16; 1],
524+
pub stx_ino: ::__u64,
525+
pub stx_size: ::__u64,
526+
pub stx_blocks: ::__u64,
527+
pub stx_attributes_mask: ::__u64,
528+
pub stx_atime: ::statx_timestamp,
529+
pub stx_btime: ::statx_timestamp,
530+
pub stx_ctime: ::statx_timestamp,
531+
pub stx_mtime: ::statx_timestamp,
532+
pub stx_rdev_major: ::__u32,
533+
pub stx_rdev_minor: ::__u32,
534+
pub stx_dev_major: ::__u32,
535+
pub stx_dev_minor: ::__u32,
536+
pub stx_mnt_id: ::__u64,
537+
pub stx_dio_mem_align: ::__u32,
538+
pub stx_dio_offset_align: ::__u32,
539+
__statx_pad3: [::__u64; 12],
540+
}
514541

542+
pub struct statx_timestamp {
543+
pub tv_sec: ::__s64,
544+
pub tv_nsec: ::__u32,
545+
pub __reserved: ::__s32,
546+
}
515547
}
516548

517549
s_no_extra_traits! {
@@ -4014,6 +4046,22 @@ extern "C" {
40144046
) -> ::size_t;
40154047
pub fn fflush_unlocked(stream: *mut ::FILE) -> ::c_int;
40164048
pub fn fgets_unlocked(buf: *mut ::c_char, size: ::c_int, stream: *mut ::FILE) -> *mut ::c_char;
4049+
4050+
pub fn memfd_create(name: *const ::c_char, flags: ::c_uint) -> ::c_int;
4051+
pub fn renameat2(
4052+
olddirfd: ::c_int,
4053+
oldpath: *const ::c_char,
4054+
newdirfd: ::c_int,
4055+
newpath: *const ::c_char,
4056+
flags: ::c_uint,
4057+
) -> ::c_int;
4058+
pub fn statx(
4059+
dirfd: ::c_int,
4060+
pathname: *const c_char,
4061+
flags: ::c_int,
4062+
mask: ::c_uint,
4063+
statxbuf: *mut statx,
4064+
) -> ::c_int;
40174065
}
40184066

40194067
cfg_if! {

0 commit comments

Comments
 (0)