summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Carlier <devnexen@gmail.com>2023-02-10 22:11:24 +0000
committerDavid Carlier <devnexen@gmail.com>2023-02-10 22:32:37 +0000
commitd0ca2aedde5ad03a8a09417c4f5ec4addbd2d85d (patch)
tree36942b00bbfc3a28c4bb9ab2a5936899d0e13947
parent17adcf2811720173562d25b4aa5a7d4e4aa1bf46 (diff)
downloadrust-libc-d0ca2aedde5ad03a8a09417c4f5ec4addbd2d85d.tar.gz
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 79c5fbc7fd..c776e45829 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,