Skip to content

Commit 4701fcb

Browse files
committed
Auto merge of #3112 - devnexen:fbsd_tcp_info, r=JohnTitor
freebsd tcp_info data addition.
2 parents 8778e77 + d0ca2ae commit 4701fcb

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed

libc-test/build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2413,6 +2413,9 @@ fn test_freebsd(target: &str) {
24132413
("statinfo", "snap_time") => true,
24142414
("sctp_sndrcvinfo", "__reserve_pad") => true,
24152415
("sctp_extrcvinfo", "__reserve_pad") => true,
2416+
// `tcp_snd_wscale` and `tcp_rcv_wscale` are bitfields
2417+
("tcp_info", "tcp_snd_wscale") => true,
2418+
("tcp_info", "tcp_rcv_wscale") => true,
24162419

24172420
_ => false,
24182421
}

libc-test/semver/freebsd.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2066,6 +2066,7 @@ sysctlbyname
20662066
sysctlnametomib
20672067
tcp_fastopen
20682068
tcp_function_set
2069+
tcp_info
20692070
telldir
20702071
thr_kill
20712072
thr_kill2

src/unix/bsd/freebsdlike/freebsd/mod.rs

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -996,6 +996,68 @@ s! {
996996
pub pcbcnt: u32,
997997
}
998998

999+
pub struct tcp_info {
1000+
pub tcpi_state: u8,
1001+
pub __tcpi_ca_state: u8,
1002+
pub __tcpi_retransmits: u8,
1003+
pub __tcpi_probes: u8,
1004+
pub __tcpi_backoff: u8,
1005+
pub tcpi_options: u8,
1006+
pub tcp_snd_wscale: u8,
1007+
pub tcp_rcv_wscale: u8,
1008+
pub tcpi_rto: u32,
1009+
pub __tcpi_ato: u32,
1010+
pub tcpi_snd_mss: u32,
1011+
pub tcpi_rcv_mss: u32,
1012+
pub __tcpi_unacked: u32,
1013+
pub __tcpi_sacked: u32,
1014+
pub __tcpi_lost: u32,
1015+
pub __tcpi_retrans: u32,
1016+
pub __tcpi_fackets: u32,
1017+
pub __tcpi_last_data_sent: u32,
1018+
pub __tcpi_last_ack_sent: u32,
1019+
pub tcpi_last_data_recv: u32,
1020+
pub __tcpi_last_ack_recv: u32,
1021+
pub __tcpi_pmtu: u32,
1022+
pub __tcpi_rcv_ssthresh: u32,
1023+
pub tcpi_rtt: u32,
1024+
pub tcpi_rttvar: u32,
1025+
pub tcpi_snd_ssthresh: u32,
1026+
pub tcpi_snd_cwnd: u32,
1027+
pub __tcpi_advmss: u32,
1028+
pub __tcpi_reordering: u32,
1029+
pub __tcpi_rcv_rtt: u32,
1030+
pub tcpi_rcv_space: u32,
1031+
pub tcpi_snd_wnd: u32,
1032+
pub tcpi_snd_bwnd: u32,
1033+
pub tcpi_snd_nxt: u32,
1034+
pub tcpi_rcv_nxt: u32,
1035+
pub tcpi_toe_tid: u32,
1036+
pub tcpi_snd_rexmitpack: u32,
1037+
pub tcpi_rcv_ooopack: u32,
1038+
pub tcpi_snd_zerowin: u32,
1039+
#[cfg(freebsd14)]
1040+
pub tcpi_delivered_ce: u32,
1041+
#[cfg(freebsd14)]
1042+
pub tcpi_received_ce: u32,
1043+
#[cfg(freebsd14)]
1044+
pub __tcpi_delivered_e1_bytes: u32,
1045+
#[cfg(freebsd14)]
1046+
pub __tcpi_delivered_e0_bytes: u32,
1047+
#[cfg(freebsd14)]
1048+
pub __tcpi_delivered_ce_bytes: u32,
1049+
#[cfg(freebsd14)]
1050+
pub __tcpi_received_e1_bytes: u32,
1051+
#[cfg(freebsd14)]
1052+
pub __tcpi_received_e0_bytes: u32,
1053+
#[cfg(freebsd14)]
1054+
pub __tcpi_received_ce_bytes: u32,
1055+
#[cfg(freebsd14)]
1056+
pub __tcpi_pad: [u32; 19],
1057+
#[cfg(not(freebsd14))]
1058+
pub __tcpi_pad: [u32; 26],
1059+
}
1060+
9991061
pub struct _umtx_time {
10001062
pub _timeout: ::timespec,
10011063
pub _flags: u32,

0 commit comments

Comments
 (0)