Dragonfly fixes#5116
Conversation
|
Some changes occurred in a NetBSD-like module cc @semarie |
|
Could you extract ctest changes as another PR? It's independent with dragonflyBSD changes. |
|
@rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
ef2e8b4 to
84ff852
Compare
|
@rustbot ready |
| // Kernel-only symbols in DragonFly headers. | ||
| "DTYPE_VNODE" | "DTYPE_SOCKET" | "DTYPE_PIPE" | "DTYPE_FIFO" | "DTYPE_KQUEUE" | ||
| | "DTYPE_CRYPTO" | "DTYPE_MQUEUE" | "DTYPE_DMABUF" => true, | ||
|
|
||
| // Not exposed by current DragonFly userland headers. | ||
| "REG_DUMP" | ||
| | "REG_ASSERT" | ||
| | "REG_ATOI" | ||
| | "REG_ITOA" | ||
| | "REG_TRACE" | ||
| | "REG_LARGE" | ||
| | "IP_ADD_SOURCE_MEMBERSHIP" | ||
| | "IP_DROP_SOURCE_MEMBERSHIP" | ||
| | "IP_BLOCK_SOURCE" | ||
| | "IP_UNBLOCK_SOURCE" | ||
| | "MAP_RENAME" | ||
| | "MAP_NORESERVE" | ||
| | "CTL_UNSPEC" | ||
| | "KERN_PROF" | ||
| | "CTL_P1003_1B_UNUSED1" | ||
| | "CTL_P1003_1B_SEM_VALUE_MAX" | ||
| | "DOWNTIME" | ||
| | "SF_CACHE" => true, | ||
|
|
||
| // libc exposes the 6.0-compatible value for this version-dependent mask. | ||
| "KERN_PROC_FLAGMASK" => true, | ||
|
|
||
| // Renamed in current DragonFly headers. | ||
| "CPUCTL_RSMSR" | "UTX_DB_LASTLOG" => true, |
There was a problem hiding this comment.
Since dragonfly is tier 3, you can make the relevant updates in the library (change or delete as needed) rather than adding test skips.
There was a problem hiding this comment.
Addressed by moving the freebsd-only pieces.
| if dragonfly_version < 600_000 => | ||
| { | ||
| true | ||
| } |
There was a problem hiding this comment.
Is 5.x still in active enough use that this is worth worrying about? Per https://www.dragonflybsd.org/releases/ 5.8 is from 2020 and 6.0 was in 2021.
There was a problem hiding this comment.
Rust seems to not have an exact support policy for dragonfly target, so I included 5.8 because dragonfly still has binaries packages for it, while binaries package repo for 5.6 is gone.
|
It looks like Dragonfly doesn't have a target maintainer, do you have any interest in being added as one? It's pretty much no commitment, just means that people can ping you in the rare occasion that we stumble across Dragonfly-specific questions. If so, all you need to do is PR rust-lang/rust adding a dragonfly page in https://github.com/rust-lang/rust/tree/f7da3c0d4b3a4cc291f8c800cc61549d27d14c49/src/doc/rustc/src/platform-support based on the template, and link it from the table at https://github.com/rust-lang/rust/blob/f7da3c0d4b3a4cc291f8c800cc61549d27d14c49/src/doc/rustc/src/platform-support.md. We're trying to make sure every platform has 1-2 documented maintainers so this would be an awesome help if you are interested! |
|
For the above, |
| fn parse_dragonfly_version(version: &str) -> Option<u32> { | ||
| let version = version.trim(); | ||
|
|
||
| if let Ok(version) = version.parse::<u32>() { | ||
| // DragonFly's __DragonFly_version uses major * 100_000 + minor * 100. | ||
| // Accept compact test override spellings like 58, 60, 62, and 602. | ||
| return Some(match version { | ||
| 0..=9 => version * 100_000, | ||
| 10..=99 => (version / 10) * 100_000 + (version % 10) * 100, | ||
| 100..=999 => (version / 100) * 100_000 + (version % 100) * 100, | ||
| _ => version, | ||
| }); | ||
| } | ||
|
|
||
| let mut pieces = version.split(['.', '-']); | ||
| let major = pieces.next()?.parse::<u32>().ok()?; | ||
| let minor = pieces.next()?.parse::<u32>().ok()?; | ||
| Some(major * 100_000 + minor * 100) | ||
| } |
There was a problem hiding this comment.
Is this constant available in a header? If so, once #5188 merges you'll be able to use that similar to __FreeBSD_version rather than needing uname, in the rare case that host and target differ.
There was a problem hiding this comment.
Yes, DragonFly does expose a __DragonFly_version macro in both <sys/param.h> and <osreldate.h>. On my DragonFly 5.8, 6.0, 6.2, and 6.4 machine it has value 500800, 600000, 600200, and 600401. so it should be able to use the same header-based version detection in #5188.
There was a problem hiding this comment.
That PR landed so you can add a field to Versions and update init_from_cc, then drop which_dragonfly
This comment has been minimized.
This comment has been minimized.
84ff852 to
db1db80
Compare
This comment has been minimized.
This comment has been minimized.
|
I found some style things that I'd appreciate addressing in this PR, but feel free to address the changes/removal in #5116 (comment) in a followup if that's easier since this is pretty much already done. Also: we can't run CI here since DragonFly is Tier 3, but if you're interested in running CI yourself we have #5209 now to make that a bit easier. (Possibly via https://github.com/vmactions, should be easy to set up similar to our existing |
This comment has been minimized.
This comment has been minimized.
Fix DragonFly type aliases and struct layouts to match current headers, including regex offsets, ifaddrs, pthread barriers, process sizing fields, and mcontext alignment.
(backport <rust-lang#5116>) (cherry picked from commit f3b3388)
(backport <rust-lang#5116>) (cherry picked from commit f497ed2)
(backport <rust-lang#5116>) (cherry picked from commit 6b97738)
(backport <rust-lang#5116>) (cherry picked from commit 8e1069b)
(backport <rust-lang#5116>) (cherry picked from commit fab9366)
(backport <rust-lang#5116>) (cherry picked from commit 6a87bac)
(backport <rust-lang#5116>) (cherry picked from commit ab6df27)
(backport <rust-lang#5116>) (cherry picked from commit 7483748)
Fix DragonFly type aliases and struct layouts to match current headers, including regex offsets, ifaddrs, pthread barriers, process sizing fields, and mcontext alignment. (backport <rust-lang#5116>) (cherry picked from commit 8f8ce99)
(backport <rust-lang#5116>) (cherry picked from commit f3b3388)
(backport <rust-lang#5116>) (cherry picked from commit f497ed2)
(backport <rust-lang#5116>) (cherry picked from commit 6b97738)
(backport <rust-lang#5116>) (cherry picked from commit 8e1069b)
(backport <rust-lang#5116>) (cherry picked from commit fab9366)
[ dropped `fexecve` skip that is redundant on this branch (skipped above) - Trevor ] (backport <rust-lang#5116>) (cherry picked from commit 6a87bac)
(backport <rust-lang#5116>) (cherry picked from commit ab6df27)
(backport <rust-lang#5116>) (cherry picked from commit 7483748)
Fix DragonFly type aliases and struct layouts to match current headers, including regex offsets, ifaddrs, pthread barriers, process sizing fields, and mcontext alignment. (backport <rust-lang#5116>) (cherry picked from commit 8f8ce99)
(backport <rust-lang#5116>) (cherry picked from commit f3b3388)
(backport <rust-lang#5116>) (cherry picked from commit f497ed2)
(backport <rust-lang#5116>) (cherry picked from commit 6b97738)
(backport <rust-lang#5116>) (cherry picked from commit 8e1069b)
(backport <rust-lang#5116>) (cherry picked from commit fab9366)
[ dropped `fexecve` skip that is redundant on this branch (skipped above) - Trevor ] (backport <rust-lang#5116>) (cherry picked from commit 6a87bac)
(backport <rust-lang#5116>) (cherry picked from commit ab6df27)
(backport <rust-lang#5116>) (cherry picked from commit 7483748)
Description
Improve DragonFly BSD support by fixing existing ABI definitions, fix typo'd constant names, fix constant values, moving BSD constants that are not actually generic down into target modules, and adding missing DragonFly constants and libc declarations.
This also expands
libc-testcoverage for DragonFly and makes the tests handle older DragonFly headers with test-only version skips. The public libc API remains version-independent for DragonFly.Sources
Primary API references are DragonFly BSD 6.4 release headers, using tag
v6.4.0(commitaf5fb9a9e56f90cf51e48514d1874be61e9364e6). The same definitions and test behavior were cross-checked against DragonFly 6.2, 6.0, and 5.8 where older headers differ or omit newer symbols.ABI/type definitions:
segsz_t: https://github.com/DragonFlyBSD/DragonFlyBSD/blob/af5fb9a9e56f90cf51e48514d1874be61e9364e6/sys/sys/types.hif_msghdrand interface flags: https://github.com/DragonFlyBSD/DragonFlyBSD/blob/af5fb9a9e56f90cf51e48514d1874be61e9364e6/sys/net/if.hifaddrs.ifa_addrflags: https://github.com/DragonFlyBSD/DragonFlyBSD/blob/af5fb9a9e56f90cf51e48514d1874be61e9364e6/include/ifaddrs.hkinfo_cputime: https://github.com/DragonFlyBSD/DragonFlyBSD/blob/af5fb9a9e56f90cf51e48514d1874be61e9364e6/sys/sys/kinfo.hmcontext_t: https://github.com/DragonFlyBSD/DragonFlyBSD/blob/af5fb9a9e56f90cf51e48514d1874be61e9364e6/sys/cpu/x86_64/include/ucontext.hregoff_t: https://github.com/DragonFlyBSD/DragonFlyBSD/blob/af5fb9a9e56f90cf51e48514d1874be61e9364e6/lib/libc/tre-regex/regex.hConstants and functions:
posix_fadviseconstants: https://github.com/DragonFlyBSD/DragonFlyBSD/blob/af5fb9a9e56f90cf51e48514d1874be61e9364e6/sys/sys/fcntl.hgetrandomconstants: https://github.com/DragonFlyBSD/DragonFlyBSD/blob/af5fb9a9e56f90cf51e48514d1874be61e9364e6/sys/sys/random.hgetnameinfoconstants: https://github.com/DragonFlyBSD/DragonFlyBSD/blob/af5fb9a9e56f90cf51e48514d1874be61e9364e6/include/netdb.hfdatasyncanddup3: https://github.com/DragonFlyBSD/DragonFlyBSD/blob/af5fb9a9e56f90cf51e48514d1874be61e9364e6/include/unistd.hdlvsym: https://github.com/DragonFlyBSD/DragonFlyBSD/blob/af5fb9a9e56f90cf51e48514d1874be61e9364e6/include/dlfcn.hreallocarrayandqsort_r: https://github.com/DragonFlyBSD/DragonFlyBSD/blob/af5fb9a9e56f90cf51e48514d1874be61e9364e6/include/stdlib.hftok: https://github.com/DragonFlyBSD/DragonFlyBSD/blob/af5fb9a9e56f90cf51e48514d1874be61e9364e6/sys/sys/ipc.hChecklist
libc-test/semverhave been updated*LASTor*MAXareincluded (see #3131)
cd libc-test && cargo test --target mytarget);especially relevant for platforms that may not be checked in CI
Tested on DragonFly 5.8.3, 6.0.1, 6.2.2, 6.4.2 with self-built Rust/Cargo 1.95.0, Rust 1.95.0 on DragonFly 5.8.3 needs patches.
There is actually a
KERN_MAXID, but the same constant is also present and non-deprecated on both nto and apple.@rustbot label +stable-nominated