summaryrefslogtreecommitdiff
path: root/src/macos.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/macos.zig')
-rw-r--r--src/macos.zig17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/macos.zig b/src/macos.zig
index 50fa04fa..5d3dfec4 100644
--- a/src/macos.zig
+++ b/src/macos.zig
@@ -44,7 +44,11 @@ fn hostWatchFile(pane: u8, generation: u32, path: ?[*]const u8, path_len: usize)
const TIOCSWINSZ: c_int = @bitCast(@as(u32, if (@hasDecl(posix.T, "IOCSWINSZ")) posix.T.IOCSWINSZ else 0x80087467));
-pub const std_options: std.Options = .{ .logFn = logFn };
+// Every thread's alternate signal stack is a threadlocal that libc zeroes as
+// the thread starts, so std's 256 KiB made each 9P connection's thread cost
+// that much resident. A stack-overflow segfault on a thread still printed its
+// whole symbolized trace from 32 KiB up (16 KiB double-faulted): 64 KiB.
+pub const std_options: std.Options = .{ .logFn = logFn, .signal_stack_size = 64 * 1024 };
fn logFn(
comptime level: std.log.Level,
@@ -2419,7 +2423,7 @@ fn pipeWorker(st: *State, job: *selection_pipe.Job) anyerror!void {
}
fn lspWorker(st: *State, job: *host_io.Lsp.Job) anyerror!void {
- host_io.Lsp.work(st.gpa, job, st, deliverLspRows);
+ host_io.Lsp.work(st.io, st.gpa, job, st, deliverLspRows);
}
fn deliverLspRows(ctx: ?*anyopaque, id: u32, rows: ?[]u8) void {
@@ -2582,12 +2586,11 @@ fn reap(st: *State, pane: u8) void {
}
fn readPty(st: *State, io: std.Io, pty: std.Io.File, id: u8, gen: u32) anyerror!void {
- var read_buf: [0x10000]u8 = undefined;
- var reader = pty.readerStreaming(io, &read_buf);
+ // One buffer, read into directly: a Reader around it only added a second
+ // (and in a safe build, filled both as `undefined` on every start).
+ var buf: [0x10000]u8 = undefined;
while (true) {
- var buf: [0x10000]u8 = undefined;
- var vec = [_][]u8{&buf};
- const n = reader.interface.readVec(&vec) catch break;
+ const n = pty.readStreaming(io, &.{&buf}) catch break;
if (n == 0) break;
const bytes = st.gpa.dupe(u8, buf[0..n]) catch break;
st.inbox.pushOutput(st.gpa, io, .{ .pane = id, .gen = gen, .bytes = bytes }) catch break;