From e8c6714fd092da02deea3a261cf1e142632720f8 Mon Sep 17 00:00:00 2001 From: Havard Eidnes Date: Mon, 29 Dec 2025 21:01:39 +0100 Subject: [PATCH] src/new/netbsd/net/if_.rs: make if_msghdr self-tests succeed on ilp32 hosts: This fixes the following errors from `cd libc-test; cargo test`: bad `if_msghdr` size: rust: 148 != c 152 bad `if_msghdr` align: rust: 4 != c 8 and size of `struct if_msghdr` is 152 in C and 148 in Rust as verified natively on NetBSD/i386 10.0 with rust 1.92.0. Ref. https://nxr.netbsd.org/xref/src/sys/net/if.h#790 for the original C definition of `struct if_msghdr`. --- src/new/netbsd/net/if_.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/new/netbsd/net/if_.rs b/src/new/netbsd/net/if_.rs index 99e4f97a3748b..68f2d91626903 100644 --- a/src/new/netbsd/net/if_.rs +++ b/src/new/netbsd/net/if_.rs @@ -50,6 +50,7 @@ pub const IFF_LINK2: c_int = 0x4000; // per link layer defined bit pub const IFF_MULTICAST: c_int = 0x8000; // supports multicast s! { + #[repr(C, align(8))] pub struct if_msghdr { pub ifm_msglen: c_ushort, pub ifm_version: c_uchar,