Skip to content

Commit

Permalink
sys::socket fixes for haiku, illumos's cfg to solarish compound. (nix…
Browse files Browse the repository at this point in the history
  • Loading branch information
devnexen authored Dec 2, 2023
1 parent 3b1ae36 commit 2ad5573
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
2 changes: 2 additions & 0 deletions changelog/2242.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fixed UnixAddr::new for haiku, it did not record the `sun_len` value as needed.
Fixed `sys::socket::addr::from_raw_parts` and `sys::socket::Sockaddrlike::len` build for solaris.
15 changes: 5 additions & 10 deletions src/sys/socket/addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,7 @@ pub struct UnixAddr {
/// The length of the valid part of `sun`, including the sun_family field
/// but excluding any trailing nul.
// On the BSDs, this field is built into sun
#[cfg(any(
linux_android,
target_os = "fuchsia",
target_os = "illumos",
target_os = "redox",
))]
#[cfg(not(any(bsd, target_os = "haiku")))]
sun_len: u8,
}

Expand Down Expand Up @@ -366,7 +361,7 @@ impl UnixAddr {
.try_into()
.unwrap();

#[cfg(bsd)]
#[cfg(any(bsd, target_os = "haiku"))]
{
ret.sun_len = sun_len;
}
Expand Down Expand Up @@ -447,7 +442,7 @@ impl UnixAddr {
cfg_if! {
if #[cfg(any(linux_android,
target_os = "fuchsia",
target_os = "illumos",
solarish,
target_os = "redox",
))]
{
Expand Down Expand Up @@ -525,7 +520,7 @@ impl UnixAddr {

impl private::SockaddrLikePriv for UnixAddr {}
impl SockaddrLike for UnixAddr {
#[cfg(any(linux_android, target_os = "fuchsia", target_os = "illumos"))]
#[cfg(any(linux_android, target_os = "fuchsia", solarish, target_os = "redox"))]
fn len(&self) -> libc::socklen_t {
self.sun_len.into()
}
Expand Down Expand Up @@ -2246,7 +2241,7 @@ mod tests {
#[cfg(any(
bsd,
target_os = "aix",
target_os = "illumos",
solarish,
target_os = "haiku"
))]
let l = mem::size_of::<libc::sockaddr_dl>();
Expand Down
2 changes: 1 addition & 1 deletion src/sys/socket/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2373,7 +2373,7 @@ mod tests {
let _ = cmsg_space!(u8);
}

#[cfg(not(any(linux_android, target_os = "redox")))]
#[cfg(not(any(linux_android, target_os = "redox", target_os = "haiku")))]
#[test]
fn can_open_routing_socket() {
let _ = super::socket(
Expand Down

0 comments on commit 2ad5573

Please sign in to comment.