zig/lib/std
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 std.Io.{Writer|Duration}: move duration formatting to a format method 2026-02-28 02:46:04 +01:00
builtin Add lr and sp clobbers for arm/thumb 2026-02-20 01:16:33 +01:00
c Io.Dispatch.Mutex: fix deadlock conditions 2026-02-14 05:52:59 -05:00
compress 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
crypto Expose the elligator map for Curve25519 2026-02-23 13:04:58 +01:00
debug Revert "compiler: override debug_io in release + evented mode" 2026-02-11 10:44:04 -08:00
dwarf fix compiler ftbfs from std.macho and std.dwarf changes 2025-09-30 13:44:51 +01:00
fmt all: replace all @Type usages 2025-11-22 22:42:38 +00:00
fs std.Thread: remove ResetEvent and WaitGroup 2026-02-02 00:09:48 -08:00
hash Fix benchmarks after the randomness changes 2026-01-13 07:04:51 +01:00
heap std.heap: delete ThreadSafeAllocator 2026-02-26 21:20:34 +01:00
http std: finish moving time to Io interface 2026-02-02 23:02:31 -08:00
Io std.Io: remove cancelation propagation assertions 2026-02-28 05:07:54 +01:00
json 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
math std.math.big.int: address log2/log10 reviews 2026-03-01 20:34:17 +01:00
mem std.Io.Threaded: implement and cleanup windows codepaths 2026-02-04 14:15:41 -05:00
meta all: replace all @Type usages 2025-11-22 22:42:38 +00:00
os bpf: add missing helpers 2026-02-23 02:27:13 +01:00
posix std.posix: remove close function 2026-02-11 23:37:31 +01:00
process Io.Dispatch: introduce grand central dispatch io impl 2026-02-13 12:29:40 -05:00
Random feat(std.Random): add a linear congruent generator 2026-01-14 12:48:09 +01:00
sort std.sort.pdq: fix out-of-bounds access in partialInsertionSort (#25253) 2025-09-17 19:54:15 -07:00
tar all: prefer else => |e| return e, over else => return err, 2026-01-11 11:37:17 +00:00
Target std.Target.x86: refresh from update_cpu_features.zig 2025-11-13 22:29:28 +01:00
testing rework fuzz testing to be smith based 2026-02-13 22:12:19 -05:00
time removed reduntant @as() from switch in getDaysInMonth 2026-02-05 21:58:35 +01:00
tz
unicode update all occurrences of std.fs.File to std.Io.File 2025-12-23 22:15:07 -08:00
valgrind Remove numerous things deprecated during the 0.14 release cycle 2025-07-11 08:17:43 +02:00
zig rework fuzz testing to be smith based 2026-02-13 22:12:19 -05:00
zon update deprecated ArrayListUnmanaged usage (#25958) 2025-11-20 14:46:23 -08:00
array_hash_map.zig update deprecated ArrayListUnmanaged usage (#25958) 2025-11-20 14:46:23 -08:00
array_list.zig std.ArrayList: Fix compile error when @sizeOf(T) == 0 2026-02-09 19:59:09 +01:00
ascii.zig feat(std.ascii): add boundedOrderIgnoreCaseZ 2026-01-17 21:42:38 +01:00
atomic.zig std: introduce atomic.Mutex and use it in heap.SmpAllocator 2026-02-02 18:36:40 -08:00
base64.zig Base64DecoderWithIgnore.calcSizeUpperBound cannot return an error (#25834) 2025-11-07 08:16:34 +01:00
bit_set.zig std.bit_set: Disable IntegerBitSet decltest on RISC-V with vector support 2025-07-01 23:03:15 +02:00
BitStack.zig std.ArrayList: make unmanaged the default 2025-08-11 15:52:49 -07:00
buf_map.zig
buf_set.zig
Build.zig allow specifying mode in --debug-rt 2026-02-13 17:58:09 -05:00
builtin.zig Merge pull request '@extern: add support for SPIR-V locations and descriptors' (#30570) from ashpil/zig:extern-bindings-locations into master 2026-01-06 23:44:10 +01:00
c.zig fix msghdr and cmsghdr on non-Linux targets, document musl behaviour 2026-03-02 17:46:26 +01:00
coff.zig std: replace usages of std.mem.indexOf with std.mem.find 2025-12-05 14:31:27 +01:00
compress.zig std.compress: rework flate to new I/O API 2025-07-31 22:10:11 -07:00
crypto.zig crypto: Allow arbitrary types for secureZeroes 2026-02-13 17:07:03 +01:00
debug.zig 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
deque.zig rework fuzz testing to be smith based 2026-02-13 22:12:19 -05:00
DoublyLinkedList.zig *LinkedList.remove() assumes node is in the list 2025-10-25 21:10:02 -07:00
dwarf.zig Dwarf: cleanup emitted debug info 2024-08-22 08:44:08 +02:00
dynamic_library.zig std: move GetFinalPathNameByHandle to Io.Threaded 2026-02-04 16:27:13 -08:00
elf.zig link: recognize thin archives in ld script detection 2026-02-17 23:15:32 +01:00
enums.zig Make functions on EnumMap always take a pointer to avoid copies of big EnumMaps 2026-01-28 03:13:37 +01:00
fmt.zig std: replace usages of std.mem.indexOf with std.mem.find 2025-12-05 14:31:27 +01:00
fs.zig std: find a better home for the "preopens" concept 2026-01-08 05:06:31 +01:00
gpu.zig remove std.gpu.(binding|location) 2025-12-22 10:00:35 -08:00
hash.zig all: replace all @Type usages 2025-11-22 22:42:38 +00:00
hash_map.zig std: replace usages of std.mem.indexOf with std.mem.find 2025-12-05 14:31:27 +01:00
heap.zig std.heap: delete ThreadSafeAllocator 2026-02-26 21:20:34 +01:00
http.zig update all occurrences of std.fs.File to std.Io.File 2025-12-23 22:15:07 -08:00
Io.zig std.Io: remove cancelation propagation assertions 2026-02-28 05:07:54 +01:00
json.zig std.Io: delete GenericReader 2025-08-29 17:14:26 -07:00
leb128.zig std.Io: delete GenericReader 2025-08-29 17:14:26 -07:00
log.zig std.Threaded: replace console kernel32 functions with ntdll 2026-02-05 07:41:25 -05:00
macho.zig std: move memory locking and memory protection to process 2026-01-09 13:52:00 -08:00
math.zig all: replace all @Type usages 2025-11-22 22:42:38 +00:00
mem.zig std.mem.readVarInt: Fix type name in doc comment (#31007) 2026-01-27 05:29:51 +01:00
meta.zig std.meta: delete declList 2026-01-28 00:43:20 -08:00
multi_array_list.zig std.MultiArrayList: add *Bounded variants and initCapacity 2026-01-04 03:05:34 +01:00
os.zig std: start wrangling environment variables and process args 2026-01-04 00:27:07 -08:00
pdb.zig update all occurrences of std.fs.File to std.Io.File 2025-12-23 22:15:07 -08:00
pie.zig std.pie: add missing clobbers on alpha and sparc 2025-11-14 12:19:38 +01:00
posix.zig std.posix: remove close function 2026-02-11 23:37:31 +01:00
priority_dequeue.zig min heap is formed with less than comparison 2026-02-18 13:24:03 -08:00
priority_queue.zig Make std.PriorityQueue an unmanaged container (#31299) 2026-02-26 21:09:52 +01:00
process.zig std.heap.ArenaAllocator: make it threadsafe 2026-02-25 19:12:35 +01:00
Progress.zig std.Progress: add Node.startFmt 2026-02-05 16:50:41 -08:00
Random.zig feat(std.Random): add a linear congruent generator 2026-01-14 12:48:09 +01:00
SemanticVersion.zig std: replace usages of std.mem.indexOf with std.mem.find 2025-12-05 14:31:27 +01:00
simd.zig std.simd: suggest 1024-bit vectors for kvx 2025-11-10 09:40:44 +01:00
SinglyLinkedList.zig SinglyLinkedList.remove docs: Assumes -> asserts 2025-10-25 21:28:54 -07:00
sort.zig std.sort.partitionPoint: faster implementation (#30005) 2025-11-27 20:48:54 +01:00
start.zig std.Threaded: replace more kernel32 functions with ntdll 2026-02-07 00:02:50 -05:00
static_string_map.zig
std.zig Revert "Allow overriding std.Io at a namespace level." 2026-02-15 20:26:12 -08:00
tar.zig tar: Fix symlink test when symlinks can't be created on Windows 2026-03-01 15:01:51 -08:00
Target.zig std.Target: update max Linux version to 6.19 2026-02-09 23:54:30 +01:00
testing.zig rework fuzz testing to be smith based 2026-02-13 22:12:19 -05:00
Thread.zig std.Threaded: replace more kernel32 functions with ntdll 2026-02-07 00:02:50 -05:00
time.zig std: finish moving time to Io interface 2026-02-02 23:02:31 -08:00
treap.zig std.ArrayList: make unmanaged the default 2025-08-11 15:52:49 -07:00
tz.zig std.tz: fix redundant endian handling 2025-08-28 18:30:57 -07:00
unicode.zig std: move some windows path checking logic 2025-10-29 06:20:50 -07:00
Uri.zig std: replace usages of std.mem.indexOf with std.mem.find 2025-12-05 14:31:27 +01:00
valgrind.zig remove condition codes 2025-07-16 10:27:39 -07:00
wasm.zig wasm linker: implement @tagName for sparse enums 2025-01-15 15:11:36 -08:00
zig.zig rework fuzz testing to be smith based 2026-02-13 22:12:19 -05:00
zip.zig std: rename other Dir "make" functions to "create" 2025-12-23 22:15:11 -08:00
zon.zig zon: Add anonymous struct literal in the example 2025-08-15 23:35:16 +02:00