diff options
Diffstat (limited to 'libc/src/unix/bsd/mod.rs')
-rw-r--r-- | libc/src/unix/bsd/mod.rs | 41 |
1 files changed, 7 insertions, 34 deletions
diff --git a/libc/src/unix/bsd/mod.rs b/libc/src/unix/bsd/mod.rs index 03125c9..12f6e14 100644 --- a/libc/src/unix/bsd/mod.rs +++ b/libc/src/unix/bsd/mod.rs @@ -57,7 +57,9 @@ s! { pub ifa_addr: *mut ::sockaddr, pub ifa_netmask: *mut ::sockaddr, pub ifa_dstaddr: *mut ::sockaddr, - pub ifa_data: *mut ::c_void + pub ifa_data: *mut ::c_void, + #[cfg(target_os = "netbsd")] + pub ifa_addrflags: ::c_uint } pub struct fd_set { @@ -340,43 +342,14 @@ pub const POLLRDBAND: ::c_short = 0x080; pub const POLLWRBAND: ::c_short = 0x100; f! { - pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr { - if (*mhdr).msg_controllen as usize >= mem::size_of::<cmsghdr>() { - (*mhdr).msg_control as *mut cmsghdr + pub fn CMSG_FIRSTHDR(mhdr: *const ::msghdr) -> *mut ::cmsghdr { + if (*mhdr).msg_controllen as usize >= mem::size_of::<::cmsghdr>() { + (*mhdr).msg_control as *mut ::cmsghdr } else { - 0 as *mut cmsghdr + 0 as *mut ::cmsghdr } } - pub fn CMSG_NXTHDR(mhdr: *const msghdr, - cmsg: *const cmsghdr) -> *mut cmsghdr { - if cmsg.is_null() { - return CMSG_FIRSTHDR(mhdr); - }; - let pad = mem::align_of::<cmsghdr>() - 1; - let next = cmsg as usize + (*cmsg).cmsg_len as usize + pad & !pad; - let max = (*mhdr).msg_control as usize - + (*mhdr).msg_controllen as usize; - if next < max { - next as *mut cmsghdr - } else { - 0 as *mut cmsghdr - } - } - - pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut ::c_uchar { - cmsg.offset(1) as *mut ::c_uchar - } - - pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint { - let pad = mem::align_of::<cmsghdr>() as ::c_uint - 1; - mem::size_of::<cmsghdr>() as ::c_uint + ((length + pad) & !pad) - } - - pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint { - mem::size_of::<cmsghdr>() as ::c_uint + length - } - pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8; let fd = fd as usize; |