summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Engler <opara@cs.georgetown.edu>2022-11-21 14:29:20 -0500
committerSteven Engler <opara@cs.georgetown.edu>2022-11-21 14:45:18 -0500
commit4c74b89f35b69d0c4553b5824a2a1a933e0c8025 (patch)
tree5f6f2fdf9e5db609eaf92f014927c3c45e97403f
parent73c25f4e9d66054d1496c693b72d60caea00c4a9 (diff)
downloadrust-libc-4c74b89f35b69d0c4553b5824a2a1a933e0c8025.tar.gz
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
-rw-r--r--src/unix/linux_like/mod.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs
index 46964cc173..8e738d87b8 100644
--- a/src/unix/linux_like/mod.rs
+++ b/src/unix/linux_like/mod.rs
@@ -231,11 +231,11 @@ s_no_extra_traits! {
pub struct sockaddr_storage {
pub ss_family: sa_family_t,
- __ss_align: ::size_t,
#[cfg(target_pointer_width = "32")]
- __ss_pad2: [u8; 128 - 2 * 4],
+ __ss_pad2: [u8; 128 - 2 - 4],
#[cfg(target_pointer_width = "64")]
- __ss_pad2: [u8; 128 - 2 * 8],
+ __ss_pad2: [u8; 128 - 2 - 8],
+ __ss_align: ::size_t,
}
pub struct utsname {