Joran Dirk Greef
a853f00410
Add IORING_FEAT_FAST_POLL
2020-09-20 19:51:23 +02:00
Joran Dirk Greef
77903f8d4e
Test structs and offsets
2020-09-20 18:45:44 +02:00
Joran Dirk Greef
e51728a1b4
Make enter(), flush_sq(), sq_ring_needs_enter(), cq_ring_needs_flush() public
...
These will also be needed by any custom helpers
2020-09-20 15:54:31 +02:00
Joran Dirk Greef
40293a0643
Add safety checks
2020-09-20 15:41:22 +02:00
Joran Dirk Greef
f22eea82c4
Fix opcode support detection for read/write test
2020-09-20 15:33:48 +02:00
Joran Dirk Greef
b672dc7abf
Use os.fd_t instead of i32 and assert against c_int for syscall safety
2020-09-20 14:59:40 +02:00
Joran Dirk Greef
abebacda32
Handle all possible syscall errors and bring errors in line with os.zig
2020-09-20 14:21:44 +02:00
Joran Dirk Greef
4bc1b7a7ac
Fix io_uring_sqe to use the names of the first member of each union
...
Now we're really future-proof... no more `opflags` creeping in.
When anonymous unions land, we can start using `accept_flags` etc.
Until then, code using this struct won't break when the kernel adds features.
Refs: https://github.com/ziglang/zig/issues/6349
Refs: https://github.com/ziglang/zig/issues/985
2020-09-19 18:50:24 +02:00
Joran Dirk Greef
92407bfcd7
Upgrade check_errno() to an exhaustive switch (safer)
2020-09-19 18:29:50 +02:00
Joran Dirk Greef
ba18420b27
Zero the SQE slot and assign, instead of initializing with default values
2020-09-19 18:17:06 +02:00
Joran Dirk Greef
e7ae6f2fad
Remove default values from io_uring_sqe struct
2020-09-19 18:14:41 +02:00
Joran Dirk Greef
f4df2f091a
Allow the kernel to drive feature detection
2020-09-19 17:31:39 +02:00
Joran Dirk Greef
64ae9a6a87
Rename to error.SubmissionQueueFull
2020-09-19 16:54:44 +02:00
Joran Dirk Greef
c1f9d10b6a
Remove unused import aliases
2020-09-19 16:51:35 +02:00
Joran Dirk Greef
9fabae2a28
Return error.UnsupportedKernel for ENOSYS
2020-09-19 16:47:05 +02:00
Joran Dirk Greef
0d8c6a960f
Remove dangling @import from std
2020-09-19 16:45:52 +02:00
Joran Dirk Greef
cb591285d7
Use linux.IORING_SQ_CQ_OVERFLOW
2020-09-19 16:20:21 +02:00
Joran Dirk Greef
31533eb743
Move to std/os/linux
2020-09-19 16:18:04 +02:00
Joran Dirk Greef
873d1c80b3
Add splice_fd_in to io_uring_sqe and future-proof for anonymous unions
2020-09-19 16:15:17 +02:00
Joran Dirk Greef
09f2f4aeb3
Fix std @import
2020-09-19 15:14:47 +02:00
Joran Dirk Greef
b2a54b9581
Test IORING_REGISTER_FILES but avoid sparse fd sets
2020-09-19 15:07:10 +02:00
Joran Dirk Greef
5df0d284d0
Do not register /dev/zero as an fd when testing queue_readv()
2020-09-19 14:29:23 +02:00
Joran Dirk Greef
ee5931908e
@ptrCast fds.ptr to *const c_void for io_uring_register()
2020-09-19 13:25:59 +02:00
Joran Dirk Greef
8b030a6599
Use x.y for C-style x->y instead of x.*.y
2020-09-17 20:29:56 +02:00
Joran Dirk Greef
e33c466daf
Use std.builtin
2020-09-17 19:56:57 +02:00
Joran Dirk Greef
d966fe6319
Add IORING_SQ_CQ_OVERFLOW to std/os/bits/linux.zig
2020-09-17 19:53:34 +02:00
Joran Dirk Greef
21c81360ba
Remove comment
2020-09-17 19:44:53 +02:00
Joran Dirk Greef
ac1d9f716a
Use != 0 for bitwise flag conditions
2020-09-17 19:37:17 +02:00
Joran Dirk Greef
491a434b01
Check kernel support for single_mmap, accept, and read/write
2020-09-16 19:36:29 +02:00
Joran Dirk Greef
6f09796ff2
Add short license and copyright notice
2020-09-16 18:51:21 +02:00
Joran Dirk Greef
b340bbfc1d
std: add io_uring library
...
This brings io_uring helper methods to Zig for kernels >= 5.4.
We follow liburing's design decisions so that anyone who is comfortable with
liburing (https://unixism.net/loti/ref-liburing/index.html ) will feel at home.
Thanks to @daurnimator for the first draft.
Refs: https://github.com/ziglang/zig/pull/3083
Signed-off-by: Joran Dirk Greef <joran@coil.com>
2020-09-16 15:07:13 +02:00
Andrew Kelley
281fc10ec5
std.crypto siphash: fix assertion on the size of output buffer
...
the logic was backwards
2020-09-16 02:24:36 -07:00
Andrew Kelley
b3cc36857e
Merge pull request #6340 from Vexu/fix
...
Fixes
2020-09-15 14:28:16 -04:00
LemonBoy
c1c3212500
std: Fix typo in ELF section header iterator
...
The code accidentally used the phdr offset instead of the shdr one while
iterating over the section headers.
Fixes #6338
2020-09-15 18:14:06 +03:00
Vexu
a3624e94f8
translate-c: determine sizeof using std.meta.sizeof
2020-09-14 23:53:38 +03:00
Vexu
29fd0c6d61
fix meta.cast behavior; add exhaustive tests
2020-09-14 23:21:26 +03:00
Veikka Tuominen
d073836894
Merge pull request #6172 from tadeokondrak/@Type(.Union)
...
Implement @Type for Union
2020-09-14 16:43:49 +03:00
Andrew Kelley
c49435f76b
Merge pull request #6331 from mattnite/bpf-helper-defs
...
BPF: helper definitions
2020-09-14 04:00:00 -04:00
LemonBoy
61e9e82bdc
std: Make the CRC32 calculation slightly faster
...
Speed up a little the slicing-by-8 code path by replacing the
(load+shift+xor)*4 sequence with a single u32 load plus a xor.
Before:
```
iterative: 1018 MiB/s [000000006c3b110d]
small keys: 1075 MiB/s [0035bf3dcac00000]
```
After:
```
iterative: 1114 MiB/s [000000006c3b110d]
small keys: 1324 MiB/s [0035bf3dcac00000]
```
2020-09-13 16:32:21 -04:00
LemonBoy
5e50d145d9
std: Limit the read/write size on Darwin
...
It turns out that the kernel won't read or write more than 0x7fffffff
bytes in a single call, failing with EINVAL when trying to do so.
Adjust the limit and curse whoever is responsible for this.
Closes #6332
2020-09-13 16:31:21 -04:00
Matt Knight
88dacd3b70
changed to opaque
2020-09-13 09:53:20 -07:00
Matt Knight
1afbf4fb21
removed all those kern aliases
2020-09-13 09:43:49 -07:00
Matt Knight
cb5f76bb1c
got booleans wrong
2020-09-13 09:24:56 -07:00
Matt Knight
b043a31889
added helper definitions
2020-09-12 23:45:35 -07:00
LemonBoy
9fe4c89230
std: Add a gzip decoder
2020-09-11 20:02:41 -04:00
Andrew Kelley
1edf097871
Merge pull request #6323 from LemonBoy/fast-zlib
...
std: Make the DEFLATE decompression routine 3x faster
2020-09-11 17:25:18 -04:00
Andrew Kelley
1eaf0691f9
Merge pull request #6320 from ifreund/prctl
...
std: add prctl and securebits definitions for linux/C
2020-09-11 16:33:57 -04:00
Isaac Freund
1078810cef
std: add prctl definition when linking libc
2020-09-11 22:32:23 +02:00
Isaac Freund
b6f4601545
std: add securebits definitions for linux
2020-09-11 22:32:23 +02:00
Isaac Freund
744b73ab46
std: add prctl wrapper to std.os
2020-09-11 22:32:23 +02:00