Skip to content

Commit 6177c37

Browse files
committed
Make ifaddrs.ifa_ifu an union
1 parent 912cad4 commit 6177c37

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

libc-test/build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2836,6 +2836,9 @@ fn test_emscripten(target: &str) {
28362836
});
28372837

28382838
cfg.skip_struct(move |ty| {
2839+
if ty.starts_with("__c_anonymous_") {
2840+
return true;
2841+
}
28392842
match ty {
28402843
// FIXME: It was removed in
28412844
// emscripten-core/emscripten@953e414

src/fuchsia/mod.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ s! {
465465
pub ifa_flags: ::c_uint,
466466
pub ifa_addr: *mut ::sockaddr,
467467
pub ifa_netmask: *mut ::sockaddr,
468-
pub ifa_ifu: *mut ::sockaddr, // FIXME This should be a union
468+
pub ifa_ifu: __c_anonymous_ifa_ifu,
469469
pub ifa_data: *mut ::c_void,
470470
}
471471

@@ -1046,6 +1046,11 @@ s_no_extra_traits! {
10461046
pub sival_int: ::int,
10471047
pub sival_ptr: *mut ::c_void,
10481048
}
1049+
1050+
pub union __c_anonymous_ifa_ifu {
1051+
ifu_broadaddr: *mut sockaddr,
1052+
ifu_dstaddr: *mut sockaddr,
1053+
}
10491054
}
10501055

10511056
cfg_if! {
@@ -1376,6 +1381,13 @@ cfg_if! {
13761381
f.debug_struct("sigval").finish_non_exhaustive()
13771382
}
13781383
}
1384+
1385+
impl ::fmt::Debug for __c_anonymous_ifa_ifu {
1386+
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1387+
f.debug_struct("ifa_ifu")
1388+
.finish_non_exhaustive()
1389+
}
1390+
}
13791391
}
13801392
}
13811393

src/unix/linux_like/mod.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ s! {
159159
pub ifa_flags: ::c_uint,
160160
pub ifa_addr: *mut ::sockaddr,
161161
pub ifa_netmask: *mut ::sockaddr,
162-
pub ifa_ifu: *mut ::sockaddr, // FIXME This should be a union
162+
pub ifa_ifu: __c_anonymous_ifa_ifu,
163163
pub ifa_data: *mut ::c_void,
164164
}
165165

@@ -257,6 +257,11 @@ s_no_extra_traits! {
257257
#[cfg(target_pointer_width = "32")]
258258
__unused1: [::c_int; 12],
259259
}
260+
261+
pub union __c_anonymous_ifa_ifu {
262+
ifu_broadaddr: *mut sockaddr,
263+
ifu_dstaddr: *mut sockaddr,
264+
}
260265
}
261266

262267
cfg_if! {
@@ -429,6 +434,13 @@ cfg_if! {
429434
self.sigev_notify_thread_id.hash(state);
430435
}
431436
}
437+
438+
impl ::fmt::Debug for __c_anonymous_ifa_ifu {
439+
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
440+
f.debug_struct("ifa_ifu")
441+
.finish_non_exhaustive()
442+
}
443+
}
432444
}
433445
}
434446

0 commit comments

Comments
 (0)