summaryrefslogtreecommitdiff
path: root/src/ninep/sources.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-09 03:29:30 -0300
committerGabriel Schneider <[email protected]>2026-11-09 03:30:37 -0300
commit446292e15d56c9c248dae5d6fde1be3a83ade82e (patch)
tree859d8be8a92a18011034e614324fa1af5c99139e /src/ninep/sources.zig
parentaabbccba49772cf73c7e35ae470245e9fda9d6ff (diff)
downloadpardes-446292e15d56c9c248dae5d6fde1be3a83ade82e.tar.gz
pardes-446292e15d56c9c248dae5d6fde1be3a83ade82e.zip
idioms: the 9P tree's swallows decided: a directory read stages every entry or answers ENOMEM (stageDirent and sources.stage return error{OutOfMemory}, readdir's entries made by stageDir, an /os listing whose buffer fills ends there), a pane's tag read through tagOf fails by name (a read or an event write answers ENOMEM, a stat's length and ctl's line say 0), a pane that cannot close (removePane's nine swallowing callers) and a /pager text that cannot go in (fillClosedPagers) are said on their pane, and Queue.push says once why a lost record is not said
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/ninep/sources.zig')
-rw-r--r--src/ninep/sources.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ninep/sources.zig b/src/ninep/sources.zig
index 32edb1f6..2e96b539 100644
--- a/src/ninep/sources.zig
+++ b/src/ninep/sources.zig
@@ -38,7 +38,7 @@ fn info(n: u64) ?struct { path: []const u8, contents: []const u8, dir: bool } {
/// Stages the children of one archive directory; "" lists the top-level
/// directories the served root shows.
-pub fn stage(p: *Pardes, out: *std.ArrayList(u8), path: []const u8, skip: *u64) void {
+pub fn stage(p: *Pardes, out: *std.ArrayList(u8), path: []const u8, skip: *u64) error{OutOfMemory}!void {
var seen: [sources.len][]const u8 = undefined;
var count: usize = 0;
for (sources, 0..) |source, i| {
@@ -61,7 +61,7 @@ pub fn stage(p: *Pardes, out: *std.ArrayList(u8), path: []const u8, skip: *u64)
continue;
}
const child = archive_node | (@as(u64, i) << 12) | (start + len);
- tree.stageDirent(out, p.gpa, child, len < rest.len, name);
+ try tree.stageDirent(out, p.gpa, child, len < rest.len, name);
}
}
@@ -97,7 +97,7 @@ pub fn handle(p: *Pardes, req: Req) Reply {
if (!found.dir) return Reply.fail(req.tag, E.NOTDIR);
const out = p.fs.stage(p.gpa);
var skip = req.off;
- stage(p, out, found.path, &skip);
+ stage(p, out, found.path, &skip) catch return Reply.fail(req.tag, E.NOMEM);
return .{ .tag = req.tag, .payload = .{ .staged = @intCast(out.items.len) } };
},
.read => {