zig/lib/std/os
Pat Tullmann 4b63f94b4e Fix sigaddset/sigdelset bit-fiddling math
The code was using u32 and usize interchangably, which doesn't work on
64-bit systems.  This:
  `pub const sigset_t = [1024 / 32]u32;`
is not consistent with this:
  `const shift = @as(u5, @intCast(s & (usize_bits - 1)));`

However, normal signal numbers are less than 31, so the bad math doesn't matter much.  Also, despite support for 1024 signals in the set, only setting signals between 1 and NSIG (which is mostly 65, but sometimes 128) is defined.  The existing tests only exercised signal numbers in the first 31 bits so they didn't trip over this:

The C library `sigaddset` will return `EINVAL` if given an out of bounds signal number.  I made the Zig code just silently ignore any out of bounds signal numbers.

Moved all the `sigset` related declarations next to each in the source, too.

The `filled_sigset` seems non-standard to me.  I think it is meant to be used like `empty_sigset`, but it only contains 31 set signals, which seems wrong (should be 64 or 128, aka `NSIG`).  It's also unused.  The oddly named but similar `all_mask` is used (by posix.zig) but sets all 1024 bits (which I understood to be undefined behavior but seems to work just fine).  For comparison the musl `sigfillset` fills in 65 bits or 128 bits.
2025-04-10 23:49:44 +02:00
..
linux Fix sigaddset/sigdelset bit-fiddling math 2025-04-10 23:49:44 +02:00
plan9 extract std.posix from std.os 2024-03-19 11:45:09 -07:00
uefi fix review 2025-04-04 12:42:28 +01:00
windows support more process creation options on Windows 2025-03-25 23:48:27 +01:00
emscripten.zig all: update to std.builtin.Type.Pointer.Size field renames 2025-01-16 12:46:29 +00:00
linux.zig Fix sigaddset/sigdelset bit-fiddling math 2025-04-10 23:49:44 +02:00
plan9.zig runtime page size detection 2025-02-06 14:23:23 -08:00
uefi.zig std.start: allow return uefi error union in main (#23425) 2025-04-01 17:10:10 +00:00
wasi.zig wasi: fix wasm-wasi-musl constants 2025-02-09 09:08:11 +01:00
windows.zig std.os.windows.PF: Add ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE. 2025-04-03 04:00:30 +02:00