Repository navigation
nuttx: use updated pollfd definition - #163202
Conversation
|
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:
|
This comment has been minimized.
This comment has been minimized.
7910336 to
89eb084
Compare
This comment has been minimized.
This comment has been minimized.
|
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 |
|
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:
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? |
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.
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 |
|
I would suggest the pattern of creating the C struct with rust/library/std/src/sys/process/unix/pidfd.rs Lines 31 to 32 in 96a18bf 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 |
|
Reminder, once the PR becomes ready for a review, use |
89eb084 to
4e405ed
Compare
|
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. |
That works too (if unsafe is acceptable), and I updated accordingly. |
This comment has been minimized.
This comment has been minimized.
4e405ed to
f9f9cd6
Compare
This comment has been minimized.
This comment has been minimized.
f9f9cd6 to
4731e88
Compare
This comment has been minimized.
This comment has been minimized.
4731e88 to
eeb36a0
Compare
| #[allow(unused_imports)] | ||
| use crate::{io, mem}; |
There was a problem hiding this comment.
Instead of allowing unused imports, please either use the full path without import, or move the import into the cfg block where it's needed (like the use crate::sys::io::errno).
There was a problem hiding this comment.
I changed it to the full path.
| while libc::poll(pfds.as_mut_ptr(), 3, 0) == -1 { | ||
| let mut pfds: [libc::pollfd; 3] = mem::zeroed(); | ||
| pfds[0].fd = 0; | ||
| pfds[0].events = 0; |
There was a problem hiding this comment.
Setting events to zero explicitly seems a bit redundant in this context. But I could see the argument that it's more consistent to always set the "input" parts explicitly. So I'm fine with either, just wanted to ask if this is an intentional choice.
There was a problem hiding this comment.
Yes I considered both and ended up setting it so that someone reading it does not get the impression it was forgotten (pfds[0].fd = 0; could also be removed).
Corresponding libc PR: rust-lang/libc#5555 pollfd has some extra internal fields on NuttX, so we use mem::zeroed() to initialze.
eeb36a0 to
2cab4ca
Compare
|
@bors r+ rollup |
…kruppe nuttx: use updated pollfd definition This goes together with this libc PR: rust-lang/libc#5555
Rollup of 5 pull requests Successful merges: - #164784 (Introduce OptimizationObjective and fix the entry shim's size attributes) - #147696 (Implement `bit` and `set_bit` for integral types.) - #163202 (nuttx: use updated pollfd definition) - #163571 ([rustdoc] Render `Deref` methods on aliased items) - #165482 (apply `-Zcrate-attr` attributes before the crate attributes)
…kruppe nuttx: use updated pollfd definition This goes together with this libc PR: rust-lang/libc#5555
…uwer Rollup of 8 pull requests Successful merges: - #164784 (Introduce OptimizationObjective and fix the entry shim's size attributes) - #165469 (Make notable trait `i` badges `<span>` instead of `<a>`) - #165576 (compiletest: Reject whitespace between `//` & `@` and reject leading revision conditions like (e.g., `//[rev]@ dir`)) - #147696 (Implement `bit` and `set_bit` for integral types.) - #163202 (nuttx: use updated pollfd definition) - #165482 (apply `-Zcrate-attr` attributes before the crate attributes) - #165517 (Migrate basic block ctors to require Terminator where possible) - #165552 (use lang item instead of name when assembling builtin `Clone::clone` instances)
…uwer Rollup of 8 pull requests Successful merges: - #164784 (Introduce OptimizationObjective and fix the entry shim's size attributes) - #165469 (Make notable trait `i` badges `<span>` instead of `<a>`) - #165576 (compiletest: Reject whitespace between `//` & `@` and reject leading revision conditions like (e.g., `//[rev]@ dir`)) - #147696 (Implement `bit` and `set_bit` for integral types.) - #163202 (nuttx: use updated pollfd definition) - #165482 (apply `-Zcrate-attr` attributes before the crate attributes) - #165517 (Migrate basic block ctors to require Terminator where possible) - #165552 (use lang item instead of name when assembling builtin `Clone::clone` instances)
Rollup merge of #163202 - bkueng:nuttx_poll_update, r=hanna-kruppe nuttx: use updated pollfd definition This goes together with this libc PR: rust-lang/libc#5555
This goes together with this libc PR: rust-lang/libc#5555