authorgravatar for enfipy@gmail.comDavid <enfipy@gmail.com> 2026-10-15 10:02:28+04:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-10-15 19:56:13+02:00
log13ee140439e8a175dc80983b0257793fa9c2cb0e
tree10528a836ac67c7ca454e9c61b87a3b16628639a
parent3f4f2c640b187b5f97cf67a3399f4c8c0005e8ff

std.c: fix Sigaction and sigset_t layout on android


1 files changed, 14 insertions(+), 2 deletions(-)

lib/std/c.zig+14-2
......@@ -3239,7 +3239,18 @@ const common_linux_Sigaction = extern struct {
32393239
32403240/// Renamed from `sigaction` to `Sigaction` to avoid conflict with function name.
32413241pub const Sigaction = switch (native_os) {
3242 .linux => switch (native_arch) {
3242 .linux => if (builtin.abi.isAndroid() and builtin.target.ptrBitWidth() == 64) extern struct {
3243 pub const handler_fn = *align(1) const fn (SIG) callconv(.c) void;
3244 pub const sigaction_fn = *const fn (SIG, *const siginfo_t, ?*anyopaque) callconv(.c) void;
3245
3246 flags: c_uint,
3247 handler: extern union {
3248 handler: ?handler_fn,
3249 sigaction: ?sigaction_fn,
3250 },
3251 mask: sigset_t,
3252 restorer: ?*const fn () callconv(.c) void = null,
3253 } else switch (native_arch) {
32433254 .mips,
32443255 .mipsel,
32453256 .mips64,
......@@ -4877,7 +4888,8 @@ pub const siginfo_t = switch (native_os) {
48774888 else => void,
48784889};
48794890pub const sigset_t = switch (native_os) {
4880 .linux => [1024 / @bitSizeOf(c_ulong)]c_ulong, // glibc and musl present a 1024-bit sigset_t, while kernel's is 128-bit or less.
4891 // glibc and musl present a 1024-bit sigset_t, while kernel's (and bionic's) is 128-bit or less.
4892 .linux => if (builtin.abi.isAndroid()) c_ulong else [1024 / @bitSizeOf(c_ulong)]c_ulong,
48814893 .emscripten => emscripten.sigset_t,
48824894 // https://github.com/SerenityOS/serenity/blob/ec492a1a0819e6239ea44156825c4ee7234ca3db/Kernel/API/POSIX/signal.h#L19
48834895 .openbsd, .serenity => u32,