summaryrefslogtreecommitdiff
path: root/src/host_io.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-29 22:56:07 -0300
committerGabriel Schneider <[email protected]>2026-10-29 23:37:00 -0300
commit370913ae34c69b7958911c6146612c77275f6ebf (patch)
tree61e4fd328e104afbb381d2fd161029d1be637aa7 /src/host_io.zig
parentddcfd860ef05c37f5536038d8828cc81c0c4125c (diff)
downloadpardes-370913ae34c69b7958911c6146612c77275f6ebf.tar.gz
pardes-370913ae34c69b7958911c6146612c77275f6ebf.zip
upgrade: a newer build at the path a session started from is said at a focus-in, once a build, the path read just after the first frame (off a startup's way); an upgraded process lets the binary it replaced go (held, its deleted file kept its blocks) and sweeps its old image's prompt files (kept for an exec that failed); test/daemon.py --upgrade asks through /ctl, checks the fds and prompt files level, and runs on FreeBSD (procstat, the daemon's registry, no kept old binary there)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/host_io.zig')
-rw-r--r--src/host_io.zig6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/host_io.zig b/src/host_io.zig
index 46ee9afc..c627d4ab 100644
--- a/src/host_io.zig
+++ b/src/host_io.zig
@@ -977,8 +977,10 @@ pub const Shell = struct {
while (std.c.readdir(dir)) |ent| {
const name = std.mem.sliceTo(@as([*:0]const u8, @ptrCast(&ent.name)), 0);
const pid = rcPid(name) orelse continue;
- if (pid == std.c.getpid()) continue;
- if (std.posix.errno(std.c.kill(pid, @fromBackingInt(@intCast(0)))) != .SRCH) continue;
+ // This pid's are this process's, but in an upgraded one: those
+ // were its old image's (upgrade.zig), and its own come after.
+ if (pid == std.c.getpid() and @import("upgrade.zig").resumed == null) continue;
+ if (pid != std.c.getpid() and std.posix.errno(std.c.kill(pid, @fromBackingInt(@intCast(0)))) != .SRCH) continue;
if (name.len >= 64 or n == dead.len) continue;
@memcpy(dead[n][0..name.len], name);
dead_len[n] = name.len;