diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-05 09:40:43 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-05 09:54:56 -0300 |
| commit | acae35d08598b10a7f3bb8620d8e04eaa02833b2 (patch) | |
| tree | 4cbc0ae35d1886aae36df3fbc057cafa0416598b | |
| parent | e32f749c80468b9e2fc79eb068f7088527a9c504 (diff) | |
| download | pardes-acae35d08598b10a7f3bb8620d8e04eaa02833b2.tar.gz pardes-acae35d08598b10a7f3bb8620d8e04eaa02833b2.zip | |
after the processes merge: the QUIC remnants go (9p_io.quic_enabled and Options.ninep_quic, read by nothing once --9p-quic left main.zig); forkShell's fs argument goes from its signature and every caller (tui, gui, macos and the tests), as exportEnv takes this process's own socket; rollback's note on the frame statistics says what they are now
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
| -rw-r--r-- | src/9p_io.zig | 4 | ||||
| -rw-r--r-- | src/gui/gui.zig | 8 | ||||
| -rw-r--r-- | src/host_io.zig | 35 | ||||
| -rw-r--r-- | src/macos.zig | 4 | ||||
| -rw-r--r-- | src/pardes.zig | 1 | ||||
| -rw-r--r-- | src/rollback.zig | 2 | ||||
| -rw-r--r-- | src/tui/tui.zig | 2 |
7 files changed, 22 insertions, 34 deletions
diff --git a/src/9p_io.zig b/src/9p_io.zig index 8291a37f..6e9148b8 100644 --- a/src/9p_io.zig +++ b/src/9p_io.zig @@ -6,10 +6,6 @@ const cloud9 = @import("cloud9"); const transport = cloud9.transport; const pardes = @import("pardes.zig"); const limits = @import("memory.zig").limits; -// shortcut: main.zig's --9p-quic refusal reads this until the processes -// change takes the flag out; then it goes. -pub const quic_enabled = false; - const log = std.log.scoped(.ninep); const nowMs = transport.nowMs; diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 7d77ed2a..dc95a584 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -831,7 +831,7 @@ test "GUI PTY reader delivers a real shell tail before EOF and joins on close" { shell.queue = &queue; defer shell.shutdownPtys(); const rcs: host_io.Shell.PromptFiles = .{}; - const child = try host_io.forkShell(null, 0, &rcs, "/bin/sh", "", 24, 80, null); + const child = try host_io.forkShell(null, 0, &rcs, "/bin/sh", "", 24, 80); ptys[0] = .{ .fd = child.file.handle, .pid = child.pid, .serial = core.panes[0].?.serial }; ptys[0].?.reader = try queue.startReader(.{ .handle = ptys[0].?.fd, .flags = .{ .nonblocking = false } }, 0, 1); try std.testing.expect(host_io.writeFd(child.file.handle, "printf '\\120\\101\\122\\104\\105\\123\\055\\124\\101\\111\\114'; exit\n")); @@ -882,7 +882,7 @@ test "GUI PTY Restore joins a real reader waiting for queue space" { shell.queue = &queue; defer shell.shutdownPtys(); const rcs: host_io.Shell.PromptFiles = .{}; - const child = try host_io.forkShell(null, 0, &rcs, "/bin/sh", "", 24, 80, null); + const child = try host_io.forkShell(null, 0, &rcs, "/bin/sh", "", 24, 80); ptys[0] = .{ .fd = child.file.handle, .pid = child.pid, .serial = core.panes[0].?.serial }; ptys[0].?.reader = try queue.startReader(.{ .handle = ptys[0].?.fd, .flags = .{ .nonblocking = false } }, 0, 1); try std.testing.expect(host_io.writeFd(child.file.handle, "printf 'after-full'; exit\n")); @@ -924,7 +924,7 @@ test "GUI PTY deletion joins an idle reader and its shell is reaped by exit" { shell.queue = &queue; defer shell.shutdownPtys(); const rcs: host_io.Shell.PromptFiles = .{}; - const child = try host_io.forkShell(null, 0, &rcs, "/bin/sh", "", 24, 80, null); + const child = try host_io.forkShell(null, 0, &rcs, "/bin/sh", "", 24, 80); ptys[0] = .{ .fd = child.file.handle, .pid = child.pid, .serial = core.panes[0].?.serial }; ptys[0].?.reader = try queue.startReader(.{ .handle = ptys[0].?.fd, .flags = .{ .nonblocking = false } }, 0, 1); try core.removePane(0, null); @@ -4403,7 +4403,7 @@ fn spawnPane(ctx: ?*anyopaque, pane: u8, cwd: []const u8) void { // The new shell starts before a running one goes: one that cannot // start leaves the running one be (pty/ctl's exec). const running = s.ptys[pane] != null; - const child = host_io.forkShell(s.core, pane, s.prompt_rcs, s.core.shellBin(), cwd, s.core.screen_h, s.core.screen_w, s.fs) catch |err| { + const child = host_io.forkShell(s.core, pane, s.prompt_rcs, s.core.shellBin(), cwd, s.core.screen_h, s.core.screen_w) catch |err| { if (running) return s.core.restartFailed(pane, err); return s.core.shellFailed(pane, err); }; diff --git a/src/host_io.zig b/src/host_io.zig index 2b2e1fe3..ad7c77dd 100644 --- a/src/host_io.zig +++ b/src/host_io.zig @@ -2075,7 +2075,6 @@ pub fn forkShell( cwd: []const u8, rows: u16, cols: u16, - fs: ?*const ninep_io.Listener, ) !Child { const native_cwd = filesystem.localPath(cwd) orelse cwd; if (std.mem.indexOfScalar(u8, native_cwd, 0) != null) return error.InvalidPath; @@ -2116,12 +2115,6 @@ pub fn forkShell( command_buf[line.len] = 0; spawn.argv = Shell.commandArgv(spawn.path, command_buf[0..line.len :0].ptr); } - // The last argument is whether this session takes its children's Looks — - // every session does but a `--nested` one, and a fork with no core at all - // (the tests below) is nobody's parent. - // shortcut: `fs` is read by nothing now (exportEnv takes this process's - // own socket); its argument goes from the frontends' calls with them. - _ = fs; ninep_io.exportEnv( if (core) |c| (if (c.panes[pane]) |pn| pn.serial else 0) else 0, if (core) |c| !c.opts.nested else false, @@ -2201,9 +2194,9 @@ pub fn forkShell( test "shell spawn rejects invalid directories before creating a child" { const rcs: Shell.PromptFiles = .{}; - try std.testing.expectError(error.InvalidPath, forkShell(null, 0, &rcs, "/bin/sh", "/tmp\x00/ignored", 24, 80, null)); + try std.testing.expectError(error.InvalidPath, forkShell(null, 0, &rcs, "/bin/sh", "/tmp\x00/ignored", 24, 80)); const too_long = @as([4096]u8, @splat('x')); - try std.testing.expectError(error.NameTooLong, forkShell(null, 0, &rcs, "/bin/sh", &too_long, 24, 80, null)); + try std.testing.expectError(error.NameTooLong, forkShell(null, 0, &rcs, "/bin/sh", &too_long, 24, 80)); var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); @@ -2212,12 +2205,12 @@ test "shell spawn rejects invalid directories before creating a child" { const directory = directory_buf[0..try tmp.dir.realPath(std.testing.io, &directory_buf)]; var path_buf: [4096]u8 = undefined; const file = try std.fmt.bufPrint(&path_buf, "{s}/file", .{directory}); - try std.testing.expectError(error.NotDir, forkShell(null, 0, &rcs, "/bin/sh", file, 24, 80, null)); + try std.testing.expectError(error.NotDir, forkShell(null, 0, &rcs, "/bin/sh", file, 24, 80)); const explicit_file = try std.fmt.bufPrint(&path_buf, "/n/os{s}/file", .{directory}); - try std.testing.expectError(error.NotDir, forkShell(null, 0, &rcs, "/bin/sh", explicit_file, 24, 80, null)); + try std.testing.expectError(error.NotDir, forkShell(null, 0, &rcs, "/bin/sh", explicit_file, 24, 80)); const missing = try std.fmt.bufPrint(&path_buf, "{s}/missing/" ++ (std.mem.asBytes(&@as([50][6]u8, @splat("child/".*)))), .{directory}); try std.testing.expect(missing.len > 256); - try std.testing.expectError(error.FileNotFound, forkShell(null, 0, &rcs, "/bin/sh", missing, 24, 80, null)); + try std.testing.expectError(error.FileNotFound, forkShell(null, 0, &rcs, "/bin/sh", missing, 24, 80)); } test "a forked shell is told which terminal it is talking to" { @@ -2240,7 +2233,7 @@ test "a forked shell is told which terminal it is talking to" { _ = Shell.setenv("TERM", "dumb", 1); const rcs: Shell.PromptFiles = .{}; - const child = try forkShell(null, 0, &rcs, "/bin/sh", "", 24, 80, null); + const child = try forkShell(null, 0, &rcs, "/bin/sh", "", 24, 80); defer { _ = libc.kill(child.pid, libc.SIG.KILL); _ = libc.waitpid(child.pid, null, 0); @@ -2268,7 +2261,7 @@ test "shell spawn uses an explicit OS directory longer than 256 bytes" { var explicit_buf: [4096]u8 = undefined; const explicit = try std.fmt.bufPrint(&explicit_buf, "/n/os{s}", .{directory}); const rcs: Shell.PromptFiles = .{}; - const child = try forkShell(null, 0, &rcs, "/bin/sh", explicit, 24, 80, null); + const child = try forkShell(null, 0, &rcs, "/bin/sh", explicit, 24, 80); defer { _ = libc.kill(child.pid, libc.SIG.KILL); _ = libc.waitpid(child.pid, null, 0); @@ -2420,7 +2413,7 @@ test "a terminal is where its shell is: under a wrapper the foreground shell, ne // A wrapper exec'd over the shell (timeout standing in for 9ns) runs // another, two directories down, in the foreground. { - const child = try forkShell(null, 0, &rcs, "/bin/sh", start, 24, 80, null); + const child = try forkShell(null, 0, &rcs, "/bin/sh", start, 24, 80); defer { _ = libc.kill(child.pid, libc.SIG.KILL); _ = libc.waitpid(child.pid, null, 0); @@ -2439,7 +2432,7 @@ test "a terminal is where its shell is: under a wrapper the foreground shell, ne // A job of the shell's own, gone into a/b, leaves the pane where the // shell is. { - const child = try forkShell(null, 0, &rcs, "/bin/sh", start, 24, 80, null); + const child = try forkShell(null, 0, &rcs, "/bin/sh", start, 24, 80); defer { _ = libc.kill(child.pid, libc.SIG.KILL); _ = libc.waitpid(child.pid, null, 0); @@ -2464,7 +2457,7 @@ test "shell cwd rejects truncation and preserves an owned child path longer than const directory = path_buf[0..try tmp.dir.realPathFile(io, nested, &path_buf)]; try std.testing.expect(directory.len > 1024); const rcs: Shell.PromptFiles = .{}; - const child = try forkShell(null, 0, &rcs, "/bin/sh", directory, 24, 80, null); + const child = try forkShell(null, 0, &rcs, "/bin/sh", directory, 24, 80); defer { _ = libc.kill(child.pid, libc.SIG.KILL); _ = libc.waitpid(child.pid, null, 0); @@ -2491,7 +2484,7 @@ test "a shell whose directory was removed is not named `... (deleted)`" { var path_buf: [4096]u8 = undefined; const directory = path_buf[0..try tmp.dir.realPathFile(io, "gone", &path_buf)]; const rcs: Shell.PromptFiles = .{}; - const child = try forkShell(null, 0, &rcs, "/bin/sh", directory, 24, 80, null); + const child = try forkShell(null, 0, &rcs, "/bin/sh", directory, 24, 80); defer { _ = libc.kill(child.pid, libc.SIG.KILL); _ = libc.waitpid(child.pid, null, 0); @@ -3296,7 +3289,7 @@ test "a command pane's child is its shell running the one line, and its exit sta _ = try core.newCommand(id, "", "printf 'said '; exit 7"); while (core.nextEffect()) |_| {} const rcs: Shell.PromptFiles = .{}; - const child = try forkShell(core, id, &rcs, "/bin/sh", "", 24, 80, null); + const child = try forkShell(core, id, &rcs, "/bin/sh", "", 24, 80); defer _ = libc.close(child.file.handle); var got: [256]u8 = undefined; var n: usize = 0; @@ -3326,7 +3319,7 @@ test "a command's exit is its process's, told by its watcher, whether or not its const id = core.freeSlot().?; _ = try core.newCommand(id, "", c.line); while (core.nextEffect()) |_| {} - const child = try forkShell(core, id, &rcs, "/bin/sh", "", 24, 80, null); + const child = try forkShell(core, id, &rcs, "/bin/sh", "", 24, 80); defer _ = libc.close(child.file.handle); try std.testing.expect(watchExit(child.pid)); var got: ?libc.pid_t = null; @@ -3366,7 +3359,7 @@ test "a command's background job outlives it and its pty, and Kill stops its who const id = core.freeSlot().?; _ = try core.newCommand(id, dir, c.line); while (core.nextEffect()) |_| {} - const child = try forkShell(core, id, &rcs, "/bin/sh", dir, 24, 80, null); + const child = try forkShell(core, id, &rcs, "/bin/sh", dir, 24, 80); if (c.kill) { sleepMs(150); signalTty(child.pid, child.file.handle, .term, true); diff --git a/src/macos.zig b/src/macos.zig index af8410e0..147930c0 100644 --- a/src/macos.zig +++ b/src/macos.zig @@ -1316,7 +1316,7 @@ test "mac Restore cancels a PTY reader waiting for output capacity" { while (st.core.nextEffect()) |_| {} st.inbox.acceptReader(1, 1); for (0..Inbox.output_capacity) |_| _ = st.inbox.pushOutput(1, 1, try gpa.dupe(u8, "retained output")); - const child = try host_io.forkShell(null, 0, &st.prompt_rcs, "/bin/sh", "", 12, 40, null); + const child = try host_io.forkShell(null, 0, &st.prompt_rcs, "/bin/sh", "", 12, 40); st.gens[0] = 1; st.ptys[0] = .{ .file = child.file, .pid = child.pid, .gen = 1, .reader = .{ .any_future = null, .result = {} } }; defer { @@ -2151,7 +2151,7 @@ fn spawnShell(ctx: ?*anyopaque, pane: u8, cwd: []const u8) void { // The new shell starts before a running one goes: one that cannot // start leaves the running one be (pty/ctl's exec). const running = st.ptys[pane] != null; - const child = host_io.forkShell(core, pane, &st.prompt_rcs, core.shellBin(), cwd, core.screen_h, core.screen_w, st.ninep) catch |err| { + const child = host_io.forkShell(core, pane, &st.prompt_rcs, core.shellBin(), cwd, core.screen_h, core.screen_w) catch |err| { if (running) return core.restartFailed(pane, err); return core.shellFailed(pane, err); }; diff --git a/src/pardes.zig b/src/pardes.zig index f2d9bef6..1b09f8ee 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -3717,7 +3717,6 @@ pub const Options = struct { startup_config: ?[]const u8 = null, ninep_name: []const u8 = "", ninep_tcp: ?[]const u8 = null, - ninep_quic: ?[]const u8 = null, mounts: []const filesystem.Mount = &.{}, config_dir: ?[]const u8 = null, /// The store every window shares (Store.zig): the files opened lately, diff --git a/src/rollback.zig b/src/rollback.zig index 06260812..aebca40d 100644 --- a/src/rollback.zig +++ b/src/rollback.zig @@ -436,7 +436,7 @@ fn annotatedStruct(comptime T: type) bool { /// The queues every step drains (empty between steps, asserted when a copy /// is taken: what is in their slots is nothing), the frame statistics -/// (numbers, and a static name), and the rows a terminal was last read as +/// (numbers), and the rows a terminal was last read as /// (a grid's worth of text, emptied when a copy is taken and when it is /// put back: src/replica.zig), and a replica's predicted echo (src/echo.zig: /// the replica's, never its core's). And the store and Recent, a replica's diff --git a/src/tui/tui.zig b/src/tui/tui.zig index dd0baf0b..674a7812 100644 --- a/src/tui/tui.zig +++ b/src/tui/tui.zig @@ -2744,7 +2744,7 @@ const Shell = struct { // The new shell starts before a running one goes: one that cannot // start leaves the running one be (pty/ctl's exec). const running = s.ptys[pane] != null; - const child = host_io.forkShell(s.core, pane, s.prompt_rcs, s.core.shellBin(), cwd, s.core.screen_h, s.core.screen_w, s.fs) catch |err| { + const child = host_io.forkShell(s.core, pane, s.prompt_rcs, s.core.shellBin(), cwd, s.core.screen_h, s.core.screen_w) catch |err| { if (running) return s.core.restartFailed(pane, err); return s.core.shellFailed(pane, err); }; |
