summaryrefslogtreecommitdiff
path: root/core/fs.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-20 06:33:52 -0300
committerGabriel Schneider <[email protected]>2026-11-20 06:33:53 -0300
commitffe05cceb897b3ae6a6d36491f9318a8aa3426e7 (patch)
tree352414579559060b3e8486af34e29d49fd5df781 /core/fs.zig
parent5b7124d10f9b2db8d1c5e99eacb9b6d2fffff0cc (diff)
parenta403340ec5c90238b136ca85fc64d65809b29a65 (diff)
downloadpardes-ffe05cceb897b3ae6a6d36491f9318a8aa3426e7.tar.gz
pardes-ffe05cceb897b3ae6a6d36491f9318a8aa3426e7.zip
integration: the build's second pass on the handle and the devices once: pardes-build-pass2 (pardes-isolate and the tree-sitter=disabled tier deleted; one option, grammars = none | minimal | full; build.zig with the consumer's lines as its head comment; test/lib -> test/consumer; the manual's library section) and pardes-merge31, merged without a textual conflict; one line follows a deletion: dev/file_watch.zig's end-to-end test of a session's watches (written since on the base) guarded on fs.platform_has_fs, which the first of these changes deleted: the guard reads as the file's other tests' (comptime !supported); tui core-test 857/1008 (151 skipped), shell-test 1048/1051, the window builds; the coordinator's gate in the ledger (reorg/merge32)
Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/fs.zig')
-rw-r--r--core/fs.zig15
1 files changed, 3 insertions, 12 deletions
diff --git a/core/fs.zig b/core/fs.zig
index 0797beb0..6e5829e1 100644
--- a/core/fs.zig
+++ b/core/fs.zig
@@ -163,7 +163,6 @@ fn osNode(p: *pardes.Pardes, path: []const u8) !u64 {
/// outlives the yield, and nothing is staged into the shared reply buffer
/// until the turn is back.
pub fn osHandle(p: *pardes.Pardes, req: Req) Reply {
- if (comptime !platform_has_fs) return Reply.fail(req.tag, E.NOENT);
const path = osPath(p, req.node) orelse return Reply.fail(req.tag, E.NOENT);
if (req.op == .release) return .{ .tag = req.tag };
const stat = p.tape.site(.os_stat, null, osStat, .{path}) catch return Reply.fail(req.tag, E.NOENT);
@@ -307,7 +306,6 @@ pub fn statPath(io: std.Io, path: []const u8, options: std.Io.Dir.StatFileOption
/// does: one already there is no failure. A failure shows at the open
/// that follows.
pub fn makeDirs(tape: *pardes.tape.Tape, dir: []const u8) void {
- if (comptime !platform_has_fs) return;
if (dir.len == 0) return;
tape.site(.make_dirs, null, makeDirsHost, .{dir});
}
@@ -320,7 +318,6 @@ fn makeDirsHost(io: std.Io, dir: []const u8) void {
/// nearest ancestor that is there may not be searched or written (EACCES:
/// `noperm/a/b`, `/proc/1/root/x`).
pub fn deniedAbove(dir: []const u8) bool {
- if (comptime !platform_has_fs) return false;
var at: ?[]const u8 = dir;
while (at) |d| : (at = std.Io.Dir.path.dirname(d)) {
var z: [4096]u8 = undefined;
@@ -443,7 +440,6 @@ fn userHome(name: []const u8) ?[]const u8 {
}
pub fn resolveOs(tape: *pardes.tape.Tape, path: []const u8, out: *[4096]u8) ?Resolved {
- if (comptime !platform_has_fs) return null;
var z: [4096]u8 = undefined;
const path_z = std.fmt.bufPrintSentinel(&z, "{s}", .{path}, 0) catch return null;
return tape.site(.resolve, null, resolveHost, .{ path_z, out });
@@ -676,8 +672,6 @@ fn findEmbeddedSource(path: []const u8, allow_root_suffix: bool) ?Source {
return null;
}
-pub const platform_has_fs = !pardes.isolated;
-
fn isDir(path: [*:0]const u8) bool {
const fd = libc.open(path, .{ .ACCMODE = .RDONLY, .DIRECTORY = true, .CLOEXEC = true });
if (fd < 0) return false;
@@ -719,8 +713,8 @@ pub fn restorePath(tape: *pardes.tape.Tape, typed: []const u8, dir_setting: []co
fn readFileLimit(tape: *pardes.tape.Tape, gpa: std.mem.Allocator, path: []const u8, limit: usize) ![]u8 {
if (std.mem.indexOfScalar(u8, path, 0) != null) return error.OpenFailed;
- if (!platform_has_fs or std.mem.startsWith(u8, path, "/virtual/")) {
- const archive_path = if (std.mem.startsWith(u8, path, "/virtual/")) path[9..] else path;
+ if (std.mem.startsWith(u8, path, "/virtual/")) {
+ const archive_path = path[9..];
var normalized_buf: [4096]u8 = undefined;
const normalized = normalizeVirtualPath(archive_path, &normalized_buf) orelse return error.OpenFailed;
const source = findEmbeddedSource(normalized, true) orelse return error.OpenFailed;
@@ -1215,7 +1209,6 @@ test "self files share the regular file limit without preallocating it" {
}
test "bounded reads accept exact OS file lengths and empty files" {
- if (!platform_has_fs) return error.SkipZigTest;
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{ .tty_only = true });
defer p.deinit();
@@ -1327,7 +1320,7 @@ test "bounded reads release terminal snapshots after success and size refusal" {
}
test "bounded reads probe size-unknown proc files at the exact limit" {
- if (!platform_has_fs or @import("builtin").os.tag != .linux) return error.SkipZigTest;
+ if (@import("builtin").os.tag != .linux) return error.SkipZigTest;
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{ .tty_only = true });
defer p.deinit();
@@ -1379,7 +1372,6 @@ test "self file reads release partial allocations when memory runs out" {
}
test "oversized OS files fail before allocating their contents" {
- if (!platform_has_fs) return error.SkipZigTest;
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
const file = try tmp.dir.createFile(std.testing.io, "oversized", .{});
@@ -1481,7 +1473,6 @@ test "a leading ~ is home, from HOME or else the passwd entry" {
}
test "Restore prefers default directory then falls back to original path" {
- if (!platform_has_fs) return error.SkipZigTest;
const gpa = std.testing.allocator;
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();