Skip to content

Commit

Permalink
Fix casting on DragonFly
Browse files Browse the repository at this point in the history
  • Loading branch information
strangelittlemonkey committed Feb 14, 2019
1 parent 70937c8 commit 2c33181
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/unix/bsd/freebsdlike/dragonfly/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ impl ::dox::Clone for sem {
fn clone(&self) -> sem { *self }
}

use dox::mem;

s! {

pub struct exit_status {
Expand Down Expand Up @@ -805,25 +807,25 @@ f! {
}

pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
_CMSG_ALIGN(mem::size_of::<::cmsghdr>()) + length as usize
(_CMSG_ALIGN(mem::size_of::<::cmsghdr>()) + length as usize) as u32
}

pub fn CMSG_NXTHDR(mhdr: *const ::msghdr, cmsg: *const ::cmsghdr)
-> *mut ::cmsghdr
{
let next = cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len)
let next = cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len as usize)
+ _CMSG_ALIGN(mem::size_of::<::cmsghdr>());
let max = (*mhdr).msg_control as usize
+ (*mhdr).msg_controllen as usize;
if next <= max {
(cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len)) as *mut ::cmsghdr
(cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len as usize)) as *mut ::cmsghdr
} else {
0 as *mut ::cmsghdr
}
}

pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
_CMSG_ALIGN(mem::size_of::<::cmsghdr>()) + _CMSG_ALIGN(length as usize)
(_CMSG_ALIGN(mem::size_of::<::cmsghdr>()) + _CMSG_ALIGN(length as usize)) as u32
}
}

Expand Down

0 comments on commit 2c33181

Please sign in to comment.