Skip to content

c.darwin: define MSG for macos #24224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/std/c.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5598,6 +5598,7 @@ pub const MSG = switch (native_os) {
.linux => linux.MSG,
.emscripten => emscripten.MSG,
.windows => ws2_32.MSG,
.driverkit, .macos, .ios, .tvos, .watchos, .visionos => darwin.MSG,
.haiku => struct {
pub const OOB = 0x0001;
pub const PEEK = 0x0002;
Expand Down
39 changes: 39 additions & 0 deletions lib/std/c/darwin.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1553,3 +1553,42 @@ pub const TCP = struct {
/// State of the TCP connection
pub const CONNECTION_INFO = 0x106;
};

pub const MSG = struct {
/// process out-of-band data
pub const OOB = 0x1;
/// peek at incoming message
pub const PEEK = 0x2;
/// send without using routing tables
pub const DONTROUTE = 0x4;
/// data completes record
pub const EOR = 0x8;
/// data discarded before delivery
pub const TRUNC = 0x10;
/// control data lost before delivery
pub const CTRUNC = 0x20;
/// wait for full request or error
pub const WAITALL = 0x40;
/// this message should be nonblocking
pub const DONTWAIT = 0x80;
/// data completes connection
pub const EOF = 0x100;
/// wait up to full request, may return partial
pub const WAITSTREAM = 0x200;
/// Start of 'hold' seq; dump so_temp, deprecated
pub const FLUSH = 0x400;
/// Hold frag in so_temp, deprecated
pub const HOLD = 0x800;
/// Send the packet in so_temp, deprecated
pub const SEND = 0x1000;
/// Data ready to be read
pub const HAVEMORE = 0x2000;
/// Data remains in current pkt
pub const RCVMORE = 0x4000;
/// Fail receive if socket address cannot be allocated
pub const NEEDSA = 0x10000;
/// do not generate SIGPIPE on EOF
pub const NOSIGNAL = 0x80000;
/// Inherit upcall in sock_accept
pub const USEUPCALL = 0x80000000;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this one from? I don't see it in our vendored lib/libc/include/any-macos-any/sys/socket.h.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@linusg any idea why we don't have this in our vendored headers yet?

};