Skip to content

Commit

Permalink
Auto merge of #2293 - devnexen:system_prop_api_android, r=JohnTitor
Browse files Browse the repository at this point in the history
android system prop api update.
  • Loading branch information
bors committed Jul 23, 2021
2 parents b6e0cbe + 3cffa6f commit 03f9a91
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
4 changes: 3 additions & 1 deletion libc-test/build.rs
Expand Up @@ -1659,7 +1659,9 @@ fn test_android(target: &str) {
// signalfd had SIGSYS fields added in Android 4.19, but CI does not have that version yet.
(struct_ == "signalfd_siginfo" && (field == "ssi_syscall" ||
field == "ssi_call_addr" ||
field == "ssi_arch"))
field == "ssi_arch")) ||
// serial field is a volatile.
(struct_ == "prop_info" && field == "serial")
});

cfg.skip_field(|struct_, field| {
Expand Down
8 changes: 8 additions & 0 deletions libc-test/semver/android.txt
Expand Up @@ -1621,6 +1621,8 @@ PRIO_PGRP
PRIO_PROCESS
PRIO_USER
PROC_SUPER_MAGIC
PROP_NAME_MAX
PROP_VALUE_MAX
PROT_EXEC
PROT_GROWSDOWN
PROT_GROWSUP
Expand Down Expand Up @@ -2562,6 +2564,11 @@ __kernel_pid_t
__sched_cpualloc
__sched_cpucount
__sched_cpufree
__system_property_find
__system_property_find_nth
__system_property_foreach
__system_property_get
__system_property_set
_exit
abort
accept
Expand Down Expand Up @@ -2939,6 +2946,7 @@ prlimit
prlimit64
process_vm_readv
process_vm_writev
prop_info
protoent
pselect
pthread_atfork
Expand Down
17 changes: 16 additions & 1 deletion src/unix/linux_like/android/mod.rs
Expand Up @@ -46,6 +46,8 @@ pub type Elf64_Off = u64;
pub type Elf64_Word = u32;
pub type Elf64_Xword = u64;

pub type prop_info = __prop_info;

s! {
pub struct stack_t {
pub ss_sp: *mut ::c_void,
Expand Down Expand Up @@ -422,6 +424,12 @@ s_no_extra_traits! {
pub ivlen: u32,
pub iv: [::c_uchar; 0],
}

pub struct __prop_info {
pub name: [::c_char; PROP_NAME_MAX],
pub serial: ::c_uint,
pub value: [::c_char; PROP_VALUE_MAX],
}
}

cfg_if! {
Expand Down Expand Up @@ -2409,7 +2417,8 @@ pub const PF_NFC: ::c_int = AF_NFC;
pub const PF_VSOCK: ::c_int = AF_VSOCK;

// sys/system_properties.h
pub const PROP_VALUE_MAX: ::c_int = 92;
pub const PROP_VALUE_MAX: ::size_t = 92;
pub const PROP_NAME_MAX: ::size_t = 32;

f! {
pub fn CMSG_NXTHDR(mhdr: *const msghdr,
Expand Down Expand Up @@ -2862,6 +2871,12 @@ extern "C" {

pub fn __system_property_set(__name: *const ::c_char, __value: *const ::c_char) -> ::c_int;
pub fn __system_property_get(__name: *const ::c_char, __value: *mut ::c_char) -> ::c_int;
pub fn __system_property_find(__name: *const ::c_char) -> *const prop_info;
pub fn __system_property_find_nth(__n: ::c_uint) -> *const prop_info;
pub fn __system_property_foreach(
__callback: unsafe extern "C" fn(__pi: *const prop_info, __cookie: *mut ::c_void),
__cookie: *mut ::c_void,
) -> ::c_int;

// #include <link.h>
/// Only available in API Version 21+
Expand Down

0 comments on commit 03f9a91

Please sign in to comment.