578 Commits

Author SHA1 Message Date
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
Joran Dirk Greef
9091fcbe9d Improve openat/accept test debugging 2020-10-04 15:11:09 +02:00
Joran Dirk Greef
6a53f4be4b Add openat(), close(), connect(), send(), recv(), as well as tests
Removes non-essential .hardlink_with_next_sqe() and .drain_previous_sqes().
2020-10-04 13:15:39 +02:00
Joran Dirk Greef
3d2de6cfba Use load relaxed semantics when reading the SQPOLL wakeup flag 2020-10-04 13:14:57 +02:00
Joran Dirk Greef
69a55fc560 Allow for advanced non-sequential SQE allocation schemes
Decouples SQE queueing and SQE prepping methods to allow for non-sequential
SQE allocation schemes as suggested by @daurnimator.

Adds essential SQE prepping methods from liburing to reduce boilerplate.

Removes non-essential .link_with_next_sqe() and .use_registered_fd().
2020-10-04 13:01:41 +02:00
Joran Dirk Greef
e32c7d06e5 Limit entries to u12, add errors for invalid entries, use mem.zeroInit 2020-10-04 12:49:48 +02:00
Joran Dirk Greef
61ec6cb6d3 Expose available kernel features 2020-10-04 12:48:08 +02:00
Joran Dirk Greef
c5b4fcaa1c Add IORING_FEAT_POLL_32BITS 2020-10-03 17:43:08 +02:00
Joran Dirk Greef
a9b107045f Use load acquire semantics when reading the SQPOLL wakeup flag
Ensures that the wakeup flag is read after the tail pointer has been
written. It's important to use memory load acquire semantics for the
flags read, otherwise the application and the kernel might not agree on
the consistency of the wakeup flag, leading to I/O starvation.

Refs: 6768ddcc56
Refs: https://github.com/axboe/liburing/issues/219
2020-10-03 14:34:42 +02:00
Joran Dirk Greef
95def89c23 Handle EBADFD (ring fd in bad state) in enter() 2020-10-03 14:34:01 +02:00
Andrew Kelley
fe117d9961
Merge pull request #6250 from ziglang/stage2-zig-cc
move `zig cc`, `zig translate-c`, `zig libc`, main(), and linking from stage1 to stage2
2020-09-30 04:28:19 -04:00
Ryan Liptak
254ee89def Windows: Handle ACCESS_DENIED in DeviceIoControl
This was causing the Dir.readLink test to fail for me locally with error.Unexpected NTSTATUS=0xc0000022. Not sure if PRIVILEGE_NOT_HELD is actually possible or not.
2020-09-29 20:54:45 -04:00
Andrew Kelley
af64fd2f42 Merge remote-tracking branch 'origin/master' into stage2-zig-cc
This merges in the revert that fixes the broken Windows build of master
branch.
2020-09-29 17:26:09 -07:00
Jakub Konka
bb636cb3bf Revert "Fix for Windows: std.os.windows.DeleteFile()" 2020-09-29 19:35:44 -04:00
Andrew Kelley
750b00c642 Merge remote-tracking branch 'origin/master' into stage2-zig-cc 2020-09-29 00:27:48 -07:00
Jakub Konka
e60939bfaa
Merge pull request #6397 from suirad/fix-5537
Fix for Windows: std.os.windows.DeleteFile()
2020-09-27 21:59:29 +02:00
Woze Parrrot
ed357f9897 uefi system_table 2020-09-27 03:15:18 -04:00
Suirad
43cd9eb110 Add clarification comment 2020-09-25 18:11:31 -05:00
Suirad
f78652484a Stdlib fix for os.windows.deleteFile to fail with
a proper error when attempting to delete a directory that isnt empty
2020-09-25 18:09:05 -05:00
Andrew Kelley
0c70bb4fce Merge remote-tracking branch 'origin/master' into stage2-zig-cc 2020-09-21 21:16:46 -07:00
Joran Dirk Greef
5f99d2c240 Define SPLICE, PROVIDE_BUFFERS, REMOVE_BUFFERS and TEE opcodes and flags 2020-09-21 20:15:14 +02:00
Joran Dirk Greef
2d8df2b745 Use @intCast instead of @truncate 2020-09-21 12:03:52 +02:00
Joran Dirk Greef
7719abbf54 Add flags to queue_fsync() signature as per liburing 2020-09-21 11:09:37 +02:00
Joran Dirk Greef
57603fd26d Use @intCast instead of @truncate on io_uring_enter() result 2020-09-21 11:09:09 +02:00
Joran Dirk Greef
575ed941d7 Cache mask instead of dereferencing mask pointer 2020-09-21 11:07:11 +02:00
Joran Dirk Greef
843c104fc9 Add io_uring syscalls to os.bits.linux.mips.SYS
As per lib/libc/musl/arch/mips/bits/syscall.h.in:

```c
```
2020-09-21 10:39:58 +02:00
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
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
Ryan Liptak
5e3fa0e94f Add rename to std.fs API
- Moves fs.rename functions to fs.renameAbsolute to match other functions outside of fs.Dir
- Adds fs.Dir.rename that takes two paths relative to the given Dir
- Adds fs.rename that takes two separate Dir's that the given paths are relative to (for renaming across directories without having to make the second path relative to a single directory)
- Fixes FileNotFound error return in std.os.windows.MoveFileExW
- Returns error.RenameAcrossMountPoints from renameatW
  + Matches the RenameAcrossMountPoints error return in renameatWasi/renameatZ
2020-09-17 17:22:26 -04:00
Joran Dirk Greef
d966fe6319 Add IORING_SQ_CQ_OVERFLOW to std/os/bits/linux.zig 2020-09-17 19:53:34 +02:00
Andrew Kelley
f82b1831f7 std: handle sharing violation when deleting a file on windows 2020-09-15 15:24:13 -07: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