Skip to content

Commit 7ada017

Browse files
committed
Auto merge of #1164 - AdelieLinux:musl-endianness, r=alexcrichton
musl: 64-bit: Ensure proper (c)msghdr layout on big-endian Discovered while debugging: mozilla/audioipc#52
2 parents 9a8908c + 06bf363 commit 7ada017

File tree

1 file changed

+10
-1
lines changed
  • src/unix/notbsd/linux/musl/b64

1 file changed

+10
-1
lines changed

src/unix/notbsd/linux/musl/b64/mod.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,25 @@ s! {
9292
pub msg_name: *mut ::c_void,
9393
pub msg_namelen: ::socklen_t,
9494
pub msg_iov: *mut ::iovec,
95+
#[cfg(target_endian = "big")]
96+
__pad1: ::c_int,
9597
pub msg_iovlen: ::c_int,
98+
#[cfg(target_endian = "little")]
9699
__pad1: ::c_int,
97100
pub msg_control: *mut ::c_void,
101+
#[cfg(target_endian = "big")]
102+
__pad2: ::c_int,
98103
pub msg_controllen: ::socklen_t,
99-
__pad2: ::socklen_t,
104+
#[cfg(target_endian = "little")]
105+
__pad2: ::c_int,
100106
pub msg_flags: ::c_int,
101107
}
102108

103109
pub struct cmsghdr {
110+
#[cfg(target_endian = "big")]
111+
pub __pad1: ::c_int,
104112
pub cmsg_len: ::socklen_t,
113+
#[cfg(target_endian = "little")]
105114
pub __pad1: ::c_int,
106115
pub cmsg_level: ::c_int,
107116
pub cmsg_type: ::c_int,

0 commit comments

Comments
 (0)