summaryrefslogtreecommitdiffstats
path: root/vendor/rustix/src/backend/libc/net/addr.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/rustix/src/backend/libc/net/addr.rs')
-rw-r--r--vendor/rustix/src/backend/libc/net/addr.rs32
1 files changed, 23 insertions, 9 deletions
diff --git a/vendor/rustix/src/backend/libc/net/addr.rs b/vendor/rustix/src/backend/libc/net/addr.rs
index bd2e7dafe..6a140d767 100644
--- a/vendor/rustix/src/backend/libc/net/addr.rs
+++ b/vendor/rustix/src/backend/libc/net/addr.rs
@@ -76,15 +76,17 @@ impl SocketAddrUnix {
fn init() -> c::sockaddr_un {
c::sockaddr_un {
- #[cfg(any(bsd, target_os = "haiku", target_os = "nto"))]
+ #[cfg(any(bsd, target_os = "aix", target_os = "haiku", target_os = "nto"))]
sun_len: 0,
sun_family: c::AF_UNIX as _,
#[cfg(any(bsd, target_os = "nto"))]
sun_path: [0; 104],
- #[cfg(not(any(bsd, target_os = "haiku", target_os = "nto")))]
+ #[cfg(not(any(bsd, target_os = "aix", target_os = "haiku", target_os = "nto")))]
sun_path: [0; 108],
#[cfg(target_os = "haiku")]
sun_path: [0; 126],
+ #[cfg(target_os = "aix")]
+ sun_path: [0; 1023],
}
}
@@ -159,9 +161,7 @@ impl Eq for SocketAddrUnix {}
impl PartialOrd for SocketAddrUnix {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
- let self_len = self.len() - offsetof_sun_path();
- let other_len = other.len() - offsetof_sun_path();
- self.unix.sun_path[..self_len].partial_cmp(&other.unix.sun_path[..other_len])
+ Some(self.cmp(other))
}
}
@@ -208,18 +208,32 @@ pub type SocketAddrStorage = c::sockaddr_storage;
#[inline]
pub(crate) fn offsetof_sun_path() -> usize {
let z = c::sockaddr_un {
- #[cfg(any(bsd, target_os = "haiku", target_os = "nto"))]
+ #[cfg(any(bsd, target_os = "aix", target_os = "haiku", target_os = "nto"))]
sun_len: 0_u8,
- #[cfg(any(bsd, target_os = "espidf", target_os = "haiku", target_os = "nto"))]
+ #[cfg(any(
+ bsd,
+ target_os = "aix",
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "nto"
+ ))]
sun_family: 0_u8,
- #[cfg(not(any(bsd, target_os = "espidf", target_os = "haiku", target_os = "nto")))]
+ #[cfg(not(any(
+ bsd,
+ target_os = "aix",
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "nto"
+ )))]
sun_family: 0_u16,
#[cfg(any(bsd, target_os = "nto"))]
sun_path: [0; 104],
- #[cfg(not(any(bsd, target_os = "haiku", target_os = "nto")))]
+ #[cfg(not(any(bsd, target_os = "aix", target_os = "haiku", target_os = "nto")))]
sun_path: [0; 108],
#[cfg(target_os = "haiku")]
sun_path: [0; 126],
+ #[cfg(target_os = "aix")]
+ sun_path: [0; 1023],
};
(crate::utils::as_ptr(&z.sun_path) as usize) - (crate::utils::as_ptr(&z) as usize)
}