Commit graph

519 commits

Author SHA1 Message Date
Bernard Assan
15534e190e
Add and improve comments
Signed-off-by: Bernard Assan <mega.alpha100@gmail.com>
2025-12-01 12:15:57 +00:00
Bernard Assan
6f40669413
replace direct set of some flags with link_next and set_flags calls
Signed-off-by: Bernard Assan <mega.alpha100@gmail.com>
2025-12-01 12:15:56 +00:00
Bernard Assan
a07abaa248
Use lower case identifiers for IoUring flags and enums
update io_uring_enter and io_uring_register syscalls to
use IoUring flags and types

Cleanup comments

Signed-off-by: Bernard Assan <mega.alpha100@gmail.com>
2025-12-01 12:15:56 +00:00
Bernard Assan
2584301978
Replace EPOLL struct with an EpollOp enum and Epoll packed struct type
Prefer Using aliases over packed union field

Fix bug in HANDLE_FID declaration

Use EpollOp op type and Epoll packed struct flag type in IoUring

Signed-off-by: Bernard Assan <mega.alpha100@gmail.com>
2025-12-01 12:15:55 +00:00
Bernard Assan
9d460e7a78
Add So and Sol typed flags
Replace SO with So type and Add SO named constants for compatability

Replace SOL with Sol type and Add SOL named constants for compatability

Replace some more typed flags with their typed equivalent

Remove any unnecessary IoUring dependency on linux.*

Add TODOs for all untyped flags

Signed-off-by: Bernard Assan <mega.alpha100@gmail.com>
2025-12-01 12:15:55 +00:00
Bernard Assan
1ae677fda1
Get test passing for all the newly introduced flags
4❯ zig test lib/std/std.zig --zig-lib-dir lib --test-filter "os.linux"
68/116 os.linux.test.test.futex2_wait...SKIP
69/116 os.linux.test.test.futex2_wake...SKIP
70/116 os.linux.test.test.futex2_requeue...SKIP
111/116 os.linux.IoUring.test.waitid...SKIP
116/116 os.linux.IoUring.test.bind/listen/connect...SKIP
111 passed; 5 skipped; 0 failed.

fix skipKernelLessThan fn to work on wsl linux

fix logical error in flags compatibility check

Update all IoUring to use the implemented flags

bandage types that affect posix for now so that the scope
doesn't become unmanageable

TODO: impl linux.SOL and linux.SO types

Signed-off-by: Bernard Assan <mega.alpha100@gmail.com>
2025-12-01 12:15:55 +00:00
Bernard Assan
0464bcc98d
Replace MSG with Packed Struct Flags
Signed-off-by: Bernard Assan <mega.alpha100@gmail.com>
2025-12-01 12:15:55 +00:00
Bernard Assan
88fa1decbf
Restore deprecated contants using new Flag types
This allows for a gradual transitioning to the new typed flags

Signed-off-by: Bernard Assan <mega.alpha100@gmail.com>
2025-12-01 12:15:54 +00:00
Bernard Assan
b5dab22f26
update some syscall APIs to use the new flags
Add Shut, PF, AF, IPPROTO types

Update IoUring and test to use some of this flags

TODO: avoid breaking API and make transitioning smooth
Instead mark the previous API as deprecated for at least
One zig release while using the new in the Zig codebase

Signed-off-by: Bernard Assan <mega.alpha100@gmail.com>
2025-12-01 12:15:54 +00:00
Bernard Assan
af2397777a
Replace AT,W,SHUT,SOCK with a packed struct Flag type
Use the new Flag types in IoUring

fix some test

Signed-off-by: Bernard Assan <mega.alpha100@gmail.com>
2025-12-01 12:15:54 +00:00
Bernard Assan
86ed53e28f
Improve organization of fn and structs in IoUring
Update std to use Statx.Mask
Update statx syscall to use Statx.Mask

Signed-off-by: Bernard Assan <mega.alpha100@gmail.com>
2025-12-01 12:15:54 +00:00
Bernard Assan
3e4f8ee485
Replace STATX_* with StatxMask & StatxAttr
Add RenameFlags for IoUring renameat

Start update io_uring Types in linux.zig to use IoUring

Continue change options and flags to Typed types

Fix test cases to use updated IoUring flags and options

Signed-off-by: Bernard Assan <mega.alpha100@gmail.com>
2025-12-01 12:15:54 +00:00
Bernard Assan
c20b2b91a9
move Flags that were mistakenly tagged as constants
Improve naming and namespacing of IoUring flags and types to
match Zig Style

move some flags from uflags to its type

Add matches doc comments to make it easy to match Zig IoUring types
to liburing

Signed-off-by: Bernard Assan <mega.alpha100@gmail.com>
2025-12-01 12:15:53 +00:00
Bernard Assan
3b715fda9a
replace some more fn flags with Typed Flags
and use linux Flags where appropriate

constants is a namespace

make AsyncCancel flags more descriptive

move cqe.flags into the Cqe type

make io_uring_sqe ioprio a packed union of SendRecv & Accept

TODO: move some of the used linux Flags to be packed structs

Signed-off-by: Bernard Assan <mega.alpha100@gmail.com>
2025-12-01 12:15:53 +00:00
Bernard Assan
c0a97b7d5f
IoUring: use typed Flags and Features for IoUring
IoUring Overhaul

Named Constants for IoUring

Move io_uring_sqe.zig into IoUring

Add new exposed IoUring data types

Improve naming and namespacing a bit

Improve api of init with Setup.Flags

 // https://github.com/axboe/liburing/issues/1075#issuecomment-1970744640
 // https://github.com/axboe/liburing/issues/811#issuecomment-1454967969
 // https://nick-black.com/dankwiki/index.php/Io_uring
Catch simple incompatible flag configurations during init_params

Start updating IoUring gradually to use the new typed flags

Slowly remove IoUring bits and pieces from linux.zig

Signed-off-by: Bernard Assan <mega.alpha100@gmail.com>
2025-12-01 12:15:53 +00:00
Alex Rønne Petersen
1231aa9719
Revert "std.os.linux.sparc64: use icc instead of xcc in asm clobbers"
This reverts commit b34a13da38.

This is not the right fix; rather, the C backend needs to translate all of ccr,
icc, and xcc to just icc.
2025-11-23 07:27:45 +01:00
rpkak
6b4f45f782 system specific errno 2025-11-20 15:03:23 -08:00
Alex Rønne Petersen
508f676bb4
std.os.linux.IoUring: disable bind/listen/connect on s390x
https://github.com/ziglang/zig/issues/25956
2025-11-19 01:42:45 +01:00
John Benediktsson
74c23a237e
Merge pull request #25763 from mrjbq7/cancelled
rename Cancelled to Canceled
2025-10-30 04:40:13 +00:00
Andrew Kelley
a072d821be
Merge pull request #25592 from ziglang/init-std.Io
std: Introduce `Io` Interface
2025-10-29 13:51:37 -07:00
Alex Rønne Petersen
b2bc44e0d5
std.os.linux: fix restore for powerpc/powerpc64
sigreturn and rt_sigreturn are distinct syscalls on PowerPC.
2025-10-29 20:44:43 +01:00
Andrew Kelley
0205ce4736 std.os.linux.IoUring: disable failing test
tracked by https://github.com/ziglang/zig/issues/25734
2025-10-29 06:26:05 -07:00
Andrew Kelley
b1d270d38e std.os.linux.s390x: fix restore function 2025-10-29 06:20:52 -07:00
Andrew Kelley
1553c8eae7 std.os.linux.x86: fix signal restore function
After handling any signal on x86, it would previously segfault.
2025-10-29 06:20:52 -07:00
Andrew Kelley
8b269f7e18 std: make signal numbers into an enum
fixes start logic for checking whether IO/POLL exist
2025-10-29 06:20:51 -07:00
Andrew Kelley
c87fbd5878 std.os.linux.IoUring: use linux msghdr
it disagrees with posix msghdr
2025-10-29 06:20:51 -07:00
Andrew Kelley
750b1431bf std: fix some Io compilation errors 2025-10-29 06:20:49 -07:00
Andrew Kelley
47aa5a70a5 std: updating to std.Io interface
got the build runner compiling
2025-10-29 06:20:48 -07:00
Alex Rønne Petersen
f723d69a58
std.os.linux.tls: add hppa support
Turns out Linux on PA-RISC does system calls in a pretty fascinating way; see
arch/parisc/kernel/syscall.S for details.
2025-10-23 09:27:17 +02:00
Alex Rønne Petersen
aff557e4e8
std.os.linux.tls: add sh support 2025-10-23 09:27:17 +02:00
Alex Rønne Petersen
5e921261a0
std.os.linux.tls: add microblaze support
Implemented according to glibc because I'm pretty sure musl gets it wrong.
2025-10-23 09:27:17 +02:00
Alex Rønne Petersen
9fde44229c
std.os.linux.tls: add alpha support 2025-10-23 09:27:17 +02:00
Alex Rønne Petersen
3e2daa509a
std.Target: add arceb and xtensaeb Cpu.Arch tags 2025-10-23 09:27:17 +02:00
Alex Rønne Petersen
c571840e71
std.os.linux: add or1k arch bits 2025-10-18 22:27:35 +02:00
Alex Rønne Petersen
35e819aac8
std.os.linux.tls: implement or1k support 2025-10-18 22:27:35 +02:00
Alex Rønne Petersen
3585f79f44
std.os.linux: remove syscall7() on mips64/mipsn32
I'm not sure why this was here, but this is only a thing on O32, not N32/N64.
2025-10-18 14:01:41 +02:00
Alex Rønne Petersen
842de66db8
std.os.linux: fix some issues in x32 inline asm
ref https://github.com/ziglang/zig/issues/22189
2025-10-18 11:16:31 +02:00
Alex Rønne Petersen
f3eacec226
std.os.linux: fix some issues in mipsn32 inline asm
ref https://github.com/ziglang/zig/issues/22189
2025-10-18 11:16:31 +02:00
Alex Rønne Petersen
b8d776928a
std: make all MIPS inline asm safe for MIPS I
MIPS I has load hazards so we need to insert nops in a few places. This is not a
problem for MIPS II and later.

While doing this, I also touched up all the inline asm to use ABI register
aliases and a consistent formatting convention. Also fixed a few places that
didn't properly check if the syscall return value should be negated.
2025-10-18 11:16:31 +02:00
Alex Rønne Petersen
1f8a72175b
Merge pull request #25610 from alexrp/std-os-linux-cleanup
`std.os.linux`: some miscellaneous cleanup in arch bits
2025-10-17 12:07:51 +02:00
Alex Rønne Petersen
29fb9e4da7
std.os.linux.tls: don't unnecessarily use std.posix 2025-10-17 02:46:47 +02:00
Alex Rønne Petersen
d5481e6536
std.os.linux: add incomplete x32 arch bits file
This is very likely full of wrong stuff. It's effectively just a copy of the
x86_64 file - needed because the former stopped using usize/isize. To be clear,
this is no more broken than the old situation was; this just makes the
brokenness explicit.
2025-10-17 01:20:33 +02:00
Alex Rønne Petersen
502eca7b09
std.os.linux: add incomplete mipsn32 arch bits file
This is very likely full of wrong stuff. It's effectively just a copy of the
mips64 file - needed because the former stopped using usize/isize. To be clear,
this is no more broken than the old situation was; this just makes the
brokenness explicit.
2025-10-17 01:20:33 +02:00
Alex Rønne Petersen
aa8e53908a
std.os.linux: clean up a bunch of dead consts 2025-10-17 01:20:33 +02:00
Alex Rønne Petersen
dc1bc52dd6
std.os.linux: retranslate F_* constants and Flock struct, and move out of arch bits
Flock is now equivalent to struct flock64, and the related F.* constants map to
the 64-bit variants on 32-bit systems.
2025-10-17 01:20:33 +02:00
Alex Rønne Petersen
cfdc0f0e34
std.os.linux: replace usize/isize in arch bits with fixed types for clarity 2025-10-17 01:20:33 +02:00
Alex Rønne Petersen
fc7a5f2ae4
std.os.linux: move some generic decls out of the arch bits 2025-10-17 01:20:31 +02:00
Alex Rønne Petersen
8970d80355
std.os.linux.thumb: remove some @setRuntimeSafety(false) with no clear purpose 2025-10-16 23:17:25 +02:00
Alex Rønne Petersen
d84faceebd
std.os.linux: remove some pointless asm clobbers in naked fns 2025-10-16 23:15:23 +02:00
Alex Rønne Petersen
05b52da15e
std.os.linux: fix a bunch of syscall and time ABI issues on hexagon
I'm not particularly happy with sprinkling this check everywhere, but the
situation should improve once we complete the time64 migration.
2025-10-16 22:12:42 +02:00