Skip to content

Commit

Permalink
posix: BSD/darwin MSG.DONTWAIT
Browse files Browse the repository at this point in the history
Missing from std
  • Loading branch information
Cloudef committed Sep 10, 2024
1 parent f129349 commit da86753
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions src/aio/posix/posix.zig
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,13 @@ pub inline fn perform(op: anytype, readiness: Readiness) Operation.Error!void {
},
.accept => op.out_socket.* = try accept(op.socket, op.out_addr, op.inout_addrlen, 0),
.connect => _ = try connect(op.socket, op.addr, op.addrlen),
.recv => op.out_read.* = try recv(op.socket, op.buffer, std.posix.MSG.DONTWAIT),
.recv => op.out_read.* = try recv(op.socket, op.buffer, MSG.DONTWAIT),
.send => {
const written = try send(op.socket, op.buffer, std.posix.MSG.DONTWAIT);
const written = try send(op.socket, op.buffer, MSG.DONTWAIT);
if (op.out_written) |w| w.* = written;
},
.recv_msg => _ = try recvmsg(op.socket, op.out_msg, std.posix.MSG.DONTWAIT),
.send_msg => _ = try sendmsg(op.socket, op.msg, std.posix.MSG.DONTWAIT),
.recv_msg => _ = try recvmsg(op.socket, op.out_msg, MSG.DONTWAIT),
.send_msg => _ = try sendmsg(op.socket, op.msg, MSG.DONTWAIT),
.shutdown => try shutdown(op.socket, op.how),
.open_at => op.out_file.* = try openAtUring(op.dir, op.path, op.flags),
.close_file => std.posix.close(op.file.handle),
Expand Down Expand Up @@ -318,6 +318,22 @@ pub const socket = switch (builtin.target.os.tag) {
else => std.posix.socket,
};

pub const MSG = switch (builtin.target.os.tag) {
.freebsd,
.openbsd,
.dragonfly,
.netbsd,
.macos,
.ios,
.watchos,
.visionos,
.tvos,
=> struct {
pub const DONTWAIT = 0x0080;
},
else => std.posix.MSG,
};

pub const msghdr = switch (builtin.target.os.tag) {
.windows => windows.msghdr,
.macos, .ios, .tvos, .watchos, .visionos => darwin.msghdr,
Expand Down

0 comments on commit da86753

Please sign in to comment.