From 16c17054e868d3f4a97feb4565ed618e2e5ebbd4 Mon Sep 17 00:00:00 2001 From: Paul Peregud Date: Mon, 9 Feb 2026 15:04:47 +0100 Subject: [PATCH 1/3] fix call to fallocate on linux --- src/files/file.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/files/file.zig b/src/files/file.zig index 1d04123..c4bef3d 100644 --- a/src/files/file.zig +++ b/src/files/file.zig @@ -1105,12 +1105,12 @@ pub const FileWriter = struct { // FALLOC_FL_KEEP_SIZE = 0x01 - allocate without changing file size const FALLOC_FL_KEEP_SIZE = 0x01; const fd = file.handle; - const result = std.os.linux.syscall(.fallocate, .{ + const result = std.os.linux.syscall4(.fallocate, @as(usize, @intCast(fd)), @as(usize, FALLOC_FL_KEEP_SIZE), @as(usize, 0), // offset @as(usize, @intCast(size)), - }); + ); if (result == 0) { std.log.debug("PERF: Pre-allocated {} MB with fallocate", .{size / (1024 * 1024)}); return; From 3ef7e322fadf6ce960647b9bbf5878dcad807b40 Mon Sep 17 00:00:00 2001 From: Paul Peregud Date: Mon, 9 Feb 2026 15:05:34 +0100 Subject: [PATCH 2/3] fix strange compiler error --- src/core/rate_limiter.zig | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/core/rate_limiter.zig b/src/core/rate_limiter.zig index e782057..8e9eed5 100644 --- a/src/core/rate_limiter.zig +++ b/src/core/rate_limiter.zig @@ -17,7 +17,7 @@ pub const RateLimiter = struct { /// Token refill rate (tokens per second) refill_rate: u64, /// Last refill timestamp (nanoseconds) - last_refill: std.atomic.Value(i128), + last_refill: std.atomic.Value(i64), /// Mutex for non-atomic operations mutex: std.Thread.Mutex = .{}, @@ -26,7 +26,7 @@ pub const RateLimiter = struct { .tokens = std.atomic.Value(u64).init(config.burst_size), .max_tokens = config.burst_size, .refill_rate = config.tokens_per_second, - .last_refill = std.atomic.Value(i128).init(time.nanoTimestamp()), + .last_refill = std.atomic.Value(i64).init(@intCast(time.nanoTimestamp())), }; } @@ -79,14 +79,15 @@ pub const RateLimiter = struct { /// Refill tokens based on elapsed time fn refill(self: *RateLimiter) void { - const now = time.nanoTimestamp(); + const now: i64 = @intCast(time.nanoTimestamp()); const last = self.last_refill.load(.acquire); const elapsed_ns = now - last; if (elapsed_ns <= 0) return; // Calculate tokens to add (using nanoseconds for precision) - const elapsed_seconds = @as(u64, @intCast(@divFloor(elapsed_ns, time.ns_per_s))); + const elapsed_ns_u64: u64 = @intCast(elapsed_ns); + const elapsed_seconds = elapsed_ns_u64 / time.ns_per_s; if (elapsed_seconds == 0) return; const new_tokens = elapsed_seconds * self.refill_rate; From 777af83c7f371d4003b1f2c3b0306c8c55f1199e Mon Sep 17 00:00:00 2001 From: Paul Peregud Date: Tue, 10 Feb 2026 13:13:36 +0100 Subject: [PATCH 3/3] fix libc linking issue on Linux --- build.zig | 1 + 1 file changed, 1 insertion(+) diff --git a/build.zig b/build.zig index 4d668bf..20f029b 100644 --- a/build.zig +++ b/build.zig @@ -47,6 +47,7 @@ pub fn build(b: *std.Build) void { .root_source_file = b.path("src/files.zig"), .target = target, .optimize = optimize, + .link_libc = true, }); files_module.addImport("core", core_module); files_module.addImport("protocol", protocol_module);