Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[0.2] Backports #4069

Merged
merged 4 commits into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libc-test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "libc-test"
version = "0.2.155"
edition = "2018"
edition = "2021"
authors = ["The Rust Project Developers"]
license = "MIT OR Apache-2.0"
build = "build.rs"
Expand Down
1 change: 1 addition & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ fn test_apple(target: &str) {
"net/if.h",
"net/if_arp.h",
"net/if_dl.h",
"net/if_mib.h",
"net/if_utun.h",
"net/if_var.h",
"net/ndrv.h",
Expand Down
71 changes: 71 additions & 0 deletions src/unix/bsd/apple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1188,6 +1188,51 @@ s! {
pub struct host_cpu_load_info {
pub cpu_ticks: [::natural_t; CPU_STATE_MAX as usize],
}

// net/if_mib.h
pub struct ifmibdata {
/// Name of interface
pub ifmd_name: [::c_char; ::IFNAMSIZ],
/// Number of promiscuous listeners
pub ifmd_pcount: ::c_uint,
/// Interface flags
pub ifmd_flags: ::c_uint,
/// Instantaneous length of send queue
pub ifmd_snd_len: ::c_uint,
/// Maximum length of send queue
pub ifmd_snd_maxlen: ::c_uint,
/// Number of drops in send queue
pub ifmd_snd_drops: ::c_uint,
/// For future expansion
pub ifmd_filler: [::c_uint; 4],
/// Generic information and statistics
pub ifmd_data: if_data64,
}

pub struct ifs_iso_8802_3 {
pub dot3StatsAlignmentErrors: u32,
pub dot3StatsFCSErrors: u32,
pub dot3StatsSingleCollisionFrames: u32,
pub dot3StatsMultipleCollisionFrames: u32,
pub dot3StatsSQETestErrors: u32,
pub dot3StatsDeferredTransmissions: u32,
pub dot3StatsLateCollisions: u32,
pub dot3StatsExcessiveCollisions: u32,
pub dot3StatsInternalMacTransmitErrors: u32,
pub dot3StatsCarrierSenseErrors: u32,
pub dot3StatsFrameTooLongs: u32,
pub dot3StatsInternalMacReceiveErrors: u32,
pub dot3StatsEtherChipSet: u32,
pub dot3StatsMissedFrames: u32,
pub dot3StatsCollFrequencies: [u32; 16],
pub dot3Compliance: u32,
}

pub struct if_family_id {
pub iffmid_len: u32,
pub iffmid_id: u32,
pub iffmid_str: [::c_char; 1],
}
}

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

// bsd/net/if_mib.h
/// Non-interface-specific
pub const IFMIB_SYSTEM: ::c_int = 1;
/// Per-interface data table
pub const IFMIB_IFDATA: ::c_int = 2;
/// All interfaces data at once
pub const IFMIB_IFALLDATA: ::c_int = 3;

/// Generic stats for all kinds of ifaces
pub const IFDATA_GENERAL: ::c_int = 1;
/// Specific to the type of interface
pub const IFDATA_LINKSPECIFIC: ::c_int = 2;
/// Addresses assigned to interface
pub const IFDATA_ADDRS: ::c_int = 3;
/// Multicast addresses assigned to interface
pub const IFDATA_MULTIADDRS: ::c_int = 4;

/// Number of interfaces configured
pub const IFMIB_IFCOUNT: ::c_int = 1;

/// Functions not specific to a type of iface
pub const NETLINK_GENERIC: ::c_int = 0;

pub const DOT3COMPLIANCE_STATS: ::c_int = 1;
pub const DOT3COMPLIANCE_COLLS: ::c_int = 2;

f! {
pub fn CMSG_NXTHDR(mhdr: *const ::msghdr,
cmsg: *const ::cmsghdr) -> *mut ::cmsghdr {
Expand Down
7 changes: 7 additions & 0 deletions triagebot.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ contributing_url = "https://github.com/rust-lang/libc/blob/HEAD/CONTRIBUTING.md"
[assign.owners]
"*" = ["@JohnTitor"]

[autolabel."A-CI"]
trigger_files = [
".cirrus.yml",
".github",
"src/ci",
]

[autolabel."S-waiting-on-review"]
new_pr = true

Expand Down