Skip to content

FreeBSD: Added xfile structure and file descriptor types#5002

Open
antoncxx wants to merge 1 commit intorust-lang:mainfrom
antoncxx:freebsd-file
Open

FreeBSD: Added xfile structure and file descriptor types#5002
antoncxx wants to merge 1 commit intorust-lang:mainfrom
antoncxx:freebsd-file

Conversation

@antoncxx
Copy link
Contributor

@antoncxx antoncxx commented Mar 4, 2026

Description

Added binding for xfile structure from sys/file.h and descriptor types.

Sources

FreeBSD 15

FreeBSD 14

FreeBSD 13

FreeBSD 12

FreeBSD 11

FreeBSD 10

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

@rustbot label +stable-nominated

@rustbot rustbot added S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Mar 4, 2026
Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

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

Copy link
Contributor

@asomers asomers left a comment

Choose a reason for hiding this comment

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

What's the purpose of this PR? As far as I know, struct xfile is only exposed to the user via the KERN_FILE sysctl. That's fairly obscure. I would be ok if those definitions lived outside of the libc crate. It's up to Trevor if he thinks it's worthwhile to include.
And like Trevor said, you should drop everything related to FreeBSD 10 through12.

View changes since this review

@antoncxx
Copy link
Contributor Author

antoncxx commented Mar 5, 2026

What's the purpose of this PR? As far as I know, struct xfile is only exposed to the user via the KERN_FILE sysctl. That's fairly obscure. I would be ok if those definitions lived outside of the libc crate. It's up to Trevor if he thinks it's worthwhile to include. And like Trevor said, you should drop everything related to FreeBSD 10 through12.

View changes since this review

The motivation is what you described. I'm involved into development of a Rust library that performs KERN_FILE sysctl query, currently written in C, and I want to rewrite it in pure Rust. I could define the bindings locally, but since libc is already a dependency, I figured contributing them here might be useful to others as well.

@rustbot
Copy link
Collaborator

rustbot commented Mar 8, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@antoncxx antoncxx requested a review from tgross35 March 9, 2026 04:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review 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.

5 participants