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

Fix tests on FreeBSD x86 #3948

Merged
merged 8 commits into from
Oct 24, 2024
1 change: 1 addition & 0 deletions src/unix/bsd/freebsdlike/dragonfly/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1462,6 +1462,7 @@ pub const TIOCISPTMASTER: ::c_ulong = 0x20007455;
pub const TIOCMODG: ::c_ulong = 0x40047403;
pub const TIOCMODS: ::c_ulong = 0x80047404;
pub const TIOCREMOTE: ::c_ulong = 0x80047469;
pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459;

// Constants used by "at" family of system calls.
pub const AT_FDCWD: ::c_int = 0xFFFAFDCD; // invalid file descriptor
Expand Down
4 changes: 4 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/aarch64.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pub type c_char = u8;
pub type c_long = i64;
pub type c_ulong = u64;
pub type clock_t = i32;
pub type wchar_t = u32;
pub type time_t = i64;
pub type suseconds_t = i64;
Expand Down Expand Up @@ -133,5 +134,8 @@ cfg_if! {
}
}

pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d;
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e;
pub const MAP_32BIT: ::c_int = 0x00080000;
pub const MINSIGSTKSZ: ::size_t = 4096; // 1024 * 4
pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459;
4 changes: 4 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/arm.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pub type c_char = u8;
pub type c_long = i32;
pub type c_ulong = u32;
pub type clock_t = u32;
pub type wchar_t = u32;
pub type time_t = i64;
pub type suseconds_t = i32;
Expand Down Expand Up @@ -50,5 +51,8 @@ cfg_if! {
}

pub(crate) const _ALIGNBYTES: usize = ::mem::size_of::<::c_int>() - 1;
pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d;
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e;
pub const MAP_32BIT: ::c_int = 0x00080000;
pub const MINSIGSTKSZ: ::size_t = 4096; // 1024 * 4
pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459;
5 changes: 4 additions & 1 deletion src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ s! {
}

pub struct __c_anonymous_domainset {
_priv: [::uintptr_t; 4],
#[cfg(target_pointer_width = "64")]
_priv: [::c_ulong; 4],
#[cfg(target_pointer_width = "32")]
_priv: [::c_ulong; 8],
}

pub struct kinfo_proc {
Expand Down
5 changes: 4 additions & 1 deletion src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ s! {
}

pub struct __c_anonymous_domainset {
_priv: [::uintptr_t; 4],
#[cfg(target_pointer_width = "64")]
_priv: [::c_ulong; 4],
#[cfg(target_pointer_width = "32")]
_priv: [::c_ulong; 8],
}

pub struct kinfo_proc {
Expand Down
5 changes: 4 additions & 1 deletion src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ s! {
}

pub struct __c_anonymous_domainset {
_priv: [::uintptr_t; 4],
#[cfg(target_pointer_width = "64")]
_priv: [::c_ulong; 4],
#[cfg(target_pointer_width = "32")]
_priv: [::c_ulong; 8],
}

pub struct kinfo_proc {
Expand Down
20 changes: 16 additions & 4 deletions src/unix/bsd/freebsdlike/freebsd/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
pub type fflags_t = u32;
pub type clock_t = i32;

pub type vm_prot_t = u_char;
pub type kvaddr_t = u64;
Expand Down Expand Up @@ -1630,7 +1629,7 @@ s_no_extra_traits! {
pub kf_flags: ::c_int,
_kf_pad0: ::c_int,
pub kf_offset: i64,
_priv: [::uintptr_t; 38], // FIXME if needed
_priv: [u8; 304], // FIXME: this is really a giant union
pub kf_status: u16,
_kf_pad1: u16,
_kf_ispare0: ::c_int,
Expand Down Expand Up @@ -3145,9 +3144,22 @@ pub const H4DISC: ::c_int = 0x7;

pub const VM_TOTAL: ::c_int = 1;

pub const BIOCSETFNR: ::c_ulong = 0x80104282;
cfg_if! {
if #[cfg(target_pointer_width = "64")] {
pub const BIOCSETFNR: ::c_ulong = 0x80104282;
} else {
pub const BIOCSETFNR: ::c_ulong = 0x80084282;
}
}

cfg_if! {
if #[cfg(target_pointer_width = "64")] {
pub const FIODGNAME: ::c_ulong = 0x80106678;
} else {
pub const FIODGNAME: ::c_ulong = 0x80086678;
}
}

pub const FIODGNAME: ::c_ulong = 0x80106678;
pub const FIONWRITE: ::c_ulong = 0x40046677;
pub const FIONSPACE: ::c_ulong = 0x40046676;
pub const FIOSEEKDATA: ::c_ulong = 0xc0086661;
Expand Down
4 changes: 4 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/powerpc.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pub type c_char = u8;
pub type c_long = i32;
pub type c_ulong = u32;
pub type clock_t = u32;
pub type wchar_t = i32;
pub type time_t = i64;
pub type suseconds_t = i32;
Expand Down Expand Up @@ -69,5 +70,8 @@ cfg_if! {
}

pub(crate) const _ALIGNBYTES: usize = ::mem::size_of::<::c_int>() - 1;
pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d;
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e;
pub const MAP_32BIT: ::c_int = 0x00080000;
pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4
pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459;
4 changes: 4 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/powerpc64.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pub type c_char = u8;
pub type c_long = i64;
pub type c_ulong = u64;
pub type clock_t = u32;
pub type wchar_t = i32;
pub type time_t = i64;
pub type suseconds_t = i64;
Expand Down Expand Up @@ -69,5 +70,8 @@ cfg_if! {
}

pub(crate) const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1;
pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d;
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e;
pub const MAP_32BIT: ::c_int = 0x00080000;
pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4
pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459;
4 changes: 4 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/riscv64.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pub type c_char = u8;
pub type c_long = i64;
pub type c_ulong = u64;
pub type clock_t = i32;
pub type wchar_t = ::c_int;
pub type time_t = i64;
pub type suseconds_t = ::c_long;
Expand Down Expand Up @@ -141,5 +142,8 @@ cfg_if! {
}
}

pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d;
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e;
pub const MAP_32BIT: ::c_int = 0x00080000;
pub const MINSIGSTKSZ: ::size_t = 4096; // 1024 * 4
pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459;
7 changes: 6 additions & 1 deletion src/unix/bsd/freebsdlike/freebsd/x86.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
pub type c_char = i8;
pub type c_long = i32;
pub type c_ulong = u32;
pub type clock_t = ::c_ulong;
pub type wchar_t = i32;
pub type time_t = i32;
pub type suseconds_t = i32;
pub type register_t = i32;

s_no_extra_traits! {
#[repr(align(16))]
pub struct mcontext_t {
pub mc_onstack: register_t,
pub mc_gs: register_t,
Expand All @@ -32,7 +34,7 @@ s_no_extra_traits! {
pub mc_fpformat: ::c_int,
pub mc_ownedfp: ::c_int,
pub mc_flags: register_t,
pub mc_fpstate: [[::c_int; 32]; 4],
pub mc_fpstate: [::c_int; 128],
pub mc_fsbase: register_t,
pub mc_gsbase: register_t,
pub mc_xfpustate: register_t,
Expand Down Expand Up @@ -155,4 +157,7 @@ cfg_if! {

pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4

pub const BIOCSRTIMEOUT: ::c_ulong = 0x8008426d;
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4008426e;
pub const KINFO_FILE_SIZE: ::c_int = 1392;
pub const TIOCTIMESTAMP: ::c_ulong = 0x40087459;
6 changes: 6 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pub type c_char = i8;
pub type c_long = i64;
pub type c_ulong = u64;
pub type clock_t = i32;
pub type wchar_t = i32;
pub type time_t = i64;
pub type suseconds_t = i64;
Expand Down Expand Up @@ -220,6 +221,9 @@ cfg_if! {

pub(crate) const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1;

pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d;
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e;

pub const MAP_32BIT: ::c_int = 0x00080000;
pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4

Expand All @@ -236,5 +240,7 @@ pub const _MC_FPOWNED_PCB: c_long = 0x20002;

pub const KINFO_FILE_SIZE: ::c_int = 1392;

pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459;

mod align;
pub use self::align::*;
14 changes: 9 additions & 5 deletions src/unix/bsd/freebsdlike/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,6 @@ pub const TIOCGETD: ::c_ulong = 0x4004741a;
pub const TIOCSETD: ::c_ulong = 0x8004741b;
pub const TIOCGDRAINWAIT: ::c_ulong = 0x40047456;
pub const TIOCSDRAINWAIT: ::c_ulong = 0x80047457;
pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459;
pub const TIOCMGDTRWAIT: ::c_ulong = 0x4004745a;
pub const TIOCMSDTRWAIT: ::c_ulong = 0x8004745b;
pub const TIOCDRAIN: ::c_ulong = 0x2000745e;
Expand Down Expand Up @@ -1279,10 +1278,15 @@ pub const BIOCSRSIG: ::c_ulong = 0x80044273;
pub const BIOCSDLT: ::c_ulong = 0x80044278;
pub const BIOCGSEESENT: ::c_ulong = 0x40044276;
pub const BIOCSSEESENT: ::c_ulong = 0x80044277;
pub const BIOCSETF: ::c_ulong = 0x80104267;
pub const BIOCGDLTLIST: ::c_ulong = 0xc0104279;
pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d;
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e;
cfg_if! {
if #[cfg(target_pointer_width = "64")] {
pub const BIOCGDLTLIST: ::c_ulong = 0xc0104279;
pub const BIOCSETF: ::c_ulong = 0x80104267;
} else if #[cfg(target_pointer_width = "32")] {
pub const BIOCGDLTLIST: ::c_ulong = 0xc0084279;
pub const BIOCSETF: ::c_ulong = 0x80084267;
}
}

pub const FIODTYPE: ::c_ulong = 0x4004667a;
pub const FIOGETLBA: ::c_ulong = 0x40046679;
Expand Down