Skip to content

Commit 184ed58

Browse files
tgross35AkhilTThomas
authored andcommitted
Merge pull request rust-lang#3871 from tgross35/backport-garlic
[0.2] Backport four pull requests
2 parents da92ffc + 46388e4 commit 184ed58

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

src/unix/align.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
s! {
2+
#[repr(align(4))]
3+
pub struct in6_addr {
4+
pub s6_addr: [u8; 16],
5+
}
6+
}
7+
8+
pub const IN6ADDR_LOOPBACK_INIT: in6_addr = in6_addr {
9+
s6_addr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
10+
};
11+
12+
pub const IN6ADDR_ANY_INIT: in6_addr = in6_addr {
13+
s6_addr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
14+
};

src/unix/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,11 @@ pub const ATF_USETRAILERS: c_int = 0x10;
338338
pub const FNM_PERIOD: c_int = 1 << 2;
339339
pub const FNM_NOMATCH: c_int = 1;
340340

341+
extern "C" {
342+
pub static in6addr_loopback: in6_addr;
343+
pub static in6addr_any: in6_addr;
344+
}
345+
341346
cfg_if! {
342347
if #[cfg(any(target_os = "illumos", target_os = "solaris",))] {
343348
pub const FNM_CASEFOLD: c_int = 1 << 3;

src/unix/no_align.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
s! {
2+
pub struct in6_addr {
3+
pub s6_addr: [u8; 16],
4+
__align: [u32; 0],
5+
}
6+
}
7+
8+
pub const IN6ADDR_LOOPBACK_INIT: in6_addr = in6_addr {
9+
s6_addr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
10+
__align: [0u32; 0],
11+
};
12+
13+
pub const IN6ADDR_ANY_INIT: in6_addr = in6_addr {
14+
s6_addr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
15+
__align: [0u32; 0],
16+
};

0 commit comments

Comments
 (0)