From 7dc3891ed574d6e96548f592b09b0f8abc87ae2a Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Sun, 27 Sep 2026 20:20:27 -0300 Subject: Keep what each open holds in one table of open records Snapshots (and /log's cursor), runs, and the reader_handle constants for event and pty/data each reused the open handle and each validated handle and node on its own. Now p.fs.opens is one table of 64 records, each the node it was opened on and a tagged union of what it holds, like lib9p's per-fid aux and acme's Fid (editors/acme/dat.h:373-385): one lookup (openOf), one release, ENFILE when full. A held read lives in its open's record, so it goes with the release. Opens that hold nothing answer handle 0 and take no record. Co-Authored-By: Claude Opus 5.5 --- src/ninep/pane.zig | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/ninep/pane.zig') diff --git a/src/ninep/pane.zig b/src/ninep/pane.zig index b07ee038..c03cd776 100644 --- a/src/ninep/pane.zig +++ b/src/ninep/pane.zig @@ -32,6 +32,7 @@ pub const State = struct { /// `cat addr` answer what was written. addr: Range = .{}, limit: ?Range = null, + /// Opens of `event`, which hold the pane scripted. readers: u16 = 0, /// One of `readers` reads `event`; a second reading open is refused. event_reader: bool = false, @@ -39,9 +40,11 @@ pub const State = struct { nomark: bool = false, noscroll: bool = false, tag_snap: std.ArrayList(u8) = .empty, - pty_readers: u16 = 0, + /// An open reads pty/data, so output queues for it; a second is refused. + pty_reader: bool = false, pty_out: events.Queue = .{}, - /// The pty/run open waiting on this shell's current command. + /// The open record (tree.zig) of the pty/run waiting on this shell's + /// current command. run: ?u8 = null, /// The host started a shell it could not teach to mark its prompts. unmarked: bool = false, -- cgit v1.3