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

sys::socket fixes for haiku #2242

Merged
merged 1 commit into from
Dec 2, 2023
Merged
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
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"))]
asomers marked this conversation as resolved.
Show resolved Hide resolved
{
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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change? It doesn't match the commit message.

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