Skip to content

Commit 6a203e9

Browse files
committed
Auto merge of #3482 - devnexen:tcp_connection_info_macos, r=JohnTitor
apple adding tcp_connection_info struct
2 parents 9899913 + 9bb8dca commit 6a203e9

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed

libc-test/build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,9 @@ fn test_apple(target: &str) {
309309

310310
// FIXME: The size is changed in recent macOSes.
311311
"malloc_zone_t" => true,
312+
// it is a moving target, changing through versions
313+
// also contains bitfields members
314+
"tcp_connection_info" => true,
312315

313316
_ => false,
314317
}

libc-test/semver/apple.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,6 +1366,7 @@ TAB1
13661366
TAB2
13671367
TAB3
13681368
TABDLY
1369+
TCP_CONNECTION_INFO
13691370
TCP_FASTOPEN
13701371
TCP_KEEPALIVE
13711372
TCP_KEEPCNT
@@ -2246,6 +2247,7 @@ task_info
22462247
task_inspect_t
22472248
task_terminate
22482249
task_threads
2250+
tcp_connection_info
22492251
telldir
22502252
thread_basic_info_t
22512253
thread_extended_info_t

src/unix/bsd/apple/mod.rs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,6 +1138,49 @@ s! {
11381138
#[cfg(not(libc_union))]
11391139
pub ifc_ifcu: *mut ifreq,
11401140
}
1141+
1142+
#[cfg_attr(libc_align, repr(align(8)))]
1143+
pub struct tcp_connection_info {
1144+
pub tcpi_state: u8,
1145+
pub tcpi_snd_wscale: u8,
1146+
pub tcpi_rcv_wscale: u8,
1147+
__pad1: u8,
1148+
pub tcpi_options: u32,
1149+
pub tcpi_flags: u32,
1150+
pub tcpi_rto: u32,
1151+
pub tcpi_maxseg: u32,
1152+
pub tcpi_snd_ssthresh: u32,
1153+
pub tcpi_snd_cwnd: u32,
1154+
pub tcpi_snd_wnd: u32,
1155+
pub tcpi_snd_sbbytes: u32,
1156+
pub tcpi_rcv_wnd: u32,
1157+
pub tcpi_rttcur: u32,
1158+
pub tcpi_srtt: u32,
1159+
pub tcpi_rttvar: u32,
1160+
pub tcpi_tfo_cookie_req: u32,
1161+
pub tcpi_tfo_cookie_rcv: u32,
1162+
pub tcpi_tfo_syn_loss: u32,
1163+
pub tcpi_tfo_syn_data_sent: u32,
1164+
pub tcpi_tfo_syn_data_acked: u32,
1165+
pub tcpi_tfo_syn_data_rcv: u32,
1166+
pub tcpi_tfo_cookie_req_rcv: u32,
1167+
pub tcpi_tfo_cookie_sent: u32,
1168+
pub tcpi_tfo_cookie_invalid: u32,
1169+
pub tcpi_tfo_cookie_wrong: u32,
1170+
pub tcpi_tfo_no_cookie_rcv: u32,
1171+
pub tcpi_tfo_heuristics_disable: u32,
1172+
pub tcpi_tfo_send_blackhole: u32,
1173+
pub tcpi_tfo_recv_blackhole: u32,
1174+
pub tcpi_tfo_onebyte_proxy: u32,
1175+
__pad2: u32,
1176+
pub tcpi_txpackets: u64,
1177+
pub tcpi_txbytes: u64,
1178+
pub tcpi_txretransmitbytes: u64,
1179+
pub tcpi_rxpackets: u64,
1180+
pub tcpi_rxbytes: u64,
1181+
pub tcpi_rxoutoforderbytes: u64,
1182+
pub tcpi_rxretransmitpackets: u64,
1183+
}
11411184
}
11421185

11431186
s_no_extra_traits! {
@@ -4103,6 +4146,7 @@ pub const TCP_KEEPINTVL: ::c_int = 0x101;
41034146
pub const TCP_KEEPCNT: ::c_int = 0x102;
41044147
/// Enable/Disable TCP Fastopen on this socket
41054148
pub const TCP_FASTOPEN: ::c_int = 0x105;
4149+
pub const TCP_CONNECTION_INFO: ::c_int = 0x106;
41064150

41074151
pub const SOL_LOCAL: ::c_int = 0;
41084152

0 commit comments

Comments
 (0)