From 31706a1d1c13c26c69f67f107b72179019cbd255 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 6 Nov 2026 13:39:00 -0300 Subject: kinds #26, one static pardes: `zig build static -Dplatform=tui -Dtarget=x86_64-linux-musl` (musl's, as glibc links only dynamically; never the default, and -Dstatic gone) links the terminal binary statically with both addons compiled in, image.zig as a module and pdf.c with MuPDF, its export renamed by a -D, which Addon.zig registers at start as if loaded (/addons says builtin, Addon reload refuses one, no library is scanned), and execveat and close_range go by their syscalls, which musl has no wrappers for; macOS's way to image and PDF panes too, say a comment, building.typ, shared-libs.md and the changelog Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/daemon.zig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/daemon.zig') diff --git a/src/daemon.zig b/src/daemon.zig index bc9e9773..6c0a0adf 100644 --- a/src/daemon.zig +++ b/src/daemon.zig @@ -247,7 +247,9 @@ fn spawn(listener: c_int, lock: c_int) bool { const l = libc.fcntl(listener, libc.F.DUPFD, @as(c_int, 10)); const k = libc.fcntl(lock, libc.F.DUPFD, @as(c_int, 10)); if (l < 0 or k < 0 or libc.dup2(l, 3) < 0 or libc.dup2(k, 4) < 0) libc._exit(127); - if (close_range(5, std.math.maxInt(c_uint), 0) != 0) { + // Linux's by its syscall: musl (a static pardes) has no close_range. + const shut = if (comptime builtin.os.tag == .linux) std.os.linux.close_range(5, std.math.maxInt(i32), .{ .UNSHARE = false, .CLOEXEC = false }) == 0 else close_range(5, std.math.maxInt(c_uint), 0) == 0; + if (!shut) { var fd: c_int = 5; while (fd < 1024) : (fd += 1) _ = libc.close(fd); } -- cgit v1.3