summaryrefslogtreecommitdiff
path: root/libc
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
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')
-rw-r--r--libc/.travis.yml5
-rw-r--r--libc/Cargo.lock68
-rw-r--r--libc/Cargo.toml2
-rw-r--r--libc/ci/android-install-sdk.sh6
-rw-r--r--libc/libc-test/build.rs2
-rw-r--r--libc/src/unix/bsd/apple/mod.rs39
-rw-r--r--libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs39
-rw-r--r--libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs5
-rw-r--r--libc/src/unix/bsd/freebsdlike/freebsd/mod.rs44
-rw-r--r--libc/src/unix/bsd/freebsdlike/freebsd/x86.rs6
-rw-r--r--libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs5
-rw-r--r--libc/src/unix/bsd/freebsdlike/mod.rs7
-rw-r--r--libc/src/unix/bsd/mod.rs41
-rw-r--r--libc/src/unix/bsd/netbsdlike/mod.rs41
-rw-r--r--libc/src/unix/bsd/netbsdlike/netbsd/aarch64.rs6
-rw-r--r--libc/src/unix/bsd/netbsdlike/netbsd/arm.rs6
-rw-r--r--libc/src/unix/bsd/netbsdlike/netbsd/mod.rs14
-rw-r--r--libc/src/unix/bsd/netbsdlike/netbsd/powerpc.rs6
-rw-r--r--libc/src/unix/bsd/netbsdlike/netbsd/sparc64.rs4
-rw-r--r--libc/src/unix/bsd/netbsdlike/netbsd/x86.rs6
-rw-r--r--libc/src/unix/bsd/netbsdlike/netbsd/x86_64.rs6
-rw-r--r--libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/aarch64.rs6
-rw-r--r--libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86.rs6
-rw-r--r--libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs6
24 files changed, 286 insertions, 90 deletions
diff --git a/libc/.travis.yml b/libc/.travis.yml
index da882ae..52d2403 100644
--- a/libc/.travis.yml
+++ b/libc/.travis.yml
@@ -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:
diff --git a/libc/Cargo.lock b/libc/Cargo.lock
index fb3c107..a8165ea 100644
--- a/libc/Cargo.lock
+++ b/libc/Cargo.lock
@@ -36,7 +36,7 @@ dependencies = [
"rand 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -69,12 +69,12 @@ dependencies = [
[[package]]
name = "libc"
-version = "0.2.46"
+version = "0.2.47"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "libc"
-version = "0.2.47"
+version = "0.2.48"
dependencies = [
"rustc-std-workspace-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -84,7 +84,7 @@ name = "libc-test"
version = "0.1.0"
dependencies = [
"ctest 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.47",
+ "libc 0.2.48",
]
[[package]]
@@ -110,7 +110,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "proc-macro2"
-version = "0.4.24"
+version = "0.4.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -118,10 +118,10 @@ dependencies = [
[[package]]
name = "quote"
-version = "0.6.10"
+version = "0.6.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -130,7 +130,7 @@ version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -182,39 +182,39 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "serde"
-version = "1.0.84"
+version = "1.0.85"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "serde_derive"
-version = "1.0.84"
+version = "1.0.85"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
- "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
- "syn 0.15.24 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)",
+ "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
+ "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "serde_json"
-version = "1.0.35"
+version = "1.0.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "syn"
-version = "0.15.24"
+version = "0.15.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
- "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)",
+ "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -223,9 +223,9 @@ name = "syntex_errors"
version = "0.59.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex_pos 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)",
"term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -236,8 +236,8 @@ name = "syntex_pos"
version = "0.59.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -248,9 +248,9 @@ dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"extprim 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_json 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_json 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex_errors 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex_pos 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -310,12 +310,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b"
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
-"checksum libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)" = "023a4cd09b2ff695f9734c1934145a315594b7986398496841c7031a5a1bbdbd"
+"checksum libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)" = "48450664a984b25d5b479554c29cc04e3150c97aa4c01da5604a2d4ed9151476"
"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"
"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6"
"checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1"
-"checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09"
-"checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c"
+"checksum proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)" = "38fddd23d98b2144d197c0eca5705632d4fe2667d14a6be5df8934f8d74f1978"
+"checksum quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "cdd8e04bd9c52e0342b406469d494fcb033be4bdbe5c606016defbb1681411e1"
"checksum rand 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "dee497e66d8d76bf08ce20c8d36e16f93749ab0bf89975b4f8ae5cee660c2da2"
"checksum rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0905b6b7079ec73b314d4c748701f6931eb79fd97c668caa3f1899b22b32c6db"
"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
@@ -324,10 +324,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7"
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
-"checksum serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)" = "0e732ed5a5592c17d961555e3b552985baf98d50ce418b7b655f31f6ba7eb1b7"
-"checksum serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d6115a3ca25c224e409185325afc16a0d5aaaabc15c42b09587d6f1ba39a5b"
-"checksum serde_json 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)" = "dfb1277d4d0563e4593e0b8b5d23d744d277b55d2bc0bf1c38d0d8a6589d38aa"
-"checksum syn 0.15.24 (registry+https://github.com/rust-lang/crates.io-index)" = "734ecc29cd36e8123850d9bf21dfd62ef8300aaa8f879aabaa899721808be37c"
+"checksum serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)" = "534b8b91a95e0f71bca3ed5824752d558da048d4248c91af873b63bd60519752"
+"checksum serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)" = "a915306b0f1ac5607797697148c223bedeaa36bcc2e28a01441cd638cc6567b4"
+"checksum serde_json 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)" = "574378d957d6dcdf1bbb5d562a15cbd5e644159432f84634b94e485267abbcc7"
+"checksum syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)" = "f92e629aa1d9c827b2bb8297046c1ccffc57c99b947a680d3ccff1f136a3bee9"
"checksum syntex_errors 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3133289179676c9f5c5b2845bf5a2e127769f4889fcbada43035ef6bd662605e"
"checksum syntex_pos 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)" = "30ab669fa003d208c681f874bbc76d91cc3d32550d16b5d9d2087cf477316470"
"checksum syntex_syntax 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03815b9f04d95828770d9c974aa39c6e1f6ef3114eb77a3ce09008a0d15dd142"
diff --git a/libc/Cargo.toml b/libc/Cargo.toml
index 1d61dad..9161644 100644
--- a/libc/Cargo.toml
+++ b/libc/Cargo.toml
@@ -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"
diff --git a/libc/ci/android-install-sdk.sh b/libc/ci/android-install-sdk.sh
index c0f63c9..6b5ac09 100644
--- a/libc/ci/android-install-sdk.sh
+++ b/libc/ci/android-install-sdk.sh
@@ -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" \
diff --git a/libc/libc-test/build.rs b/libc/libc-test/build.rs
index 7606800..5edbdf5 100644
--- a/libc/libc-test/build.rs
+++ b/libc/libc-test/build.rs
@@ -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"
diff --git a/libc/src/unix/bsd/apple/mod.rs b/libc/src/unix/bsd/apple/mod.rs
index 13da82c..837efff 100644
--- a/libc/src/unix/bsd/apple/mod.rs
+++ b/libc/src/unix/bsd/apple/mod.rs
@@ -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;
@@ -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
}
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;
diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs b/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs
index 3d61f88..d33b475 100644
--- a/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs
+++ b/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs
@@ -1,3 +1,5 @@
+use dox::mem;
+
pub type c_long = i64;
pub type c_ulong = u64;
pub type time_t = i64;
@@ -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;
diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs b/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs
index 878deea..91eab30 100644
--- a/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs
+++ b/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs
@@ -1,3 +1,5 @@
+use dox::mem;
+
pub type fflags_t = u32;
pub type clock_t = i32;
pub type ino_t = u32;
@@ -182,6 +184,12 @@ s! {
pub sdl_slen: ::c_uchar,
pub sdl_data: [::c_char; 46],
}
+
+ pub struct stack_t {
+ pub ss_sp: *mut ::c_void,
+ pub ss_size: ::size_t,
+ pub ss_flags: ::c_int,
+ }
}
pub const SIGEV_THREAD_ID: ::c_int = 4;
@@ -962,7 +970,43 @@ pub const UF_READONLY: ::c_ulong = 0x00001000;
pub const UF_HIDDEN: ::c_ulong = 0x00008000;
pub const SF_SNAPSHOT: ::c_ulong = 0x00200000;
+fn _ALIGN(p: usize) -> usize {
+ (p + _ALIGNBYTES) & !_ALIGNBYTES
+}
+
f! {
+ pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar {
+ (cmsg as *mut ::c_uchar)
+ .offset(_ALIGN(mem::size_of::<::cmsghdr>()) as isize)
+ }
+
+ pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
+ _ALIGN(mem::size_of::<::cmsghdr>()) as ::c_uint + length
+ }
+
+ pub fn CMSG_NXTHDR(mhdr: *const ::msghdr, cmsg: *const ::cmsghdr)
+ -> *mut ::cmsghdr
+ {
+ if cmsg.is_null() {
+ return ::CMSG_FIRSTHDR(mhdr);
+ };
+ let next = cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize)
+ + _ALIGN(mem::size_of::<::cmsghdr>());
+ let max = (*mhdr).msg_control as usize
+ + (*mhdr).msg_controllen as usize;
+ if next > max {
+ 0 as *mut ::cmsghdr
+ } else {
+ (cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize))
+ as *mut ::cmsghdr
+ }
+ }
+
+ pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
+ (_ALIGN(mem::size_of::<::cmsghdr>()) + _ALIGN(length as usize))
+ as ::c_uint
+ }
+
pub fn uname(buf: *mut ::utsname) -> ::c_int {
__xuname(256, buf as *mut ::c_void)
}
diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/x86.rs b/libc/src/unix/bsd/freebsdlike/freebsd/x86.rs
index 8a5e5f9..a5495aa 100644
--- a/libc/src/unix/bsd/freebsdlike/freebsd/x86.rs
+++ b/libc/src/unix/bsd/freebsdlike/freebsd/x86.rs
@@ -1,3 +1,5 @@
+use dox::mem;
+
pub type c_long = i32;
pub type c_ulong = u32;
pub type time_t = i32;
@@ -29,3 +31,7 @@ s! {
__unused: [u8; 8],
}
}
+
+// should be pub(crate), but that requires Rust 1.18.0
+#[doc(hidden)]
+pub const _ALIGNBYTES: usize = mem::size_of::<::c_long>() - 1;
diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs b/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs
index 3d61f88..711feb7 100644
--- a/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs
+++ b/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs
@@ -1,3 +1,5 @@
+use dox::mem;
+
pub type c_long = i64;
pub type c_ulong = u64;
pub type time_t = i64;
@@ -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_long>() - 1;
pub const MAP_32BIT: ::c_int = 0x00080000;
diff --git a/libc/src/unix/bsd/freebsdlike/mod.rs b/libc/src/unix/bsd/freebsdlike/mod.rs
index 9829dde..22c11b3 100644
--- a/libc/src/unix/bsd/freebsdlike/mod.rs
+++ b/libc/src/unix/bsd/freebsdlike/mod.rs
@@ -82,13 +82,6 @@ s! {
pub sa_mask: sigset_t,
}
- pub struct stack_t {
- // In FreeBSD 11 and later, ss_sp is actually a void*
- pub ss_sp: *mut ::c_char,
- pub ss_size: ::size_t,
- pub ss_flags: ::c_int,
- }
-
pub struct sched_param {
pub sched_priority: ::c_int,
}
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;
diff --git a/libc/src/unix/bsd/netbsdlike/mod.rs b/libc/src/unix/bsd/netbsdlike/mod.rs
index 15f84d9..291c081 100644
--- a/libc/src/unix/bsd/netbsdlike/mod.rs
+++ b/libc/src/unix/bsd/netbsdlike/mod.rs
@@ -1,3 +1,5 @@
+use dox::mem;
+
pub type time_t = i64;
pub type mode_t = u32;
pub type nlink_t = ::uint32_t;
@@ -593,7 +595,43 @@ pub const SF_APPEND: ::c_ulong = 0x00040000;
pub const TIMER_ABSTIME: ::c_int = 1;
+fn _ALIGN(p: usize) -> usize {
+ (p + _ALIGNBYTES) & !_ALIGNBYTES
+}
+
f! {
+ pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar {
+ (cmsg as *mut ::c_uchar)
+ .offset(_ALIGN(mem::size_of::<::cmsghdr>()) as isize)
+ }
+
+ pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
+ _ALIGN(mem::size_of::<::cmsghdr>()) as ::c_uint + length
+ }
+
+ pub fn CMSG_NXTHDR(mhdr: *const ::msghdr, cmsg: *const ::cmsghdr)
+ -> *mut ::cmsghdr
+ {
+ if cmsg.is_null() {
+ return ::CMSG_FIRSTHDR(mhdr);
+ };
+ let next = cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize)
+ + _ALIGN(mem::size_of::<::cmsghdr>());
+ let max = (*mhdr).msg_control as usize
+ + (*mhdr).msg_controllen as usize;
+ if next > max {
+ 0 as *mut ::cmsghdr
+ } else {
+ (cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize))
+ as *mut ::cmsghdr
+ }
+ }
+
+ pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
+ (_ALIGN(mem::size_of::<::cmsghdr>()) + _ALIGN(length as usize))
+ as ::c_uint
+ }
+
pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
status >> 8
}
@@ -671,9 +709,6 @@ extern {
groups: *mut ::gid_t,
ngroups: *mut ::c_int) -> ::c_int;
pub fn initgroups(name: *const ::c_char, basegid: ::gid_t) -> ::c_int;
- pub fn fexecve(fd: ::c_int, argv: *const *const ::c_char,
- envp: *const *const ::c_char)
- -> ::c_int;
pub fn getdomainname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
pub fn setdomainname(name: *const ::c_char, len: ::size_t) -> ::c_int;
pub fn uname(buf: *mut ::utsname) -> ::c_int;
diff --git a/libc/src/unix/bsd/netbsdlike/netbsd/aarch64.rs b/libc/src/unix/bsd/netbsdlike/netbsd/aarch64.rs
index 66f3301..cda75bc 100644
--- a/libc/src/unix/bsd/netbsdlike/netbsd/aarch64.rs
+++ b/libc/src/unix/bsd/netbsdlike/netbsd/aarch64.rs
@@ -1,3 +1,5 @@
+use dox::mem;
+
use PT_FIRSTMACH;
pub type c_long = i64;
@@ -5,6 +7,10 @@ pub type c_ulong = u64;
pub type c_char = u8;
pub type __cpu_simple_lock_nv_t = ::c_uchar;
+// should be pub(crate), but that requires Rust 1.18.0
+#[doc(hidden)]
+pub const _ALIGNBYTES: usize = mem::size_of::<::c_int>() - 1;
+
pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 0;
pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 1;
pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 2;
diff --git a/libc/src/unix/bsd/netbsdlike/netbsd/arm.rs b/libc/src/unix/bsd/netbsdlike/netbsd/arm.rs
index 9e67316..71c2cb7 100644
--- a/libc/src/unix/bsd/netbsdlike/netbsd/arm.rs
+++ b/libc/src/unix/bsd/netbsdlike/netbsd/arm.rs
@@ -1,3 +1,5 @@
+use dox::mem;
+
use PT_FIRSTMACH;
pub type c_long = i32;
@@ -5,6 +7,10 @@ pub type c_ulong = u32;
pub type c_char = u8;
pub type __cpu_simple_lock_nv_t = ::c_int;
+// 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 PT_GETREGS: ::c_int = PT_FIRSTMACH + 1;
pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 2;
pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 3;
diff --git a/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs b/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs
index 760582c..d3acfb9 100644
--- a/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs
+++ b/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs
@@ -526,15 +526,16 @@ pub const AF_BLUETOOTH: ::c_int = 31;
pub const AF_IEEE80211: ::c_int = 32;
pub const AF_MPLS: ::c_int = 33;
pub const AF_ROUTE: ::c_int = 34;
-pub const AF_MAX: ::c_int = 35;
+pub const AF_MAX: ::c_int = 36;
pub const NET_MAXID: ::c_int = AF_MAX;
pub const NET_RT_DUMP: ::c_int = 1;
pub const NET_RT_FLAGS: ::c_int = 2;
-pub const NET_RT_OOIFLIST: ::c_int = 3;
-pub const NET_RT_OIFLIST: ::c_int = 4;
-pub const NET_RT_IFLIST: ::c_int = 5;
-pub const NET_RT_MAXID: ::c_int = 6;
+pub const NET_RT_OOOIFLIST: ::c_int = 3;
+pub const NET_RT_OOIFLIST: ::c_int = 4;
+pub const NET_RT_OIFLIST: ::c_int = 5;
+pub const NET_RT_IFLIST: ::c_int = 6;
+pub const NET_RT_MAXID: ::c_int = 7;
pub const PF_OROUTE: ::c_int = AF_OROUTE;
pub const PF_ARP: ::c_int = AF_ARP;
@@ -1039,6 +1040,7 @@ f! {
}
}
+#[link(name = "rt")]
extern {
pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
@@ -1051,7 +1053,9 @@ extern {
pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
pub fn lio_listio(mode: ::c_int, aiocb_list: *const *mut aiocb,
nitems: ::c_int, sevp: *mut sigevent) -> ::c_int;
+}
+extern {
pub fn chflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int;
pub fn fchflags(fd: ::c_int, flags: ::c_ulong) -> ::c_int;
pub fn lchflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int;
diff --git a/libc/src/unix/bsd/netbsdlike/netbsd/powerpc.rs b/libc/src/unix/bsd/netbsdlike/netbsd/powerpc.rs
index 54d069e..3c682c3 100644
--- a/libc/src/unix/bsd/netbsdlike/netbsd/powerpc.rs
+++ b/libc/src/unix/bsd/netbsdlike/netbsd/powerpc.rs
@@ -1,3 +1,5 @@
+use dox::mem;
+
use PT_FIRSTMACH;
pub type c_long = i32;
@@ -5,6 +7,10 @@ pub type c_ulong = u32;
pub type c_char = u8;
pub type __cpu_simple_lock_nv_t = ::c_int;
+// should be pub(crate), but that requires Rust 1.18.0
+#[doc(hidden)]
+pub const _ALIGNBYTES: usize = mem::size_of::<::c_double>() - 1;
+
pub const PT_STEP: ::c_int = PT_FIRSTMACH + 0;
pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1;
pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 2;
diff --git a/libc/src/unix/bsd/netbsdlike/netbsd/sparc64.rs b/libc/src/unix/bsd/netbsdlike/netbsd/sparc64.rs
index db8f2a9..6a86759 100644
--- a/libc/src/unix/bsd/netbsdlike/netbsd/sparc64.rs
+++ b/libc/src/unix/bsd/netbsdlike/netbsd/sparc64.rs
@@ -2,3 +2,7 @@ pub type c_long = i64;
pub type c_ulong = u64;
pub type c_char = i8;
pub type __cpu_simple_lock_nv_t = ::c_uchar;
+
+// should be pub(crate), but that requires Rust 1.18.0
+#[doc(hidden)]
+pub const _ALIGNBYTES: usize = 0xf;
diff --git a/libc/src/unix/bsd/netbsdlike/netbsd/x86.rs b/libc/src/unix/bsd/netbsdlike/netbsd/x86.rs
index 8bd1058..4da9968 100644
--- a/libc/src/unix/bsd/netbsdlike/netbsd/x86.rs
+++ b/libc/src/unix/bsd/netbsdlike/netbsd/x86.rs
@@ -1,4 +1,10 @@
+use dox::mem;
+
pub type c_long = i32;
pub type c_ulong = u32;
pub type c_char = i8;
pub type __cpu_simple_lock_nv_t = ::c_uchar;
+
+// should be pub(crate), but that requires Rust 1.18.0
+#[doc(hidden)]
+pub const _ALIGNBYTES: usize = mem::size_of::<::c_int>() - 1;
diff --git a/libc/src/unix/bsd/netbsdlike/netbsd/x86_64.rs b/libc/src/unix/bsd/netbsdlike/netbsd/x86_64.rs
index 8d3de84..af1b8f8 100644
--- a/libc/src/unix/bsd/netbsdlike/netbsd/x86_64.rs
+++ b/libc/src/unix/bsd/netbsdlike/netbsd/x86_64.rs
@@ -1,3 +1,5 @@
+use dox::mem;
+
use PT_FIRSTMACH;
pub type c_long = i64;
@@ -5,6 +7,10 @@ pub type c_ulong = u64;
pub type c_char = i8;
pub type __cpu_simple_lock_nv_t = ::c_uchar;
+// should be pub(crate), but that requires Rust 1.18.0
+#[doc(hidden)]
+pub const _ALIGNBYTES: usize = mem::size_of::<::c_long>() - 1;
+
pub const PT_STEP: ::c_int = PT_FIRSTMACH + 0;
pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1;
pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 2;
diff --git a/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/aarch64.rs b/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/aarch64.rs
index 6aa9950..2a28c2a 100644
--- a/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/aarch64.rs
+++ b/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/aarch64.rs
@@ -1,3 +1,9 @@
+use dox::mem;
+
pub type c_long = i64;
pub type c_ulong = u64;
pub type c_char = u8;
+
+// should be pub(crate), but that requires Rust 1.18.0
+#[doc(hidden)]
+pub const _ALIGNBYTES: usize = mem::size_of::<::c_long>() - 1;
diff --git a/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86.rs b/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86.rs
index a00e333..b63b69f 100644
--- a/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86.rs
+++ b/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86.rs
@@ -1,3 +1,9 @@
+use dox::mem;
+
pub type c_long = i32;
pub type c_ulong = u32;
pub type c_char = i8;
+
+// should be pub(crate), but that requires Rust 1.18.0
+#[doc(hidden)]
+pub const _ALIGNBYTES: usize = mem::size_of::<::c_int>() - 1;
diff --git a/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs b/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs
index 3bc7f52..581096f 100644
--- a/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs
+++ b/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs
@@ -1,9 +1,15 @@
+use dox::mem;
+
use PT_FIRSTMACH;
pub type c_long = i64;
pub type c_ulong = u64;
pub type c_char = i8;
+// should be pub(crate), but that requires Rust 1.18.0
+#[doc(hidden)]
+pub const _ALIGNBYTES: usize = mem::size_of::<::c_long>() - 1;
+
pub const PT_STEP: ::c_int = PT_FIRSTMACH + 0;
pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1;
pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 2;