Skip to content

nuttx: use updated pollfd definition - #163202

Open
bkueng wants to merge 1 commit into
rust-lang:mainfrom
bkueng:nuttx_poll_update
Open

bkueng wants to merge 1 commit into
rust-lang:mainfrom
bkueng:nuttx_poll_update

Conversation

@bkueng

@bkueng bkueng commented Sep 23, 2026

Copy link
Copy Markdown

This goes together with this libc PR: rust-lang/libc#5555

@rustbot rustbot added O-unix Operating system: Unix-like S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Sep 23, 2026
@rustbot

rustbot commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the pull request, and welcome! The Rust Project has assigned @LawnGnome (or someone else) to review your changes, you should hear from them (or someone else) within the next two weeks.

Please see the contribution instructions and our LLM policy for more information.

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ChrisDenton, libs
  • @ChrisDenton, libs expanded to 13 candidates
  • Random selection from 7 candidates

@rust-log-analyzer

This comment has been minimized.

@rust-bors

rust-bors Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #164757) made this pull request unmergeable. Please resolve the merge conflicts by rebasing.

@LawnGnome

Copy link
Copy Markdown
Contributor

Just catching up on the last month of notifications, sorry. I don't have any context on nuttx, so I'm going to re-roll this.

@rustbot reroll

@rustbot rustbot assigned hanna-kruppe and unassigned LawnGnome Oct 27, 2026
@hanna-kruppe

Copy link
Copy Markdown
Contributor

I don't know anything about nuttx either, cc @no1wudi as target maintainer

From a quick glance it looks like rust-lang/libc#5555 was merged now, but only into the main branch, so it's only in the libc 1.0 pre-release, not in any 0.2.x release. My understanding is that more steps are needed before std can use the updated libc definitions:

  1. Backport the libc change to the 0.2 branch
  2. Wait until a new libc 0.2.x release includes the change
  3. Update the standard library workspace to use that libc version

However, looking at the actual changes here, I'm not sure if this is the right way. Duplicating various struct literals just to add fields which are internal to the libc implementation on some platform doesn't seem great for maintainability. Perhaps there's a way to rewrite the affected code that works the same on all platforms including NuttX?

@bkueng

bkueng commented Oct 28, 2026

Copy link
Copy Markdown
Author

so it's only in the libc 1.0 pre-release, not in any 0.2.x release. My understanding is that more steps are needed before std can use the updated libc definitions:

I'm not sure what the update process for libc is, I just wanted to provide the required changes upfront so it won't break.

However, looking at the actual changes here, I'm not sure if this is the right way. Duplicating various struct literals just to add fields which are internal to the libc implementation on some platform doesn't seem great for maintainability.

I agree, do you see a better solution? The primary alternative I see is using Default:

let mut pollfd = libc::pollfd {
            fd: self.as_raw_fd(),
            events: libc::POLLOUT,
            revents: 0,
            ..Default::default()
    };

Which would require implementing Default for pollfd.

@hanna-kruppe

Copy link
Copy Markdown
Contributor

I would suggest the pattern of creating the C struct with mem::zeroed() and setting the relevant fields by assigning afterwards. Similar to what's done here, for example:

let mut pidfd_info: libc::pidfd_info = unsafe { crate::mem::zeroed() };
pidfd_info.mask = libc::PIDFD_INFO_PID as u64;

Then we should be able to merge this PR independently of when the libc fix makes it into a libc 0.2.x release and that release is adopted by the standard library.

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 29, 2026
@rustbot

rustbot commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

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

This branch has not been deployed

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

Labels

O-unix Operating system: Unix-like S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants