zig/lib
invlpg 0a2f6a048b fix msghdr and cmsghdr on non-Linux targets, document musl behaviour
The following assertions fail on non-Linux platforms after c0c2010535
which inserted padding based on musl definitions. This padding only
exists on musl to workaround a discrepancy betweeen the POSIX API and
Linux ABI, and is incorrect on other POSIX operating systems.

This change makes the padding musl-only, and documents the reason it
exists. With this change, the assertions pass on Linux and FreeBSD
targets. The corresponding definitions on other targets line up with the
POSIX and FreeBSD ones, so they should work there too.

```zig
const std = @import("std");
const assert = std.debug.assert;
const msghdr = std.c.msghdr;
const cmsghdr = std.c.cmsghdr;

const c = @cImport({
    @cInclude("sys/socket.h");
});

comptime {
    assert(@offsetOf(msghdr, "iovlen") == @offsetOf(c.msghdr, "msg_iovlen"));
    assert(@offsetOf(msghdr, "controllen") == @offsetOf(c.msghdr, "msg_controllen"));
    assert(@offsetOf(msghdr, "control") == @offsetOf(c.msghdr, "msg_control"));
    assert(@offsetOf(msghdr, "flags") == @offsetOf(c.msghdr, "msg_flags"));

    assert(@sizeOf(msghdr) == @sizeOf(c.msghdr));

    assert(@offsetOf(cmsghdr, "len") == @offsetOf(c.cmsghdr, "cmsg_len"));
    assert(@offsetOf(cmsghdr, "level") == @offsetOf(c.cmsghdr, "cmsg_level"));

    assert(@sizeOf(cmsghdr) == @sizeOf(c.cmsghdr));
}
```
2026-03-02 17:46:26 +01:00
..
build-web std.Io.{Writer|Duration}: move duration formatting to a format method 2026-02-28 02:46:04 +01:00
c libc malloc: introduce a canary 2026-02-14 09:25:41 +01:00
compiler Merge pull request 'rework fuzz testing to be smith based' (#31205) from gooncreeper/zig:integrated-smith into master 2026-02-25 20:23:36 +01:00
compiler_rt compiler_rt: Implemented missing handling of denormal numbers when dividing f128 (#30198) 2026-02-13 20:49:14 +01:00
docs fix(docs/wasm):zig std html render error function 'a' 2026-02-27 19:17:47 +01:00
include remove all IBM AIX and z/OS support 2025-10-29 14:25:51 +01:00
init rework fuzz testing to be smith based 2026-02-13 22:12:19 -05:00
libc zig libc: acosf 2026-02-13 11:30:14 -08:00
libcxx libcxx: use compiler's _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION when set 2025-11-14 02:02:59 +01:00
libcxxabi remove all IBM AIX and z/OS support 2025-10-29 14:25:51 +01:00
libtsan remove all IBM AIX and z/OS support 2025-10-29 14:25:51 +01:00
libunwind remove all IBM AIX and z/OS support 2025-10-29 14:25:51 +01:00
std fix msghdr and cmsghdr on non-Linux targets, document musl behaviour 2026-03-02 17:46:26 +01:00
c.zig libc: implement insque and remque in Zig 2026-02-12 21:35:36 -08:00
compiler_rt.zig compiler_rt: common -> compiler_rt 2026-02-09 20:03:15 -08:00
fuzzer.zig rework fuzz testing to be smith based 2026-02-13 22:12:19 -05:00
ubsan_rt.zig Coff: implement threadlocal variables 2025-10-10 22:47:47 -07:00
zig.h std.Threaded: replace more kernel32 functions with ntdll 2026-02-07 00:02:50 -05:00