Skip to content

Commit 77db2d8

Browse files
committed
adding few android api 30 calls.
close #3598.
1 parent 6f47f51 commit 77db2d8

File tree

3 files changed

+55
-2
lines changed

3 files changed

+55
-2
lines changed

libc-test/build.rs

Lines changed: 1 addition & 1 deletion
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

Lines changed: 5 additions & 0 deletions
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/mod.rs

Lines changed: 49 additions & 1 deletion
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: i64,
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)