Skip to content

Commit 80f4ca2

Browse files
committed
Auto merge of #2649 - devnexen:netbsd_ifconf, r=Amanieu
netbsd add ifconf data
2 parents 831b3a2 + 0ef1e71 commit 80f4ca2

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

libc-test/semver/netbsd.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,6 +1240,7 @@ if_freenameindex
12401240
if_msghdr
12411241
if_nameindex
12421242
ifaddrs
1243+
ifconf
12431244
in6_pktinfo
12441245
in_pktinfo
12451246
initgroups

src/unix/bsd/netbsdlike/netbsd/mod.rs

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,16 @@ s! {
575575
pub descr_len: u32,
576576
pub descr_str: [::c_char; 1],
577577
}
578+
579+
pub struct ifreq {
580+
pub _priv: [[::c_char; 6]; 24],
581+
}
582+
583+
pub struct ifconf {
584+
pub ifc_len: ::c_int,
585+
#[cfg(libc_union)]
586+
pub ifc_ifcu: __c_anonymous_ifc_ifcu,
587+
}
578588
}
579589

580590
s_no_extra_traits! {
@@ -693,6 +703,12 @@ s_no_extra_traits! {
693703
pub open: __c_anonymous_posix_spawn_fae_open,
694704
pub dup2: __c_anonymous_posix_spawn_fae_dup2,
695705
}
706+
707+
#[cfg(libc_union)]
708+
pub union __c_anonymous_ifc_ifcu {
709+
pub ifcu_buf: *mut ::c_void,
710+
pub ifcu_req: *mut ifreq,
711+
}
696712
}
697713

698714
cfg_if! {
@@ -1155,6 +1171,41 @@ cfg_if! {
11551171
}
11561172
}
11571173
}
1174+
1175+
#[cfg(libc_union)]
1176+
impl Eq for __c_anonymous_ifc_ifcu {}
1177+
1178+
#[cfg(libc_union)]
1179+
impl PartialEq for __c_anonymous_ifc_ifcu {
1180+
fn eq(&self, other: &__c_anonymous_ifc_ifcu) -> bool {
1181+
unsafe {
1182+
self.ifcu_buf == other.ifcu_buf
1183+
|| self.ifcu_req == other.ifcu_req
1184+
}
1185+
}
1186+
}
1187+
1188+
#[cfg(libc_union)]
1189+
impl ::fmt::Debug for __c_anonymous_ifc_ifcu {
1190+
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1191+
unsafe {
1192+
f.debug_struct("__c_anonymous_ifc_ifcu")
1193+
.field("ifcu_buf", &self.ifcu_buf)
1194+
.field("ifcu_req", &self.ifcu_req)
1195+
.finish()
1196+
}
1197+
}
1198+
}
1199+
1200+
#[cfg(libc_union)]
1201+
impl ::hash::Hash for __c_anonymous_ifc_ifcu {
1202+
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1203+
unsafe {
1204+
self.ifcu_buf.hash(state);
1205+
self.ifcu_req.hash(state);
1206+
}
1207+
}
1208+
}
11581209
}
11591210
}
11601211

0 commit comments

Comments
 (0)