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 if_nameindex/if_freenameindex support for Android. #4247

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1846,6 +1846,8 @@ fn test_android(target: &str) {

// FIXME: "'__uint128' undeclared" in C
"__uint128" => true,
// Added in API level 24
"if_nameindex" => true,

_ => false,
}
Expand Down Expand Up @@ -2089,6 +2091,9 @@ fn test_android(target: &str) {
| "ispunct" | "isspace" | "isupper" | "isxdigit" | "isblank" | "tolower"
| "toupper" => true,

// Added in API level 24
"if_nameindex" | "if_freenameindex" => true,

_ => false,
}
});
Expand Down
2 changes: 2 additions & 0 deletions libc-test/semver/android.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3379,7 +3379,9 @@ group
hostent
id_t
idtype_t
if_freenameindex
if_indextoname
if_nameindex
if_nametoindex
ifaddrs
ifconf
Expand Down
8 changes: 8 additions & 0 deletions src/unix/linux_like/android/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,11 @@ s! {
pub ifr6_prefixlen: u32,
pub ifr6_ifindex: c_int,
}

pub struct if_nameindex {
pub if_index: c_uint,
pub if_name: *mut c_char,
}
}

s_no_extra_traits! {
Expand Down Expand Up @@ -4084,6 +4089,9 @@ extern "C" {
newpath: *const c_char,
flags: c_uint,
) -> c_int;

pub fn if_nameindex() -> *mut if_nameindex;
pub fn if_freenameindex(ptr: *mut if_nameindex);
}

cfg_if! {
Expand Down
Loading