Build on the extensive work already done
IoUring: add fixed_fd_install, ftruncate, cmd_discard
Working on IoUring pipe flags
Signed-off-by: Bernard Assan <mega.alpha100@gmail.com>
Signed-off-by: Bernard Assan <mega.alpha100@gmail.com>
Add futex_* operations to IoUring
Refactor Futex 2 flags into Futex2 struct
add mpol to Wait flags and fix private field as its 128 not 32
Signed-off-by: Bernard Assan <mega.alpha100@gmail.com>
Update futex2_* functions and constants to use the new Futex2 type
Improve the Api of futex2_* functions to be more idiomatic Zig
Signed-off-by: Bernard Assan <mega.alpha100@gmail.com>
ignore prep_openat2* for now
add non-at variant of some unlink, rename, mkdir, symlink, link
TODO: add Sync File Flags
Signed-off-by: Bernard Assan <mega.alpha100@gmail.com>
Add timeout update, cancel_fd, epoll_wait, files_update, open, open_direct, f/madvice
don't implement f/madvice64 for now I doubt it is used by a lot of people in practice
Implement BufferGroup read_multishot
Try to make definition of function align as logically as posible with
liburing to make keeping our implementation in sync easy
TODO: add M/Fadvice enum flags
TODO: understand buffer_selection and how its different from BufferGroup
Signed-off-by: Bernard Assan <mega.alpha100@gmail.com>
add IoUring tee syscall functionality
adapt ReadBuffer union idea for read_fixed to support fixed read and readv
Use same idea and create a WriteBuffer type for write() and write_fixed()
ignored flags for splice and tee lets see if they become important in
the future
add a get_data helper to Cqe
Signed-off-by: Bernard Assan <mega.alpha100@gmail.com>
Future enhancement:
enter_ring_fd: u24,
init_flags: u8,
register functions that require the extra fields above like
io_uring_register_ring_fd, io_uring_close_ring_fd,
io_uring_clone_buffers_offset, io_uring_set_iowait not implemented
register_*_tag functions not implemented
remove unnecessary use of @ptrCast in io_uring_register
Signed-off-by: Bernard Assan <mega.alpha100@gmail.com>
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>
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>
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>
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>
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>
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>
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>
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>
[Incremental provided buffer
consumption](https://github.com/axboe/liburing/wiki/What's-new-with-io_uring-in-6.11-and-6.12#incremental-provided-buffer-consumption)
support is added in kernel 6.12.
IoUring.BufferGroup will now use incremental consumption whenever
kernel supports it.
Before, provided buffers are wholly consumed when picked. Each cqe
points to the different buffer. With this, cqe points to the part of the
buffer. Multiple cqe's can reuse same buffer.
Appropriate sizing of buffers becomes less important.
There are slight changes in BufferGroup interface (it now needs to track
current receive point for each buffer). Init requires allocator
instead of buffers slice, it will allocate buffers slice and head
pointers slice. Get and put now requires cqe becasue there we have
information will the buffer be reused.
ring.cmd_sock is generic socket operation. Two most common uses are
setsockopt and getsockopt. This provides same interface as posix
versions of this methods.
libring has also [sqe_set_flags](https://man7.org/linux/man-pages/man3/io_uring_sqe_set_flags.3.html)
method. Adding that in our io_uring_sqe. Adding sqe.link_next method for setting most common flag.
* fix merge conflicts
* rename the declarations
* reword documentation
* extract FixedBufferAllocator to separate file
* take advantage of locals
* remove the assertion about max alignment in Allocator API, leaving it
Allocator implementation defined
* fix non-inline function call in start logic
The GeneralPurposeAllocator implementation is totally broken because it
uses global state but I didn't address that in this commit.
heap.zig: define new default page sizes
heap.zig: add min/max_page_size and their options
lib/std/c: add miscellaneous declarations
heap.zig: add pageSize() and its options
switch to new page sizes, especially in GPA/stdlib
mem.zig: remove page_size
It is now composed of these main sections:
* Declarations that are shared among all operating systems.
* Declarations that have the same name, but different type signatures
depending on the operating system. Often multiple operating systems
share the same type signatures however.
* Declarations that are specific to a single operating system.
- These are imported one per line so you can see where they come from,
protected by a comptime block to prevent accessing the wrong one.
Closes#19352 by changing the convention to making types `void` and
functions `{}`, so that it becomes possible to update `@hasDecl` sites
to use `@TypeOf(f) != void` or `T != void`. Happily, this ended up
removing some duplicate logic and update some bitrotted feature
detection checks.
A handful of types have been modified to gain namespacing and type
safety. This is a breaking change.
Oh, and the last usage of `usingnamespace` site is eliminated.
In my first [try](https://github.com/ziglang/zig/pull/20224) to fix
20212 I didn't reproduce bug on required kernel (6.9.2) and wrongly
concluded that first two completions have different order on newer
kernel.
On my current kernel (6.5.0) order of completions is: send1, recv,
send2. On 6.9.2 order is send1, send2, recv. This fix allows second two
completions to arrive in any order.
Tested on both kernels.
Fixes: #20212
Deprecated aliases that are now compile errors:
- `std.fs.MAX_PATH_BYTES` (renamed to `std.fs.max_path_bytes`)
- `std.mem.tokenize` (split into `tokenizeAny`, `tokenizeSequence`, `tokenizeScalar`)
- `std.mem.split` (split into `splitSequence`, `splitAny`, `splitScalar`)
- `std.mem.splitBackwards` (split into `splitBackwardsSequence`, `splitBackwardsAny`, `splitBackwardsScalar`)
- `std.unicode`
+ `utf16leToUtf8Alloc`, `utf16leToUtf8AllocZ`, `utf16leToUtf8`, `fmtUtf16le` (all renamed to have capitalized `Le`)
+ `utf8ToUtf16LeWithNull` (renamed to `utf8ToUtf16LeAllocZ`)
- `std.zig.CrossTarget` (moved to `std.Target.Query`)
Deprecated `lib/std/std.zig` decls were deleted instead of made a `@compileError` because the `refAllDecls` in the test block would trigger the `@compileError`. The deleted top-level `std` namespaces are:
- `std.rand` (renamed to `std.Random`)
- `std.TailQueue` (renamed to `std.DoublyLinkedList`)
- `std.ChildProcess` (renamed/moved to `std.process.Child`)
This is not exhaustive. Deprecated aliases that I didn't touch:
+ `std.io.*`
+ `std.Build.*`
+ `std.builtin.Mode`
+ `std.zig.c_translation.CIntLiteralRadix`
+ anything in `src/`