Commit 85697d5

Chance Zibolski  ·  2026-08-01 09:44:16 -0400 EDT
parent 266a733
fix: build on macOS with zig 0.16.0 (#223)

* fix: cast log_mode to mode_t for File.Permissions.fromMode

cfg.log_mode is u32 while fromMode takes mode_t, which is u16 on macOS, so
these two call sites fail to compile there. cfg.zig already casts for the
equivalent Dir.Permissions calls.

* fix: use the platform signal type in the wake handler

The handler was declared with std.os.linux.SIG, so sigaction rejects it on
platforms where that is not the native type and the build fails on macOS.
posix.zig already re-exports SIG for this purpose.
3 files changed,  +3, -3
+1, -1
1@@ -725,7 +725,7 @@ pub const Daemon = struct {
2                 fba.allocator(),
3                 &.{ self.cfg.log_dir, session_log_name },
4             );
5-            const log_mode = std.Io.File.Permissions.fromMode(self.cfg.log_mode);
6+            const log_mode = std.Io.File.Permissions.fromMode(@intCast(self.cfg.log_mode));
7             log.log_system.init(new_io, session_log_path, log_mode) catch {};
8         }
9 
+1, -1
1@@ -42,7 +42,7 @@ pub fn main(init: std.process.Init) !void {
2 
3     const log_path = try std.fs.path.join(gpa, &.{ cfg.log_dir, "zmx.log" });
4     defer gpa.free(log_path);
5-    const log_mode = std.Io.File.Permissions.fromMode(cfg.log_mode);
6+    const log_mode = std.Io.File.Permissions.fromMode(@intCast(cfg.log_mode));
7     try log.log_system.init(io, log_path, log_mode);
8     defer log.log_system.deinit();
9 
+1, -1
1@@ -6,7 +6,7 @@ const lib_posix = @import("posix.zig");
2 /// never surfaces; the handler writes a byte here and poll() wakes on POLLIN.
3 pub var sig_pipe: [2]lib_posix.fd_t = .{ -1, -1 };
4 
5-pub fn wakeSignalPipe(_: std.os.linux.SIG, _: *const lib_posix.siginfo_t, _: ?*anyopaque) callconv(.c) void {
6+pub fn wakeSignalPipe(_: lib_posix.SIG, _: *const lib_posix.siginfo_t, _: ?*anyopaque) callconv(.c) void {
7     const saved = std.c._errno().*;
8     _ = std.c.write(sig_pipe[1], "x", 1);
9     std.c._errno().* = saved;