authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-08-23 18:52:40-07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-08-23 18:52:40-07:00
log61cf2b1af033a83ec2137e21824a8afa01318388
treed113b166ecb7bcc920b42f64d01737887292901e
parent999b68bfbd1498c65560766c545edaef8f14d894
signature Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

add support for freebsd, netbsd, openbsd


8 files changed, 29 insertions(+), 1 deletions(-)

AnyWritable.zig+3
...@@ -4,6 +4,9 @@ const sys_linux = @import("sys-linux");...@@ -4,6 +4,9 @@ const sys_linux = @import("sys-linux");
44
5const sys = switch (builtin.target.os.tag) {5const sys = switch (builtin.target.os.tag) {
6 .linux => sys_linux,6 .linux => sys_linux,
7 .freebsd => @import("sys-freebsd"),
8 .netbsd => @import("sys-netbsd"),
9 .openbsd => @import("sys-openbsd"),
7 else => unreachable,10 else => unreachable,
8};11};
912
allocating_writer.zig+3
...@@ -5,6 +5,9 @@ const builtin = @import("builtin");...@@ -5,6 +5,9 @@ const builtin = @import("builtin");
5const sys = switch (builtin.target.os.tag) {5const sys = switch (builtin.target.os.tag) {
6 .linux => @import("sys-linux"),6 .linux => @import("sys-linux"),
7 .macos => @import("sys-darwin"),7 .macos => @import("sys-darwin"),
8 .freebsd => @import("sys-freebsd"),
9 .netbsd => @import("sys-netbsd"),
10 .openbsd => @import("sys-openbsd"),
8 else => unreachable,11 else => unreachable,
9};12};
1013
buffered_writer.zig+3
...@@ -6,6 +6,9 @@ const sys_linux = @import("sys-linux");...@@ -6,6 +6,9 @@ const sys_linux = @import("sys-linux");
66
7const sys = switch (builtin.target.os.tag) {7const sys = switch (builtin.target.os.tag) {
8 .linux => sys_linux,8 .linux => sys_linux,
9 .freebsd => @import("sys-freebsd"),
10 .netbsd => @import("sys-netbsd"),
11 .openbsd => @import("sys-openbsd"),
9 else => unreachable,12 else => unreachable,
10};13};
1114
fixed_buffer_stream.zig+3
...@@ -6,6 +6,9 @@ const sys_linux = @import("sys-linux");...@@ -6,6 +6,9 @@ const sys_linux = @import("sys-linux");
6const sys = switch (builtin.target.os.tag) {6const sys = switch (builtin.target.os.tag) {
7 .linux => sys_linux,7 .linux => sys_linux,
8 .macos => @import("sys-darwin"),8 .macos => @import("sys-darwin"),
9 .freebsd => @import("sys-freebsd"),
10 .netbsd => @import("sys-netbsd"),
11 .openbsd => @import("sys-openbsd"),
9 else => unreachable,12 else => unreachable,
10};13};
1114
hash_writer.zig+3
...@@ -7,6 +7,9 @@ const builtin = @import("builtin");...@@ -7,6 +7,9 @@ const builtin = @import("builtin");
7const sys = switch (builtin.target.os.tag) {7const sys = switch (builtin.target.os.tag) {
8 .linux => @import("sys-linux"),8 .linux => @import("sys-linux"),
9 .macos => @import("sys-darwin"),9 .macos => @import("sys-darwin"),
10 .freebsd => @import("sys-freebsd"),
11 .netbsd => @import("sys-netbsd"),
12 .openbsd => @import("sys-openbsd"),
10 else => unreachable,13 else => unreachable,
11};14};
1215
licenses.txt+3
...@@ -6,4 +6,7 @@ MIT:...@@ -6,4 +6,7 @@ MIT:
6= https://spdx.org/licenses/MIT6= https://spdx.org/licenses/MIT
7- git https://github.com/nektro/zig-extras7- git https://github.com/nektro/zig-extras
8- git https://github.com/nektro/zig-sys-darwin8- git https://github.com/nektro/zig-sys-darwin
9- git https://github.com/nektro/zig-sys-freebsd
9- git https://github.com/nektro/zig-sys-linux10- git https://github.com/nektro/zig-sys-linux
11- git https://github.com/nektro/zig-sys-netbsd
12- git https://github.com/nektro/zig-sys-openbsd
nio.zig+8-1
...@@ -8,6 +8,9 @@ pub const fmt = @import("./fmt.zig");...@@ -8,6 +8,9 @@ pub const fmt = @import("./fmt.zig");
8const sys = switch (builtin.target.os.tag) {8const sys = switch (builtin.target.os.tag) {
9 .linux => sys_linux,9 .linux => sys_linux,
10 .macos => @import("sys-darwin"),10 .macos => @import("sys-darwin"),
11 .freebsd => @import("sys-freebsd"),
12 .netbsd => @import("sys-netbsd"),
13 .openbsd => @import("sys-openbsd"),
11 else => unreachable,14 else => unreachable,
12};15};
1316
...@@ -454,7 +457,11 @@ pub const crypto_random: std.Random = .{...@@ -454,7 +457,11 @@ pub const crypto_random: std.Random = .{
454 .fillFn = getrandomFill,457 .fillFn = getrandomFill,
455};458};
456fn getrandomFill(_: *anyopaque, buffer: []u8) void {459fn getrandomFill(_: *anyopaque, buffer: []u8) void {
457 _ = sys.getrandom(buffer, 0) catch unreachable;460 if (builtin.target.abi.isMusl()) {
461 _ = sys.getrandom(buffer, 0) catch unreachable;
462 return;
463 }
464 sys.libc.arc4random_buf(buffer.ptr, buffer.len);
458}465}
459466
460pub fn randomBytes(comptime len: usize) [len]u8 {467pub fn randomBytes(comptime len: usize) [len]u8 {
zigmod.yml+3
...@@ -7,3 +7,6 @@ dependencies:...@@ -7,3 +7,6 @@ dependencies:
7 - src: git https://github.com/nektro/zig-sys-linux7 - src: git https://github.com/nektro/zig-sys-linux
8 - src: git https://github.com/nektro/zig-extras8 - src: git https://github.com/nektro/zig-extras
9 - src: git https://github.com/nektro/zig-sys-darwin9 - src: git https://github.com/nektro/zig-sys-darwin
10 - src: git https://github.com/nektro/zig-sys-freebsd
11 - src: git https://github.com/nektro/zig-sys-netbsd
12 - src: git https://github.com/nektro/zig-sys-openbsd