authorgravatar for mail@isaacfreund.comIsaac Freund <mail@isaacfreund.com> 2021-03-12 14:51:18+01:00
committergravatar for mail@isaacfreund.comIsaac Freund <mail@isaacfreund.com> 2021-03-12 22:22:06+01:00
logb83ef595a53377189d42bdb697af866f30838040
tree4f8bc655f46b52f71fb274fa7620f366785ee0d4
parentf950489ed98ce8b011ef2d288e67352ab490065c

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.

1 files changed, 4 insertions(+), 4 deletions(-)

lib/std/os/linux/io_uring.zig+4-4
...@@ -163,9 +163,9 @@ pub const IO_Uring = struct {...@@ -163,9 +163,9 @@ pub const IO_Uring = struct {
163 /// Returns the number of SQEs submitted.163 /// Returns the number of SQEs submitted.
164 /// Matches the implementation of io_uring_submit_and_wait() in liburing.164 /// Matches the implementation of io_uring_submit_and_wait() in liburing.
165 pub fn submit_and_wait(self: *IO_Uring, wait_nr: u32) !u32 {165 pub fn submit_and_wait(self: *IO_Uring, wait_nr: u32) !u32 {
166 var submitted = self.flush_sq();166 const submitted = self.flush_sq();
167 var flags: u32 = 0;167 var flags: u32 = 0;
168 if (self.sq_ring_needs_enter(submitted, &flags) or wait_nr > 0) {168 if (self.sq_ring_needs_enter(&flags) or wait_nr > 0) {
169 if (wait_nr > 0 or (self.flags & linux.IORING_SETUP_IOPOLL) != 0) {169 if (wait_nr > 0 or (self.flags & linux.IORING_SETUP_IOPOLL) != 0) {
170 flags |= linux.IORING_ENTER_GETEVENTS;170 flags |= linux.IORING_ENTER_GETEVENTS;
171 }171 }
...@@ -236,9 +236,9 @@ pub const IO_Uring = struct {...@@ -236,9 +236,9 @@ pub const IO_Uring = struct {
236 /// or if IORING_SQ_NEED_WAKEUP is set and the SQ thread must be explicitly awakened.236 /// or if IORING_SQ_NEED_WAKEUP is set and the SQ thread must be explicitly awakened.
237 /// For the latter case, we set the SQ thread wakeup flag.237 /// For the latter case, we set the SQ thread wakeup flag.
238 /// Matches the implementation of sq_ring_needs_enter() in liburing.238 /// Matches the implementation of sq_ring_needs_enter() in liburing.
239 pub fn sq_ring_needs_enter(self: *IO_Uring, submitted: u32, flags: *u32) bool {239 pub fn sq_ring_needs_enter(self: *IO_Uring, flags: *u32) bool {
240 assert(flags.* == 0);240 assert(flags.* == 0);
241 if ((self.flags & linux.IORING_SETUP_SQPOLL) == 0 and submitted > 0) return true;241 if ((self.flags & linux.IORING_SETUP_SQPOLL) == 0) return true;
242 if ((@atomicLoad(u32, self.sq.flags, .Unordered) & linux.IORING_SQ_NEED_WAKEUP) != 0) {242 if ((@atomicLoad(u32, self.sq.flags, .Unordered) & linux.IORING_SQ_NEED_WAKEUP) != 0) {
243 flags.* |= linux.IORING_ENTER_SQ_WAKEUP;243 flags.* |= linux.IORING_ENTER_SQ_WAKEUP;
244 return true;244 return true;