Skip to content

Commit 6b61531

Browse files
authored
Merge pull request #4093 from tgross35/sync-more
Sync more files with `main` to reduce the diff
2 parents 53db662 + e0bbde3 commit 6b61531

File tree

6 files changed

+137
-135
lines changed

6 files changed

+137
-135
lines changed

src/unix/bsd/apple/mod.rs

+50-50
Original file line numberDiff line numberDiff line change
@@ -1186,56 +1186,6 @@ s! {
11861186
pub tcpi_rxretransmitpackets: u64,
11871187
}
11881188

1189-
// mach/host_info.h
1190-
pub struct host_cpu_load_info {
1191-
pub cpu_ticks: [::natural_t; CPU_STATE_MAX as usize],
1192-
}
1193-
1194-
// net/if_mib.h
1195-
pub struct ifmibdata {
1196-
/// Name of interface
1197-
pub ifmd_name: [::c_char; ::IFNAMSIZ],
1198-
/// Number of promiscuous listeners
1199-
pub ifmd_pcount: ::c_uint,
1200-
/// Interface flags
1201-
pub ifmd_flags: ::c_uint,
1202-
/// Instantaneous length of send queue
1203-
pub ifmd_snd_len: ::c_uint,
1204-
/// Maximum length of send queue
1205-
pub ifmd_snd_maxlen: ::c_uint,
1206-
/// Number of drops in send queue
1207-
pub ifmd_snd_drops: ::c_uint,
1208-
/// For future expansion
1209-
pub ifmd_filler: [::c_uint; 4],
1210-
/// Generic information and statistics
1211-
pub ifmd_data: if_data64,
1212-
}
1213-
1214-
pub struct ifs_iso_8802_3 {
1215-
pub dot3StatsAlignmentErrors: u32,
1216-
pub dot3StatsFCSErrors: u32,
1217-
pub dot3StatsSingleCollisionFrames: u32,
1218-
pub dot3StatsMultipleCollisionFrames: u32,
1219-
pub dot3StatsSQETestErrors: u32,
1220-
pub dot3StatsDeferredTransmissions: u32,
1221-
pub dot3StatsLateCollisions: u32,
1222-
pub dot3StatsExcessiveCollisions: u32,
1223-
pub dot3StatsInternalMacTransmitErrors: u32,
1224-
pub dot3StatsCarrierSenseErrors: u32,
1225-
pub dot3StatsFrameTooLongs: u32,
1226-
pub dot3StatsInternalMacReceiveErrors: u32,
1227-
pub dot3StatsEtherChipSet: u32,
1228-
pub dot3StatsMissedFrames: u32,
1229-
pub dot3StatsCollFrequencies: [u32; 16],
1230-
pub dot3Compliance: u32,
1231-
}
1232-
1233-
pub struct if_family_id {
1234-
pub iffmid_len: u32,
1235-
pub iffmid_id: u32,
1236-
pub iffmid_str: [::c_char; 1],
1237-
}
1238-
12391189
pub struct in6_addrlifetime {
12401190
pub ia6t_expire: time_t,
12411191
pub ia6t_preferred: time_t,
@@ -1307,6 +1257,56 @@ s! {
13071257
pub ifs6_out_mldreport: ::u_quad_t,
13081258
pub ifs6_out_mlddone: ::u_quad_t,
13091259
}
1260+
1261+
// mach/host_info.h
1262+
pub struct host_cpu_load_info {
1263+
pub cpu_ticks: [::natural_t; CPU_STATE_MAX as usize],
1264+
}
1265+
1266+
// net/if_mib.h
1267+
pub struct ifmibdata {
1268+
/// Name of interface
1269+
pub ifmd_name: [::c_char; ::IFNAMSIZ],
1270+
/// Number of promiscuous listeners
1271+
pub ifmd_pcount: ::c_uint,
1272+
/// Interface flags
1273+
pub ifmd_flags: ::c_uint,
1274+
/// Instantaneous length of send queue
1275+
pub ifmd_snd_len: ::c_uint,
1276+
/// Maximum length of send queue
1277+
pub ifmd_snd_maxlen: ::c_uint,
1278+
/// Number of drops in send queue
1279+
pub ifmd_snd_drops: ::c_uint,
1280+
/// For future expansion
1281+
pub ifmd_filler: [::c_uint; 4],
1282+
/// Generic information and statistics
1283+
pub ifmd_data: if_data64,
1284+
}
1285+
1286+
pub struct ifs_iso_8802_3 {
1287+
pub dot3StatsAlignmentErrors: u32,
1288+
pub dot3StatsFCSErrors: u32,
1289+
pub dot3StatsSingleCollisionFrames: u32,
1290+
pub dot3StatsMultipleCollisionFrames: u32,
1291+
pub dot3StatsSQETestErrors: u32,
1292+
pub dot3StatsDeferredTransmissions: u32,
1293+
pub dot3StatsLateCollisions: u32,
1294+
pub dot3StatsExcessiveCollisions: u32,
1295+
pub dot3StatsInternalMacTransmitErrors: u32,
1296+
pub dot3StatsCarrierSenseErrors: u32,
1297+
pub dot3StatsFrameTooLongs: u32,
1298+
pub dot3StatsInternalMacReceiveErrors: u32,
1299+
pub dot3StatsEtherChipSet: u32,
1300+
pub dot3StatsMissedFrames: u32,
1301+
pub dot3StatsCollFrequencies: [u32; 16],
1302+
pub dot3Compliance: u32,
1303+
}
1304+
1305+
pub struct if_family_id {
1306+
pub iffmid_len: u32,
1307+
pub iffmid_id: u32,
1308+
pub iffmid_str: [::c_char; 1],
1309+
}
13101310
}
13111311

13121312
s_no_extra_traits! {

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ cfg_if! {
107107
.field("mc_fpformat", &self.mc_fpformat)
108108
.field("mc_ownedfp", &self.mc_ownedfp)
109109
.field("mc_flags", &self.mc_flags)
110-
// FIXME(msrv) debug not supported for arrays in old MSRV
111-
// .field("mc_fpstate", &self.mc_fpstate)
110+
.field("mc_fpstate", &self.mc_fpstate)
112111
.field("mc_fsbase", &self.mc_fsbase)
113112
.field("mc_gsbase", &self.mc_gsbase)
114113
.field("mc_xfpustate", &self.mc_xfpustate)

src/unix/bsd/netbsdlike/openbsd/mod.rs

+28-35
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,32 @@ s_no_extra_traits! {
724724
pub ifru_data: ::caddr_t,
725725
pub ifru_index: ::c_uint,
726726
}
727+
728+
// This type uses the union mount_info:
729+
pub struct statfs {
730+
pub f_flags: u32,
731+
pub f_bsize: u32,
732+
pub f_iosize: u32,
733+
pub f_blocks: u64,
734+
pub f_bfree: u64,
735+
pub f_bavail: i64,
736+
pub f_files: u64,
737+
pub f_ffree: u64,
738+
pub f_favail: i64,
739+
pub f_syncwrites: u64,
740+
pub f_syncreads: u64,
741+
pub f_asyncwrites: u64,
742+
pub f_asyncreads: u64,
743+
pub f_fsid: ::fsid_t,
744+
pub f_namemax: u32,
745+
pub f_owner: ::uid_t,
746+
pub f_ctime: u64,
747+
pub f_fstypename: [::c_char; 16],
748+
pub f_mntonname: [::c_char; 90],
749+
pub f_mntfromname: [::c_char; 90],
750+
pub f_mntfromspec: [::c_char; 90],
751+
pub mount_info: mount_info,
752+
}
727753
}
728754

729755
cfg_if! {
@@ -980,39 +1006,7 @@ cfg_if! {
9801006
}
9811007
}
9821008
}
983-
}
984-
}
9851009

986-
s_no_extra_traits! {
987-
// This type uses the union mount_info:
988-
pub struct statfs {
989-
pub f_flags: u32,
990-
pub f_bsize: u32,
991-
pub f_iosize: u32,
992-
pub f_blocks: u64,
993-
pub f_bfree: u64,
994-
pub f_bavail: i64,
995-
pub f_files: u64,
996-
pub f_ffree: u64,
997-
pub f_favail: i64,
998-
pub f_syncwrites: u64,
999-
pub f_syncreads: u64,
1000-
pub f_asyncwrites: u64,
1001-
pub f_asyncreads: u64,
1002-
pub f_fsid: ::fsid_t,
1003-
pub f_namemax: u32,
1004-
pub f_owner: ::uid_t,
1005-
pub f_ctime: u64,
1006-
pub f_fstypename: [::c_char; 16],
1007-
pub f_mntonname: [::c_char; 90],
1008-
pub f_mntfromname: [::c_char; 90],
1009-
pub f_mntfromspec: [::c_char; 90],
1010-
pub mount_info: mount_info,
1011-
}
1012-
}
1013-
1014-
cfg_if! {
1015-
if #[cfg(feature = "extra_traits")] {
10161010
impl PartialEq for statfs {
10171011
fn eq(&self, other: &statfs) -> bool {
10181012
self.f_flags == other.f_flags
@@ -1052,11 +1046,10 @@ cfg_if! {
10521046
}
10531047
}
10541048

1055-
impl Eq for statfs { }
1049+
impl Eq for statfs {}
10561050

10571051
impl ::fmt::Debug for statfs {
1058-
fn fmt(&self, f: &mut ::fmt::Formatter)
1059-
-> ::fmt::Result {
1052+
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
10601053
f.debug_struct("statfs")
10611054
.field("f_flags", &self.f_flags)
10621055
.field("f_bsize", &self.f_bsize)

src/unix/linux_like/linux/mod.rs

+44-40
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! Linux-specific definitions for linux-like values
22
3+
use core::mem;
4+
35
pub type useconds_t = u32;
46
pub type dev_t = u64;
57
pub type socklen_t = u32;
@@ -244,6 +246,13 @@ s! {
244246
pub tp_feature_req_word: ::c_uint,
245247
}
246248

249+
#[repr(align(8))]
250+
pub struct tpacket_rollover_stats {
251+
pub tp_all: ::__u64,
252+
pub tp_huge: ::__u64,
253+
pub tp_failed: ::__u64,
254+
}
255+
247256
pub struct tpacket_stats {
248257
pub tp_packets: ::c_uint,
249258
pub tp_drops: ::c_uint,
@@ -273,6 +282,17 @@ s! {
273282
pub ts_usec: ::c_uint,
274283
}
275284

285+
#[repr(align(8))]
286+
pub struct tpacket_hdr_v1 {
287+
pub block_status: ::__u32,
288+
pub num_pkts: ::__u32,
289+
pub offset_to_first_pkt: ::__u32,
290+
pub blk_len: ::__u32,
291+
pub seq_num: ::__u64,
292+
pub ts_first_pkt: ::tpacket_bd_ts,
293+
pub ts_last_pkt: ::tpacket_bd_ts,
294+
}
295+
276296
pub struct cpu_set_t {
277297
#[cfg(all(target_pointer_width = "32",
278298
not(target_arch = "x86_64")))]
@@ -976,24 +996,6 @@ s! {
976996
pub resolve: ::__u64,
977997
}
978998

979-
#[repr(align(8))]
980-
pub struct tpacket_rollover_stats {
981-
pub tp_all: ::__u64,
982-
pub tp_huge: ::__u64,
983-
pub tp_failed: ::__u64,
984-
}
985-
986-
#[repr(align(8))]
987-
pub struct tpacket_hdr_v1 {
988-
pub block_status: ::__u32,
989-
pub num_pkts: ::__u32,
990-
pub offset_to_first_pkt: ::__u32,
991-
pub blk_len: ::__u32,
992-
pub seq_num: ::__u64,
993-
pub ts_first_pkt: ::tpacket_bd_ts,
994-
pub ts_last_pkt: ::tpacket_bd_ts,
995-
}
996-
997999
// linux/wireless.h
9981000

9991001
pub struct iw_param {
@@ -1133,34 +1135,36 @@ s! {
11331135
cfg_if! {
11341136
if #[cfg(not(target_arch = "sparc64"))] {
11351137
s!{
1136-
pub struct __c_anonymous_elf32_rela {
1137-
pub r_offset: Elf32_Addr,
1138-
pub r_info: Elf32_Word,
1139-
pub r_addend: Elf32_Sword,
1140-
}
1141-
1142-
pub struct __c_anonymous_elf64_rela {
1143-
pub r_offset: Elf64_Addr,
1144-
pub r_info: Elf64_Xword,
1145-
pub r_addend: Elf64_Sxword,
1146-
}
1147-
11481138
pub struct iw_thrspy {
11491139
pub addr: ::sockaddr,
11501140
pub qual: iw_quality,
11511141
pub low: iw_quality,
11521142
pub high: iw_quality,
11531143
}
1144+
11541145
pub struct iw_mlme {
11551146
pub cmd: __u16,
11561147
pub reason_code: __u16,
11571148
pub addr: ::sockaddr,
11581149
}
1150+
11591151
pub struct iw_michaelmicfailure {
11601152
pub flags: __u32,
11611153
pub src_addr: ::sockaddr,
11621154
pub tsc: [__u8; IW_ENCODE_SEQ_MAX_SIZE],
11631155
}
1156+
1157+
pub struct __c_anonymous_elf32_rela {
1158+
pub r_offset: Elf32_Addr,
1159+
pub r_info: Elf32_Word,
1160+
pub r_addend: Elf32_Sword,
1161+
}
1162+
1163+
pub struct __c_anonymous_elf64_rela {
1164+
pub r_offset: Elf64_Addr,
1165+
pub r_info: Elf64_Xword,
1166+
pub r_addend: Elf64_Sxword,
1167+
}
11641168
}
11651169
}
11661170
}
@@ -1270,11 +1274,11 @@ s_no_extra_traits! {
12701274
pub ifcu_req: *mut ::ifreq,
12711275
}
12721276

1273-
/* Structure used in SIOCGIFCONF request. Used to retrieve interface
1274-
configuration for machine (useful for programs which must know all
1275-
networks accessible). */
1277+
/// Structure used in SIOCGIFCONF request. Used to retrieve interface configuration for
1278+
/// machine (useful for programs which must know all networks accessible).
12761279
pub struct ifconf {
1277-
pub ifc_len: ::c_int, /* Size of buffer. */
1280+
/// Size of buffer
1281+
pub ifc_len: ::c_int,
12781282
pub ifc_ifcu: __c_anonymous_ifc_ifcu,
12791283
}
12801284

@@ -3577,15 +3581,15 @@ pub const TP_FT_REQ_FILL_RXHASH: ::__u32 = 1;
35773581

35783582
pub const TPACKET_ALIGNMENT: usize = 16;
35793583

3580-
pub const TPACKET_HDRLEN: usize = ((::mem::size_of::<::tpacket_hdr>() + TPACKET_ALIGNMENT - 1)
3584+
pub const TPACKET_HDRLEN: usize = ((mem::size_of::<::tpacket_hdr>() + TPACKET_ALIGNMENT - 1)
35813585
& !(TPACKET_ALIGNMENT - 1))
3582-
+ ::mem::size_of::<::sockaddr_ll>();
3583-
pub const TPACKET2_HDRLEN: usize = ((::mem::size_of::<::tpacket2_hdr>() + TPACKET_ALIGNMENT - 1)
3586+
+ mem::size_of::<::sockaddr_ll>();
3587+
pub const TPACKET2_HDRLEN: usize = ((mem::size_of::<::tpacket2_hdr>() + TPACKET_ALIGNMENT - 1)
35843588
& !(TPACKET_ALIGNMENT - 1))
3585-
+ ::mem::size_of::<::sockaddr_ll>();
3586-
pub const TPACKET3_HDRLEN: usize = ((::mem::size_of::<::tpacket3_hdr>() + TPACKET_ALIGNMENT - 1)
3589+
+ mem::size_of::<::sockaddr_ll>();
3590+
pub const TPACKET3_HDRLEN: usize = ((mem::size_of::<::tpacket3_hdr>() + TPACKET_ALIGNMENT - 1)
35873591
& !(TPACKET_ALIGNMENT - 1))
3588-
+ ::mem::size_of::<::sockaddr_ll>();
3592+
+ mem::size_of::<::sockaddr_ll>();
35893593

35903594
// linux/netfilter.h
35913595
pub const NF_DROP: ::c_int = 0;

0 commit comments

Comments
 (0)