Skip to content

Commit 8891822

Browse files

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

libc-test/semver/linux-gnu.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ STA_PPSTIME
450450
STA_PPSWANDER
451451
STA_RONLY
452452
STA_UNSYNC
453+
SUN_LEN
453454
ST_RELATIME
454455
SYSFS_MAGIC
455456
TCA_CHAIN

libc-test/semver/linux-musl.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ RWF_HIPRI
3838
RWF_NOAPPEND
3939
RWF_NOWAIT
4040
RWF_SYNC
41+
SUN_LEN
4142
USER_PROCESS
4243
UT_HOSTSIZE
4344
UT_LINESIZE

src/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ macro_rules! offset_of {
401401
// SAFETY: computed address is inbounds since we have a stack alloc for T
402402
let fptr = unsafe { core::ptr::addr_of!((*ptr).$field) };
403403
let off = (fptr as usize).checked_sub(ptr as usize).unwrap();
404-
assert!(off <= core::mem::size_of::<$Ty>());
404+
core::assert!(off <= core::mem::size_of::<$Ty>());
405405
off
406406
}};
407407
}

src/unix/linux_like/linux/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5877,6 +5877,16 @@ f! {
58775877
pub fn ELF64_R_INFO(sym: Elf64_Xword, t: Elf64_Xword) -> Elf64_Xword {
58785878
sym << (32 + t)
58795879
}
5880+
5881+
#[cfg(target_env = "gnu")]
5882+
pub fn SUN_LEN(s: crate::sockaddr_un) -> usize {
5883+
offset_of!(crate::sockaddr_un, sun_path) + crate::strlen(s.sun_path.as_ptr())
5884+
}
5885+
5886+
#[cfg(target_env = "musl")]
5887+
pub fn SUN_LEN(s: crate::sockaddr_un) -> usize {
5888+
2 * crate::strlen(s.sun_path.as_ptr())
5889+
}
58805890
}
58815891

58825892
safe_f! {

0 commit comments

Comments
 (0)