Skip to content

Commit 4c74b89

Browse files
committed
Rearrange sockaddr_storage padding/alignment fields
Previously on Linux, the `sockaddr_storage` structure had padding bytes between the `ss_family` and `__ss_align` fields. The `__ss_align` field has now been moved to the end of the structure to eliminate these padding bytes, matching recent glibc versions: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/bits/socket.h;h=4f1f810ea1d9bf00ff428e4e7c49a52c71620775;hb=c804cd1c00adde061ca51711f63068c103e94eef#l190
1 parent 73c25f4 commit 4c74b89

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/unix/linux_like/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,11 @@ s_no_extra_traits! {
231231

232232
pub struct sockaddr_storage {
233233
pub ss_family: sa_family_t,
234-
__ss_align: ::size_t,
235234
#[cfg(target_pointer_width = "32")]
236-
__ss_pad2: [u8; 128 - 2 * 4],
235+
__ss_pad2: [u8; 128 - 2 - 4],
237236
#[cfg(target_pointer_width = "64")]
238-
__ss_pad2: [u8; 128 - 2 * 8],
237+
__ss_pad2: [u8; 128 - 2 - 8],
238+
__ss_align: ::size_t,
239239
}
240240

241241
pub struct utsname {

0 commit comments

Comments
 (0)