authorgravatar for bblack@wikimedia.orgBrandon Black <bblack@wikimedia.org> 2025-09-09 16:39:13-05:00
committergravatar for bblack@wikimedia.orgBrandon Black <bblack@wikimedia.org> 2025-09-09 16:59:50-05:00
logc449a30213d1252a4dd65e5a7fde9bea9f2ab76f
tree5a05a8ef792d3ac290d369c37dc8276bdbcaaf49
parentc70521e7b1d09d70ecf7dac9638f02a3961249de

std.c: Add accept_filter_arg for some BSDs

This is the struct type used as set/getsockopt() option data with SO.ACCEPTFILTER, which is also only declared on this same limited set of BSD-ish targets. In theory this could be aliased over to std.posix as well, but I think for a corner case like this, it's not unreasonable for a user that is avoiding uneccessary std.c references to access it as "posix.system.accept_filter_arg" (which would still work fine if, in the future, FreeBSD escapes its libc dep and defines it in std.os.freebsd).

1 files changed, 11 insertions(+), 0 deletions(-)

lib/std/c.zig+11
......@@ -3991,6 +3991,17 @@ pub const W = switch (native_os) {
39913991 },
39923992 else => void,
39933993};
3994pub const accept_filter_arg = switch (native_os) {
3995 // https://github.com/freebsd/freebsd-src/blob/2024887abc7d1b931e00fbb0697658e98adf048d/sys/sys/socket.h#L205
3996 // https://github.com/DragonFlyBSD/DragonFlyBSD/blob/6098912863ed4c7b3f70d7483910ce2956cf4ed3/sys/sys/socket.h#L164
3997 // https://github.com/NetBSD/src/blob/cad5c68a8524927f65e22ad651de3905382be6e0/sys/sys/socket.h#L188
3998 // https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/bsd/sys/socket.h#L504
3999 .freebsd, .dragonfly, .netbsd, .macos, .driverkit, .ios, .tvos, .watchos, .visionos => extern struct {
4000 name: [16]u8,
4001 arg: [240]u8,
4002 },
4003 else => void,
4004};
39944005pub const clock_t = switch (native_os) {
39954006 .linux => linux.clock_t,
39964007 .emscripten => emscripten.clock_t,