aboutsummaryrefslogtreecommitdiff
path: root/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2019-01-29 17:57:50 -0800
committerDaniel Mueller <deso@posteo.net>2019-01-29 17:57:50 -0800
commit73d48b35269bf297d66b2333040b296f26b403a1 (patch)
tree952fda784782d55183fb57d80a32a61255f1c572 /libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs
parent750c5dfef0e4d06a342d7f6fd5fb1b98e87043e0 (diff)
downloadnitrocli-73d48b35269bf297d66b2333040b296f26b403a1.tar.gz
nitrocli-73d48b35269bf297d66b2333040b296f26b403a1.tar.bz2
Update libc crate to 0.2.48
This change updates the libc crate to version 0.2.48. Import subrepo libc/:libc at 42cd3ba27254c423e03f6f4324de57075047f6a0
Diffstat (limited to 'libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs')
-rw-r--r--libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs39
1 files changed, 39 insertions, 0 deletions
diff --git a/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs
index 41b6956..992d008 100644
--- a/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs
+++ b/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs
@@ -210,6 +210,12 @@ s! {
pub sdl_rcf: ::c_ushort,
pub sdl_route: [::c_ushort; 16],
}
+
+ pub struct stack_t {
+ pub ss_sp: *mut ::c_char,
+ pub ss_size: ::size_t,
+ pub ss_flags: ::c_int,
+ }
}
pub const RAND_MAX: ::c_int = 0x7fff_ffff;
@@ -782,6 +788,39 @@ pub const SF_NOHISTORY: ::c_ulong = 0x00400000;
pub const SF_CACHE: ::c_ulong = 0x00800000;
pub const SF_XLINK: ::c_ulong = 0x01000000;
+fn _CMSG_ALIGN(n: usize) -> usize {
+ (n + 3) & !3
+}
+
+f! {
+ pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar {
+ (cmsg as *mut ::c_uchar)
+ .offset(_CMSG_ALIGN(mem::size_of::<::cmsghdr>()) as isize)
+ }
+
+ pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
+ _CMSG_ALIGN(mem::size_of::<::cmsghdr>()) + length as usize
+ }
+
+ pub fn CMSG_NXTHDR(mhdr: *const ::msghdr, cmsg: *const ::cmsghdr)
+ -> *mut ::cmsghdr
+ {
+ let next = cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len)
+ + _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
+ } 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)
+ }
+}
+
extern {
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
-> ::c_int;