Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding few android api 30 calls. #3604

Merged
merged 1 commit into from
Mar 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libc-test/build.rs
Original file line number Diff line number Diff line change
@@ -1913,7 +1913,7 @@ fn test_android(target: &str) {
"__system_property_wait" => true,

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

// Added in glibc 2.25.
"getentropy" => true,
5 changes: 5 additions & 0 deletions libc-test/semver/android.txt
Original file line number Diff line number Diff line change
@@ -3370,6 +3370,7 @@ memalign
memchr
memcmp
memcpy
memfd_create
memmem
memmove
memrchr
@@ -3385,6 +3386,7 @@ mknodat
mkstemp
mktime
mlock
mlock2
mlockall
mmap
mmap64
@@ -3574,6 +3576,7 @@ remove
removexattr
rename
renameat
renameat2
res_init
rewind
rewinddir
@@ -3698,6 +3701,8 @@ statfs
statfs64
statvfs
statvfs64
statx
statx_timestamp
strcasecmp
strcasestr
strcat
1 change: 1 addition & 0 deletions src/unix/linux_like/android/b32/mod.rs
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ pub type sigset_t = ::c_ulong;
pub type socklen_t = i32;
pub type time64_t = i64;
pub type __u64 = ::c_ulonglong;
pub type __s64 = ::c_longlong;

s! {
pub struct sigaction {
1 change: 1 addition & 0 deletions src/unix/linux_like/android/b64/aarch64/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pub type c_char = u8;
pub type wchar_t = u32;
pub type __u64 = ::c_ulonglong;
pub type __s64 = ::c_longlong;

s! {
pub struct stat {
1 change: 1 addition & 0 deletions src/unix/linux_like/android/b64/riscv64/mod.rs
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ pub type c_char = i8;
pub type wchar_t = u32;
pub type greg_t = i64;
pub type __u64 = ::c_ulonglong;
pub type __s64 = ::c_longlong;

s! {
pub struct stat {
1 change: 1 addition & 0 deletions src/unix/linux_like/android/b64/x86_64/mod.rs
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ pub type c_char = i8;
pub type wchar_t = i32;
pub type greg_t = i64;
pub type __u64 = ::c_ulonglong;
pub type __s64 = ::c_longlong;

s! {
pub struct stat {
50 changes: 49 additions & 1 deletion src/unix/linux_like/android/mod.rs
Original file line number Diff line number Diff line change
@@ -510,8 +510,40 @@ s! {
pub ifr6_addr: ::in6_addr,
pub ifr6_prefixlen: u32,
pub ifr6_ifindex: ::c_int,
}
}

pub struct statx {
pub stx_mask: ::__u32,
pub stx_blksize: ::__u32,
pub stx_attributes: ::__u64,
pub stx_nlink: ::__u32,
pub stx_uid: ::__u32,
pub stx_gid: ::__u32,
pub stx_mode: ::__u16,
__statx_pad1: [::__u16; 1],
pub stx_ino: ::__u64,
pub stx_size: ::__u64,
pub stx_blocks: ::__u64,
pub stx_attributes_mask: ::__u64,
pub stx_atime: ::statx_timestamp,
pub stx_btime: ::statx_timestamp,
pub stx_ctime: ::statx_timestamp,
pub stx_mtime: ::statx_timestamp,
pub stx_rdev_major: ::__u32,
pub stx_rdev_minor: ::__u32,
pub stx_dev_major: ::__u32,
pub stx_dev_minor: ::__u32,
pub stx_mnt_id: ::__u64,
pub stx_dio_mem_align: ::__u32,
pub stx_dio_offset_align: ::__u32,
__statx_pad3: [::__u64; 12],
}

pub struct statx_timestamp {
pub tv_sec: ::__s64,
pub tv_nsec: ::__u32,
pub __reserved: ::__s32,
}
}

s_no_extra_traits! {
@@ -4014,6 +4046,22 @@ extern "C" {
) -> ::size_t;
pub fn fflush_unlocked(stream: *mut ::FILE) -> ::c_int;
pub fn fgets_unlocked(buf: *mut ::c_char, size: ::c_int, stream: *mut ::FILE) -> *mut ::c_char;

pub fn memfd_create(name: *const ::c_char, flags: ::c_uint) -> ::c_int;
pub fn renameat2(
olddirfd: ::c_int,
oldpath: *const ::c_char,
newdirfd: ::c_int,
newpath: *const ::c_char,
flags: ::c_uint,
) -> ::c_int;
pub fn statx(
dirfd: ::c_int,
pathname: *const c_char,
flags: ::c_int,
mask: ::c_uint,
statxbuf: *mut statx,
) -> ::c_int;
}

cfg_if! {