From 4af5c9594a5e69a09d452d037d1c89ade5691475 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 30 Sep 2026 13:14:53 -0300 Subject: fs: a request past the parking cap is refused "too many reads waiting: N", not EAGAIN's C string The engine refused a read or write it had no slot to park with "Resource temporarily unavailable", which reads as the C library's EAGAIN and says nothing about why. The refusal now says so in words and names the cap (opts.slot_capacity), so a client can tell it has too many reads held on one connection. Refusals of what cannot park at all (a walk, a write too long to copy) keep e_again. Co-Authored-By: Claude Opus 5.5 --- src/fs.zig | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/fs.zig b/src/fs.zig index 82e8b40..f2f8e9c 100644 --- a/src/fs.zig +++ b/src/fs.zig @@ -338,6 +338,10 @@ pub fn Server(comptime Backend: type, comptime opts: Options) type { return struct { const Self = @This(); + /// A request past the parking cap (`slot_capacity`) says so in + /// words, and names the cap, rather than a C library's EAGAIN. + pub const e_waiting = std.fmt.comptimePrint("too many reads waiting: {d}", .{opts.slot_capacity}); + protocol: Protocol, root: u64, @@ -1455,7 +1459,7 @@ pub fn Server(comptime Backend: type, comptime opts: Options) type { return; } const i = s.freeSlot() orelse { - s.fail(j.tag, e_again); + s.fail(j.tag, e_waiting); s.finishJob(); return; }; @@ -2264,7 +2268,8 @@ test "fs server: a blocked read parks, and the connection keeps working" { } try h.send(200, .{ .tread = .{ .fid = 1, .offset = 0, .count = 4096 } }); got = try h.reap(); - try testing.expectEqualStrings(e_again, got.msg.rerror.ename); + try testing.expectEqualStrings(Srv.e_waiting, got.msg.rerror.ename); + try testing.expect(std.mem.startsWith(u8, Srv.e_waiting, "too many reads waiting: ")); } test "fs server: a parked open, truncate and clunk complete on retry, and a walk cannot park" { -- cgit v1.3