summaryrefslogtreecommitdiff
path: root/core/ninep/tree.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-20 06:56:46 -0300
committerGabriel Schneider <[email protected]>2026-11-20 06:56:46 -0300
commit2c2800c93e5417297dd06d3e52d5d336d975560c (patch)
treea028181f6c0fa1115df2f4862622fefb954a62d5 /core/ninep/tree.zig
parentffe05cceb897b3ae6a6d36491f9318a8aa3426e7 (diff)
parent0165bc532446e61a74af604c493d6b354abf798a (diff)
downloadpardes-2c2800c93e5417297dd06d3e52d5d336d975560c.tar.gz
pardes-2c2800c93e5417297dd06d3e52d5d336d975560c.zip
integration: a client that joins during a 9P pty/run replays it as its session does, and a far client's Del question is instant, on the build's second pass: pardes-faults-3 (a 9P open's handle is the session's recorded answer; a run reads its terminal's prompt marks through the tape's prompt site; a rejoin that lands as the session ends says so; Del sets question_asked and the host's pump gives it its time: the step reads no clock, so the bytes soak's one stop off may_wait, now, is gone) and pardes-merge32, merged without a textual conflict; the coordinator's gate in the ledger (reorg/merge33)
Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/ninep/tree.zig')
-rw-r--r--core/ninep/tree.zig15
1 files changed, 12 insertions, 3 deletions
diff --git a/core/ninep/tree.zig b/core/ninep/tree.zig
index 46a4e3d2..1eaaa8cb 100644
--- a/core/ninep/tree.zig
+++ b/core/ninep/tree.zig
@@ -928,9 +928,11 @@ fn open(p: *Pardes, req: Req, target: Target) Reply {
};
},
};
- const i = for (p.fs.opens, 0..) |o, i| {
- if (o.node == 0) break i;
- } else return Reply.fail(req.tag, E.NFILE);
+ // The handle every later request of this open names: the session's 9P
+ // server's, told to a replica as the answer it was. A client joined
+ // since holds none of the opens made before it, and its first free
+ // record would be another than the session's.
+ const i = p.tape.authority(freeOpen, .{p}) orelse return Reply.fail(req.tag, E.NFILE);
const o = &p.fs.opens[i];
o.* = .{ .node = req.node, .what = what };
if (resultsFile(target)) {
@@ -969,6 +971,13 @@ fn open(p: *Pardes, req: Req, target: Target) Reply {
return .{ .tag = req.tag, .handle = @intCast(i + 1) };
}
+/// The first open record free.
+fn freeOpen(p: *Pardes) ?u64 {
+ return for (p.fs.opens, 0..) |o, i| {
+ if (o.node == 0) break i;
+ } else null;
+}
+
/// Tremove closes a pane. Nothing else in the tree can be removed, and this
/// is also where an ORCLOSE open lands, so every node is checked here.
fn remove(p: *Pardes, req: Req) Reply {