Skip to content

Commit

Permalink
Update libc crate to 0.2.48
Browse files Browse the repository at this point in the history
This change updates the libc crate to version 0.2.48.

Import subrepo libc/:libc at 42cd3ba27254c423e03f6f4324de57075047f6a0
  • Loading branch information
d-e-s-o committed Jan 30, 2019
1 parent 750c5df commit 73d48b3
Show file tree
Hide file tree
Showing 26 changed files with 292 additions and 95 deletions.
5 changes: 3 additions & 2 deletions libc/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ matrix:
- shellcheck ci/*.sh

allow_failures:
- env: TARGET=aarch64-linux-android
- env: TARGET=x86_64-linux-android
# FIXME: https://github.com/rust-lang/libc/issues/1226
- env: TARGET=asmjs-unknown-emscripten
- env: TARGET=wasm32-unknown-emscripten

install: rustup target add $TARGET
script:
Expand Down
68 changes: 34 additions & 34 deletions libc/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion libc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "libc"
version = "0.2.47"
version = "0.2.48"
authors = ["The Rust Project Developers"]
license = "MIT OR Apache-2.0"
readme = "README.md"
Expand Down
6 changes: 3 additions & 3 deletions libc/ci/android-install-sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ case "$1" in
esac;

# --no_https avoids
# javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found
echo "yes" | \
./sdk/tools/bin/sdkmanager --no_https \
# javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found
yes | ./sdk/tools/bin/sdkmanager --licenses --no_https
yes | ./sdk/tools/bin/sdkmanager --no_https \
"emulator" \
"platform-tools" \
"platforms;android-24" \
Expand Down
2 changes: 1 addition & 1 deletion libc/libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ fn main() {
// MFD_HUGETLB is not available in some older libc versions on the CI builders. On the
// x86_64 and i686 builders it seems to be available for all targets, so at least test
// it there.
"MFD_HUGETLB" if !(x86_64 || i686) || musl => true,
"MFD_HUGETLB" if !(x86_64 || i686) || musl || (x86_64 && android)=> true,

"DT_FIFO" | "DT_CHR" | "DT_DIR" | "DT_BLK" | "DT_REG"
| "DT_LNK" | "DT_SOCK"
Expand Down
39 changes: 39 additions & 0 deletions libc/src/unix/bsd/apple/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Apple (ios/darwin)-specific definitions
//!
//! This covers *-apple-* triples currently
use dox::mem;

pub type c_char = i8;
pub type clock_t = c_ulong;
Expand Down Expand Up @@ -2383,7 +2384,45 @@ pub const SF_IMMUTABLE: ::c_uint = 0x00020000;
pub const SF_APPEND: ::c_uint = 0x00040000;
pub const UF_HIDDEN: ::c_uint = 0x00008000;

fn __DARWIN_ALIGN32(p: usize) -> usize {
const __DARWIN_ALIGNBYTES32: usize = mem::size_of::<u32>() - 1;
p + __DARWIN_ALIGNBYTES32 & !__DARWIN_ALIGNBYTES32
}

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

pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar {
(cmsg as *mut ::c_uchar)
.offset(__DARWIN_ALIGN32(mem::size_of::<::cmsghdr>()) as isize)
}

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

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

pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
status >> 8
}
Expand Down
39 changes: 39 additions & 0 deletions libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use dox::mem;

pub type c_long = i64;
pub type c_ulong = u64;
pub type time_t = i64;
Expand Down Expand Up @@ -29,4 +31,7 @@ s! {
}
}

// should be pub(crate), but that requires Rust 1.18.0
#[doc(hidden)]
pub const _ALIGNBYTES: usize = mem::size_of::<::c_longlong>() - 1;
pub const MAP_32BIT: ::c_int = 0x00080000;
Loading

0 comments on commit 73d48b3

Please sign in to comment.