Skip to content

Commit

Permalink
Merge pull request #3902 from tgross35/backport-horizon-network
Browse files Browse the repository at this point in the history
[0.2] Backport horizon network
  • Loading branch information
tgross35 authored Sep 6, 2024
2 parents fdd3a26 + a3e8869 commit 57a7d46
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
9 changes: 9 additions & 0 deletions src/unix/newlib/horizon/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand All @@ -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 {
Expand Down
26 changes: 16 additions & 10 deletions src/unix/newlib/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 57a7d46

Please sign in to comment.