Rollup merge of #138409 - xingxue-ibm:use-sigaction, r=compiler-errors

Use sa_sigaction instead of sa_union.__su_sigaction for AIX

Revert test cases to use `sa_sigaction` instead of `sa_union.__su_sigaction`, now that the `libc` crate implementation for AIX defines `sa_sigaction` as a direct member of `struct sigaction`, aligning it with implementations on other similar platforms. ([[AIX] Use sa_sigaction instead of the union](https://github.com/rust-lang/libc/pull/4250)).
This commit is contained in:
Manish Goregaokar 2025-03-12 10:19:35 -07:00 committed by GitHub
commit c756251076
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 24 deletions

View file

@ -26,14 +26,7 @@ extern "C" fn main(argc: core::ffi::c_int, argv: *const *const u8) -> core::ffi:
let actual = unsafe {
let mut actual: libc::sigaction = core::mem::zeroed();
libc::sigaction(libc::SIGPIPE, core::ptr::null(), &mut actual);
#[cfg(not(target_os = "aix"))]
{
actual.sa_sigaction
}
#[cfg(target_os = "aix")]
{
actual.sa_union.__su_sigaction as libc::sighandler_t
}
actual.sa_sigaction
};
assert_eq!(actual, expected, "actual and expected SIGPIPE disposition in child differs");

View file

@ -20,14 +20,7 @@ pub fn assert_sigpipe_handler(expected_handler: SignalHandler) {
let actual = unsafe {
let mut actual: libc::sigaction = std::mem::zeroed();
libc::sigaction(libc::SIGPIPE, std::ptr::null(), &mut actual);
#[cfg(not(target_os = "aix"))]
{
actual.sa_sigaction
}
#[cfg(target_os = "aix")]
{
actual.sa_union.__su_sigaction as libc::sighandler_t
}
actual.sa_sigaction
};
let expected = match expected_handler {

View file

@ -29,14 +29,7 @@ fn main() {
// Install signal handler that runs on alternate signal stack.
let mut action: sigaction = std::mem::zeroed();
action.sa_flags = (SA_ONSTACK | SA_SIGINFO) as _;
#[cfg(not(target_os = "aix"))]
{
action.sa_sigaction = signal_handler as sighandler_t;
}
#[cfg(target_os = "aix")]
{
action.sa_union.__su_sigaction = signal_handler as sighandler_t;
}
action.sa_sigaction = signal_handler as sighandler_t;
sigaction(SIGWINCH, &action, std::ptr::null_mut());
// Send SIGWINCH on exit.