zig/lib/std/os/linux
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
..
bpf linux/bpf: add alignment for helper functions to make compiler happy 2024-11-18 16:19:44 +01:00
aarch64.zig Remove uses of deprecated callconv aliases 2025-03-05 03:01:43 +00:00
arm.zig std.os.linux: use heap.pageSize() instead of MMAP2_UNIT 2025-04-07 13:37:01 +02:00
bpf.zig lib/std: PermissionDenied/AccessDenied cleanup and fallout 2025-03-24 16:20:45 +01:00
hexagon.zig std.os.linux: use heap.pageSize() instead of MMAP2_UNIT 2025-04-07 13:37:01 +02:00
io_uring_sqe.zig io_uring: add setsockopt/getsockopt 2025-03-05 13:35:52 +01:00
ioctl.zig std.Target: Remove sparcel architecture tag. 2024-07-30 06:30:25 +02:00
IoUring.zig io_uring: refactor buf_reg flags 2025-03-05 13:35:52 +01:00
loongarch64.zig std.os.linux: Add some missing arch bits for loongarch64. 2025-04-07 16:03:22 +02:00
m68k.zig std.os.linux: use heap.pageSize() instead of MMAP2_UNIT 2025-04-07 13:37:01 +02:00
mips.zig std.os.linux: use heap.pageSize() instead of MMAP2_UNIT 2025-04-07 13:37:01 +02:00
mips64.zig std.os.linux: use heap.pageSize() instead of MMAP2_UNIT 2025-04-07 13:37:01 +02:00
pie.zig std.os.linux.pie: Fix a relocation error for s390x. 2024-11-24 22:11:17 +01:00
powerpc.zig std.os.linux: use heap.pageSize() instead of MMAP2_UNIT 2025-04-07 13:37:01 +02:00
powerpc64.zig Remove uses of deprecated callconv aliases 2025-03-05 03:01:43 +00:00
riscv32.zig std.os.linux: use heap.pageSize() instead of MMAP2_UNIT 2025-04-07 13:37:01 +02:00
riscv64.zig Remove uses of deprecated callconv aliases 2025-03-05 03:01:43 +00:00
s390x.zig Remove uses of deprecated callconv aliases 2025-03-05 03:01:43 +00:00
seccomp.zig std.builtin.Endian: make the tags lower case 2023-10-31 21:37:35 -04:00
sparc64.zig Remove uses of deprecated callconv aliases 2025-03-05 03:01:43 +00:00
syscalls.zig generate_linux_syscalls: Generate syscalls for x32. 2024-11-02 10:42:53 +01:00
test.zig Fix sigaddset/sigdelset bit-fiddling math 2025-04-10 23:49:44 +02:00
thumb.zig Remove uses of deprecated callconv aliases 2025-03-05 03:01:43 +00:00
tls.zig std.os.linux: use heap.pageSize() instead of MMAP2_UNIT 2025-04-07 13:37:01 +02:00
vdso.zig std.dynamic_library: update to new elf API 2024-10-12 10:44:17 -07:00
x86.zig std.os.linux: use heap.pageSize() instead of MMAP2_UNIT 2025-04-07 13:37:01 +02:00
x86_64.zig Remove uses of deprecated callconv aliases 2025-03-05 03:01:43 +00:00