commit cf989374e986462fef70fe4c1d0f5869b194148d (tree)
parent 120c4789c31c066f15fe414a5b32cdc7e80a065c
Author: Pat Tullmann <pat.github@tullmann.org>
Date: Thu, 24 Apr 2025 22:02:53 -0700
linux: update `sigmask` in every arch `ucontext_t`
All the existing code that manipulates `ucontext_t` expects there to be a
glibc-compatible sigmask (1024-bit). The `ucontext_t` struct need to be
cleaned up so the glibc-dependent format is only used when linking
glibc/musl library, but that is a more involved change.
In practice, no Zig code looks at the sigset field contents, so it just
needs to be the right size.
Diffstat:
8 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/lib/std/os/linux/aarch64.zig b/lib/std/os/linux/aarch64.zig
@@ -289,7 +289,7 @@ pub const ucontext_t = extern struct {
flags: usize,
link: ?*ucontext_t,
stack: stack_t,
- sigmask: sigset_t,
+ sigmask: [1024 / @bitSizeOf(c_ulong)]c_ulong, // Currently a libc-compatible (1024-bit) sigmask
mcontext: mcontext_t,
};
diff --git a/lib/std/os/linux/arm.zig b/lib/std/os/linux/arm.zig
@@ -337,7 +337,7 @@ pub const ucontext_t = extern struct {
link: ?*ucontext_t,
stack: stack_t,
mcontext: mcontext_t,
- sigmask: sigset_t,
+ sigmask: [1024 / @bitSizeOf(c_ulong)]c_ulong, // Currently a libc-compatible (1024-bit) sigmask
regspace: [64]u64,
};
diff --git a/lib/std/os/linux/loongarch64.zig b/lib/std/os/linux/loongarch64.zig
@@ -264,8 +264,7 @@ pub const ucontext_t = extern struct {
flags: c_ulong,
link: ?*ucontext_t,
stack: stack_t,
- sigmask: sigset_t,
- _pad: [1024 / 8 - @sizeOf(sigset_t)]u8,
+ sigmask: [1024 / @bitSizeOf(c_ulong)]c_ulong, // Currently a libc-compatible (1024-bit) sigmask
mcontext: mcontext_t,
};
diff --git a/lib/std/os/linux/powerpc.zig b/lib/std/os/linux/powerpc.zig
@@ -341,7 +341,7 @@ pub const ucontext_t = extern struct {
stack: stack_t,
pad: [7]i32,
regs: *mcontext_t,
- sigmask: sigset_t,
+ sigmask: [1024 / @bitSizeOf(c_ulong)]c_ulong, // Currently a libc-compatible (1024-bit) sigmask
pad2: [3]i32,
mcontext: mcontext_t,
};
diff --git a/lib/std/os/linux/powerpc64.zig b/lib/std/os/linux/powerpc64.zig
@@ -337,7 +337,7 @@ pub const ucontext_t = extern struct {
flags: u32,
link: ?*ucontext_t,
stack: stack_t,
- sigmask: sigset_t,
+ sigmask: [1024 / @bitSizeOf(c_ulong)]c_ulong, // Currently a libc-compatible (1024-bit) sigmask
mcontext: mcontext_t,
};
diff --git a/lib/std/os/linux/s390x.zig b/lib/std/os/linux/s390x.zig
@@ -273,7 +273,7 @@ pub const ucontext_t = extern struct {
link: ?*ucontext_t,
stack: stack_t,
mcontext: mcontext_t,
- sigmask: sigset_t,
+ sigmask: [1024 / @bitSizeOf(c_ulong)]c_ulong, // Currently a libc-compatible (1024-bit) sigmask
};
pub const mcontext_t = extern struct {
diff --git a/lib/std/os/linux/sparc64.zig b/lib/std/os/linux/sparc64.zig
@@ -454,7 +454,7 @@ pub const ucontext_t = extern struct {
sigmask: u64,
mcontext: mcontext_t,
stack: stack_t,
- sigset: sigset_t,
+ sigset: [1024 / @bitSizeOf(c_ulong)]c_ulong, // Currently a libc-compatible (1024-bit) sigmask
};
/// TODO
diff --git a/lib/std/os/linux/x86.zig b/lib/std/os/linux/x86.zig
@@ -350,7 +350,7 @@ pub const ucontext_t = extern struct {
link: ?*ucontext_t,
stack: stack_t,
mcontext: mcontext_t,
- sigmask: sigset_t,
+ sigmask: [1024 / @bitSizeOf(c_ulong)]c_ulong, // Currently a libc-compatible (1024-bit) sigmask
regspace: [64]u64,
};