summaryrefslogtreecommitdiff
path: root/dev/host_io.zig
diff options
context:
space:
mode:
Diffstat (limited to 'dev/host_io.zig')
-rw-r--r--dev/host_io.zig20
1 files changed, 10 insertions, 10 deletions
diff --git a/dev/host_io.zig b/dev/host_io.zig
index 377263a4..2ee7c47e 100644
--- a/dev/host_io.zig
+++ b/dev/host_io.zig
@@ -54,12 +54,12 @@ pub fn stopWorkers() void {
pub fn restoreCore(gpa: std.mem.Allocator, core: *pardes.Pardes, path: []const u8, peers: *replica.Peers, inotify_fd: c_int, watches: *file_watch.Table) ?*pardes.Pardes {
peers.dropAll(core);
const bytes = pardes.dump.restoreBytes(core, gpa, path) catch |err| {
- core.reportError(core.view().active, "Restore", err);
+ core.reportError(.at(core.view().active), "Restore", err);
return null;
};
defer gpa.free(bytes);
const nc = pardes.dump.restore(core, bytes, path) catch |err| {
- core.reportError(core.view().active, "Restore", err);
+ core.reportError(.at(core.view().active), "Restore", err);
return null;
};
file_watch.unwatchAll(inotify_fd, watches);
@@ -93,13 +93,13 @@ pub const Adoptions = struct {
pub fn adoptShell(a: *Adoptions, core: *pardes.Pardes, pid: libc.pid_t, fd: c_int) void {
if (pid == 0) {
var buf: pardes.Kind.Buf(96) = .{};
- return core.setMessage(core.view().active, if (a.taken == 0) "Adopt: no shell of a session that died is waiting" else buf.print("Adopt: {d} shell{s} taken in; what they showed is gone", .{ a.taken, if (a.taken == 1) "" else "s" }));
+ return core.setMessage(.at(core.view().active), if (a.taken == 0) "Adopt: no shell of a session that died is waiting" else buf.print("Adopt: {d} shell{s} taken in; what they showed is gone", .{ a.taken, if (a.taken == 1) "" else "s" }));
}
if (a.len < a.list.len) {
a.list[a.len] = .{ .pid = pid, .fd = fd, .pane = null };
a.len += 1;
if (core.adoptShell()) |id| {
- a.list[a.len - 1].pane = id;
+ a.list[a.len - 1].pane = id.index();
a.taken += 1;
return;
}
@@ -108,7 +108,7 @@ pub const Adoptions = struct {
// No room for it: its master goes, and the shell with this session.
_ = libc.close(fd);
var buf: pardes.Kind.Buf(96) = .{};
- core.setMessage(core.view().active, buf.print("Adopt: no room for shell {d}; it ends with this session", .{pid}));
+ core.setMessage(.at(core.view().active), buf.print("Adopt: no room for shell {d}; it ends with this session", .{pid}));
}
/// The adopted shell pane `pane`'s spawn takes, off the list.
@@ -549,7 +549,7 @@ pub fn forkShell(
// The daemon keeps a dup: this session killed outright never hangs the
// shell up (daemon.zig).
@import("runtime").daemon.pty(pid, master);
- if (core) |c| c.acknowledgeShell(pane, std.mem.span(spawn.path), one_line == null and spawn.argv[1] != null);
+ if (core) |c| c.acknowledgeShell(.at(pane), std.mem.span(spawn.path), one_line == null and spawn.argv[1] != null);
return .{ .file = .{ .handle = master, .flags = .{ .nonblocking = false } }, .pid = pid };
}
@@ -1481,7 +1481,7 @@ fn sleepMs(ms: i64) void {
/// change), and "saved" said on the pane.
pub fn writeFile(core: *pardes.Pardes, watches: *file_watch.Table, pane: u8, path: []const u8, bytes: []const u8) void {
filesystem.write(core, path, bytes) catch |err|
- return core.saveFailed(pane, path, err);
+ return core.saveFailed(.at(pane), path, err);
if (core.panes[pane]) |pn| if (pn.file) |f| if (std.mem.eql(u8, f.path, path)) {
if (watches[pane]) |*w| if (w.serial == pn.serial) switch (w.generation) {
.text => w.generation = .{ .text = std.hash.Wyhash.hash(0, bytes) },
@@ -1489,7 +1489,7 @@ pub fn writeFile(core: *pardes.Pardes, watches: *file_watch.Table, pane: u8, pat
};
};
var mbuf: [256]u8 = undefined;
- core.setMessage(pane, pardes.Messages.Message.stamp(&mbuf, "saved", path));
+ core.setMessage(.at(pane), pardes.Messages.Message.stamp(&mbuf, "saved", path));
// The init file, saved here (Config): its settings take effect now.
pardes.exec.reapplyInitFile(core, path, bytes);
// The plumbing file (Plumb): its rules in force now.
@@ -1527,12 +1527,12 @@ pub fn writeDump(core: *pardes.Pardes, bytes: []const u8) void {
pub fn dumpThemes(core: *pardes.Pardes, io: std.Io, gpa: std.mem.Allocator, pane: u8) void {
const config_dir = core.opts.config_dir orelse return;
const out_dir = pardes.config.User.dumpThemes(io, gpa, config_dir, pardes.themes) catch |err| {
- core.reportError(pane, "dump themes", err);
+ core.reportError(.at(pane), "dump themes", err);
return;
};
defer gpa.free(out_dir);
var mbuf: [256]u8 = undefined;
- core.setMessage(pane, pardes.Messages.Message.stamp(&mbuf, "dumped themes", out_dir));
+ core.setMessage(.at(pane), pardes.Messages.Message.stamp(&mbuf, "dumped themes", out_dir));
}
pub const PtyTests = struct {