summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-02-12 04:28:18 +0000
committerbors <bors@rust-lang.org>2023-02-12 04:28:18 +0000
commit4701fcbad2aff3740a45f5e0c3873b689f8b3a7d (patch)
tree2f29aaf54bd9978acb27f12ee5ae9d8dba117a78
parent8778e77914dd8d86a173fbb127010cf90b89b75f (diff)
parentd0ca2aedde5ad03a8a09417c4f5ec4addbd2d85d (diff)
downloadrust-libc-4701fcbad2aff3740a45f5e0c3873b689f8b3a7d.tar.gz
Auto merge of #3112 - devnexen:fbsd_tcp_info, r=JohnTitor
freebsd tcp_info data addition.
-rw-r--r--libc-test/build.rs3
-rw-r--r--libc-test/semver/freebsd.txt1
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/mod.rs62
3 files changed, 66 insertions, 0 deletions
diff --git a/libc-test/build.rs b/libc-test/build.rs
index d73879d045..a10756380b 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -2413,6 +2413,9 @@ fn test_freebsd(target: &str) {
("statinfo", "snap_time") => true,
("sctp_sndrcvinfo", "__reserve_pad") => true,
("sctp_extrcvinfo", "__reserve_pad") => true,
+ // `tcp_snd_wscale` and `tcp_rcv_wscale` are bitfields
+ ("tcp_info", "tcp_snd_wscale") => true,
+ ("tcp_info", "tcp_rcv_wscale") => true,
_ => false,
}
diff --git a/libc-test/semver/freebsd.txt b/libc-test/semver/freebsd.txt
index 7426b63419..706a35fe19 100644
--- a/libc-test/semver/freebsd.txt
+++ b/libc-test/semver/freebsd.txt
@@ -2066,6 +2066,7 @@ sysctlbyname
sysctlnametomib
tcp_fastopen
tcp_function_set
+tcp_info
telldir
thr_kill
thr_kill2
diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs
index c575bdcf72..a3e0942485 100644
--- a/src/unix/bsd/freebsdlike/freebsd/mod.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs
@@ -996,6 +996,68 @@ s! {
pub pcbcnt: u32,
}
+ pub struct tcp_info {
+ pub tcpi_state: u8,
+ pub __tcpi_ca_state: u8,
+ pub __tcpi_retransmits: u8,
+ pub __tcpi_probes: u8,
+ pub __tcpi_backoff: u8,
+ pub tcpi_options: u8,
+ pub tcp_snd_wscale: u8,
+ pub tcp_rcv_wscale: u8,
+ pub tcpi_rto: u32,
+ pub __tcpi_ato: u32,
+ pub tcpi_snd_mss: u32,
+ pub tcpi_rcv_mss: u32,
+ pub __tcpi_unacked: u32,
+ pub __tcpi_sacked: u32,
+ pub __tcpi_lost: u32,
+ pub __tcpi_retrans: u32,
+ pub __tcpi_fackets: u32,
+ pub __tcpi_last_data_sent: u32,
+ pub __tcpi_last_ack_sent: u32,
+ pub tcpi_last_data_recv: u32,
+ pub __tcpi_last_ack_recv: u32,
+ pub __tcpi_pmtu: u32,
+ pub __tcpi_rcv_ssthresh: u32,
+ pub tcpi_rtt: u32,
+ pub tcpi_rttvar: u32,
+ pub tcpi_snd_ssthresh: u32,
+ pub tcpi_snd_cwnd: u32,
+ pub __tcpi_advmss: u32,
+ pub __tcpi_reordering: u32,
+ pub __tcpi_rcv_rtt: u32,
+ pub tcpi_rcv_space: u32,
+ pub tcpi_snd_wnd: u32,
+ pub tcpi_snd_bwnd: u32,
+ pub tcpi_snd_nxt: u32,
+ pub tcpi_rcv_nxt: u32,
+ pub tcpi_toe_tid: u32,
+ pub tcpi_snd_rexmitpack: u32,
+ pub tcpi_rcv_ooopack: u32,
+ pub tcpi_snd_zerowin: u32,
+ #[cfg(freebsd14)]
+ pub tcpi_delivered_ce: u32,
+ #[cfg(freebsd14)]
+ pub tcpi_received_ce: u32,
+ #[cfg(freebsd14)]
+ pub __tcpi_delivered_e1_bytes: u32,
+ #[cfg(freebsd14)]
+ pub __tcpi_delivered_e0_bytes: u32,
+ #[cfg(freebsd14)]
+ pub __tcpi_delivered_ce_bytes: u32,
+ #[cfg(freebsd14)]
+ pub __tcpi_received_e1_bytes: u32,
+ #[cfg(freebsd14)]
+ pub __tcpi_received_e0_bytes: u32,
+ #[cfg(freebsd14)]
+ pub __tcpi_received_ce_bytes: u32,
+ #[cfg(freebsd14)]
+ pub __tcpi_pad: [u32; 19],
+ #[cfg(not(freebsd14))]
+ pub __tcpi_pad: [u32; 26],
+ }
+
pub struct _umtx_time {
pub _timeout: ::timespec,
pub _flags: u32,