Skip to content

Commit fd92f03

Browse files
authored
Rollup merge of rust-lang#133970 - xingxue-ibm:sigaction, r=nnethercote
[AIX] Replace sa_sigaction with sa_union.__su_sigaction for AIX On AIX, the `sa_sigaction` member of `struct sigaction` is accessed as the union member `sa_union.__su_sigaction`.
2 parents 6a9869f + 3109f07 commit fd92f03

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

tests/ui/runtime/on-broken-pipe/auxiliary/assert-sigpipe-disposition.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,14 @@ fn start(argc: isize, argv: *const *const u8) -> isize {
2525
let actual = unsafe {
2626
let mut actual: libc::sigaction = std::mem::zeroed();
2727
libc::sigaction(libc::SIGPIPE, std::ptr::null(), &mut actual);
28-
actual.sa_sigaction
28+
#[cfg(not(target_os = "aix"))]
29+
{
30+
actual.sa_sigaction
31+
}
32+
#[cfg(target_os = "aix")]
33+
{
34+
actual.sa_union.__su_sigaction as libc::sighandler_t
35+
}
2936
};
3037

3138
assert_eq!(actual, expected, "actual and expected SIGPIPE disposition in child differs");

tests/ui/runtime/on-broken-pipe/auxiliary/sigpipe-utils.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,14 @@ pub fn assert_sigpipe_handler(expected_handler: SignalHandler) {
2020
let actual = unsafe {
2121
let mut actual: libc::sigaction = std::mem::zeroed();
2222
libc::sigaction(libc::SIGPIPE, std::ptr::null(), &mut actual);
23-
actual.sa_sigaction
23+
#[cfg(not(target_os = "aix"))]
24+
{
25+
actual.sa_sigaction
26+
}
27+
#[cfg(target_os = "aix")]
28+
{
29+
actual.sa_union.__su_sigaction as libc::sighandler_t
30+
}
2431
};
2532

2633
let expected = match expected_handler {

tests/ui/runtime/signal-alternate-stack-cleanup.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,14 @@ fn main() {
2929
// Install signal handler that runs on alternate signal stack.
3030
let mut action: sigaction = std::mem::zeroed();
3131
action.sa_flags = (SA_ONSTACK | SA_SIGINFO) as _;
32-
action.sa_sigaction = signal_handler as sighandler_t;
32+
#[cfg(not(target_os = "aix"))]
33+
{
34+
action.sa_sigaction = signal_handler as sighandler_t;
35+
}
36+
#[cfg(target_os = "aix")]
37+
{
38+
action.sa_union.__su_sigaction = signal_handler as sighandler_t;
39+
}
3340
sigaction(SIGWINCH, &action, std::ptr::null_mut());
3441

3542
// Send SIGWINCH on exit.

0 commit comments

Comments
 (0)