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 {...@@ -3239,7 +3239,18 @@ const common_linux_Sigaction = extern struct {
32393239
3240/// Renamed from `sigaction` to `Sigaction` to avoid conflict with function name.3240/// Renamed from `sigaction` to `Sigaction` to avoid conflict with function name.
3241pub const Sigaction = switch (native_os) {3241pub 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) {
3243 .mips,3254 .mips,
3244 .mipsel,3255 .mipsel,
3245 .mips64,3256 .mips64,
...@@ -4877,7 +4888,8 @@ pub const siginfo_t = switch (native_os) {...@@ -4877,7 +4888,8 @@ pub const siginfo_t = switch (native_os) {
4877 else => void,4888 else => void,
4878};4889};
4879pub const sigset_t = switch (native_os) {4890pub 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,
4881 .emscripten => emscripten.sigset_t,4893 .emscripten => emscripten.sigset_t,
4882 // https://github.com/SerenityOS/serenity/blob/ec492a1a0819e6239ea44156825c4ee7234ca3db/Kernel/API/POSIX/signal.h#L194894 // https://github.com/SerenityOS/serenity/blob/ec492a1a0819e6239ea44156825c4ee7234ca3db/Kernel/API/POSIX/signal.h#L19
4883 .openbsd, .serenity => u32,4895 .openbsd, .serenity => u32,