Skip to content

Dragonfly fixes#5116

Open
chitao1234 wants to merge 8 commits into
rust-lang:mainfrom
chitao1234:dragonfly-fixes
Open

Dragonfly fixes#5116
chitao1234 wants to merge 8 commits into
rust-lang:mainfrom
chitao1234:dragonfly-fixes

Conversation

@chitao1234

Copy link
Copy Markdown
Contributor

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-test coverage 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 (commit af5fb9a9e56f90cf51e48514d1874be61e9364e6). 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:

Constants and functions:

Checklist

  • Relevant tests in libc-test/semver have been updated
  • No placeholder or unstable values like *LAST or *MAX are
    included (see #3131)
  • Tested locally (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

@rustbot

rustbot commented May 26, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in a NetBSD-like module

cc @semarie

@rustbot rustbot added ctest Issues relating to the ctest crate S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels May 26, 2026
@JohnTitor

Copy link
Copy Markdown
Member

Could you extract ctest changes as another PR? It's independent with dragonflyBSD changes.

@JohnTitor

Copy link
Copy Markdown
Member

@rustbot author

@rustbot

rustbot commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@chitao1234

Copy link
Copy Markdown
Contributor Author

@rustbot ready

@JohnTitor JohnTitor removed the ctest Issues relating to the ctest crate label Jun 15, 2026
Comment thread libc-test/build.rs
Comment on lines +1690 to +1718
// 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,

@tgross35 tgross35 Jun 18, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since dragonfly is tier 3, you can make the relevant updates in the library (change or delete as needed) rather than adding test skips.

View changes since the review

Comment thread libc-test/build.rs
Comment on lines +1825 to +1835
cfg.skip_roundtrip(move |ty| {
matches!(
ty,
"kvm_t"
| "posix_spawnattr_t"
| "posix_spawn_file_actions_t"
| "umtx_t"
| "pmap"
| "ip_mreq_source"
)
});

@tgross35 tgross35 Jun 18, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a note for why these are skipped?

The match ty { ... } syntax is preferable over matches! since it's easier to add things like version-specific cases if needed.

View changes since the review

Comment thread libc-test/build.rs
if dragonfly_version < 600_000 =>
{
true
}

@tgross35 tgross35 Jun 18, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

View changes since the review

@tgross35

Copy link
Copy Markdown
Contributor

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!

@tgross35

Copy link
Copy Markdown
Contributor

For the above,
@rustbot author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author stable-nominated This PR should be considered for cherry-pick to libc's stable release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants