| ... | ... | @@ -4185,8 +4185,9 @@ pub const linger = switch (native_os) { |
| 4185 | 4185 | }, |
| 4186 | 4186 | else => void, |
| 4187 | 4187 | }; |
| 4188 | |
| 4188 | 4189 | pub const msghdr = switch (native_os) { |
| 4189 | | .linux => linux.msghdr, |
| 4190 | .linux => if (@bitSizeOf(usize) > @bitSizeOf(i32) and builtin.abi.isMusl()) posix_msghdr else linux.msghdr, |
| 4190 | 4191 | .openbsd, |
| 4191 | 4192 | .emscripten, |
| 4192 | 4193 | .dragonfly, |
| ... | ... | @@ -4201,36 +4202,24 @@ pub const msghdr = switch (native_os) { |
| 4201 | 4202 | .tvos, |
| 4202 | 4203 | .visionos, |
| 4203 | 4204 | .watchos, |
| 4204 | | => extern struct { |
| 4205 | | /// optional address |
| 4206 | | name: ?*sockaddr, |
| 4207 | | /// size of address |
| 4208 | | namelen: socklen_t, |
| 4209 | | /// scatter/gather array |
| 4210 | | iov: [*]iovec, |
| 4211 | | /// # elements in iov |
| 4212 | | iovlen: i32, |
| 4213 | | /// ancillary data |
| 4214 | | control: ?*anyopaque, |
| 4215 | | /// ancillary data buffer len |
| 4216 | | controllen: socklen_t, |
| 4217 | | /// flags on received message |
| 4218 | | flags: i32, |
| 4219 | | }, |
| 4220 | | // https://github.com/SerenityOS/serenity/blob/ac44ec5ebc707f9dd0c3d4759a1e17e91db5d74f/Kernel/API/POSIX/sys/socket.h#L74-L82 |
| 4221 | | .serenity => extern struct { |
| 4222 | | name: ?*anyopaque, |
| 4223 | | namelen: socklen_t, |
| 4224 | | iov: [*]iovec, |
| 4225 | | iovlen: c_int, |
| 4226 | | control: ?*anyopaque, |
| 4227 | | controllen: socklen_t, |
| 4228 | | flags: c_int, |
| 4229 | | }, |
| 4205 | .serenity, // https://github.com/SerenityOS/serenity/blob/ac44ec5ebc707f9dd0c3d4759a1e17e91db5d74f/Kernel/API/POSIX/sys/socket.h#L74-L82 |
| 4206 | => private.posix_msghdr, |
| 4230 | 4207 | else => void, |
| 4231 | 4208 | }; |
| 4209 | |
| 4210 | /// https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_socket.h.html |
| 4211 | const posix_msghdr = extern struct { |
| 4212 | name: ?*sockaddr, |
| 4213 | namelen: socklen_t, |
| 4214 | iov: [*]iovec, |
| 4215 | iovlen: u32, |
| 4216 | control: ?*anyopaque, |
| 4217 | controllen: socklen_t, |
| 4218 | flags: u32, |
| 4219 | }; |
| 4220 | |
| 4232 | 4221 | pub const msghdr_const = switch (native_os) { |
| 4233 | | .linux => linux.msghdr_const, |
| 4222 | .linux => if (@bitSizeOf(usize) > @bitSizeOf(i32) and builtin.abi.isMusl()) posix_msghdr_const else linux.msghdr_const, |
| 4234 | 4223 | .openbsd, |
| 4235 | 4224 | .emscripten, |
| 4236 | 4225 | .dragonfly, |
| ... | ... | @@ -4245,36 +4234,25 @@ pub const msghdr_const = switch (native_os) { |
| 4245 | 4234 | .tvos, |
| 4246 | 4235 | .visionos, |
| 4247 | 4236 | .watchos, |
| 4248 | | => extern struct { |
| 4249 | | /// optional address |
| 4250 | | name: ?*const sockaddr, |
| 4251 | | /// size of address |
| 4252 | | namelen: socklen_t, |
| 4253 | | /// scatter/gather array |
| 4254 | | iov: [*]const iovec_const, |
| 4255 | | /// # elements in iov |
| 4256 | | iovlen: u32, |
| 4257 | | /// ancillary data |
| 4258 | | control: ?*const anyopaque, |
| 4259 | | /// ancillary data buffer len |
| 4260 | | controllen: socklen_t, |
| 4261 | | /// flags on received message |
| 4262 | | flags: i32, |
| 4263 | | }, |
| 4264 | | .serenity => extern struct { |
| 4265 | | name: ?*const anyopaque, |
| 4266 | | namelen: socklen_t, |
| 4267 | | iov: [*]const iovec_const, |
| 4268 | | iovlen: c_uint, |
| 4269 | | control: ?*const anyopaque, |
| 4270 | | controllen: socklen_t, |
| 4271 | | flags: c_int, |
| 4272 | | }, |
| 4237 | .serenity, |
| 4238 | => posix_msghdr_const, |
| 4273 | 4239 | else => void, |
| 4274 | 4240 | }; |
| 4241 | |
| 4242 | const posix_msghdr_const = extern struct { |
| 4243 | name: ?*const sockaddr, |
| 4244 | namelen: socklen_t, |
| 4245 | iov: [*]const iovec_const, |
| 4246 | iovlen: u32, |
| 4247 | control: ?*const anyopaque, |
| 4248 | controllen: socklen_t, |
| 4249 | flags: u32, |
| 4250 | }; |
| 4251 | |
| 4275 | 4252 | pub const cmsghdr = switch (native_os) { |
| 4253 | .linux => if (@bitSizeOf(usize) > @bitSizeOf(i32) and builtin.abi.isMusl()) posix_cmsghdr else linux.cmsghdr, |
| 4276 | 4254 | // https://github.com/emscripten-core/emscripten/blob/96371ed7888fc78c040179f4d4faa82a6a07a116/system/lib/libc/musl/include/sys/socket.h#L44 |
| 4277 | | .linux, .emscripten => linux.cmsghdr, |
| 4255 | .emscripten => linux.cmsghdr, |
| 4278 | 4256 | // https://github.com/freebsd/freebsd-src/blob/b197d2abcb6895d78bc9df8404e374397aa44748/sys/sys/socket.h#L492 |
| 4279 | 4257 | .freebsd, |
| 4280 | 4258 | // https://github.com/DragonFlyBSD/DragonFlyBSD/blob/107c0518337ba90e7fa49e74845d8d44320c9a6d/sys/sys/socket.h#L452 |
| ... | ... | @@ -4298,13 +4276,17 @@ pub const cmsghdr = switch (native_os) { |
| 4298 | 4276 | .tvos, |
| 4299 | 4277 | .visionos, |
| 4300 | 4278 | .watchos, |
| 4301 | | => extern struct { |
| 4302 | | len: socklen_t, |
| 4303 | | level: c_int, |
| 4304 | | type: c_int, |
| 4305 | | }, |
| 4279 | => posix_cmsghdr, |
| 4280 | |
| 4306 | 4281 | else => void, |
| 4307 | 4282 | }; |
| 4283 | |
| 4284 | const posix_cmsghdr = extern struct { |
| 4285 | len: socklen_t, |
| 4286 | level: c_int, |
| 4287 | type: c_int, |
| 4288 | }; |
| 4289 | |
| 4308 | 4290 | pub const nfds_t = switch (native_os) { |
| 4309 | 4291 | .linux => linux.nfds_t, |
| 4310 | 4292 | .emscripten => emscripten.nfds_t, |