diff options
| author | Kenta Iwasaki <kenta@lithdew.net> | 2021-05-31 19:29:17 +0900 |
|---|---|---|
| committer | Kenta Iwasaki <kenta@lithdew.net> | 2021-06-01 18:24:43 +0900 |
| commit | aad8491dbd98052e97b395ea572b186482d3b38f (patch) | |
| tree | c58fd0921a6082a39f388b46d36c543d191974cf /lib/std/os/bits/linux.zig | |
| parent | 6950e4c2943d7eee1868aff1bf9e24f6bb310f60 (diff) | |
| download | zig-aad8491dbd98052e97b395ea572b186482d3b38f.tar.gz zig-aad8491dbd98052e97b395ea572b186482d3b38f.zip | |
os: make msghdr, msghdr_const, and sockaddr_storage backwards-compatible
`msghdr` and `msghdr_const` definitions have been added back the way
they were in std.os. std.os.sendmsg has also been modified to accept a
msghdr_const again to ensure backwards-compatibility with this PR.
Underneath the hood, std.os.sendmsg will @ptrCast the provided
msghdr_const into a std.x.os.Socket.Message.
`sockaddr_storage` definitions have been added back the way they were in
std.os, except that it now simply aliases
std.x.os.Socket.Address.Native.Storage as all of
std.x.os.Socket.Address.Native.Storage's fields are equivalent to the
fields that were previously defined for std.x.os.bits.sockaddr_storage.
std.x.os.Socket.sendMessage now no longer is a stub that aliases
std.os.sendmsg, but instead calls and handles
errors from std.os.system.sendmsg directly.
Addresses feedback to urge backwards compatibility from @andrewrk.
Diffstat (limited to 'lib/std/os/bits/linux.zig')
| -rw-r--r-- | lib/std/os/bits/linux.zig | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/std/os/bits/linux.zig b/lib/std/os/bits/linux.zig index c58b7cfa50..c0e22e447f 100644 --- a/lib/std/os/bits/linux.zig +++ b/lib/std/os/bits/linux.zig @@ -1149,6 +1149,8 @@ pub const sockaddr = extern struct { data: [14]u8, }; +pub const sockaddr_storage = std.x.os.Socket.Address.Native.Storage; + /// IPv4 socket address pub const sockaddr_in = extern struct { family: sa_family_t = AF_INET, @@ -1173,12 +1175,12 @@ pub const sockaddr_un = extern struct { }; pub const mmsghdr = extern struct { - msg_hdr: std.x.os.Socket.Message, + msg_hdr: msghdr, msg_len: u32, }; pub const mmsghdr_const = extern struct { - msg_hdr: std.x.os.Socket.Message, + msg_hdr: msghdr_const, msg_len: u32, }; |
