# Fix cmsghdr struct for the \*nixes · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/76c62e509b31fa31a537da94966cbd2971dfa79b)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 76c62e509b31fa31a537da94966cbd2971dfa79b

Requested commit: 76c62e509b31fa31a537da94966cbd2971dfa79b

Commit: 76c62e509b31fa31a537da94966cbd2971dfa79b

Tree: 044897678064354bd51f8dbf11640916b6b8cc4b

Author: Brandon Black

Committer: Andrew Kelley

## Message

```
Fix cmsghdr struct for the *nixes

Previously we had a single definition of std.c.cmsghdr for all
libc-linking platforms which aliased from the Solaris definition,
a superfluous matching one in std.os.dragonfly, and no others.

The existing definition from std.c didn't actually work for Linux,
as Linux's "len" field is usize in the kernel's definition.

Emscripten follows the Linux model of course (but uses the
binary-compatible musl definition, which has an endian-sensitive
padding scheme to make the len type "socklen_t" even though the
kernel uses a usize, which is fair).

This unifies and documents all the known *nix-ish cases (I'm not
sure if wasi or windows really has cmsghdr support? Could be added
later, void for now), such that c.cmsghdr and posix.system.cmsghdr
should work correctly for all the known cases here, libc or
otherwise.

```

## Parents

- [b1189ab038ad1885f961562bf188f0bd3da12153](https://git.cafe/gitcafe/zig/commit/b1189ab038ad1885f961562bf188f0bd3da12153?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/76c62e509b31fa31a537da94966cbd2971dfa79b?format=markdown)
