Skip to content

Commit

Permalink
realm-io: fix int compat issues for musl
Browse files Browse the repository at this point in the history
  • Loading branch information
zephyrchien committed May 19, 2024
1 parent 15a96c0 commit 824e7e5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion realm_io/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "realm_io"
version = "0.5.0"
version = "0.5.1"
authors = ["zephyr <[email protected]>"]
description = "Realm's high performance IO collections."
repository = "https://github.com/zhboner/realm"
Expand Down
20 changes: 10 additions & 10 deletions realm_io/src/linux/mmsg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ mod store {
} = self.store.msg_hdr;
unsafe { MmsgRef {
addr: &*msg_name.cast(),
iovec: make_slice(msg_iov as *const _, msg_iovlen),
control: make_slice(msg_control as *const _, msg_controllen),
iovec: make_slice(msg_iov as *const _, msg_iovlen as _),
control: make_slice(msg_control as *const _, msg_controllen as _),
flags: &self.store.msg_hdr.msg_flags,
nbytes: self.store.msg_len,
_lifetime: PhantomData,
Expand All @@ -202,21 +202,21 @@ mod store {
/// Set target address.
pub const fn with_addr(mut self, addr: &'a SockAddrStore) -> Self {
self.store.msg_hdr.msg_name = addr.0.as_ptr() as *mut _;
self.store.msg_hdr.msg_namelen = addr.0.len();
self.store.msg_hdr.msg_namelen = addr.0.len() as _;
self
}

/// Set data to send.
pub const fn with_iovec(mut self, iov: &'iov [IoSlice<'b>]) -> Self {
self.store.msg_hdr.msg_iov = ptr::from_ref(iov) as *mut _;
self.store.msg_hdr.msg_iovlen = iov.len();
self.store.msg_hdr.msg_iovlen = iov.len() as _;
self
}

/// Set control message to send.
pub const fn with_control(mut self, ctrl: &'ctrl [u8]) -> Self {
self.store.msg_hdr.msg_control = ptr::from_ref(ctrl) as *mut _;
self.store.msg_hdr.msg_controllen = ctrl.len();
self.store.msg_hdr.msg_controllen = ctrl.len() as _;
self
}

Expand All @@ -231,21 +231,21 @@ mod store {
/// Set storage to accommodate peer address.
pub fn with_addr(mut self, addr: &'a mut SockAddrStore) -> Self {
self.store.msg_hdr.msg_name = addr.0.as_ptr() as *mut _;
self.store.msg_hdr.msg_namelen = addr.0.len();
self.store.msg_hdr.msg_namelen = addr.0.len() as _;
self
}

/// Set storage to receive data.
pub fn with_iovec(mut self, iov: &'iov mut [IoSliceMut<'b>]) -> Self {
self.store.msg_hdr.msg_iov = ptr::from_mut(iov) as *mut _;
self.store.msg_hdr.msg_iovlen = iov.len();
self.store.msg_hdr.msg_iovlen = iov.len() as _;
self
}

/// Set storage to receive control message.
pub fn with_control(mut self, ctrl: &'ctrl mut [u8]) -> Self {
self.store.msg_hdr.msg_control = ptr::from_mut(ctrl) as *mut _;
self.store.msg_hdr.msg_controllen = ctrl.len();
self.store.msg_hdr.msg_controllen = ctrl.len() as _;
self
}

Expand All @@ -259,8 +259,8 @@ mod store {
} = self.store.msg_hdr;
unsafe { MmsgMutRef {
addr: &mut *msg_name.cast(),
iovec: make_slice_mut(msg_iov as *mut _, msg_iovlen),
control: make_slice_mut(msg_control as *mut _, msg_controllen),
iovec: make_slice_mut(msg_iov as *mut _, msg_iovlen as _),
control: make_slice_mut(msg_control as *mut _, msg_controllen as _),
flags: &mut self.store.msg_hdr.msg_flags,
nbytes: self.store.msg_len,
_lifetime: PhantomData,
Expand Down

0 comments on commit 824e7e5

Please sign in to comment.