Skip to content

Commit 385a822

Browse files
committed
Auto merge of #866 - LuoZijun:patch-1, r=alexcrichton
Add struct `sockaddr_dl` for bsdlike platforms Freebsd: https://github.com/freebsd/freebsd/blob/master/sys/net/if_dl.h#L59 Macos: https://github.com/apple/darwin-xnu/blob/master/bsd/net/if_dl.h#L95
2 parents 3f4d6d3 + 64246e0 commit 385a822

File tree

6 files changed

+58
-2
lines changed

6 files changed

+58
-2
lines changed

libc-test/build.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,12 @@ fn main() {
173173
cfg.header("crt_externs.h");
174174
}
175175
cfg.header("net/route.h");
176-
cfg.header("net/route.h");
177176
cfg.header("sys/proc_info.h");
178177
}
179178

180179
if bsdlike {
181180
cfg.header("sys/event.h");
182-
181+
cfg.header("net/if_dl.h");
183182
if freebsd {
184183
cfg.header("libutil.h");
185184
} else {

src/unix/bsd/apple/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,17 @@ s! {
476476
pub cmd: u32,
477477
pub cmdsize: u32,
478478
}
479+
480+
pub struct sockaddr_dl {
481+
pub sdl_len: ::c_uchar,
482+
pub sdl_family: ::c_uchar,
483+
pub sdl_index: ::c_ushort,
484+
pub sdl_type: ::c_uchar,
485+
pub sdl_nlen: ::c_uchar,
486+
pub sdl_alen: ::c_uchar,
487+
pub sdl_slen: ::c_uchar,
488+
pub sdl_data: [::c_char; 12],
489+
}
479490
}
480491

481492
pub const _UTX_USERSIZE: usize = 256;

src/unix/bsd/freebsdlike/dragonfly/mod.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,19 @@ s! {
168168
pub ifm_index: ::c_ushort,
169169
pub ifm_data: if_data,
170170
}
171+
172+
pub struct sockaddr_dl {
173+
pub sdl_len: ::c_uchar,
174+
pub sdl_family: ::c_uchar,
175+
pub sdl_index: ::c_ushort,
176+
pub sdl_type: ::c_uchar,
177+
pub sdl_nlen: ::c_uchar,
178+
pub sdl_alen: ::c_uchar,
179+
pub sdl_slen: ::c_uchar,
180+
pub sdl_data: [::c_char; 12],
181+
pub sdl_rcf: ::c_ushort,
182+
pub sdl_route: [::c_ushort; 16],
183+
}
171184
}
172185

173186
pub const RAND_MAX: ::c_int = 0x7fff_ffff;

src/unix/bsd/freebsdlike/freebsd/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,17 @@ s! {
135135
pub cr_groups: [::gid_t;16],
136136
__cr_unused1: *mut ::c_void,
137137
}
138+
139+
pub struct sockaddr_dl {
140+
pub sdl_len: ::c_uchar,
141+
pub sdl_family: ::c_uchar,
142+
pub sdl_index: ::c_ushort,
143+
pub sdl_type: ::c_uchar,
144+
pub sdl_nlen: ::c_uchar,
145+
pub sdl_alen: ::c_uchar,
146+
pub sdl_slen: ::c_uchar,
147+
pub sdl_data: [::c_char; 46],
148+
}
138149
}
139150

140151
pub const SIGEV_THREAD_ID: ::c_int = 4;

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,17 @@ s! {
293293
pub sc_ngroups: ::c_int,
294294
pub sc_groups: [::gid_t; 1],
295295
}
296+
297+
pub struct sockaddr_dl {
298+
pub sdl_len: ::c_uchar,
299+
pub sdl_family: ::c_uchar,
300+
pub sdl_index: ::c_ushort,
301+
pub sdl_type: ::uint8_t,
302+
pub sdl_nlen: ::uint8_t,
303+
pub sdl_alen: ::uint8_t,
304+
pub sdl_slen: ::uint8_t,
305+
pub sdl_data: [::c_char; 12],
306+
}
296307
}
297308

298309
pub const AT_FDCWD: ::c_int = -100;

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,17 @@ s! {
176176
pub ifm_xflags: ::c_int,
177177
pub ifm_data: if_data,
178178
}
179+
180+
pub struct sockaddr_dl {
181+
pub sdl_len: ::c_uchar,
182+
pub sdl_family: ::c_uchar,
183+
pub sdl_index: ::c_ushort,
184+
pub sdl_type: ::c_uchar,
185+
pub sdl_nlen: ::c_uchar,
186+
pub sdl_alen: ::c_uchar,
187+
pub sdl_slen: ::c_uchar,
188+
pub sdl_data: [::c_char; 24],
189+
}
179190
}
180191

181192
pub const UT_NAMESIZE: usize = 32;

0 commit comments

Comments
 (0)