Skip to content

Commit 57a7d46

Browse files
authored
Merge pull request #3902 from tgross35/backport-horizon-network
[0.2] Backport horizon network
2 parents fdd3a26 + a3e8869 commit 57a7d46

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed

src/unix/newlib/horizon/mod.rs

+9
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ pub type sbintime_t = ::c_longlong;
2121
pub type sigset_t = ::c_ulong;
2222

2323
s! {
24+
pub struct hostent {
25+
pub h_name: *mut ::c_char,
26+
pub h_aliases: *mut *mut ::c_char,
27+
pub h_addrtype: u16,
28+
pub h_length: u16,
29+
pub h_addr_list: *mut *mut ::c_char,
30+
}
31+
2432
pub struct sockaddr {
2533
pub sa_family: ::sa_family_t,
2634
pub sa_data: [::c_char; 26usize],
@@ -35,6 +43,7 @@ s! {
3543
pub sin_family: ::sa_family_t,
3644
pub sin_port: ::in_port_t,
3745
pub sin_addr: ::in_addr,
46+
pub sin_zero: [::c_char; 8],
3847
}
3948

4049
pub struct sockaddr_in6 {

src/unix/newlib/mod.rs

+16-10
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,21 @@ cfg_if! {
5353
}
5454
}
5555

56+
cfg_if! {
57+
if #[cfg(not(target_os = "horizon"))] {
58+
s!{
59+
pub struct hostent {
60+
pub h_name: *mut ::c_char,
61+
pub h_aliases: *mut *mut ::c_char,
62+
pub h_addrtype: ::c_int,
63+
pub h_length: ::c_int,
64+
pub h_addr_list: *mut *mut ::c_char,
65+
pub h_addr: *mut ::c_char,
66+
}
67+
}
68+
}
69+
}
70+
5671
s! {
5772
// The order of the `ai_addr` field in this struct is crucial
5873
// for converting between the Rust and C types.
@@ -87,16 +102,7 @@ s! {
87102
}
88103

89104
pub struct in_addr {
90-
pub s_addr: ::in_addr_t,
91-
}
92-
93-
pub struct hostent {
94-
pub h_name: *mut ::c_char,
95-
pub h_aliases: *mut *mut ::c_char,
96-
pub h_addrtype: ::c_int,
97-
pub h_length: ::c_int,
98-
pub h_addr_list: *mut *mut ::c_char,
99-
pub h_addr: *mut ::c_char,
105+
pub s_addr: ::in_addr_t,
100106
}
101107

102108
pub struct pollfd {

0 commit comments

Comments
 (0)