summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/fuchsia/mod.rs4
-rw-r--r--src/unix/bsd/apple/mod.rs14
-rw-r--r--src/unix/bsd/freebsdlike/dragonfly/mod.rs8
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/mod.rs8
-rw-r--r--src/unix/bsd/netbsdlike/netbsd/mod.rs8
-rw-r--r--src/unix/bsd/netbsdlike/openbsd/mod.rs8
-rw-r--r--src/unix/linux_like/mod.rs12
-rw-r--r--src/unix/solarish/mod.rs14
-rwxr-xr-xsrc/vxworks/mod.rs4
9 files changed, 49 insertions, 31 deletions
diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs
index f179923ac4..d3d9e45442 100644
--- a/src/fuchsia/mod.rs
+++ b/src/fuchsia/mod.rs
@@ -3256,12 +3256,12 @@ f! {
}
}
- pub fn CMSG_ALIGN(len: ::size_t) -> ::size_t {
+ pub {const} fn CMSG_ALIGN(len: ::size_t) -> ::size_t {
(len + ::mem::size_of::<::size_t>() - 1)
& !(::mem::size_of::<::size_t>() - 1)
}
- pub fn CMSG_SPACE(len: ::c_uint) -> ::c_uint {
+ pub {const} fn CMSG_SPACE(len: ::c_uint) -> ::c_uint {
(CMSG_ALIGN(len as ::size_t) + CMSG_ALIGN(::mem::size_of::<cmsghdr>()))
as ::c_uint
}
diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs
index a099a0a16c..4c48221135 100644
--- a/src/unix/bsd/apple/mod.rs
+++ b/src/unix/bsd/apple/mod.rs
@@ -38,6 +38,7 @@ pub type sae_associd_t = u32;
pub type sae_connid_t = u32;
pub type mach_port_t = ::c_uint;
+pub type processor_flavor_t = ::c_int;
pub type iconv_t = *mut ::c_void;
@@ -49,6 +50,8 @@ pub type processor_set_basic_info_data_t = processor_set_basic_info;
pub type processor_set_basic_info_t = *mut processor_set_basic_info;
pub type processor_set_load_info_data_t = processor_set_load_info;
pub type processor_set_load_info_t = *mut processor_set_load_info;
+pub type processor_info_t = *mut integer_t;
+pub type processor_info_array_t = *mut integer_t;
deprecated_mach! {
pub type vm_prot_t = ::c_int;
@@ -3363,7 +3366,12 @@ pub const MNT_WAIT: ::c_int = 1;
pub const MNT_NOWAIT: ::c_int = 2;
cfg_if! {
- if #[cfg(libc_const_size_of)] {
+ if #[cfg(libc_const_extern_fn)] {
+ const fn __DARWIN_ALIGN32(p: usize) -> usize {
+ const __DARWIN_ALIGNBYTES32: usize = ::mem::size_of::<u32>() - 1;
+ p + __DARWIN_ALIGNBYTES32 & !__DARWIN_ALIGNBYTES32
+ }
+ } else if #[cfg(libc_const_size_of)] {
fn __DARWIN_ALIGN32(p: usize) -> usize {
const __DARWIN_ALIGNBYTES32: usize = ::mem::size_of::<u32>() - 1;
p + __DARWIN_ALIGNBYTES32 & !__DARWIN_ALIGNBYTES32
@@ -3385,7 +3393,7 @@ f! {
let cmsg_len = (*cmsg).cmsg_len as usize;
let next = cmsg as usize + __DARWIN_ALIGN32(cmsg_len as usize);
let max = (*mhdr).msg_control as usize
- + (*mhdr).msg_controllen as usize;
+ + (*mhdr).msg_controllen as usize;
if next + __DARWIN_ALIGN32(::mem::size_of::<::cmsghdr>()) > max {
0 as *mut ::cmsghdr
} else {
@@ -3398,7 +3406,7 @@ f! {
.offset(__DARWIN_ALIGN32(::mem::size_of::<::cmsghdr>()) as isize)
}
- pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
+ pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
(__DARWIN_ALIGN32(::mem::size_of::<::cmsghdr>())
+ __DARWIN_ALIGN32(length as usize))
as ::c_uint
diff --git a/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/src/unix/bsd/freebsdlike/dragonfly/mod.rs
index 7056cc5484..2a803bd197 100644
--- a/src/unix/bsd/freebsdlike/dragonfly/mod.rs
+++ b/src/unix/bsd/freebsdlike/dragonfly/mod.rs
@@ -1020,8 +1020,10 @@ pub const SF_XLINK: ::c_ulong = 0x01000000;
pub const UTIME_OMIT: c_long = -2;
pub const UTIME_NOW: c_long = -1;
-fn _CMSG_ALIGN(n: usize) -> usize {
- (n + 3) & !3
+const_fn! {
+ {const} fn _CMSG_ALIGN(n: usize) -> usize {
+ (n + 3) & !3
+ }
}
f! {
@@ -1050,7 +1052,7 @@ f! {
}
}
- pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
+ pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
(_CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) +
_CMSG_ALIGN(length as usize)) as ::c_uint
}
diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs
index 75189cc761..6a6033dc08 100644
--- a/src/unix/bsd/freebsdlike/freebsd/mod.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs
@@ -1216,8 +1216,10 @@ pub const F_READAHEAD: ::c_int = 15;
pub const F_RDAHEAD: ::c_int = 16;
pub const F_DUP2FD_CLOEXEC: ::c_int = 18;
-fn _ALIGN(p: usize) -> usize {
- (p + _ALIGNBYTES) & !_ALIGNBYTES
+const_fn! {
+ {const} fn _ALIGN(p: usize) -> usize {
+ (p + _ALIGNBYTES) & !_ALIGNBYTES
+ }
}
f! {
@@ -1248,7 +1250,7 @@ f! {
}
}
- pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
+ pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
(_ALIGN(::mem::size_of::<::cmsghdr>()) + _ALIGN(length as usize))
as ::c_uint
}
diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs
index b789f47ec9..82b13e9f4d 100644
--- a/src/unix/bsd/netbsdlike/netbsd/mod.rs
+++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs
@@ -1748,8 +1748,10 @@ pub const SF_SNAPSHOT: ::c_ulong = 0x00200000;
pub const SF_LOG: ::c_ulong = 0x00400000;
pub const SF_SNAPINVAL: ::c_ulong = 0x00800000;
-fn _ALIGN(p: usize) -> usize {
- (p + _ALIGNBYTES) & !_ALIGNBYTES
+const_fn! {
+ {const} fn _ALIGN(p: usize) -> usize {
+ (p + _ALIGNBYTES) & !_ALIGNBYTES
+ }
}
f! {
@@ -1780,7 +1782,7 @@ f! {
}
}
- pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
+ pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
(_ALIGN(::mem::size_of::<::cmsghdr>()) + _ALIGN(length as usize))
as ::c_uint
}
diff --git a/src/unix/bsd/netbsdlike/openbsd/mod.rs b/src/unix/bsd/netbsdlike/openbsd/mod.rs
index 06068115f8..a4b1d31194 100644
--- a/src/unix/bsd/netbsdlike/openbsd/mod.rs
+++ b/src/unix/bsd/netbsdlike/openbsd/mod.rs
@@ -1397,8 +1397,10 @@ pub const PTRACE_FORK: ::c_int = 0x0002;
pub const WCONTINUED: ::c_int = 8;
-fn _ALIGN(p: usize) -> usize {
- (p + _ALIGNBYTES) & !_ALIGNBYTES
+const_fn! {
+ {const} fn _ALIGN(p: usize) -> usize {
+ (p + _ALIGNBYTES) & !_ALIGNBYTES
+ }
}
f! {
@@ -1429,7 +1431,7 @@ f! {
}
}
- pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
+ pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
(_ALIGN(::mem::size_of::<::cmsghdr>()) + _ALIGN(length as usize))
as ::c_uint
}
diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs
index 2a1b95f10a..cd4247d3bd 100644
--- a/src/unix/linux_like/mod.rs
+++ b/src/unix/linux_like/mod.rs
@@ -1546,6 +1546,12 @@ extern "C" {
count: ::size_t,
offset: off64_t,
) -> ::ssize_t;
+ pub fn pwrite64(
+ fd: ::c_int,
+ buf: *const ::c_void,
+ count: ::size_t,
+ offset: off64_t,
+ ) -> ::ssize_t;
pub fn readdir64(dirp: *mut ::DIR) -> *mut ::dirent64;
pub fn readdir64_r(
dirp: *mut ::DIR,
@@ -1677,12 +1683,6 @@ cfg_if! {
iovcnt: ::c_int,
offset: ::off64_t,
) -> ::ssize_t;
- pub fn pwrite64(
- fd: ::c_int,
- buf: *const ::c_void,
- count: ::size_t,
- offset: off64_t,
- ) -> ::ssize_t;
pub fn pwritev64(
fd: ::c_int,
iov: *const ::iovec,
diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs
index 2db4916a52..994ce7e52a 100644
--- a/src/unix/solarish/mod.rs
+++ b/src/unix/solarish/mod.rs
@@ -2103,12 +2103,14 @@ const _CMSG_HDR_ALIGNMENT: usize = 4;
const _CMSG_DATA_ALIGNMENT: usize = ::mem::size_of::<::c_int>();
-fn _CMSG_HDR_ALIGN(p: usize) -> usize {
- (p + _CMSG_HDR_ALIGNMENT - 1) & !(_CMSG_HDR_ALIGNMENT - 1)
-}
+const_fn! {
+ {const} fn _CMSG_HDR_ALIGN(p: usize) -> usize {
+ (p + _CMSG_HDR_ALIGNMENT - 1) & !(_CMSG_HDR_ALIGNMENT - 1)
+ }
-fn _CMSG_DATA_ALIGN(p: usize) -> usize {
- (p + _CMSG_DATA_ALIGNMENT - 1) & !(_CMSG_DATA_ALIGNMENT - 1)
+ {const} fn _CMSG_DATA_ALIGN(p: usize) -> usize {
+ (p + _CMSG_DATA_ALIGNMENT - 1) & !(_CMSG_DATA_ALIGNMENT - 1)
+ }
}
f! {
@@ -2146,7 +2148,7 @@ f! {
}
}
- pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
+ pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
_CMSG_HDR_ALIGN(::mem::size_of::<::cmsghdr>() as usize
+ length as usize) as ::c_uint
}
diff --git a/src/vxworks/mod.rs b/src/vxworks/mod.rs
index 668a7fcc96..704dac7f5c 100755
--- a/src/vxworks/mod.rs
+++ b/src/vxworks/mod.rs
@@ -1040,7 +1040,7 @@ impl ::Clone for fpos_t {
}
f! {
- pub fn CMSG_ALIGN(len: usize) -> usize {
+ pub {const} fn CMSG_ALIGN(len: usize) -> usize {
len + ::mem::size_of::<usize>() - 1 & !(::mem::size_of::<usize>() - 1)
}
@@ -1071,7 +1071,7 @@ f! {
.offset(CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) as isize)
}
- pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
+ pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
(CMSG_ALIGN(length as usize) + CMSG_ALIGN(::mem::size_of::<cmsghdr>()))
as ::c_uint
}