-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[API-breaking] Expose si_addr on siginfo_t. Refs #716 #1316
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @gnzlbg (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. |
Hmm, so the macros for unions don't automatically mark them |
src/unix/notbsd/linux/other/mod.rs
Outdated
pub struct siginfo_t { | ||
pub si_signo: ::c_int, | ||
pub si_errno: ::c_int, | ||
pub si_code: ::c_int, | ||
pub _pad: [::c_int; 29], | ||
sifields: sifields_t, |
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.
In the open issue #716 I was hoping that the padding field would be private, which would have allowed us to change this, but for some reason it is public, so this would be a hard breaking change, which I don't think we can make until the next breaking version is released.
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.
Depending on how long we expect it to take to get this into a mergable state, perhaps it would make sense for me to send a seperate PR to make that field private, which could be merged/released sooner?
The problem is that a Usually, these |
d5f6711
to
c5c849a
Compare
For bonus points 1.13 doesn't like unions :-( |
@alex yes, I hope I mentioned that in the issue. You need to use |
Hmm, so I attempted to make |
That should be possible, but I don't know how easy / hard doing that is. I would keep it simple for now, and just implement these outside any |
180ef25
to
4c2364f
Compare
Ok, after much pain this now builds! It's failing the size_of check, which is confusing to me, because it looks like it's failing in precisely the way you'd get if the
|
Let's go around the room, what's the dumbest thing you've done so far today? I'll go first: I didn't actually push the commit where I added No one else needs to go :-) |
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.
Looking good! Some nitpicks!
d3378bc
to
3bbcfc9
Compare
Is there anything I can be doing to help push this forward at this point, or are we fully blocked on needing to consider how to handle the backwards incompatibility? |
I've tried to inspect crates using the struct, but sourcegraph is broken AFAICT. We can't really use |
Deprecate _pad field on siginfo_t As discussed in #1316
☔ The latest upstream changes (presumably #1329) made this pull request unmergeable. Please resolve the merge conflicts. |
For consistency, could it be a function everywhere? |
A consistent API is provided in the |
|
@jedisct1 then I think it might be worth it to raise this issue there (EDIT: reported here nix-rust/nix#1051). |
☔ The latest upstream changes (presumably #1346) made this pull request unmergeable. Please resolve the merge conflicts. |
☔ The latest upstream changes (presumably #1389) made this pull request unmergeable. Please resolve the merge conflicts. |
☔ The latest upstream changes (presumably #1390) made this pull request unmergeable. Please resolve the merge conflicts. |
Just curious, I'm currently using Currently compiler throws warning on it with reference to this PR, can I assume that any API breakage will lead to libc 0.2? |
@DoumanAsh don't use |
I'm not sure how you expect me to cast the whole struct, which I already have, but libc doesn't expose |
@DoumanAsh which field are you trying to access precisely ? Maybe we can add a method here to provide this field, and you could start using that instead.
We don't know, will depend on breakage, but since this should use an union, a change is going to need to happen anyways. Doing a minor version bump of libc has huge ecosystem-wide consequences. |
@gnzlbg I think most platforms aside freebsd has it as part of enum since it is used by Posix timers On linux I can just read padding:
|
We want to use a proper rust Would you like to send a PR implementing it ? The current |
@gnzlbg To be honest I'm not exactly sure my method is the best one. About PR, I'll try to take a look and add it for platforms with which I'm familiar enough |
The plan is to try to make the padding field private with a patch bump, hoping that it doesn't break anybody. If that success, we can modify the internals to use unions like this PR does, and once that works correctly, we can make them public. We will need to keep the methods around for backward compatibility with toolchains that do not support unions (libc supports up to Rust 1.13.0...). |
☔ The latest upstream changes (presumably #1421) made this pull request unmergeable. Please resolve the merge conflicts. |
I'm going to close this for now, it's significantly bit-roting, and from my perspective the current implementation works well enough. |
This is the bare minimum to expose this. It also seems to have required making the unions
pub
, which I wasn't wild about, and I had no clue what to name the anonymous union. But it's a starting point!