Skip to content

Commit 10ff5d4

Browse files
committed
Make ifaddrs.ifa_ifu an union
1 parent a433bce commit 10ff5d4

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

src/fuchsia/mod.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ s! {
473473
pub ifa_flags: c_uint,
474474
pub ifa_addr: *mut crate::sockaddr,
475475
pub ifa_netmask: *mut crate::sockaddr,
476-
pub ifa_ifu: *mut crate::sockaddr, // FIXME This should be a union
476+
pub ifa_ifu: __c_anonymous_ifa_ifu,
477477
pub ifa_data: *mut c_void,
478478
}
479479

@@ -1054,6 +1054,11 @@ s_no_extra_traits! {
10541054
pub sival_int: c_int,
10551055
pub sival_ptr: *mut c_void,
10561056
}
1057+
1058+
pub union __c_anonymous_ifa_ifu {
1059+
ifu_broadaddr: *mut sockaddr,
1060+
ifu_dstaddr: *mut sockaddr,
1061+
}
10571062
}
10581063

10591064
cfg_if! {
@@ -1431,6 +1436,18 @@ cfg_if! {
14311436
unimplemented!("traits")
14321437
}
14331438
}
1439+
1440+
impl PartialEq for __c_anonymous_ifa_ifu {
1441+
fn eq(&self, other: &__c_anonymous_ifa_ifu) -> bool {
1442+
unimplemented!("traits")
1443+
}
1444+
}
1445+
impl Eq for __c_anonymous_ifa_ifu {}
1446+
impl hash::Hash for __c_anonymous_ifa_ifu {
1447+
fn hash<H: hash::Hasher>(&self, state: &mut H) {
1448+
unimplemented!("traits")
1449+
}
1450+
}
14341451
}
14351452
}
14361453

src/unix/linux_like/mod.rs

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ s! {
166166
pub ifa_flags: c_uint,
167167
pub ifa_addr: *mut crate::sockaddr,
168168
pub ifa_netmask: *mut crate::sockaddr,
169-
pub ifa_ifu: *mut crate::sockaddr, // FIXME(union) This should be a union
169+
pub ifa_ifu: __c_anonymous_ifa_ifu,
170170
pub ifa_data: *mut c_void,
171171
}
172172

@@ -303,6 +303,11 @@ s_no_extra_traits! {
303303
pub sigev_notify: c_int,
304304
pub _sigev_un: __c_anonymous_sigev_un,
305305
}
306+
307+
pub union __c_anonymous_ifa_ifu {
308+
ifu_broadaddr: *mut sockaddr,
309+
ifu_dstaddr: *mut sockaddr,
310+
}
306311
}
307312

308313
cfg_if! {
@@ -459,6 +464,27 @@ cfg_if! {
459464
.finish()
460465
}
461466
}
467+
468+
impl hash::Hash for sigevent {
469+
fn hash<H: hash::Hasher>(&self, state: &mut H) {
470+
self.sigev_value.hash(state);
471+
self.sigev_signo.hash(state);
472+
self.sigev_notify.hash(state);
473+
self.sigev_notify_thread_id.hash(state);
474+
}
475+
}
476+
477+
impl PartialEq for __c_anonymous_ifa_ifu {
478+
fn eq(&self, other: &__c_anonymous_ifa_ifu) -> bool {
479+
unimplemented!("traits")
480+
}
481+
}
482+
impl Eq for __c_anonymous_ifa_ifu {}
483+
impl hash::Hash for __c_anonymous_ifa_ifu {
484+
fn hash<H: hash::Hasher>(&self, state: &mut H) {
485+
unimplemented!("traits")
486+
}
487+
}
462488
}
463489
}
464490

0 commit comments

Comments
 (0)