Vincent Rischmann
6630a5ede5
io_uring: improve IO_Uring.copy_cqe
...
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-04 02:13:41 -05:00
Vincent Rischmann
0662f1d522
io_uring: fix version check in tests
...
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
2022-01-01 15:37:50 -05:00
Isaac Freund
9f9f215305
stage1, stage2: rename c_void to anyopaque ( #10316 )
...
zig fmt now replaces c_void with anyopaque to make updating
code easy.
2021-12-19 00:24:45 -05:00
Vincent Rischmann
f9b8808d74
os/linux/io_uring: implement linkat
2021-12-12 18:49:17 +01:00
Vincent Rischmann
5dd53c1986
os/linux/io_uring: implement symlinkat
2021-12-12 18:43:31 +01:00
Vincent Rischmann
1fd0542bee
os/linux/io_uring: implement mkdirat
2021-12-12 18:33:17 +01:00
Vincent Rischmann
4e647dee9f
os/linux/io_uring: implement unlinkat
2021-12-12 18:32:08 +01:00
Vincent Rischmann
088c1fab4d
os/linux/io_uring: implement renameat
2021-12-12 18:12:15 +01:00
Vincent Rischmann
0229fb7c62
os/linux/io_uring: implement shutdown
2021-12-12 18:04:15 +01:00
Hiroaki Nakamura
0714832c21
Fix test for io_uring link_timeout
...
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-12-01 14:30:33 -08:00
Andrew Kelley
ec10e63f49
std: add workaround for failing io_uring test
...
See #10247
2021-11-29 18:04:28 -07:00
Hiroaki Nakamura
f5c0c0803f
Merge pull request #10151 from hnakamur/zig
...
io_uring: adds link_timeout
2021-11-23 12:32:25 -06:00
Vincent Rischmann
3d528161c8
io_uring: implement register_files_update
2021-11-16 19:54:19 -05:00
Andrew Kelley
46af3a320c
Merge pull request #10081 from hnakamur/lib_std_os_linux_io_uring_cancel
...
std.os.linux: Add cancel and io_uring_prep_cancel
2021-11-14 22:51:11 -05:00
Kenta Iwasaki
09c17acf02
io_uring: add poll_update
...
Add method from liburing to queue (but not submit) a SQE to update the
user data of an existing poll operation.
2021-11-14 13:56:41 -05:00
Hiroaki Nakamura
77d1d5839a
Use io_uring_prep_rw in io_uring_prep_cancel
...
follow liburing's API as closely as possible.
Signed-off-by: Hiroaki Nakamura <hnakamur@gmail.com >
2021-11-12 10:51:49 +09:00
Hiroaki Nakamura
2a54c2ff19
std.os.linux: Add cancel and io_uring_prep_cancel
...
Signed-off-by: Hiroaki Nakamura <hnakamur@gmail.com >
2021-11-12 10:51:49 +09:00
Andrew Kelley
65e518e8e8
io_uring: skip statx test failure on older kernels
2021-11-09 18:31:03 -07:00
Vincent Rischmann
082072bd4f
os/linux/io_uring: implement statx
2021-11-09 13:35:17 -05:00
Andrew Kelley
6115cf2240
migrate from std.Target.current to @import("builtin").target
...
closes #9388
closes #9321
2021-10-04 23:48:55 -07:00
Vincent Rischmann
01f20c7f48
io_uring: implement read_fixed/write_fixed
2021-09-22 00:47:45 -04:00
Andrew Kelley
2264fca03e
fix regression on linux with kernel_timespec
...
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-01 17:54:07 -07:00
Andrew Kelley
cca57042df
std: fix regressions from this branch
...
Also move some usingnamespace test cases from compare_output to
behavior.
2021-09-01 17:54:07 -07:00
Andrew Kelley
c05a20fc8c
std: reorganization that allows new usingnamespace semantics
...
The proposal #9629 is now accepted, usingnamespace stays but no longer
puts identifiers in scope.
2021-09-01 17:54:06 -07:00
Andrew Kelley
7f03cfe161
std.os: more reorganization efforts
...
* 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-09-01 17:54:06 -07:00
Andrew Kelley
d29871977f
remove redundant license headers from zig standard library
...
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-24 12:25:09 -07:00
Andrew Kelley
a98fa56ae9
std: [breaking] move errno to become an nonexhaustive enum
...
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-24 01:23:28 -04:00
Ayende Rahien
65208a7fa2
Expose register_eventfd, register_eventfd_async, unregister_eventfd i… ( #9449 )
...
* 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-08-13 22:41:18 -05:00
Kenta Iwasaki
aa2a31612f
io_uring: add sqe prep methods for epoll_ctl, poll_add, and poll_remove
...
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-07-11 09:15:54 +00:00
Jacob G-W
9fffffb07b
fix code broken from previous commit
2021-06-21 17:03:03 -07:00
Jacob G-W
641ecc260f
std, src, doc, test: remove unused variables
2021-06-21 17:03:03 -07:00
Veikka Tuominen
fd77f2cfed
std: update usage of std.testing
2021-05-08 15:15:30 +03:00
Michael Dusan
2871d32be7
test: fix std.time timing tests to skip on failure
2021-04-07 08:33:32 -04:00
Michael Dusan
cc435dab2f
test: fix io_uring timing test to skip on failure
2021-04-02 07:12:09 -04:00
LemonBoy
27d07c6c4d
std: Replace testing fns for floating-point values
...
Beside handling NaNs and other non-numeric values better we finally
offer the same pair of testing predicates in math and testing.
2021-03-14 17:23:47 -04:00
Isaac Freund
b83ef595a5
std/linux: sync io_uring library with liburing
...
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-12 22:22:06 +01:00
Vincent Rischmann
3dd8396a55
os/linux: fix IO_Uring.timeout
...
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.
2021-03-02 14:13:11 +02:00
Joran Dirk Greef
68a040aec7
linux: add fallocate() to io_uring
2021-01-25 10:34:20 -08:00
daurnimator
e4c4a0a5f6
Improve uring definitions
2021-01-03 19:52:20 -08:00
Frank Denis
6c2e0c2046
Year++
2020-12-31 15:45:24 -08:00
Veikka Tuominen
e79acc24d3
std: clenup, fixes, fmt
2020-12-24 00:23:29 +02:00
Andrew Kelley
5a5389128d
Merge pull request #7369 from jorangreef/io_uring_timeout
...
Add io_uring TIMEOUT and TIMEOUT_REMOVE operations:
2020-12-10 15:45:38 -05:00
Joran Dirk Greef
b5a9fd9f98
Skip timeout_remove test where not supported by the kernel
2020-12-10 11:34:20 +02:00
Joran Dirk Greef
dd3eac2eb1
Debug CI io_uring unsupported op
2020-12-10 08:36:33 +02:00
Joran Dirk Greef
349d32dc2c
Add io_uring TIMEOUT and TIMEOUT_REMOVE operations:
...
ring.timeout() to queue a IORING_OP_TIMEOUT operation
ring.timeout_remove() to queue a IORING_OP_TIMEOUT_REMOVE operation
io_uring_prep_timeout() to prep a IORING_OP_TIMEOUT sqe
io_uring_prep_timeout_remove() to prep a IORING_OP_TIMEOUT_REMOVE sqe
2020-12-09 19:06:28 +02:00
Vexu
7e30e83900
small fixes and zig fmt
2020-12-09 13:54:26 +02:00
Joran Dirk Greef
e9ba12f456
Test the range of user_data bits
2020-10-05 09:36:07 +02:00
Joran Dirk Greef
9be2941091
Split openat/close test into two separate tests
...
If an older kernel fails the `openat` test because of `AT_FDCWD`
then we don't want to skip the `close` test.
2020-10-04 17:48:05 +02:00
Joran Dirk Greef
958ff087f2
Use const wherever possible
2020-10-04 16:57:04 +02:00
Joran Dirk Greef
72bdfa5bdd
Skip openat test only for older kernels that do not fully support AT_FDCWD
2020-10-04 16:05:52 +02:00