aboutsummaryrefslogtreecommitdiff
path: root/lib/std/os/linux/io_uring.zig
AgeCommit message (Collapse)Author
2022-07-16Fix io_uring tests (#12134)Vincent Rischmann
* io_uring: fix the timeout_remove test The test does a IORING_OP_TIMEOUT followed with a IORING_OP_TIMEOUT_REMOVE and assumed we would get the CQEs in the same order. Linux v5.18 changed how this works and we now get them in the reverse order. The documentation doesn't explicitly say which CQE we should get first so just make the test work with both cases. * io_uring: fix the remove_buffers test The original test was buggy but accidentally worked with kernels < 5.18 The test assumed that IORING_OP_REMOVE_BUFFERS removed from the start of but in fact the documentation doesn't specify which buffer is removed, only that a certain number of buffers are removed. Starting with the kernel 5.18 the check for the `used_buffer_id` fails. Turns out that previous kernels removed buffers in such a way that the remaining buffer for this read would always be 0, however this isn't true anymore. Instead of checking a specific value just check that the `used_buffer_id` corresponds to a valid ID.
2022-07-05std.os.linux.io_uring: work around LLVM bugAndrew Kelley
See #12014
2022-06-07add const to msghdr_const iov and control pointersJonathan Marler
alongside the typical msghdr struct, Zig has added a msghdr_const type that can be used with sendmsg which allows const data to be provided. I believe that data pointed to by the iov and control fields in msghdr are also left unmodified, in which case they can be marked const as well.
2022-06-06std: fix ambiguous referencesVeikka Tuominen
2022-05-25io_uring: replace the readv method with a read on a new ReadBuffer typeVincent Rischmann
readv() is essentially identical to read() except for the buffer type, this simplifies the API for the caller at the cost of not clearly mapping to the liburing C API.
2022-05-25io_uring: add tests for automatic buffer selectionVincent Rischmann
2022-05-25io_uring: use the socket test harnessVincent Rischmann
2022-05-25io_uring: add a test harness for server/client TCP socket testsVincent Rischmann
2022-05-25io_uring: change recv() to use a RecvBuffer insteadVincent Rischmann
RecvBuffer is equivalent to ReadBuffer but tailored for recv only.
2022-05-25io_uring: change read() to use a ReadBuffer insteadVincent Rischmann
Reads can be done in two ways with io_uring: * using a simple buffer * using a automatic buffer selection which requires the user to have provided a number of buffers before ReadBuffer let's the caller choose where the data should be read.
2022-05-25io_uring: add provide_buffers and remove_buffersVincent Rischmann
These functions are needed to implement automatic buffer selection. This maps to the IORING_OP_PROVIDE_BUFFERS and IORING_OP_PROVIDE_BUFFERS ops.
2022-05-10io_uring cancel test must tolerate CQ reorderingBrian Gold
Fixes #11382. Tested on ArchLinux 5.17.5-arch1-1.
2022-03-03os/linux/io_uring: add recvmsg and sendmsg (#10212)Hiroaki Nakamura
* os/linux/io_uring: add recvmsg and sendmsg * Use std.os.iovec and std.os.iovec_const * Remove msg_ prefix in msghdr and msghdr_const in arm64 etc * Strip msg_ prefix in msghdr and msghdr_const for linux arm-eabi * Copy msghdr and msghdr_const from i386 to mips * Add sockaddr to lib/std/os/linux/mips.zig * Copy msghdr and msghdr_const from x86_64 to riscv64
2022-01-04io_uring: improve IO_Uring.copy_cqeVincent Rischmann
copy_cqes() is not guaranteed to return as many CQEs as provided in the `wait_nr` argument, meaning the assert in `copy_cqe` can trigger. Instead, loop until we do get at least one CQE returned. This mimics the behaviour of liburing's _io_uring_get_cqe.
2022-01-01io_uring: fix version check in testsVincent Rischmann
For renameat, unlinkat, mkdirat, symlinkat and linkat the error code differs between kernel 5.4 which returns EBADF and kernel 5.10 which returns EINVAL. Fixes #10466
2021-12-19stage1, stage2: rename c_void to anyopaque (#10316)Isaac Freund
zig fmt now replaces c_void with anyopaque to make updating code easy.
2021-12-12os/linux/io_uring: implement linkatVincent Rischmann
2021-12-12os/linux/io_uring: implement symlinkatVincent Rischmann
2021-12-12os/linux/io_uring: implement mkdiratVincent Rischmann
2021-12-12os/linux/io_uring: implement unlinkatVincent Rischmann
2021-12-12os/linux/io_uring: implement renameatVincent Rischmann
2021-12-12os/linux/io_uring: implement shutdownVincent Rischmann
2021-12-01Fix test for io_uring link_timeoutHiroaki Nakamura
The old test "timeout_link_chain1" was ported from liburing test_timeout_link_chain1 https://github.com/axboe/liburing/blob/509873c4454012c5810c728695c21911c82acdc4/test/link-timeout.c#L539-L628 However it turns out that both fails with EBADF (-9) on Linux kernel 5.4. The this new test skips properly on Linux kernel 5.4 and passes on Linux kernel 5.11.
2021-11-29std: add workaround for failing io_uring testAndrew Kelley
See #10247
2021-11-23Merge pull request #10151 from hnakamur/zigHiroaki Nakamura
io_uring: adds link_timeout
2021-11-16io_uring: implement register_files_updateVincent Rischmann
2021-11-14Merge pull request #10081 from hnakamur/lib_std_os_linux_io_uring_cancelAndrew Kelley
std.os.linux: Add cancel and io_uring_prep_cancel
2021-11-14io_uring: add poll_updateKenta Iwasaki
Add method from liburing to queue (but not submit) a SQE to update the user data of an existing poll operation.
2021-11-12Use io_uring_prep_rw in io_uring_prep_cancelHiroaki Nakamura
follow liburing's API as closely as possible. Signed-off-by: Hiroaki Nakamura <hnakamur@gmail.com>
2021-11-12std.os.linux: Add cancel and io_uring_prep_cancelHiroaki Nakamura
Signed-off-by: Hiroaki Nakamura <hnakamur@gmail.com>
2021-11-09io_uring: skip statx test failure on older kernelsAndrew Kelley
2021-11-09os/linux/io_uring: implement statxVincent Rischmann
2021-10-04migrate from `std.Target.current` to `@import("builtin").target`Andrew Kelley
closes #9388 closes #9321
2021-09-22io_uring: implement read_fixed/write_fixedVincent Rischmann
2021-09-01fix regression on linux with kernel_timespecAndrew Kelley
I incorrectly assumed that __kernel_timespec was used when not linking libc, however that is not the case. `std.os.timespec` is used both for libc and non-libc cases. `__kernel_timespec` is a special struct that is used only for io_uring.
2021-09-01std: fix regressions from this branchAndrew Kelley
Also move some usingnamespace test cases from compare_output to behavior.
2021-09-01std: reorganization that allows new usingnamespace semanticsAndrew Kelley
The proposal #9629 is now accepted, usingnamespace stays but no longer puts identifiers in scope.
2021-09-01std.os: more reorganization effortsAndrew Kelley
* std lib tests are passing on x86_64-linux with and without -lc * stage2 is building from source on x86_64-linux * down to 38 remaining uses of `usingnamespace`
2021-08-24remove redundant license headers from zig standard libraryAndrew Kelley
We already have a LICENSE file that covers the Zig Standard Library. We no longer need to remind everyone that the license is MIT in every single file. Previously this was introduced to clarify the situation for a fork of Zig that made Zig's LICENSE file harder to find, and replaced it with their own license that required annual payments to their company. However that fork now appears to be dead. So there is no need to reinforce the copyright notice in every single file.
2021-08-24std: [breaking] move errno to become an nonexhaustive enumAndrew Kelley
The primary purpose of this change is to eliminate one usage of `usingnamespace` in the standard library - specifically the usage for errno values in `std.os.linux`. This is accomplished by truncating the `E` prefix from error values, and making errno a proper enum. A similar strategy can be used to eliminate some other `usingnamespace` sites in the std lib.
2021-08-13Expose register_eventfd, register_eventfd_async, unregister_eventfd i… (#9449)Ayende Rahien
* Expose register_eventfd, register_eventfd_async, unregister_eventfd in the IO URing API * Fixing formatting * Fixing typo * Removing unnecessary casts and adding better comments for a single registration of eventfd * Update lib/std/os/linux/io_uring.zig Co-authored-by: Joran Dirk Greef <joran@coil.com> * Update lib/std/os/linux/io_uring.zig Co-authored-by: Joran Dirk Greef <joran@coil.com> * Updating util function name Co-authored-by: Joran Dirk Greef <joran@coil.com>
2021-07-11io_uring: add sqe prep methods for epoll_ctl, poll_add, and poll_removeKenta Iwasaki
Implement io_uring submission queue entry preparation methods for epoll_ctl, poll_add and poll_remove. Poll masks are designated as 32-bit little-endian integers as specified in liburing's definitions. Updated io_uring_prep_rw to take in an unsigned 64-bit address instead of an anytype. io_uring_sqe by default assumes that the address specified in a submission queue entry is an unsigned 64-bit integer.
2021-06-21fix code broken from previous commitJacob G-W
2021-06-21std, src, doc, test: remove unused variablesJacob G-W
2021-05-08std: update usage of std.testingVeikka Tuominen
2021-04-07test: fix std.time timing tests to skip on failureMichael Dusan
2021-04-02test: fix io_uring timing test to skip on failureMichael Dusan
2021-03-14std: Replace testing fns for floating-point valuesLemonBoy
Beside handling NaNs and other non-numeric values better we finally offer the same pair of testing predicates in math and testing.
2021-03-12std/linux: sync io_uring library with liburingIsaac Freund
liburing commit: https://github.com/axboe/liburing/commit/1bafb3ce5f5eeb11cd982c7540f6aa74e3f381d4 As stated in the liburing commit message, this fixes a regression, reverting code that was added specutively to avoid a syscall in some cases.
2021-03-02os/linux: fix IO_Uring.timeoutVincent Rischmann
According to the io_uring PDF (https://kernel.dk/io_uring.pdf) the timeout struct must be 64 bits on both 32 and 64 bit architectures.