summaryrefslogtreecommitdiff
path: root/9ns
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-27 20:46:28 -0300
committerGabriel Schneider <[email protected]>2026-09-27 20:55:19 -0300
commitcca47d63c3ba774cb4de6f76603ba6edc5b475fe (patch)
treea0e7c45ba191155be232240dbf53c9ae34f209ba /9ns
parent82d8152cd15ea3ddd238caec2072bc2a1327a578 (diff)
downloadcloud9-cca47d63c3ba774cb4de6f76603ba6edc5b475fe.tar.gz
cloud9-cca47d63c3ba774cb4de6f76603ba6edc5b475fe.zip
fs: a backend can keep a parked request by ticket and answer it later, and a clunk interrupts what is parked on its fid
A backend holding a read that has nothing yet had to find its park by walking the engine's slots and matching a tag. Now Conn.hold() answers .again and returns a Ticket (slot and that park's sequence number); Conn.waiting() says whether that very park still waits, and Conn.answerWith() answers it with what a producer makes, asking the producer only while it waits and under the same lock, the way lib9p lets a server keep a Req and respond() later, so a consuming answer is never spent on a flushed request. The sequence number counts on across the connections a runner slot serves (initIn keeps it), so a ticket of one never names a park of the next. A clunk or remove fails everything parked on its fid with EINTR first, so no slot outlives its fid to be retried with a released handle or answered to a fid of the same number walked anew; retry's check for a vanished fid is gone with it. 9ns maps acme's "shut down" to EIO. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to '9ns')
-rw-r--r--9ns/src/nine.zig4
1 files changed, 4 insertions, 0 deletions
diff --git a/9ns/src/nine.zig b/9ns/src/nine.zig
index 52a45ae..1079a1d 100644
--- a/9ns/src/nine.zig
+++ b/9ns/src/nine.zig
@@ -911,6 +911,9 @@ pub fn enameToErrno(ename: []const u8) linux.E {
// A server that answers a flushed request with an error (Pardes says
// "Interrupted system call") should look like a flush to the caller.
.{ .needle = "interrupt", .err = .INTR },
+ // acme's answer to a read whose window closed under it (Pardes says
+ // it too): the file is still named, it just has no more to give.
+ .{ .needle = "shut down", .err = .IO },
.{ .needle = "not exist", .err = .NOENT },
.{ .needle = "not found", .err = .NOENT },
.{ .needle = "no such", .err = .NOENT },
@@ -1035,6 +1038,7 @@ test {
test "ename → errno mapping" {
try testing.expectEqual(linux.E.INTR, enameToErrno("Interrupted system call"));
try testing.expectEqual(linux.E.INTR, enameToErrno("read interrupted"));
+ try testing.expectEqual(linux.E.IO, enameToErrno("window shut down"));
try testing.expectEqual(linux.E.NOENT, enameToErrno("file does not exist"));
try testing.expectEqual(linux.E.NOENT, enameToErrno("No Such File"));
try testing.expectEqual(linux.E.NOENT, enameToErrno("directory entry not found"));