Constify `CMSG_SPACE` for all the targets
This commit is contained in:
parent
f913fc53a6
commit
e187543fdd
|
@ -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)
|
(len + ::mem::size_of::<::size_t>() - 1)
|
||||||
& !(::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>()))
|
(CMSG_ALIGN(len as ::size_t) + CMSG_ALIGN(::mem::size_of::<cmsghdr>()))
|
||||||
as ::c_uint
|
as ::c_uint
|
||||||
}
|
}
|
||||||
|
|
|
@ -3366,7 +3366,12 @@ pub const MNT_WAIT: ::c_int = 1;
|
||||||
pub const MNT_NOWAIT: ::c_int = 2;
|
pub const MNT_NOWAIT: ::c_int = 2;
|
||||||
|
|
||||||
cfg_if! {
|
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 {
|
fn __DARWIN_ALIGN32(p: usize) -> usize {
|
||||||
const __DARWIN_ALIGNBYTES32: usize = ::mem::size_of::<u32>() - 1;
|
const __DARWIN_ALIGNBYTES32: usize = ::mem::size_of::<u32>() - 1;
|
||||||
p + __DARWIN_ALIGNBYTES32 & !__DARWIN_ALIGNBYTES32
|
p + __DARWIN_ALIGNBYTES32 & !__DARWIN_ALIGNBYTES32
|
||||||
|
@ -3401,7 +3406,7 @@ f! {
|
||||||
.offset(__DARWIN_ALIGN32(::mem::size_of::<::cmsghdr>()) as isize)
|
.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(::mem::size_of::<::cmsghdr>())
|
||||||
+ __DARWIN_ALIGN32(length as usize))
|
+ __DARWIN_ALIGN32(length as usize))
|
||||||
as ::c_uint
|
as ::c_uint
|
||||||
|
|
|
@ -1020,8 +1020,10 @@ pub const SF_XLINK: ::c_ulong = 0x01000000;
|
||||||
pub const UTIME_OMIT: c_long = -2;
|
pub const UTIME_OMIT: c_long = -2;
|
||||||
pub const UTIME_NOW: c_long = -1;
|
pub const UTIME_NOW: c_long = -1;
|
||||||
|
|
||||||
fn _CMSG_ALIGN(n: usize) -> usize {
|
const_fn! {
|
||||||
|
{const} fn _CMSG_ALIGN(n: usize) -> usize {
|
||||||
(n + 3) & !3
|
(n + 3) & !3
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
f! {
|
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(::mem::size_of::<::cmsghdr>()) +
|
||||||
_CMSG_ALIGN(length as usize)) as ::c_uint
|
_CMSG_ALIGN(length as usize)) as ::c_uint
|
||||||
}
|
}
|
||||||
|
|
|
@ -1216,8 +1216,10 @@ pub const F_READAHEAD: ::c_int = 15;
|
||||||
pub const F_RDAHEAD: ::c_int = 16;
|
pub const F_RDAHEAD: ::c_int = 16;
|
||||||
pub const F_DUP2FD_CLOEXEC: ::c_int = 18;
|
pub const F_DUP2FD_CLOEXEC: ::c_int = 18;
|
||||||
|
|
||||||
fn _ALIGN(p: usize) -> usize {
|
const_fn! {
|
||||||
|
{const} fn _ALIGN(p: usize) -> usize {
|
||||||
(p + _ALIGNBYTES) & !_ALIGNBYTES
|
(p + _ALIGNBYTES) & !_ALIGNBYTES
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
f! {
|
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))
|
(_ALIGN(::mem::size_of::<::cmsghdr>()) + _ALIGN(length as usize))
|
||||||
as ::c_uint
|
as ::c_uint
|
||||||
}
|
}
|
||||||
|
|
|
@ -1748,8 +1748,10 @@ pub const SF_SNAPSHOT: ::c_ulong = 0x00200000;
|
||||||
pub const SF_LOG: ::c_ulong = 0x00400000;
|
pub const SF_LOG: ::c_ulong = 0x00400000;
|
||||||
pub const SF_SNAPINVAL: ::c_ulong = 0x00800000;
|
pub const SF_SNAPINVAL: ::c_ulong = 0x00800000;
|
||||||
|
|
||||||
fn _ALIGN(p: usize) -> usize {
|
const_fn! {
|
||||||
|
{const} fn _ALIGN(p: usize) -> usize {
|
||||||
(p + _ALIGNBYTES) & !_ALIGNBYTES
|
(p + _ALIGNBYTES) & !_ALIGNBYTES
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
f! {
|
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))
|
(_ALIGN(::mem::size_of::<::cmsghdr>()) + _ALIGN(length as usize))
|
||||||
as ::c_uint
|
as ::c_uint
|
||||||
}
|
}
|
||||||
|
|
|
@ -1397,8 +1397,10 @@ pub const PTRACE_FORK: ::c_int = 0x0002;
|
||||||
|
|
||||||
pub const WCONTINUED: ::c_int = 8;
|
pub const WCONTINUED: ::c_int = 8;
|
||||||
|
|
||||||
fn _ALIGN(p: usize) -> usize {
|
const_fn! {
|
||||||
|
{const} fn _ALIGN(p: usize) -> usize {
|
||||||
(p + _ALIGNBYTES) & !_ALIGNBYTES
|
(p + _ALIGNBYTES) & !_ALIGNBYTES
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
f! {
|
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))
|
(_ALIGN(::mem::size_of::<::cmsghdr>()) + _ALIGN(length as usize))
|
||||||
as ::c_uint
|
as ::c_uint
|
||||||
}
|
}
|
||||||
|
|
|
@ -2103,12 +2103,14 @@ const _CMSG_HDR_ALIGNMENT: usize = 4;
|
||||||
|
|
||||||
const _CMSG_DATA_ALIGNMENT: usize = ::mem::size_of::<::c_int>();
|
const _CMSG_DATA_ALIGNMENT: usize = ::mem::size_of::<::c_int>();
|
||||||
|
|
||||||
fn _CMSG_HDR_ALIGN(p: usize) -> usize {
|
const_fn! {
|
||||||
|
{const} fn _CMSG_HDR_ALIGN(p: usize) -> usize {
|
||||||
(p + _CMSG_HDR_ALIGNMENT - 1) & !(_CMSG_HDR_ALIGNMENT - 1)
|
(p + _CMSG_HDR_ALIGNMENT - 1) & !(_CMSG_HDR_ALIGNMENT - 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn _CMSG_DATA_ALIGN(p: usize) -> usize {
|
{const} fn _CMSG_DATA_ALIGN(p: usize) -> usize {
|
||||||
(p + _CMSG_DATA_ALIGNMENT - 1) & !(_CMSG_DATA_ALIGNMENT - 1)
|
(p + _CMSG_DATA_ALIGNMENT - 1) & !(_CMSG_DATA_ALIGNMENT - 1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
f! {
|
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
|
_CMSG_HDR_ALIGN(::mem::size_of::<::cmsghdr>() as usize
|
||||||
+ length as usize) as ::c_uint
|
+ length as usize) as ::c_uint
|
||||||
}
|
}
|
||||||
|
|
|
@ -1040,7 +1040,7 @@ impl ::Clone for fpos_t {
|
||||||
}
|
}
|
||||||
|
|
||||||
f! {
|
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)
|
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)
|
.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>()))
|
(CMSG_ALIGN(length as usize) + CMSG_ALIGN(::mem::size_of::<cmsghdr>()))
|
||||||
as ::c_uint
|
as ::c_uint
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue