feature. See also
. The project being documented here (as the example) is the Zig library itself.
Kqueue.netSend
fn netSend(
userdata: ?*anyopaque,
handle: net.Socket.Handle,
outgoing_messages: []net.OutgoingMessage,
flags: net.SendFlags,
) struct
File
Code
fn netSend(
userdata: ?*anyopaque,
handle: net.Socket.Handle,
outgoing_messages: []net.OutgoingMessage,
flags: net.SendFlags,
) struct { ?net.Socket.SendError, usize } {
const k: *Kqueue = @ptrCast(@alignCast(userdata));
const posix_flags: u32 =
@as(u32, if (@hasDecl(posix.MSG, "CONFIRM") and flags.confirm) posix.MSG.CONFIRM else 0) |
@as(u32, if (@hasDecl(posix.MSG, "DONTROUTE") and flags.dont_route) posix.MSG.DONTROUTE else 0) |
@as(u32, if (@hasDecl(posix.MSG, "EOR") and flags.eor) posix.MSG.EOR else 0) |
@as(u32, if (@hasDecl(posix.MSG, "OOB") and flags.oob) posix.MSG.OOB else 0) |
@as(u32, if (@hasDecl(posix.MSG, "FASTOPEN") and flags.fastopen) posix.MSG.FASTOPEN else 0) |
posix.MSG.NOSIGNAL;
for (outgoing_messages, 0..) |*msg, i| {
netSendOne(k, handle, msg, posix_flags) catch |err| return .{ err, i };
}
return .{ null, outgoing_messages.len };
}