From 6b66949660e0027ce9b1c6130d8ce047d637d64d Mon Sep 17 00:00:00 2001 From: David Carlier Date: Fri, 15 Dec 2023 19:04:08 +0000 Subject: [PATCH] apple adding tcp_connection_info struct --- libc-test/build.rs | 1 + libc-test/semver/apple.txt | 2 ++ src/unix/bsd/apple/mod.rs | 42 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) diff --git a/libc-test/build.rs b/libc-test/build.rs index a9d04ca81cc15..0f86c3e741969 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -309,6 +309,7 @@ fn test_apple(target: &str) { // FIXME: The size is changed in recent macOSes. "malloc_zone_t" => true, + "tcp_connection_info" => true, _ => false, } diff --git a/libc-test/semver/apple.txt b/libc-test/semver/apple.txt index a3e2161ab9ee1..e5e5ded83628e 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 @@ -2245,6 +2246,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 c7169a2274769..21ae4574b318d 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -1138,6 +1138,47 @@ s! { #[cfg(not(libc_union))] pub ifc_ifcu: *mut ifreq, } + + #[repr(C, align(8))] + pub struct tcp_connection_info { + pub tcpi_state: u8, + pub tcpi_snd_wscale: u8, + pub tcpi_rcv_wscale: 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: u8, + pub tcpi_tfo_cookie_rcv: u8, + pub tcpi_tfo_syn_loss: u8, + pub tcpi_tfo_syn_data_sent: u8, + pub tcpi_tfo_syn_data_acked: u8, + pub tcpi_tfo_syn_data_rcv: u8, + pub tcpi_tfo_cookie_req_rcv: u8, + pub tcpi_tfo_cookie_sent: u8, + pub tcpi_tfo_cookie_invalid: u8, + pub tcpi_tfo_cookie_wrong: u8, + pub tcpi_tfo_no_cookie_rcv: u8, + pub tcpi_tfo_heuristics_disable: u8, + pub tcpi_tfo_send_blackhole: u8, + pub tcpi_tfo_recv_blackhole: u8, + pub tcpi_tfo_onebyte_proxy: u8, + 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 +4144,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;