authorgravatar for david@vortan.devDavid Rubin <david@vortan.dev> 2026-10-09 15:09:09-05:00
committergravatar for david@vortan.devDavid Rubin <david@vortan.dev> 2026-10-09 17:55:43-05:00
log18b98cee0653ea539514dc14533a82c577511d7e
tree36c7a32d4b8554ce014a75ac0d72d7daaaf2d6c2
parent5f4173bb1f9fd8fd05875bb43473a14cb62a3e01
signature Commit is signed but in an unrecognized format.

Io.Uring: fix batch completion handling


1 files changed, 11 insertions(+), 2 deletions(-)

lib/std/Io/Uring.zig+11-2
......@@ -1229,7 +1229,8 @@ fn idle(ev: *Evented, thread: *Thread) void {
12291229 batch_userdata[0] = next;
12301230 }
12311231 break :ready_fiber switch (@as(u2, @truncate(next))) {
1232 0b00, 0b01 => @ptrFromInt(next & ~@as(usize, 0b11)),
1232 0b00 => @ptrFromInt(next),
1233 0b01 => null, // the timeout completion already woke this fiber
12331234 0b10, 0b11 => null,
12341235 };
12351236 },
......@@ -2406,6 +2407,10 @@ fn batchDrainSubmitted(
24062407 return error.ConcurrencyUnavailable
24072408 else
24082409 .{ .device_io_control = try ev.deviceIoControl(try maybe_sync.enterSync(ev), o) },
2410 .net_accept => |o| {
2411 _ = o;
2412 @panic("TODO implement batchDrainSubmitted for net_receive");
2413 },
24092414 .net_receive => |o| {
24102415 _ = o;
24112416 @panic("TODO implement batchDrainSubmitted for net_receive");
......@@ -2484,7 +2489,10 @@ fn batchDrainReady(batch: *Io.Batch) Io.Timeout.Error!void {
24842489 if (@as(?Io.Operation.Result, result: switch (pending.tag) {
24852490 .file_read_streaming => .{
24862491 .file_read_streaming = switch (completion.errno()) {
2487 .SUCCESS => @as(u32, @bitCast(completion.result)),
2492 .SUCCESS => if (completion.result == 0)
2493 error.EndOfStream
2494 else
2495 @as(u32, @bitCast(completion.result)),
24882496 .INTR => 0,
24892497 .CANCELED => break :result null,
24902498 .INVAL => |err| errnoBug(err),
......@@ -2522,6 +2530,7 @@ fn batchDrainReady(batch: *Io.Batch) Io.Timeout.Error!void {
25222530 },
25232531 },
25242532 .device_io_control => unreachable,
2533 .net_accept => @panic("TODO"),
25252534 .net_receive => @panic("TODO"),
25262535 .net_send => @panic("TODO"),
25272536 .net_read => @panic("TODO"),