Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding SUN_LEN macro to linux glibc/musl #4269

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libc-test/semver/linux-gnu.txt
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ STA_PPSTIME
STA_PPSWANDER
STA_RONLY
STA_UNSYNC
SUN_LEN
ST_RELATIME
SYSFS_MAGIC
TCA_CHAIN
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/linux-musl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ RWF_DSYNC
RWF_HIPRI
RWF_NOWAIT
RWF_SYNC
SUN_LEN
USER_PROCESS
_CS_V6_ENV
_CS_V7_ENV
Expand Down
11 changes: 11 additions & 0 deletions src/unix/linux_like/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6053,6 +6053,17 @@ f! {
pub fn ELF64_R_INFO(sym: Elf64_Xword, t: Elf64_Xword) -> Elf64_Xword {
sym << 32 + t
}

#[cfg(target_env = "gnu")]
pub fn SUN_LEN(s: crate::sockaddr_un) -> usize {
core::mem::offset_of!(crate::sockaddr_un, sun_path) +
unsafe { crate::strlen(s.sun_path.as_ptr()) }
}

#[cfg(target_env = "musl")]
pub fn SUN_LEN(s: crate::sockaddr_un) -> usize {
2 * (unsafe { crate::strlen(s.sun_path.as_ptr()) })
}
}

safe_f! {
Expand Down
Loading