Skip to content

Commit 89d5911

Browse files
committed
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.
1 parent d937b86 commit 89d5911

File tree

8 files changed

+8
-9
lines changed

8 files changed

+8
-9
lines changed

lib/std/os/linux/aarch64.zig

+1-1
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ pub const ucontext_t = extern struct {
289289
flags: usize,
290290
link: ?*ucontext_t,
291291
stack: stack_t,
292-
sigmask: sigset_t,
292+
sigmask: [1024 / @bitSizeOf(c_ulong)]c_ulong, // Currently a libc-compatible (1024-bit) sigmask
293293
mcontext: mcontext_t,
294294
};
295295

lib/std/os/linux/arm.zig

+1-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ pub const ucontext_t = extern struct {
337337
link: ?*ucontext_t,
338338
stack: stack_t,
339339
mcontext: mcontext_t,
340-
sigmask: sigset_t,
340+
sigmask: [1024 / @bitSizeOf(c_ulong)]c_ulong, // Currently a libc-compatible (1024-bit) sigmask
341341
regspace: [64]u64,
342342
};
343343

lib/std/os/linux/loongarch64.zig

+1-2
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,7 @@ pub const ucontext_t = extern struct {
264264
flags: c_ulong,
265265
link: ?*ucontext_t,
266266
stack: stack_t,
267-
sigmask: sigset_t,
268-
_pad: [1024 / 8 - @sizeOf(sigset_t)]u8,
267+
sigmask: [1024 / @bitSizeOf(c_ulong)]c_ulong, // Currently a libc-compatible (1024-bit) sigmask
269268
mcontext: mcontext_t,
270269
};
271270

lib/std/os/linux/powerpc.zig

+1-1
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ pub const ucontext_t = extern struct {
341341
stack: stack_t,
342342
pad: [7]i32,
343343
regs: *mcontext_t,
344-
sigmask: sigset_t,
344+
sigmask: [1024 / @bitSizeOf(c_ulong)]c_ulong, // Currently a libc-compatible (1024-bit) sigmask
345345
pad2: [3]i32,
346346
mcontext: mcontext_t,
347347
};

lib/std/os/linux/powerpc64.zig

+1-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ pub const ucontext_t = extern struct {
337337
flags: u32,
338338
link: ?*ucontext_t,
339339
stack: stack_t,
340-
sigmask: sigset_t,
340+
sigmask: [1024 / @bitSizeOf(c_ulong)]c_ulong, // Currently a libc-compatible (1024-bit) sigmask
341341
mcontext: mcontext_t,
342342
};
343343

lib/std/os/linux/s390x.zig

+1-1
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ pub const ucontext_t = extern struct {
273273
link: ?*ucontext_t,
274274
stack: stack_t,
275275
mcontext: mcontext_t,
276-
sigmask: sigset_t,
276+
sigmask: [1024 / @bitSizeOf(c_ulong)]c_ulong, // Currently a libc-compatible (1024-bit) sigmask
277277
};
278278

279279
pub const mcontext_t = extern struct {

lib/std/os/linux/sparc64.zig

+1-1
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ pub const ucontext_t = extern struct {
453453
sigmask: u64,
454454
mcontext: mcontext_t,
455455
stack: stack_t,
456-
sigset: sigset_t,
456+
sigset: [1024 / @bitSizeOf(c_ulong)]c_ulong, // Currently a libc-compatible (1024-bit) sigmask
457457
};
458458

459459
/// TODO

lib/std/os/linux/x86.zig

+1-1
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ pub const ucontext_t = extern struct {
350350
link: ?*ucontext_t,
351351
stack: stack_t,
352352
mcontext: mcontext_t,
353-
sigmask: sigset_t,
353+
sigmask: [1024 / @bitSizeOf(c_ulong)]c_ulong, // Currently a libc-compatible (1024-bit) sigmask
354354
regspace: [64]u64,
355355
};
356356

0 commit comments

Comments
 (0)