Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apple adding tcp_connection_info struct #3482

Merged
merged 1 commit into from Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions libc-test/build.rs
Expand Up @@ -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,
}
Expand Down
2 changes: 2 additions & 0 deletions libc-test/semver/apple.txt
Expand Up @@ -1366,6 +1366,7 @@ TAB1
TAB2
TAB3
TABDLY
TCP_CONNECTION_INFO
TCP_FASTOPEN
TCP_KEEPALIVE
TCP_KEEPCNT
Expand Down Expand Up @@ -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
Expand Down
44 changes: 44 additions & 0 deletions src/unix/bsd/apple/mod.rs
Expand Up @@ -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! {
Expand Down Expand Up @@ -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;

Expand Down