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 20:13:09+02:00
loga0e093bc0f4abb4d75ac75330df5d84466a8ca78
tree7c227bc49eec4f3645ea29a88121b3c41275269c
parent02a63f88744baffacee9084544321b02289a754e
signature Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.c: fix Sigaction and sigset_t layout on android


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

lib/std/c.zig+14-2
...@@ -3329,7 +3329,18 @@ const common_linux_Sigaction = extern struct {...@@ -3329,7 +3329,18 @@ const common_linux_Sigaction = extern struct {
33293329
3330/// Renamed from `sigaction` to `Sigaction` to avoid conflict with function name.3330/// Renamed from `sigaction` to `Sigaction` to avoid conflict with function name.
3331pub const Sigaction = switch (native_os) {3331pub const Sigaction = switch (native_os) {
3332 .linux => switch (native_arch) {3332 .linux => if (builtin.abi.isAndroid() and builtin.target.ptrBitWidth() == 64) extern struct {
3333 pub const handler_fn = *align(1) const fn (SIG) callconv(.c) void;
3334 pub const sigaction_fn = *const fn (SIG, *const siginfo_t, ?*anyopaque) callconv(.c) void;
3335
3336 flags: c_uint,
3337 handler: extern union {
3338 handler: ?handler_fn,
3339 sigaction: ?sigaction_fn,
3340 },
3341 mask: sigset_t,
3342 restorer: ?*const fn () callconv(.c) void = null,
3343 } else switch (native_arch) {
3333 .mips,3344 .mips,
3334 .mipsel,3345 .mipsel,
3335 .mips64,3346 .mips64,
...@@ -4967,7 +4978,8 @@ pub const siginfo_t = switch (native_os) {...@@ -4967,7 +4978,8 @@ pub const siginfo_t = switch (native_os) {
4967 else => void,4978 else => void,
4968};4979};
4969pub const sigset_t = switch (native_os) {4980pub const sigset_t = switch (native_os) {
4970 .linux => [1024 / @bitSizeOf(c_ulong)]c_ulong, // glibc and musl present a 1024-bit sigset_t, while kernel's is 128-bit or less.4981 // glibc and musl present a 1024-bit sigset_t, while kernel's (and bionic's) is 128-bit or less.
4982 .linux => if (builtin.abi.isAndroid()) c_ulong else [1024 / @bitSizeOf(c_ulong)]c_ulong,
4971 .emscripten => emscripten.sigset_t,4983 .emscripten => emscripten.sigset_t,
4972 // https://github.com/SerenityOS/serenity/blob/ec492a1a0819e6239ea44156825c4ee7234ca3db/Kernel/API/POSIX/signal.h#L194984 // https://github.com/SerenityOS/serenity/blob/ec492a1a0819e6239ea44156825c4ee7234ca3db/Kernel/API/POSIX/signal.h#L19
4973 .openbsd, .serenity => u32,4985 .openbsd, .serenity => u32,