-
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
[AIX] Use sa_sigaction instead of the union #4250
base: main
Are you sure you want to change the base?
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @tgross35 (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
close GH-4249 |
03b30be
to
597c610
Compare
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.
LGTM from the AIX perspective. This makes the implementation common with what is done on other targets
|
||
pub struct sigaction { | ||
pub sa_union: __sigaction_sa_union, | ||
pub sa_sigaction: crate::sighandler_t, //actually a union with sa_handle |
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.
Is this something that should be changed once we are able to use unions (1.0)? If so, could you label the comment FIXME(union)
?
Description
The current
libc
crate implementation for AIX definesstruct sigaction
as containing a unionsa_union
with two members:__su_handler
and__su_sigaction
. This mirrors thestruct sigaction
definition in the AIX system header. Consequently, any reference tosa_sigaction
in Rust code, whether in shipped crates or user code, must be replaced withsa_union.__su_sigaction
for AIX. Additionally, the types of these two union members are declared as function pointers rather thansighandler_t
(i.e.,usize
), as is the case on other platforms. This discrepancy causes compiler errors whensighandler_t
is used as the type for signal handlers. Other operating systems, such as Linux, also define a union forsa_handler
andsa_sigaction
instruct sigaction
. However, thelibc
crate implementations on these platforms definesa_sigaction
directly as a member ofstruct sigaction
rather than as part of a union. This patch modifies thelibc
crate implementation for AIX to definesa_sigaction
as a direct member ofstruct sigaction
, aligning it with implementations for other similar platforms. We will also update affected crates and test cases to reflect this change.Sources
Checklist
libc-test/semver
have been updated*LAST
or*MAX
areincluded (see #3131)
cd libc-test && cargo test --target mytarget
);especially relevant for platforms that may not be checked in CI