-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expose si_pid and si_uid from siginfo_t as functions #1858
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @JohnTitor (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
f8491a9
to
9d409d9
Compare
Pushed a new version to fix structure alignment. |
Currently reworking this a bit more, to handle the alignment correctly on both 64-bit and 32-bit platforms. |
9ec238c
to
e3fbc3b
Compare
Re-pushed with style issue (line length) fixed. Simplified in the process. |
Alright, looks like just two builds failed here this time. mipsel-unknown-linux-musl appears spurious: it failed to download something. Needs a retry. And the builder running rust 1.13 failed, because rust 1.13 didn't support |
e3fbc3b
to
2e0b0fa
Compare
On Linux, siginfo_t cannot expose these fields directly due to rust-lang#716 , so expose them as functions, just like si_addr and si_value. In order to get alignment correct on both 32-bit and 64-bit architectures, define an sifields union that includes a pointer field, to ensure that it has the same alignment as a pointer.
2e0b0fa
to
13d0cdb
Compare
Fixed style for conditional compilation. |
This now passes CI everywhere. |
…3 fields The first 3 fields of `siginfo_t` have different orders on MIPS. When casting `siginfo_t` to a different type to access the fields of the `sifields` union, avoid giving names to the first three fields, since they're only present for memory layout and shouldn't be accessed from the casted structure type.
The SIGCHLD variant of the siginfo structure also provides fields for user and system time; expose those as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. I am not very well versed with this and only reviewed linux-like stuff so I think it would be better to have another reviewer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
On Linux, siginfo_t cannot expose these fields directly due to
#716 , so expose them as
functions, just like si_addr and si_value.
Provide the same functions on other platforms that have these fields
declared, for consistency.