Skip to content

Commit

Permalink
Replace sa_sigaction with sa_union.__su_sigaction for AIX.
Browse files Browse the repository at this point in the history
  • Loading branch information
xingxue-ibm committed Dec 6, 2024
1 parent bc145ce commit 3109f07
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@ fn start(argc: isize, argv: *const *const u8) -> isize {
let actual = unsafe {
let mut actual: libc::sigaction = std::mem::zeroed();
libc::sigaction(libc::SIGPIPE, std::ptr::null(), &mut actual);
actual.sa_sigaction
#[cfg(not(target_os = "aix"))]
{
actual.sa_sigaction
}
#[cfg(target_os = "aix")]
{
actual.sa_union.__su_sigaction as libc::sighandler_t
}
};

assert_eq!(actual, expected, "actual and expected SIGPIPE disposition in child differs");
Expand Down
9 changes: 8 additions & 1 deletion tests/ui/runtime/on-broken-pipe/auxiliary/sigpipe-utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ 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);
actual.sa_sigaction
#[cfg(not(target_os = "aix"))]
{
actual.sa_sigaction
}
#[cfg(target_os = "aix")]
{
actual.sa_union.__su_sigaction as libc::sighandler_t
}
};

let expected = match expected_handler {
Expand Down
9 changes: 8 additions & 1 deletion tests/ui/runtime/signal-alternate-stack-cleanup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@ 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 _;
action.sa_sigaction = signal_handler as sighandler_t;
#[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;
}
sigaction(SIGWINCH, &action, std::ptr::null_mut());

// Send SIGWINCH on exit.
Expand Down

0 comments on commit 3109f07

Please sign in to comment.