Skip to content

Commit 57a1be4

Browse files
Add missing sysctl net types for mac
1 parent 3a0b044 commit 57a1be4

File tree

1 file changed

+72
-1
lines changed

1 file changed

+72
-1
lines changed

src/unix/bsd/apple/mod.rs

+72-1
Original file line numberDiff line numberDiff line change
@@ -1218,6 +1218,51 @@ s! {
12181218
pub struct host_cpu_load_info {
12191219
pub cpu_ticks: [::natural_t; CPU_STATE_MAX as usize],
12201220
}
1221+
1222+
// net/if_mib.h
1223+
pub struct ifmibdata {
1224+
/// Name of interface
1225+
pub ifmd_name: [::c_char; ::IFNAMSIZ],
1226+
/// Number of promiscuous listeners
1227+
pub ifmd_pcount: ::c_uint,
1228+
/// Interface flags
1229+
pub ifmd_flags: ::c_uint,
1230+
/// Instantaneous length of send queue
1231+
pub ifmd_snd_len: ::c_uint,
1232+
/// Maximum length of send queue
1233+
pub ifmd_snd_maxlen: ::c_uint,
1234+
/// Number of drops in send queue
1235+
pub ifmd_snd_drops: ::c_uint,
1236+
/// For future expansion
1237+
pub ifmd_filler: [::c_uint; 4],
1238+
/// Generic information and statistics
1239+
pub ifmd_data: if_data64,
1240+
}
1241+
1242+
pub struct ifs_iso_8802_3 {
1243+
pub dot3StatsAlignmentErrors: u32,
1244+
pub dot3StatsFCSErrors: u32,
1245+
pub dot3StatsSingleCollisionFrames: u32,
1246+
pub dot3StatsMultipleCollisionFrames: u32,
1247+
pub dot3StatsSQETestErrors: u32,
1248+
pub dot3StatsDeferredTransmissions: u32,
1249+
pub dot3StatsLateCollisions: u32,
1250+
pub dot3StatsExcessiveCollisions: u32,
1251+
pub dot3StatsInternalMacTransmitErrors: u32,
1252+
pub dot3StatsCarrierSenseErrors: u32,
1253+
pub dot3StatsFrameTooLongs: u32,
1254+
pub dot3StatsInternalMacReceiveErrors: u32,
1255+
pub dot3StatsEtherChipSet: u32,
1256+
pub dot3StatsMissedFrames: u32,
1257+
pub dot3StatsCollFrequencies: [u32; 16],
1258+
pub dot3Compliance: u32,
1259+
}
1260+
1261+
pub struct if_family_id {
1262+
pub iffmid_len: u32,
1263+
pub iffmid_id: u32,
1264+
pub iffmid_str: [::c_char; 1],
1265+
}
12211266
}
12221267

12231268
s_no_extra_traits! {
@@ -3102,7 +3147,7 @@ cfg_if! {
31023147
}
31033148
}
31043149

3105-
impl ::fmt::Debug for ifconf{
3150+
impl ::fmt::Debug for ifconf {
31063151
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
31073152
f.debug_struct("ifconf").finish_non_exhaustive()
31083153
}
@@ -5496,6 +5541,32 @@ pub const HOST_VM_INFO64_COUNT: mach_msg_type_number_t =
54965541
(::mem::size_of::<vm_statistics64_data_t>() / ::mem::size_of::<integer_t>())
54975542
as mach_msg_type_number_t;
54985543

5544+
// bsd/net/if_mib.h
5545+
/// Non-interface-specific
5546+
pub const IFMIB_SYSTEM: ::c_int = 1;
5547+
/// Per-interface data table
5548+
pub const IFMIB_IFDATA: ::c_int = 2;
5549+
/// All interfaces data at once
5550+
pub const IFMIB_IFALLDATA: ::c_int = 3;
5551+
5552+
/// Generic stats for all kinds of ifaces
5553+
pub const IFDATA_GENERAL: ::c_int = 1;
5554+
/// Specific to the type of interface
5555+
pub const IFDATA_LINKSPECIFIC: ::c_int = 2;
5556+
/// Addresses assigned to interface
5557+
pub const IFDATA_ADDRS: ::c_int = 3;
5558+
/// Multicast addresses assigned to interface
5559+
pub const IFDATA_MULTIADDRS: ::c_int = 4;
5560+
5561+
/// Number of interfaces configured
5562+
pub const IFMIB_IFCOUNT: ::c_int = 1;
5563+
5564+
/// Functions not specific to a type of iface
5565+
pub const NETLINK_GENERIC: ::c_int = 0;
5566+
5567+
pub const DOT3COMPLIANCE_STATS: ::c_int = 1;
5568+
pub const DOT3COMPLIANCE_COLLS: ::c_int = 2;
5569+
54995570
f! {
55005571
pub fn CMSG_NXTHDR(mhdr: *const ::msghdr,
55015572
cmsg: *const ::cmsghdr) -> *mut ::cmsghdr {

0 commit comments

Comments
 (0)