From ad2d864d0a75eb9d9c2c44a03b31fa6a7045ce5f Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Mon, 23 Sep 2024 10:25:07 -0600 Subject: [PATCH 1/8] Fix the definition of mc_fpstate on FreeBSD x86 The definition added in b811b70f6676a24c16a786a3549eb6b35071c13c was technically wrong even though the type size was correct. It was probably defined this way because earlier versions of Rust had difficulty with fixed-size arrays of size greater than 32. This change is necessary for CI to pass on x86 FreeBSD. https://github.com/freebsd/freebsd-src/blob/main/sys/x86/include/ucontext.h --- src/unix/bsd/freebsdlike/freebsd/x86.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unix/bsd/freebsdlike/freebsd/x86.rs b/src/unix/bsd/freebsdlike/freebsd/x86.rs index 71bdb88b9f2a1..9422e194b27ff 100644 --- a/src/unix/bsd/freebsdlike/freebsd/x86.rs +++ b/src/unix/bsd/freebsdlike/freebsd/x86.rs @@ -32,7 +32,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, From 908fc71c07262473dba532fd83f4494276b1b2ec Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Fri, 27 Sep 2024 17:19:51 -0600 Subject: [PATCH 2/8] Fix alignment of mcontext_t on FreeBSD x86 https://github.com/freebsd/freebsd-src/blob/main/sys/x86/include/ucontext.h --- src/unix/bsd/freebsdlike/freebsd/x86.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/unix/bsd/freebsdlike/freebsd/x86.rs b/src/unix/bsd/freebsdlike/freebsd/x86.rs index 9422e194b27ff..9dd989dfa2228 100644 --- a/src/unix/bsd/freebsdlike/freebsd/x86.rs +++ b/src/unix/bsd/freebsdlike/freebsd/x86.rs @@ -7,6 +7,7 @@ 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, From 19d213d883cbe8a321fa2b0b559479f9033ac374 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Mon, 23 Sep 2024 11:06:35 -0600 Subject: [PATCH 3/8] Fix the definition of domainset_t in 32-bit FreeBSD It's always had the wrong size, but apparently never been tested on 32-bit FreeBSD. In addition to fixing its size, it ought to be moved info freebsd/mod.rs . Otherwise it's pretty much inaccessible to everyone. https://github.com/freebsd/freebsd-src/blob/main/sys/sys/_domainset.h --- src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs | 5 ++++- src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs | 5 ++++- src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs index 118404e8b089b..e6cc1fad0b591 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs @@ -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 { diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs index e624dd7201b0a..1c58bb4b5afcf 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs @@ -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 { diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs index a299af7d5d53e..00ea22a041a7d 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs @@ -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 { From 60cf16dd91bf20d68ace4c2391a4f74c80a32d78 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Fri, 27 Sep 2024 17:26:09 -0600 Subject: [PATCH 4/8] Fix definition of TIOCTIMESTAMP on FreeBSD x86 https://github.com/freebsd/freebsd-src/blob/main/sys/sys/ttycom.h --- src/unix/bsd/freebsdlike/dragonfly/mod.rs | 1 + src/unix/bsd/freebsdlike/freebsd/aarch64.rs | 1 + src/unix/bsd/freebsdlike/freebsd/arm.rs | 1 + src/unix/bsd/freebsdlike/freebsd/powerpc.rs | 1 + src/unix/bsd/freebsdlike/freebsd/powerpc64.rs | 1 + src/unix/bsd/freebsdlike/freebsd/riscv64.rs | 1 + src/unix/bsd/freebsdlike/freebsd/x86.rs | 1 + src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs | 2 ++ src/unix/bsd/freebsdlike/mod.rs | 1 - 9 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/src/unix/bsd/freebsdlike/dragonfly/mod.rs index 489b82adb84b9..bbfa9db150dde 100644 --- a/src/unix/bsd/freebsdlike/dragonfly/mod.rs +++ b/src/unix/bsd/freebsdlike/dragonfly/mod.rs @@ -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 diff --git a/src/unix/bsd/freebsdlike/freebsd/aarch64.rs b/src/unix/bsd/freebsdlike/freebsd/aarch64.rs index d240eb001ad5d..552a2dfc7f42d 100644 --- a/src/unix/bsd/freebsdlike/freebsd/aarch64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/aarch64.rs @@ -135,3 +135,4 @@ cfg_if! { pub const MAP_32BIT: ::c_int = 0x00080000; pub const MINSIGSTKSZ: ::size_t = 4096; // 1024 * 4 +pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459; diff --git a/src/unix/bsd/freebsdlike/freebsd/arm.rs b/src/unix/bsd/freebsdlike/freebsd/arm.rs index 58cf6263310a6..0458847320542 100644 --- a/src/unix/bsd/freebsdlike/freebsd/arm.rs +++ b/src/unix/bsd/freebsdlike/freebsd/arm.rs @@ -52,3 +52,4 @@ cfg_if! { pub(crate) const _ALIGNBYTES: usize = ::mem::size_of::<::c_int>() - 1; pub const MAP_32BIT: ::c_int = 0x00080000; pub const MINSIGSTKSZ: ::size_t = 4096; // 1024 * 4 +pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459; diff --git a/src/unix/bsd/freebsdlike/freebsd/powerpc.rs b/src/unix/bsd/freebsdlike/freebsd/powerpc.rs index 17d48d5c42cfc..c5cfe543352a0 100644 --- a/src/unix/bsd/freebsdlike/freebsd/powerpc.rs +++ b/src/unix/bsd/freebsdlike/freebsd/powerpc.rs @@ -71,3 +71,4 @@ cfg_if! { pub(crate) const _ALIGNBYTES: usize = ::mem::size_of::<::c_int>() - 1; pub const MAP_32BIT: ::c_int = 0x00080000; pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4 +pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459; diff --git a/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs b/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs index c98fa3b027173..9f2a89e579541 100644 --- a/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs @@ -71,3 +71,4 @@ cfg_if! { pub(crate) const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1; pub const MAP_32BIT: ::c_int = 0x00080000; pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4 +pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459; diff --git a/src/unix/bsd/freebsdlike/freebsd/riscv64.rs b/src/unix/bsd/freebsdlike/freebsd/riscv64.rs index c5ea8ee203a72..68a4a35f917c3 100644 --- a/src/unix/bsd/freebsdlike/freebsd/riscv64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/riscv64.rs @@ -143,3 +143,4 @@ cfg_if! { pub const MAP_32BIT: ::c_int = 0x00080000; pub const MINSIGSTKSZ: ::size_t = 4096; // 1024 * 4 +pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459; diff --git a/src/unix/bsd/freebsdlike/freebsd/x86.rs b/src/unix/bsd/freebsdlike/freebsd/x86.rs index 9dd989dfa2228..19d90b8161dc5 100644 --- a/src/unix/bsd/freebsdlike/freebsd/x86.rs +++ b/src/unix/bsd/freebsdlike/freebsd/x86.rs @@ -157,3 +157,4 @@ cfg_if! { pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4 pub const KINFO_FILE_SIZE: ::c_int = 1392; +pub const TIOCTIMESTAMP: ::c_ulong = 0x40087459; diff --git a/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs b/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs index aa33345f3113f..99662c127b6a4 100644 --- a/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs @@ -236,5 +236,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::*; diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index af0632882cdbc..43469d497423b 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -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; From cfbc1203e4b4fe0fb37f7639f9b740aa2e401cb8 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Fri, 27 Sep 2024 17:29:06 -0600 Subject: [PATCH 5/8] Fix the definition of several BPF related ioctls on 32-bit FreeBSD https://github.com/freebsd/freebsd-src/blob/main/sys/net/bpf.h --- src/unix/bsd/freebsdlike/freebsd/aarch64.rs | 2 ++ src/unix/bsd/freebsdlike/freebsd/arm.rs | 2 ++ src/unix/bsd/freebsdlike/freebsd/mod.rs | 8 +++++++- src/unix/bsd/freebsdlike/freebsd/powerpc.rs | 2 ++ src/unix/bsd/freebsdlike/freebsd/powerpc64.rs | 2 ++ src/unix/bsd/freebsdlike/freebsd/riscv64.rs | 2 ++ src/unix/bsd/freebsdlike/freebsd/x86.rs | 2 ++ src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs | 3 +++ src/unix/bsd/freebsdlike/mod.rs | 13 +++++++++---- 9 files changed, 31 insertions(+), 5 deletions(-) diff --git a/src/unix/bsd/freebsdlike/freebsd/aarch64.rs b/src/unix/bsd/freebsdlike/freebsd/aarch64.rs index 552a2dfc7f42d..0a1e51df88f36 100644 --- a/src/unix/bsd/freebsdlike/freebsd/aarch64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/aarch64.rs @@ -133,6 +133,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; diff --git a/src/unix/bsd/freebsdlike/freebsd/arm.rs b/src/unix/bsd/freebsdlike/freebsd/arm.rs index 0458847320542..fe014117a82b2 100644 --- a/src/unix/bsd/freebsdlike/freebsd/arm.rs +++ b/src/unix/bsd/freebsdlike/freebsd/arm.rs @@ -50,6 +50,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; diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index fc01d8e5463b8..03f148324c97a 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -3145,7 +3145,13 @@ 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; + } +} pub const FIODGNAME: ::c_ulong = 0x80106678; pub const FIONWRITE: ::c_ulong = 0x40046677; diff --git a/src/unix/bsd/freebsdlike/freebsd/powerpc.rs b/src/unix/bsd/freebsdlike/freebsd/powerpc.rs index c5cfe543352a0..d1a5834d6134a 100644 --- a/src/unix/bsd/freebsdlike/freebsd/powerpc.rs +++ b/src/unix/bsd/freebsdlike/freebsd/powerpc.rs @@ -69,6 +69,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; diff --git a/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs b/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs index 9f2a89e579541..bcd0d69435bce 100644 --- a/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs @@ -69,6 +69,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; diff --git a/src/unix/bsd/freebsdlike/freebsd/riscv64.rs b/src/unix/bsd/freebsdlike/freebsd/riscv64.rs index 68a4a35f917c3..020d86b377daf 100644 --- a/src/unix/bsd/freebsdlike/freebsd/riscv64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/riscv64.rs @@ -141,6 +141,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; diff --git a/src/unix/bsd/freebsdlike/freebsd/x86.rs b/src/unix/bsd/freebsdlike/freebsd/x86.rs index 19d90b8161dc5..f0f0dfa8f0077 100644 --- a/src/unix/bsd/freebsdlike/freebsd/x86.rs +++ b/src/unix/bsd/freebsdlike/freebsd/x86.rs @@ -156,5 +156,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; diff --git a/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs b/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs index 99662c127b6a4..cfc2ba2934338 100644 --- a/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs @@ -220,6 +220,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 diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index 43469d497423b..0d049272ab2ae 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -1278,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; From 6605f08aeade93fb6d01c91a13d84769735dc172 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Fri, 27 Sep 2024 17:37:05 -0600 Subject: [PATCH 6/8] Fix definition of clock_t on FreeBSD x86, powerpc, powerpc64, and arm. https://github.com/freebsd/freebsd-src/blob/main/sys/arm/include/_types.h https://github.com/freebsd/freebsd-src/blob/main/sys/arm64/include/_types.h https://github.com/freebsd/freebsd-src/blob/main/sys/powerpc/include/_types.h https://github.com/freebsd/freebsd-src/blob/main/sys/riscv/include/_types.h https://github.com/freebsd/freebsd-src/blob/main/sys/x86/include/_types.h --- src/unix/bsd/freebsdlike/freebsd/aarch64.rs | 1 + src/unix/bsd/freebsdlike/freebsd/arm.rs | 1 + src/unix/bsd/freebsdlike/freebsd/mod.rs | 1 - src/unix/bsd/freebsdlike/freebsd/powerpc.rs | 1 + src/unix/bsd/freebsdlike/freebsd/powerpc64.rs | 1 + src/unix/bsd/freebsdlike/freebsd/riscv64.rs | 1 + src/unix/bsd/freebsdlike/freebsd/x86.rs | 1 + src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs | 1 + 8 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/unix/bsd/freebsdlike/freebsd/aarch64.rs b/src/unix/bsd/freebsdlike/freebsd/aarch64.rs index 0a1e51df88f36..05fe64b5c0c8a 100644 --- a/src/unix/bsd/freebsdlike/freebsd/aarch64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/aarch64.rs @@ -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; diff --git a/src/unix/bsd/freebsdlike/freebsd/arm.rs b/src/unix/bsd/freebsdlike/freebsd/arm.rs index fe014117a82b2..1325b930902b0 100644 --- a/src/unix/bsd/freebsdlike/freebsd/arm.rs +++ b/src/unix/bsd/freebsdlike/freebsd/arm.rs @@ -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; diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index 03f148324c97a..108494d52482b 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -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; diff --git a/src/unix/bsd/freebsdlike/freebsd/powerpc.rs b/src/unix/bsd/freebsdlike/freebsd/powerpc.rs index d1a5834d6134a..9690cb13cd310 100644 --- a/src/unix/bsd/freebsdlike/freebsd/powerpc.rs +++ b/src/unix/bsd/freebsdlike/freebsd/powerpc.rs @@ -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; diff --git a/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs b/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs index bcd0d69435bce..08e7ad12c9c9b 100644 --- a/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs @@ -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; diff --git a/src/unix/bsd/freebsdlike/freebsd/riscv64.rs b/src/unix/bsd/freebsdlike/freebsd/riscv64.rs index 020d86b377daf..542c95b54453c 100644 --- a/src/unix/bsd/freebsdlike/freebsd/riscv64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/riscv64.rs @@ -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; diff --git a/src/unix/bsd/freebsdlike/freebsd/x86.rs b/src/unix/bsd/freebsdlike/freebsd/x86.rs index f0f0dfa8f0077..8a2721e62d71b 100644 --- a/src/unix/bsd/freebsdlike/freebsd/x86.rs +++ b/src/unix/bsd/freebsdlike/freebsd/x86.rs @@ -1,6 +1,7 @@ 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; diff --git a/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs b/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs index cfc2ba2934338..4ff9469086cb6 100644 --- a/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs @@ -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; From f2b8b8f8c753755e74c5f0ae3440ea59b5909383 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Fri, 27 Sep 2024 17:49:50 -0600 Subject: [PATCH 7/8] Fix size of struct kinfo_file on 32-bit FreeBSD https://github.com/freebsd/freebsd-src/blob/main/sys/sys/user.h --- src/unix/bsd/freebsdlike/freebsd/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index 108494d52482b..48dbf0b5f5ff4 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -1629,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, From 0b6cab8f19d32248fd84788475747ffb6708318a Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Fri, 27 Sep 2024 17:56:33 -0600 Subject: [PATCH 8/8] Fix definition of FIODGNAME on 32-bit FreeBSD https://github.com/freebsd/freebsd-src/blob/main/sys/sys/filio.h --- src/unix/bsd/freebsdlike/freebsd/mod.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index 48dbf0b5f5ff4..91f4879e3453c 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -3152,7 +3152,14 @@ cfg_if! { } } -pub const FIODGNAME: ::c_ulong = 0x80106678; +cfg_if! { + if #[cfg(target_pointer_width = "64")] { + pub const FIODGNAME: ::c_ulong = 0x80106678; + } else { + pub const FIODGNAME: ::c_ulong = 0x80086678; + } +} + pub const FIONWRITE: ::c_ulong = 0x40046677; pub const FIONSPACE: ::c_ulong = 0x40046676; pub const FIOSEEKDATA: ::c_ulong = 0xc0086661;