Skip to content

Commit

Permalink
correct the msghdr_const definition for the quic client (#547)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexicon226 authored Feb 6, 2025
1 parent 4ea9244 commit 94720a6
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions src/net/send_msg.zig
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
const std = @import("std");
const builtin = @import("builtin");

// zig stdlib does not define the msghdr{_const} for macos.
pub const msghdr_const = extern struct {
name: ?*const std.posix.sockaddr,
namelen: std.posix.socklen_t,
iov: [*]const std.posix.iovec_const,
iovlen: usize,
control: ?*const anyopaque,
controllen: usize,
flags: i32,
// Zig 0.13 does not define the msghdr{_const} for macos.
pub const msghdr_const = switch (builtin.os.tag) {
.macos => extern struct {
/// optional address
name: ?*const std.posix.sockaddr,
/// size of address
namelen: std.posix.socklen_t,
/// scatter/gather array
iov: [*]const std.posix.iovec_const,
/// # elements in iov
iovlen: i32,
/// ancillary data
control: ?*const anyopaque,
/// ancillary data buffer len
controllen: std.posix.socklen_t,
/// flags on received message
flags: i32,
},
else => std.posix.msghdr_const,
};

extern "c" fn sendmsg(sockfd: std.posix.fd_t, msg: *const msghdr_const, flags: u32) isize;
Expand Down

0 comments on commit 94720a6

Please sign in to comment.