71 Commits

Author SHA1 Message Date
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
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
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
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
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
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
Andrew Kelley
2315331d23
Merge pull request #5527 from shawnanastasio/ppc64le
Implement support for powerpc64{,le}
2020-09-10 15:56:27 -04:00
Andrew Kelley
f6f0e09456
Merge pull request #6267 from mattnite/btf
BPF: add BTF
2020-09-08 12:59:31 -04:00
Matt Knight
a496f94be9 added map create, update, delete, and prog load 2020-09-07 15:42:41 -04:00
Matthew Knight
db7a238297
BPF: add some more documentation (#6268)
* added documentation for ringbuffers, which context type maps to which program type, and added some formatting
2020-09-07 15:41:29 -04:00
Matt Knight
b878a64a5f
added license comments 2020-09-07 12:26:41 -07:00
Matt Knight
cf3194804e
changed enums to lower case 2020-09-07 07:17:21 -07:00
Matt Knight
e7547eeefa
fixed missing 'packed' keyword 2020-09-06 22:31:35 -07:00
Matt Knight
caaa9ad2af
added btf 2020-09-06 21:44:16 -07:00
Matt Knight
67817b230f
fixed improper builtin import 2020-09-06 17:09:25 -07:00
Matt Knight
cf06817768
improved compile error message 2020-09-06 16:21:05 -07:00
Matt Knight
a993c7dd1b
removed redundant pseudo insn 2020-09-06 16:19:49 -07:00
Matt Knight
295f09eadc
implemented and testing op codes for instructions documented in the unofficial bpf insn reference 2020-09-06 16:12:27 -07:00
Matthew Knight
0fa3cfdb4a
Bpf: move under os/linux instead of bits (#6126)
* moved bpf syscall, added some bpf instructions and tests

* had to move bpf out of bits so that a freestanding target could import it

* removed line

* fixed imports
2020-08-22 15:08:01 -04:00
Andrew Kelley
4a69b11e74 add license header to all std lib files
add SPDX license identifier
copyright ownership is zig contributors
2020-08-20 16:07:04 -04:00
Shawn Anastasio
ec0d775524 Implement std.os for powerpc64{,le} 2020-07-01 16:10:49 -05:00
Tadeo Kondrak
6745a6f6f6
zig fmt 2020-05-05 09:38:02 -06:00
Timon Kruiper
c829f2f7b7 Add mips support to standard library 2020-04-24 15:28:55 -04:00
daurnimator
63409cf422 std: linux syscall numbers are now an extensible enum 2020-03-31 10:16:20 -04:00
Andrew Kelley
9e7ae06249
std lib API deprecations for the upcoming 0.6.0 release
See #3811
2020-03-30 14:23:22 -04:00
LemonBoy
d788b0cd8b std: Minor changes to TLS handling
* Always allocate an info block per-thread so that libc can store
  important stuff there.
* Respect ABI-mandated alignment in more places.
* Nicer code, use slices/pointers instead of raw addresses whenever
  possible.
2020-03-28 11:20:38 -04:00
Andrew Kelley
f7f563ea53
Revert "Merge pull request #4807 from LemonBoy/tls-touchups"
This reverts commit ee6fda2297bf75432b8d7115ec4c60c213535bbe, reversing
changes made to f313ab18aecea1ade0b6a90d671352a641ad351a.

This caused a test failure:

```
behavior.misc.test "behavior-arm-linux-none-Debug-bare-multi thread local variable"...test failure
/home/vsts/work/1/s/lib/std/testing.zig:191:14: 0x4608f in std.testing.expect (test)
    if (!ok) @panic("test failure");
             ^
/home/vsts/work/1/s/test/stage1/behavior/misc.zig:616:11: 0x53e93 in behavior.misc.test "behavior-arm-linux-none-Debug-bare-multi thread local variable" (test)
    expect(S.t == 1235);
          ^
```
2020-03-25 21:12:24 -04:00
LemonBoy
a34f67aa66 std: Minor changes to TLS handling
* Always allocate an info block per-thread so that libc can store
  important stuff there.
* Respect ABI-mandated alignment in more places.
* Nicer code, use slices/pointers instead of raw addresses whenever
  possible.
2020-03-25 12:08:50 +01:00
Alexandros Naskos
7559418305 Added comment justifying wrapping operations 2020-03-03 12:41:11 +02:00