diff --git a/libc-test/build.rs b/libc-test/build.rs index 4c2f7f03614c0..1a5500072ece5 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -309,6 +309,9 @@ fn test_apple(target: &str) { // FIXME: The size is changed in recent macOSes. "malloc_zone_t" => true, + // it is a moving target, changing through versions + // also contains bitfields members + "tcp_connection_info" => true, _ => false, } diff --git a/libc-test/semver/apple.txt b/libc-test/semver/apple.txt index 5a34303a157fc..b1911e290dad4 100644 --- a/libc-test/semver/apple.txt +++ b/libc-test/semver/apple.txt @@ -1366,6 +1366,7 @@ TAB1 TAB2 TAB3 TABDLY +TCP_CONNECTION_INFO TCP_FASTOPEN TCP_KEEPALIVE TCP_KEEPCNT @@ -2246,6 +2247,7 @@ task_info task_inspect_t task_terminate task_threads +tcp_connection_info telldir thread_basic_info_t thread_extended_info_t diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index dbf91a099a7bc..2e7827231e65f 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -1138,6 +1138,49 @@ s! { #[cfg(not(libc_union))] pub ifc_ifcu: *mut ifreq, } + + #[cfg_attr(libc_align, repr(align(8)))] + pub struct tcp_connection_info { + pub tcpi_state: u8, + pub tcpi_snd_wscale: u8, + pub tcpi_rcv_wscale: u8, + __pad1: u8, + pub tcpi_options: u32, + pub tcpi_flags: u32, + pub tcpi_rto: u32, + pub tcpi_maxseg: u32, + pub tcpi_snd_ssthresh: u32, + pub tcpi_snd_cwnd: u32, + pub tcpi_snd_wnd: u32, + pub tcpi_snd_sbbytes: u32, + pub tcpi_rcv_wnd: u32, + pub tcpi_rttcur: u32, + pub tcpi_srtt: u32, + pub tcpi_rttvar: u32, + pub tcpi_tfo_cookie_req: u32, + pub tcpi_tfo_cookie_rcv: u32, + pub tcpi_tfo_syn_loss: u32, + pub tcpi_tfo_syn_data_sent: u32, + pub tcpi_tfo_syn_data_acked: u32, + pub tcpi_tfo_syn_data_rcv: u32, + pub tcpi_tfo_cookie_req_rcv: u32, + pub tcpi_tfo_cookie_sent: u32, + pub tcpi_tfo_cookie_invalid: u32, + pub tcpi_tfo_cookie_wrong: u32, + pub tcpi_tfo_no_cookie_rcv: u32, + pub tcpi_tfo_heuristics_disable: u32, + pub tcpi_tfo_send_blackhole: u32, + pub tcpi_tfo_recv_blackhole: u32, + pub tcpi_tfo_onebyte_proxy: u32, + __pad2: u32, + pub tcpi_txpackets: u64, + pub tcpi_txbytes: u64, + pub tcpi_txretransmitbytes: u64, + pub tcpi_rxpackets: u64, + pub tcpi_rxbytes: u64, + pub tcpi_rxoutoforderbytes: u64, + pub tcpi_rxretransmitpackets: u64, + } } s_no_extra_traits! { @@ -4103,6 +4146,7 @@ pub const TCP_KEEPINTVL: ::c_int = 0x101; pub const TCP_KEEPCNT: ::c_int = 0x102; /// Enable/Disable TCP Fastopen on this socket pub const TCP_FASTOPEN: ::c_int = 0x105; +pub const TCP_CONNECTION_INFO: ::c_int = 0x106; pub const SOL_LOCAL: ::c_int = 0;