diff --git a/src/unix/newlib/horizon/mod.rs b/src/unix/newlib/horizon/mod.rs index 9c70f7b031b63..97e0b18f6fb71 100644 --- a/src/unix/newlib/horizon/mod.rs +++ b/src/unix/newlib/horizon/mod.rs @@ -21,6 +21,14 @@ pub type sbintime_t = ::c_longlong; pub type sigset_t = ::c_ulong; s! { + pub struct hostent { + pub h_name: *mut ::c_char, + pub h_aliases: *mut *mut ::c_char, + pub h_addrtype: u16, + pub h_length: u16, + pub h_addr_list: *mut *mut ::c_char, + } + pub struct sockaddr { pub sa_family: ::sa_family_t, pub sa_data: [::c_char; 26usize], @@ -35,6 +43,7 @@ s! { pub sin_family: ::sa_family_t, pub sin_port: ::in_port_t, pub sin_addr: ::in_addr, + pub sin_zero: [::c_char; 8], } pub struct sockaddr_in6 { diff --git a/src/unix/newlib/mod.rs b/src/unix/newlib/mod.rs index 45a2668aac71a..0a241c21baf2d 100644 --- a/src/unix/newlib/mod.rs +++ b/src/unix/newlib/mod.rs @@ -53,6 +53,21 @@ cfg_if! { } } +cfg_if! { + if #[cfg(not(target_os = "horizon"))] { + s!{ + pub struct hostent { + pub h_name: *mut ::c_char, + pub h_aliases: *mut *mut ::c_char, + pub h_addrtype: ::c_int, + pub h_length: ::c_int, + pub h_addr_list: *mut *mut ::c_char, + pub h_addr: *mut ::c_char, + } + } + } +} + s! { // The order of the `ai_addr` field in this struct is crucial // for converting between the Rust and C types. @@ -87,16 +102,7 @@ s! { } pub struct in_addr { - pub s_addr: ::in_addr_t, - } - - pub struct hostent { - pub h_name: *mut ::c_char, - pub h_aliases: *mut *mut ::c_char, - pub h_addrtype: ::c_int, - pub h_length: ::c_int, - pub h_addr_list: *mut *mut ::c_char, - pub h_addr: *mut ::c_char, + pub s_addr: ::in_addr_t, } pub struct pollfd {