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 {...@@ -1229,7 +1229,8 @@ fn idle(ev: *Evented, thread: *Thread) void {
1229 batch_userdata[0] = next;1229 batch_userdata[0] = next;
1230 }1230 }
1231 break :ready_fiber switch (@as(u2, @truncate(next))) {1231 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
1233 0b10, 0b11 => null,1234 0b10, 0b11 => null,
1234 };1235 };
1235 },1236 },
...@@ -2406,6 +2407,10 @@ fn batchDrainSubmitted(...@@ -2406,6 +2407,10 @@ fn batchDrainSubmitted(
2406 return error.ConcurrencyUnavailable2407 return error.ConcurrencyUnavailable
2407 else2408 else
2408 .{ .device_io_control = try ev.deviceIoControl(try maybe_sync.enterSync(ev), o) },2409 .{ .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 },
2409 .net_receive => |o| {2414 .net_receive => |o| {
2410 _ = o;2415 _ = o;
2411 @panic("TODO implement batchDrainSubmitted for net_receive");2416 @panic("TODO implement batchDrainSubmitted for net_receive");
...@@ -2484,7 +2489,10 @@ fn batchDrainReady(batch: *Io.Batch) Io.Timeout.Error!void {...@@ -2484,7 +2489,10 @@ fn batchDrainReady(batch: *Io.Batch) Io.Timeout.Error!void {
2484 if (@as(?Io.Operation.Result, result: switch (pending.tag) {2489 if (@as(?Io.Operation.Result, result: switch (pending.tag) {
2485 .file_read_streaming => .{2490 .file_read_streaming => .{
2486 .file_read_streaming = switch (completion.errno()) {2491 .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)),
2488 .INTR => 0,2496 .INTR => 0,
2489 .CANCELED => break :result null,2497 .CANCELED => break :result null,
2490 .INVAL => |err| errnoBug(err),2498 .INVAL => |err| errnoBug(err),
...@@ -2522,6 +2530,7 @@ fn batchDrainReady(batch: *Io.Batch) Io.Timeout.Error!void {...@@ -2522,6 +2530,7 @@ fn batchDrainReady(batch: *Io.Batch) Io.Timeout.Error!void {
2522 },2530 },
2523 },2531 },
2524 .device_io_control => unreachable,2532 .device_io_control => unreachable,
2533 .net_accept => @panic("TODO"),
2525 .net_receive => @panic("TODO"),2534 .net_receive => @panic("TODO"),
2526 .net_send => @panic("TODO"),2535 .net_send => @panic("TODO"),
2527 .net_read => @panic("TODO"),2536 .net_read => @panic("TODO"),