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");
44
55const sys = switch (builtin.target.os.tag) {
66 .linux => sys_linux,
7 .freebsd => @import("sys-freebsd"),
8 .netbsd => @import("sys-netbsd"),
9 .openbsd => @import("sys-openbsd"),
710 else => unreachable,
811};
912
allocating_writer.zig+3
......@@ -5,6 +5,9 @@ const builtin = @import("builtin");
55const sys = switch (builtin.target.os.tag) {
66 .linux => @import("sys-linux"),
77 .macos => @import("sys-darwin"),
8 .freebsd => @import("sys-freebsd"),
9 .netbsd => @import("sys-netbsd"),
10 .openbsd => @import("sys-openbsd"),
811 else => unreachable,
912};
1013
buffered_writer.zig+3
......@@ -6,6 +6,9 @@ const sys_linux = @import("sys-linux");
66
77const sys = switch (builtin.target.os.tag) {
88 .linux => sys_linux,
9 .freebsd => @import("sys-freebsd"),
10 .netbsd => @import("sys-netbsd"),
11 .openbsd => @import("sys-openbsd"),
912 else => unreachable,
1013};
1114
fixed_buffer_stream.zig+3
......@@ -6,6 +6,9 @@ const sys_linux = @import("sys-linux");
66const sys = switch (builtin.target.os.tag) {
77 .linux => sys_linux,
88 .macos => @import("sys-darwin"),
9 .freebsd => @import("sys-freebsd"),
10 .netbsd => @import("sys-netbsd"),
11 .openbsd => @import("sys-openbsd"),
912 else => unreachable,
1013};
1114
hash_writer.zig+3
......@@ -7,6 +7,9 @@ const builtin = @import("builtin");
77const sys = switch (builtin.target.os.tag) {
88 .linux => @import("sys-linux"),
99 .macos => @import("sys-darwin"),
10 .freebsd => @import("sys-freebsd"),
11 .netbsd => @import("sys-netbsd"),
12 .openbsd => @import("sys-openbsd"),
1013 else => unreachable,
1114};
1215
licenses.txt+3
......@@ -6,4 +6,7 @@ MIT:
66= https://spdx.org/licenses/MIT
77- git https://github.com/nektro/zig-extras
88- git https://github.com/nektro/zig-sys-darwin
9- git https://github.com/nektro/zig-sys-freebsd
910- 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");
88const sys = switch (builtin.target.os.tag) {
99 .linux => sys_linux,
1010 .macos => @import("sys-darwin"),
11 .freebsd => @import("sys-freebsd"),
12 .netbsd => @import("sys-netbsd"),
13 .openbsd => @import("sys-openbsd"),
1114 else => unreachable,
1215};
1316
......@@ -454,7 +457,11 @@ pub const crypto_random: std.Random = .{
454457 .fillFn = getrandomFill,
455458};
456459fn 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);
458465}
459466
460467pub fn randomBytes(comptime len: usize) [len]u8 {
zigmod.yml+3
......@@ -7,3 +7,6 @@ dependencies:
77 - src: git https://github.com/nektro/zig-sys-linux
88 - src: git https://github.com/nektro/zig-extras
99 - 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