Skip to content

Commit d738047

Browse files
authored
Merge pull request #4247 from devnexen/gh4246
adding if_nameindex/if_freenameindex support for Android.
2 parents b550c6b + 32821d4 commit d738047

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

libc-test/build.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1847,6 +1847,8 @@ fn test_android(target: &str) {
18471847

18481848
// FIXME(android): "'__uint128' undeclared" in C
18491849
"__uint128" => true,
1850+
// Added in API level 24
1851+
"if_nameindex" => true,
18501852

18511853
_ => false,
18521854
}
@@ -2093,6 +2095,9 @@ fn test_android(target: &str) {
20932095
| "ispunct" | "isspace" | "isupper" | "isxdigit" | "isblank" | "tolower"
20942096
| "toupper" => true,
20952097

2098+
// Added in API level 24
2099+
"if_nameindex" | "if_freenameindex" => true,
2100+
20962101
_ => false,
20972102
}
20982103
});

libc-test/semver/android.txt

+2
Original file line numberDiff line numberDiff line change
@@ -3382,7 +3382,9 @@ group
33823382
hostent
33833383
id_t
33843384
idtype_t
3385+
if_freenameindex
33853386
if_indextoname
3387+
if_nameindex
33863388
if_nametoindex
33873389
ifaddrs
33883390
ifconf

src/unix/linux_like/android/mod.rs

+8
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,11 @@ s! {
517517
pub ifr6_prefixlen: u32,
518518
pub ifr6_ifindex: c_int,
519519
}
520+
521+
pub struct if_nameindex {
522+
pub if_index: c_uint,
523+
pub if_name: *mut c_char,
524+
}
520525
}
521526

522527
s_no_extra_traits! {
@@ -4094,6 +4099,9 @@ extern "C" {
40944099
newpath: *const c_char,
40954100
flags: c_uint,
40964101
) -> c_int;
4102+
4103+
pub fn if_nameindex() -> *mut if_nameindex;
4104+
pub fn if_freenameindex(ptr: *mut if_nameindex);
40974105
}
40984106

40994107
cfg_if! {

0 commit comments

Comments
 (0)