Skip to content

Commit

Permalink
Merge pull request #4093 from tgross35/sync-more
Browse files Browse the repository at this point in the history
Sync more files with `main` to reduce the diff
  • Loading branch information
tgross35 authored Nov 18, 2024
2 parents 53db662 + e0bbde3 commit 6b61531
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 135 deletions.
100 changes: 50 additions & 50 deletions src/unix/bsd/apple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1186,56 +1186,6 @@ s! {
pub tcpi_rxretransmitpackets: u64,
}

// mach/host_info.h
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],
}

pub struct in6_addrlifetime {
pub ia6t_expire: time_t,
pub ia6t_preferred: time_t,
Expand Down Expand Up @@ -1307,6 +1257,56 @@ s! {
pub ifs6_out_mldreport: ::u_quad_t,
pub ifs6_out_mlddone: ::u_quad_t,
}

// mach/host_info.h
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
3 changes: 1 addition & 2 deletions src/unix/bsd/freebsdlike/freebsd/x86.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ cfg_if! {
.field("mc_fpformat", &self.mc_fpformat)
.field("mc_ownedfp", &self.mc_ownedfp)
.field("mc_flags", &self.mc_flags)
// FIXME(msrv) debug not supported for arrays in old MSRV
// .field("mc_fpstate", &self.mc_fpstate)
.field("mc_fpstate", &self.mc_fpstate)
.field("mc_fsbase", &self.mc_fsbase)
.field("mc_gsbase", &self.mc_gsbase)
.field("mc_xfpustate", &self.mc_xfpustate)
Expand Down
63 changes: 28 additions & 35 deletions src/unix/bsd/netbsdlike/openbsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,32 @@ s_no_extra_traits! {
pub ifru_data: ::caddr_t,
pub ifru_index: ::c_uint,
}

// This type uses the union mount_info:
pub struct statfs {
pub f_flags: u32,
pub f_bsize: u32,
pub f_iosize: u32,
pub f_blocks: u64,
pub f_bfree: u64,
pub f_bavail: i64,
pub f_files: u64,
pub f_ffree: u64,
pub f_favail: i64,
pub f_syncwrites: u64,
pub f_syncreads: u64,
pub f_asyncwrites: u64,
pub f_asyncreads: u64,
pub f_fsid: ::fsid_t,
pub f_namemax: u32,
pub f_owner: ::uid_t,
pub f_ctime: u64,
pub f_fstypename: [::c_char; 16],
pub f_mntonname: [::c_char; 90],
pub f_mntfromname: [::c_char; 90],
pub f_mntfromspec: [::c_char; 90],
pub mount_info: mount_info,
}
}

cfg_if! {
Expand Down Expand Up @@ -980,39 +1006,7 @@ cfg_if! {
}
}
}
}
}

s_no_extra_traits! {
// This type uses the union mount_info:
pub struct statfs {
pub f_flags: u32,
pub f_bsize: u32,
pub f_iosize: u32,
pub f_blocks: u64,
pub f_bfree: u64,
pub f_bavail: i64,
pub f_files: u64,
pub f_ffree: u64,
pub f_favail: i64,
pub f_syncwrites: u64,
pub f_syncreads: u64,
pub f_asyncwrites: u64,
pub f_asyncreads: u64,
pub f_fsid: ::fsid_t,
pub f_namemax: u32,
pub f_owner: ::uid_t,
pub f_ctime: u64,
pub f_fstypename: [::c_char; 16],
pub f_mntonname: [::c_char; 90],
pub f_mntfromname: [::c_char; 90],
pub f_mntfromspec: [::c_char; 90],
pub mount_info: mount_info,
}
}

cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for statfs {
fn eq(&self, other: &statfs) -> bool {
self.f_flags == other.f_flags
Expand Down Expand Up @@ -1052,11 +1046,10 @@ cfg_if! {
}
}

impl Eq for statfs { }
impl Eq for statfs {}

impl ::fmt::Debug for statfs {
fn fmt(&self, f: &mut ::fmt::Formatter)
-> ::fmt::Result {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("statfs")
.field("f_flags", &self.f_flags)
.field("f_bsize", &self.f_bsize)
Expand Down
84 changes: 44 additions & 40 deletions src/unix/linux_like/linux/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! Linux-specific definitions for linux-like values
use core::mem;

pub type useconds_t = u32;
pub type dev_t = u64;
pub type socklen_t = u32;
Expand Down Expand Up @@ -244,6 +246,13 @@ s! {
pub tp_feature_req_word: ::c_uint,
}

#[repr(align(8))]
pub struct tpacket_rollover_stats {
pub tp_all: ::__u64,
pub tp_huge: ::__u64,
pub tp_failed: ::__u64,
}

pub struct tpacket_stats {
pub tp_packets: ::c_uint,
pub tp_drops: ::c_uint,
Expand Down Expand Up @@ -273,6 +282,17 @@ s! {
pub ts_usec: ::c_uint,
}

#[repr(align(8))]
pub struct tpacket_hdr_v1 {
pub block_status: ::__u32,
pub num_pkts: ::__u32,
pub offset_to_first_pkt: ::__u32,
pub blk_len: ::__u32,
pub seq_num: ::__u64,
pub ts_first_pkt: ::tpacket_bd_ts,
pub ts_last_pkt: ::tpacket_bd_ts,
}

pub struct cpu_set_t {
#[cfg(all(target_pointer_width = "32",
not(target_arch = "x86_64")))]
Expand Down Expand Up @@ -976,24 +996,6 @@ s! {
pub resolve: ::__u64,
}

#[repr(align(8))]
pub struct tpacket_rollover_stats {
pub tp_all: ::__u64,
pub tp_huge: ::__u64,
pub tp_failed: ::__u64,
}

#[repr(align(8))]
pub struct tpacket_hdr_v1 {
pub block_status: ::__u32,
pub num_pkts: ::__u32,
pub offset_to_first_pkt: ::__u32,
pub blk_len: ::__u32,
pub seq_num: ::__u64,
pub ts_first_pkt: ::tpacket_bd_ts,
pub ts_last_pkt: ::tpacket_bd_ts,
}

// linux/wireless.h

pub struct iw_param {
Expand Down Expand Up @@ -1133,34 +1135,36 @@ s! {
cfg_if! {
if #[cfg(not(target_arch = "sparc64"))] {
s!{
pub struct __c_anonymous_elf32_rela {
pub r_offset: Elf32_Addr,
pub r_info: Elf32_Word,
pub r_addend: Elf32_Sword,
}

pub struct __c_anonymous_elf64_rela {
pub r_offset: Elf64_Addr,
pub r_info: Elf64_Xword,
pub r_addend: Elf64_Sxword,
}

pub struct iw_thrspy {
pub addr: ::sockaddr,
pub qual: iw_quality,
pub low: iw_quality,
pub high: iw_quality,
}

pub struct iw_mlme {
pub cmd: __u16,
pub reason_code: __u16,
pub addr: ::sockaddr,
}

pub struct iw_michaelmicfailure {
pub flags: __u32,
pub src_addr: ::sockaddr,
pub tsc: [__u8; IW_ENCODE_SEQ_MAX_SIZE],
}

pub struct __c_anonymous_elf32_rela {
pub r_offset: Elf32_Addr,
pub r_info: Elf32_Word,
pub r_addend: Elf32_Sword,
}

pub struct __c_anonymous_elf64_rela {
pub r_offset: Elf64_Addr,
pub r_info: Elf64_Xword,
pub r_addend: Elf64_Sxword,
}
}
}
}
Expand Down Expand Up @@ -1270,11 +1274,11 @@ s_no_extra_traits! {
pub ifcu_req: *mut ::ifreq,
}

/* Structure used in SIOCGIFCONF request. Used to retrieve interface
configuration for machine (useful for programs which must know all
networks accessible). */
/// Structure used in SIOCGIFCONF request. Used to retrieve interface configuration for
/// machine (useful for programs which must know all networks accessible).
pub struct ifconf {
pub ifc_len: ::c_int, /* Size of buffer. */
/// Size of buffer
pub ifc_len: ::c_int,
pub ifc_ifcu: __c_anonymous_ifc_ifcu,
}

Expand Down Expand Up @@ -3577,15 +3581,15 @@ pub const TP_FT_REQ_FILL_RXHASH: ::__u32 = 1;

pub const TPACKET_ALIGNMENT: usize = 16;

pub const TPACKET_HDRLEN: usize = ((::mem::size_of::<::tpacket_hdr>() + TPACKET_ALIGNMENT - 1)
pub const TPACKET_HDRLEN: usize = ((mem::size_of::<::tpacket_hdr>() + TPACKET_ALIGNMENT - 1)
& !(TPACKET_ALIGNMENT - 1))
+ ::mem::size_of::<::sockaddr_ll>();
pub const TPACKET2_HDRLEN: usize = ((::mem::size_of::<::tpacket2_hdr>() + TPACKET_ALIGNMENT - 1)
+ mem::size_of::<::sockaddr_ll>();
pub const TPACKET2_HDRLEN: usize = ((mem::size_of::<::tpacket2_hdr>() + TPACKET_ALIGNMENT - 1)
& !(TPACKET_ALIGNMENT - 1))
+ ::mem::size_of::<::sockaddr_ll>();
pub const TPACKET3_HDRLEN: usize = ((::mem::size_of::<::tpacket3_hdr>() + TPACKET_ALIGNMENT - 1)
+ mem::size_of::<::sockaddr_ll>();
pub const TPACKET3_HDRLEN: usize = ((mem::size_of::<::tpacket3_hdr>() + TPACKET_ALIGNMENT - 1)
& !(TPACKET_ALIGNMENT - 1))
+ ::mem::size_of::<::sockaddr_ll>();
+ mem::size_of::<::sockaddr_ll>();

// linux/netfilter.h
pub const NF_DROP: ::c_int = 0;
Expand Down
Loading

0 comments on commit 6b61531

Please sign in to comment.