Skip to content

Commit bd40454

Browse files
authored
Merge pull request #4069 from tgross35/backport-potato
[0.2] Backports
2 parents 0f15698 + 23f263e commit bd40454

File tree

4 files changed

+80
-1
lines changed

4 files changed

+80
-1
lines changed

libc-test/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "libc-test"
33
version = "0.2.155"
4-
edition = "2018"
4+
edition = "2021"
55
authors = ["The Rust Project Developers"]
66
license = "MIT OR Apache-2.0"
77
build = "build.rs"

libc-test/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ fn test_apple(target: &str) {
221221
"net/if.h",
222222
"net/if_arp.h",
223223
"net/if_dl.h",
224+
"net/if_mib.h",
224225
"net/if_utun.h",
225226
"net/if_var.h",
226227
"net/ndrv.h",

src/unix/bsd/apple/mod.rs

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,6 +1188,51 @@ s! {
11881188
pub struct host_cpu_load_info {
11891189
pub cpu_ticks: [::natural_t; CPU_STATE_MAX as usize],
11901190
}
1191+
1192+
// net/if_mib.h
1193+
pub struct ifmibdata {
1194+
/// Name of interface
1195+
pub ifmd_name: [::c_char; ::IFNAMSIZ],
1196+
/// Number of promiscuous listeners
1197+
pub ifmd_pcount: ::c_uint,
1198+
/// Interface flags
1199+
pub ifmd_flags: ::c_uint,
1200+
/// Instantaneous length of send queue
1201+
pub ifmd_snd_len: ::c_uint,
1202+
/// Maximum length of send queue
1203+
pub ifmd_snd_maxlen: ::c_uint,
1204+
/// Number of drops in send queue
1205+
pub ifmd_snd_drops: ::c_uint,
1206+
/// For future expansion
1207+
pub ifmd_filler: [::c_uint; 4],
1208+
/// Generic information and statistics
1209+
pub ifmd_data: if_data64,
1210+
}
1211+
1212+
pub struct ifs_iso_8802_3 {
1213+
pub dot3StatsAlignmentErrors: u32,
1214+
pub dot3StatsFCSErrors: u32,
1215+
pub dot3StatsSingleCollisionFrames: u32,
1216+
pub dot3StatsMultipleCollisionFrames: u32,
1217+
pub dot3StatsSQETestErrors: u32,
1218+
pub dot3StatsDeferredTransmissions: u32,
1219+
pub dot3StatsLateCollisions: u32,
1220+
pub dot3StatsExcessiveCollisions: u32,
1221+
pub dot3StatsInternalMacTransmitErrors: u32,
1222+
pub dot3StatsCarrierSenseErrors: u32,
1223+
pub dot3StatsFrameTooLongs: u32,
1224+
pub dot3StatsInternalMacReceiveErrors: u32,
1225+
pub dot3StatsEtherChipSet: u32,
1226+
pub dot3StatsMissedFrames: u32,
1227+
pub dot3StatsCollFrequencies: [u32; 16],
1228+
pub dot3Compliance: u32,
1229+
}
1230+
1231+
pub struct if_family_id {
1232+
pub iffmid_len: u32,
1233+
pub iffmid_id: u32,
1234+
pub iffmid_str: [::c_char; 1],
1235+
}
11911236
}
11921237

11931238
s_no_extra_traits! {
@@ -5529,6 +5574,32 @@ pub const HOST_VM_INFO64_COUNT: mach_msg_type_number_t =
55295574
(::mem::size_of::<vm_statistics64_data_t>() / ::mem::size_of::<integer_t>())
55305575
as mach_msg_type_number_t;
55315576

5577+
// bsd/net/if_mib.h
5578+
/// Non-interface-specific
5579+
pub const IFMIB_SYSTEM: ::c_int = 1;
5580+
/// Per-interface data table
5581+
pub const IFMIB_IFDATA: ::c_int = 2;
5582+
/// All interfaces data at once
5583+
pub const IFMIB_IFALLDATA: ::c_int = 3;
5584+
5585+
/// Generic stats for all kinds of ifaces
5586+
pub const IFDATA_GENERAL: ::c_int = 1;
5587+
/// Specific to the type of interface
5588+
pub const IFDATA_LINKSPECIFIC: ::c_int = 2;
5589+
/// Addresses assigned to interface
5590+
pub const IFDATA_ADDRS: ::c_int = 3;
5591+
/// Multicast addresses assigned to interface
5592+
pub const IFDATA_MULTIADDRS: ::c_int = 4;
5593+
5594+
/// Number of interfaces configured
5595+
pub const IFMIB_IFCOUNT: ::c_int = 1;
5596+
5597+
/// Functions not specific to a type of iface
5598+
pub const NETLINK_GENERIC: ::c_int = 0;
5599+
5600+
pub const DOT3COMPLIANCE_STATS: ::c_int = 1;
5601+
pub const DOT3COMPLIANCE_COLLS: ::c_int = 2;
5602+
55325603
f! {
55335604
pub fn CMSG_NXTHDR(mhdr: *const ::msghdr,
55345605
cmsg: *const ::cmsghdr) -> *mut ::cmsghdr {

triagebot.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ contributing_url = "https://github.com/rust-lang/libc/blob/HEAD/CONTRIBUTING.md"
99
[assign.owners]
1010
"*" = ["@JohnTitor"]
1111

12+
[autolabel."A-CI"]
13+
trigger_files = [
14+
".cirrus.yml",
15+
".github",
16+
"src/ci",
17+
]
18+
1219
[autolabel."S-waiting-on-review"]
1320
new_pr = true
1421

0 commit comments

Comments
 (0)