Merge pull request #17 from rust-lang/master

Sync to rust-lang/libc branch master
This commit is contained in:
Baoshan 2019-09-24 13:40:28 -07:00 committed by GitHub
commit a195fd4ac6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
57 changed files with 400 additions and 65 deletions

View File

@ -1,3 +1,17 @@
task:
name: nightly x86_64-unknown-freebsd-10
freebsd_instance:
image: freebsd-10-4-release-amd64
setup_script:
- pkg install -y curl
- curl https://sh.rustup.rs -sSf --output rustup.sh
- sh rustup.sh --default-toolchain nightly -y
- . $HOME/.cargo/env
- rustup default nightly
test_script:
- . $HOME/.cargo/env
- LIBC_CI=1 sh ci/run.sh x86_64-unknown-freebsd
task:
name: stable x86_64-unknown-freebsd-11
freebsd_instance:

View File

@ -21,7 +21,7 @@ Consequently, this indicates where an API should be added! Adding an API at a
particular level in the hierarchy means that it is supported on all the child
platforms of that level. For example, when adding a Unix API it should be added
to `src/unix/mod.rs`, but when adding a Linux-only API it should be added to
`src/unix/notbsd/linux/mod.rs`.
`src/unix/linux_like/linux/mod.rs`.
If you're not 100% sure at what level of the hierarchy an API should be added
at, fear not! This crate has CI support which tests any binding against all

View File

@ -16,11 +16,15 @@ fn main() {
);
}
// The ABI of libc is backward compatible with FreeBSD 11.
// The ABI of libc used by libstd is backward compatible with FreeBSD 10.
// The ABI of libc from crates.io is backward compatible with FreeBSD 11.
//
// On CI, we detect the actual FreeBSD version and match its ABI exactly,
// running tests to ensure that the ABI is correct.
match which_freebsd() {
Some(10) if libc_ci || rustc_dep_of_std => {
println!("cargo:rustc-cfg=freebsd10")
}
Some(11) if libc_ci => println!("cargo:rustc-cfg=freebsd11"),
Some(12) if libc_ci => println!("cargo:rustc-cfg=freebsd12"),
Some(13) if libc_ci => println!("cargo:rustc-cfg=freebsd13"),
@ -109,6 +113,7 @@ fn which_freebsd() -> Option<i32> {
let stdout = stdout.unwrap();
match &stdout {
s if s.starts_with("10") => Some(10),
s if s.starts_with("11") => Some(11),
s if s.starts_with("12") => Some(12),
s if s.starts_with("13") => Some(13),

View File

@ -25,7 +25,7 @@ jobs:
TARGET: x86_64-unknown-linux-gnu
- job: DockerLinuxTier2
dependsOn: DockerLinuxTier1
#dependsOn: DockerLinuxTier1
pool:
vmImage: ubuntu-16.04
steps:

View File

@ -2,6 +2,8 @@
# Checks that libc builds properly for all supported targets on a particular
# Rust version:
# The FILTER environment variable can be used to select which target(s) to build.
# For example: set FILTER to vxworks to select the targets that has vxworks in name
set -ex
@ -176,7 +178,9 @@ case "${OS}" in
esac
for TARGET in $TARGETS; do
test_target build "$TARGET"
if echo "$TARGET"|grep -q "$FILTER";then
test_target build "$TARGET"
fi
done
# FIXME: https://github.com/rust-lang/rust/issues/58564
@ -237,7 +241,9 @@ powerpc64-wrs-vxworks \
if [ "${RUST}" = "nightly" ] && [ "${OS}" = "linux" ]; then
for TARGET in $RUST_LINUX_NO_CORE_TARGETS; do
test_target xbuild "$TARGET" 1
if echo "$TARGET"|grep -q "$FILTER";then
test_target xbuild "$TARGET" 1
fi
done
# Nintendo switch

View File

@ -31,6 +31,23 @@ fn do_ctest() {
}
}
fn ctest_cfg() -> ctest::TestGenerator {
let mut cfg = ctest::TestGenerator::new();
let libc_cfgs = [
"libc_priv_mod_use",
"libc_union",
"libc_const_size_of",
"libc_align",
"libc_core_cvoid",
"libc_packedN",
"libc_thread_local",
];
for f in &libc_cfgs {
cfg.cfg(f, None);
}
cfg
}
fn main() {
do_cc();
do_ctest();
@ -59,8 +76,9 @@ macro_rules! headers {
fn test_apple(target: &str) {
assert!(target.contains("apple"));
let x86_64 = target.contains("x86_64");
let i686 = target.contains("i686");
let mut cfg = ctest::TestGenerator::new();
let mut cfg = ctest_cfg();
cfg.flag("-Wno-deprecated-declarations");
cfg.define("__APPLE_USE_RFC_3542", None);
@ -225,13 +243,18 @@ fn test_apple(target: &str) {
}
});
cfg.skip_roundtrip(move |s| match s {
// FIXME: this type has the wrong ABI
"max_align_t" if i686 => true,
_ => false,
});
cfg.generate("../src/lib.rs", "main.rs");
}
fn test_openbsd(target: &str) {
assert!(target.contains("openbsd"));
let mut cfg = ctest::TestGenerator::new();
let mut cfg = ctest_cfg();
cfg.flag("-Wno-deprecated-declarations");
headers! { cfg:
@ -371,7 +394,7 @@ fn test_windows(target: &str) {
assert!(target.contains("windows"));
let gnu = target.contains("gnu");
let mut cfg = ctest::TestGenerator::new();
let mut cfg = ctest_cfg();
cfg.define("_WIN32_WINNT", Some("0x8000"));
headers! { cfg:
@ -474,7 +497,7 @@ fn test_windows(target: &str) {
fn test_redox(target: &str) {
assert!(target.contains("redox"));
let mut cfg = ctest::TestGenerator::new();
let mut cfg = ctest_cfg();
cfg.flag("-Wno-deprecated-declarations");
headers! {
@ -540,7 +563,7 @@ fn test_redox(target: &str) {
fn test_cloudabi(target: &str) {
assert!(target.contains("cloudabi"));
let mut cfg = ctest::TestGenerator::new();
let mut cfg = ctest_cfg();
cfg.flag("-Wno-deprecated-declarations");
headers! {
@ -611,7 +634,7 @@ fn test_cloudabi(target: &str) {
fn test_solaris(target: &str) {
assert!(target.contains("solaris"));
let mut cfg = ctest::TestGenerator::new();
let mut cfg = ctest_cfg();
cfg.flag("-Wno-deprecated-declarations");
cfg.define("_XOPEN_SOURCE", Some("700"));
@ -722,7 +745,7 @@ fn test_solaris(target: &str) {
fn test_netbsd(target: &str) {
assert!(target.contains("netbsd"));
let rumprun = target.contains("rumprun");
let mut cfg = ctest::TestGenerator::new();
let mut cfg = ctest_cfg();
cfg.flag("-Wno-deprecated-declarations");
cfg.define("_NETBSD_SOURCE", Some("1"));
@ -922,7 +945,7 @@ fn test_netbsd(target: &str) {
fn test_dragonflybsd(target: &str) {
assert!(target.contains("dragonfly"));
let mut cfg = ctest::TestGenerator::new();
let mut cfg = ctest_cfg();
cfg.flag("-Wno-deprecated-declarations");
headers! {
@ -1127,7 +1150,7 @@ fn test_dragonflybsd(target: &str) {
fn test_wasi(target: &str) {
assert!(target.contains("wasi"));
let mut cfg = ctest::TestGenerator::new();
let mut cfg = ctest_cfg();
cfg.define("_GNU_SOURCE", None);
headers! { cfg:
@ -1204,7 +1227,7 @@ fn test_android(target: &str) {
};
let x86 = target.contains("i686") || target.contains("x86_64");
let mut cfg = ctest::TestGenerator::new();
let mut cfg = ctest_cfg();
cfg.define("_GNU_SOURCE", None);
headers! { cfg:
@ -1429,11 +1452,12 @@ fn test_android(target: &str) {
fn test_freebsd(target: &str) {
assert!(target.contains("freebsd"));
let mut cfg = ctest::TestGenerator::new();
let mut cfg = ctest_cfg();
let freebsd_ver = which_freebsd();
match freebsd_ver {
Some(10) => cfg.cfg("freebsd10", None),
Some(11) => cfg.cfg("freebsd11", None),
Some(12) => cfg.cfg("freebsd12", None),
Some(13) => cfg.cfg("freebsd13", None),
@ -1443,7 +1467,10 @@ fn test_freebsd(target: &str) {
// Required for `getline`:
cfg.define("_WITH_GETLINE", None);
// Required for making freebsd11_stat available in the headers
cfg.define("_WANT_FREEBSD11_STAT", None);
match freebsd_ver {
Some(10) => &mut cfg,
_ => cfg.define("_WANT_FREEBSD11_STAT", None),
};
headers! { cfg:
"aio.h",
@ -1571,6 +1598,34 @@ fn test_freebsd(target: &str) {
true
}
// These constants were introduced in FreeBSD 11:
"SF_USER_READAHEAD"
| "SF_NOCACHE"
| "RLIMIT_KQUEUES"
| "RLIMIT_UMTXP"
| "EVFILT_PROCDESC"
| "EVFILT_SENDFILE"
| "EVFILT_EMPTY"
| "SO_REUSEPORT_LB"
| "TCP_CCALGOOPT"
| "TCP_PCAP_OUT"
| "TCP_PCAP_IN"
| "IP_BINDMULTI"
| "IP_ORIGDSTADDR"
| "IP_RECVORIGDSTADDR"
| "IPV6_ORIGDSTADDR"
| "IPV6_RECVORIGDSTADDR"
| "PD_CLOEXEC"
| "PD_ALLOWED_AT_FORK"
| "IP_RSS_LISTEN_BUCKET"
if Some(10) == freebsd_ver =>
{
true
}
// FIXME: This constant has a different value in FreeBSD 10:
"RLIM_NLIMITS" if Some(10) == freebsd_ver => true,
// FIXME: There are deprecated - remove in a couple of releases.
// These constants were removed in FreeBSD 11 (svn r273250) but will
// still be accepted and ignored at runtime.
@ -1586,12 +1641,35 @@ fn test_freebsd(target: &str) {
}
});
cfg.skip_struct(move |ty| {
match ty {
// `mmsghdr` is not available in FreeBSD 10
"mmsghdr" if Some(10) == freebsd_ver => true,
// `max_align_t` is not available in FreeBSD 10
"max_align_t" if Some(10) == freebsd_ver => true,
_ => false,
}
});
cfg.skip_fn(move |name| {
// skip those that are manually verified
match name {
// FIXME: https://github.com/rust-lang/libc/issues/1272
"execv" | "execve" | "execvp" | "execvpe" | "fexecve" => true,
// These functions were added in FreeBSD 11:
"fdatasync" | "mq_getfd_np" | "sendmmsg" | "recvmmsg"
if Some(10) == freebsd_ver =>
{
true
}
// This function changed its return type from `int` in FreeBSD10 to
// `ssize_t` in FreeBSD11:
"aio_waitcomplete" if Some(10) == freebsd_ver => true,
// The `uname` function in the `utsname.h` FreeBSD header is a C
// inline function (has no symbol) that calls the `__xuname` symbol.
// Therefore the function pointer comparison does not make sense for it.
@ -1607,6 +1685,14 @@ fn test_freebsd(target: &str) {
}
});
cfg.skip_signededness(move |c| {
match c {
// FIXME: has a different sign in FreeBSD10
"blksize_t" if Some(10) == freebsd_ver => true,
_ => false,
}
});
cfg.volatile_item(|i| {
use ctest::VolatileItemKind::*;
match i {
@ -1620,9 +1706,17 @@ fn test_freebsd(target: &str) {
});
cfg.skip_field(move |struct_, field| {
// FIXME: `sa_sigaction` has type `sighandler_t` but that type is
// incorrect, see: https://github.com/rust-lang/libc/issues/1359
(struct_ == "sigaction" && field == "sa_sigaction")
match (struct_, field) {
// FIXME: `sa_sigaction` has type `sighandler_t` but that type is
// incorrect, see: https://github.com/rust-lang/libc/issues/1359
("sigaction", "sa_sigaction") => true,
// FIXME: in FreeBSD10 this field has type `char*` instead of
// `void*`:
("stack_t", "ss_sp") if Some(10) == freebsd_ver => true,
_ => false,
}
});
cfg.generate("../src/lib.rs", "main.rs");
@ -1631,7 +1725,7 @@ fn test_freebsd(target: &str) {
fn test_emscripten(target: &str) {
assert!(target.contains("emscripten"));
let mut cfg = ctest::TestGenerator::new();
let mut cfg = ctest_cfg();
cfg.define("_GNU_SOURCE", None); // FIXME: ??
headers! { cfg:
@ -1852,17 +1946,19 @@ fn test_linux(target: &str) {
}
let arm = target.contains("arm");
let x86_64 = target.contains("x86_64");
let x86_32 = target.contains("i686");
let x32 = target.contains("x32");
let i686 = target.contains("i686");
let mips = target.contains("mips");
let mips32 = mips && !target.contains("64");
let mips64 = mips && target.contains("64");
let mips32_musl = mips32 && musl;
let sparc64 = target.contains("sparc64");
let mips64 = mips && target.contains("64");
let ppc64 = target.contains("powerpc64");
let s390x = target.contains("s390x");
let sparc64 = target.contains("sparc64");
let x32 = target.contains("x32");
let x86_32 = target.contains("i686");
let x86_64 = target.contains("x86_64");
let mut cfg = ctest::TestGenerator::new();
let mut cfg = ctest_cfg();
cfg.define("_GNU_SOURCE", None);
// This macro re-deifnes fscanf,scanf,sscanf to link to the symbols that are
// deprecated since glibc >= 2.29. This allows Rust binaries to link against
@ -2286,6 +2382,9 @@ fn test_linux(target: &str) {
true
}
// FIXME: the call ABI of max_align_t is incorrect on these platforms:
"max_align_t" if i686 || mips64 || ppc64 => true,
_ => false,
});
@ -2305,7 +2404,7 @@ fn test_linux_like_apis(target: &str) {
if linux || android || emscripten {
// test strerror_r from the `string.h` header
let mut cfg = ctest::TestGenerator::new();
let mut cfg = ctest_cfg();
cfg.skip_type(|_| true).skip_static(|_| true);
headers! { cfg: "string.h" }
@ -2321,7 +2420,7 @@ fn test_linux_like_apis(target: &str) {
if linux || android || emscripten {
// test fcntl - see:
// http://man7.org/linux/man-pages/man2/fcntl.2.html
let mut cfg = ctest::TestGenerator::new();
let mut cfg = ctest_cfg();
if musl {
cfg.header("fcntl.h");
@ -2351,7 +2450,7 @@ fn test_linux_like_apis(target: &str) {
if linux || android {
// test termios
let mut cfg = ctest::TestGenerator::new();
let mut cfg = ctest_cfg();
cfg.header("asm/termbits.h");
cfg.skip_type(|_| true)
.skip_static(|_| true)
@ -2368,7 +2467,7 @@ fn test_linux_like_apis(target: &str) {
if linux || android {
// test IPV6_ constants:
let mut cfg = ctest::TestGenerator::new();
let mut cfg = ctest_cfg();
headers! {
cfg:
"linux/in6.h"
@ -2399,7 +2498,7 @@ fn test_linux_like_apis(target: &str) {
// These types have a field called `p_type`, but including
// "resolve.h" defines a `p_type` macro that expands to `__p_type`
// making the tests for these fails when both are included.
let mut cfg = ctest::TestGenerator::new();
let mut cfg = ctest_cfg();
cfg.header("elf.h");
cfg.skip_fn(|_| true)
.skip_static(|_| true)
@ -2429,6 +2528,7 @@ fn which_freebsd() -> Option<i32> {
let stdout = String::from_utf8(output.stdout).ok()?;
match &stdout {
s if s.starts_with("10") => Some(10),
s if s.starts_with("11") => Some(11),
s if s.starts_with("12") => Some(12),
s if s.starts_with("13") => Some(13),

View File

@ -3732,7 +3732,7 @@ extern "C" {
native: ::pthread_t,
value: *mut *mut ::c_void,
) -> ::c_int;
pub fn pthread_exit(value: *mut ::c_void);
pub fn pthread_exit(value: *mut ::c_void) -> !;
pub fn pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int;
pub fn pthread_attr_destroy(attr: *mut ::pthread_attr_t) -> ::c_int;
pub fn pthread_attr_setstacksize(

View File

@ -0,0 +1,3 @@
#[derive(Copy, Clone, Debug, PartialEq)]
#[repr(C, align(16))]
pub struct max_align_t([f64; 2]);

View File

@ -106,3 +106,10 @@ extern "C" {
options: ::c_ulong,
) -> ::c_int;
}
cfg_if! {
if #[cfg(libc_align)] {
mod align;
pub use self::align::*;
}
}

View File

@ -0,0 +1,3 @@
#[derive(Copy, Clone, Debug, PartialEq)]
#[repr(C, align(16))]
pub struct max_align_t([f64; 2]);

View File

@ -111,3 +111,10 @@ extern "C" {
options: ::c_uint,
) -> ::c_int;
}
cfg_if! {
if #[cfg(libc_align)] {
mod align;
pub use self::align::*;
}
}

View File

@ -1456,7 +1456,7 @@ cfg_if! {
} else if #[cfg(freebsd13)] {
mod freebsd12;
pub use self::freebsd12::*;
} else if #[cfg(freebsd11)] {
} else if #[cfg(any(freebsd10, freebsd11))] {
mod freebsd11;
pub use self::freebsd11::*;
} else {

View File

@ -0,0 +1,3 @@
#[derive(Copy, Clone, Debug, PartialEq)]
#[repr(C, align(16))]
pub struct max_align_t([f64; 4]);

View File

@ -15,3 +15,10 @@ cfg_if! {
}
}
pub const MAP_32BIT: ::c_int = 0x00080000;
cfg_if! {
if #[cfg(libc_align)] {
mod align;
pub use self::align::*;
}
}

View File

@ -1193,7 +1193,7 @@ extern "C" {
pub fn getutxline(ut: *const utmpx) -> *mut utmpx;
pub fn initgroups(name: *const ::c_char, basegid: ::gid_t) -> ::c_int;
#[cfg_attr(
all(target_os = "freebsd", freebsd11),
all(target_os = "freebsd", any(freebsd11, freebsd10)),
link_name = "kevent@FBSD_1.0"
)]
pub fn kevent(
@ -1223,7 +1223,7 @@ extern "C" {
mode: ::mode_t,
) -> ::c_int;
#[cfg_attr(
all(target_os = "freebsd", freebsd11),
all(target_os = "freebsd", any(freebsd11, freebsd10)),
link_name = "mknodat@FBSD_1.1"
)]
pub fn mknodat(
@ -1241,13 +1241,13 @@ extern "C" {
mqd: ::mqd_t,
msg_ptr: *mut ::c_char,
msg_len: ::size_t,
msq_prio: *mut ::c_uint,
msg_prio: *mut ::c_uint,
) -> ::ssize_t;
pub fn mq_send(
mqd: ::mqd_t,
msg_ptr: *const ::c_char,
msg_len: ::size_t,
msq_prio: ::c_uint,
msg_prio: ::c_uint,
) -> ::c_int;
pub fn mq_setattr(
mqd: ::mqd_t,
@ -1258,14 +1258,14 @@ extern "C" {
mqd: ::mqd_t,
msg_ptr: *mut ::c_char,
msg_len: ::size_t,
msq_prio: *mut ::c_uint,
msg_prio: *mut ::c_uint,
abs_timeout: *const ::timespec,
) -> ::ssize_t;
pub fn mq_timedsend(
mqd: ::mqd_t,
msg_ptr: *const ::c_char,
msg_len: ::size_t,
msq_prio: ::c_uint,
msg_prio: ::c_uint,
abs_timeout: *const ::timespec,
) -> ::c_int;
pub fn mq_unlink(name: *const ::c_char) -> ::c_int;

View File

@ -558,7 +558,7 @@ extern "C" {
#[cfg_attr(target_os = "macos", link_name = "glob$INODE64")]
#[cfg_attr(target_os = "netbsd", link_name = "__glob30")]
#[cfg_attr(
all(target_os = "freebsd", freebsd11),
all(target_os = "freebsd", any(freebsd11, freebsd10)),
link_name = "glob@FBSD_1.0"
)]
pub fn glob(
@ -571,7 +571,7 @@ extern "C" {
) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__globfree30")]
#[cfg_attr(
all(target_os = "freebsd", freebsd11),
all(target_os = "freebsd", any(freebsd11, freebsd10)),
link_name = "globfree@FBSD_1.0"
)]
pub fn globfree(pglob: *mut ::glob_t);

View File

@ -1627,13 +1627,13 @@ extern "C" {
mqd: ::mqd_t,
msg_ptr: *mut ::c_char,
msg_len: ::size_t,
msq_prio: *mut ::c_uint,
msg_prio: *mut ::c_uint,
) -> ::ssize_t;
pub fn mq_send(
mqd: ::mqd_t,
msg_ptr: *const ::c_char,
msg_len: ::size_t,
msq_prio: ::c_uint,
msg_prio: ::c_uint,
) -> ::c_int;
pub fn mq_setattr(
mqd: ::mqd_t,
@ -1645,7 +1645,7 @@ extern "C" {
mqd: ::mqd_t,
msg_ptr: *mut ::c_char,
msg_len: ::size_t,
msq_prio: *mut ::c_uint,
msg_prio: *mut ::c_uint,
abs_timeout: *const ::timespec,
) -> ::ssize_t;
#[link_name = "__mq_timedsend50"]
@ -1653,7 +1653,7 @@ extern "C" {
mqd: ::mqd_t,
msg_ptr: *const ::c_char,
msg_len: ::size_t,
msq_prio: ::c_uint,
msg_prio: ::c_uint,
abs_timeout: *const ::timespec,
) -> ::c_int;
pub fn mq_unlink(name: *const ::c_char) -> ::c_int;

View File

@ -0,0 +1,3 @@
#[derive(Copy, Clone, Debug, PartialEq)]
#[repr(C, align(8))]
pub struct max_align_t([f64; 2]);

View File

@ -413,3 +413,10 @@ pub const CS: ::c_int = 13;
pub const EFL: ::c_int = 14;
pub const UESP: ::c_int = 15;
pub const SS: ::c_int = 16;
cfg_if! {
if #[cfg(libc_align)] {
mod align;
pub use self::align::*;
}
}

View File

@ -0,0 +1,3 @@
#[derive(Copy, Clone, Debug, PartialEq)]
#[repr(C, align(16))]
pub struct max_align_t([f32; 8]);

View File

@ -323,3 +323,10 @@ pub const SYS_pkey_mprotect: ::c_long = 288;
pub const SYS_pkey_alloc: ::c_long = 289;
pub const SYS_pkey_free: ::c_long = 290;
pub const SYS_syscalls: ::c_long = 292;
cfg_if! {
if #[cfg(libc_align)] {
mod align;
pub use self::align::*;
}
}

View File

@ -0,0 +1,3 @@
#[derive(Copy, Clone, Debug, PartialEq)]
#[repr(C, align(16))]
pub struct max_align_t([f64; 4]);

View File

@ -418,3 +418,10 @@ pub const DS: ::c_int = 23;
pub const ES: ::c_int = 24;
pub const FS: ::c_int = 25;
pub const GS: ::c_int = 26;
cfg_if! {
if #[cfg(libc_align)] {
mod align;
pub use self::align::*;
}
}

View File

@ -1,5 +1,9 @@
macro_rules! expand_align {
() => {
#[derive(Copy, Clone, Debug, PartialEq)]
#[repr(C, align(8))]
pub struct max_align_t([f64; 2]);
s! {
#[repr(align(4))]
pub struct pthread_mutex_t {

View File

@ -0,0 +1,3 @@
#[derive(Copy, Clone, Debug, PartialEq)]
#[repr(C, align(8))]
pub struct max_align_t([i64; 2]);

View File

@ -859,3 +859,10 @@ pub const SYS_pkey_mprotect: ::c_long = 394;
pub const SYS_pkey_alloc: ::c_long = 395;
pub const SYS_pkey_free: ::c_long = 396;
pub const SYS_statx: ::c_long = 397;
cfg_if! {
if #[cfg(libc_align)] {
mod align;
pub use self::align::*;
}
}

View File

@ -0,0 +1,3 @@
#[derive(Copy, Clone, Debug, PartialEq)]
#[repr(C, align(8))]
pub struct max_align_t([f32; 4]);

View File

@ -891,3 +891,10 @@ pub const TIOCM_RNG: ::c_int = 0x200;
pub const TIOCM_DSR: ::c_int = 0x400;
pub const EHWPOISON: ::c_int = 168;
cfg_if! {
if #[cfg(libc_align)] {
mod align;
pub use self::align::*;
}
}

View File

@ -0,0 +1,3 @@
#[derive(Copy, Clone, Debug, PartialEq)]
#[repr(C, align(16))]
pub struct max_align_t([f64; 6]);

View File

@ -1147,3 +1147,10 @@ extern "C" {
ucp: *const ucontext_t,
) -> ::c_int;
}
cfg_if! {
if #[cfg(libc_align)] {
mod align;
pub use self::align::*;
}
}

View File

@ -0,0 +1,3 @@
#[derive(Copy, Clone, Debug, PartialEq)]
#[repr(C, align(16))]
pub struct max_align_t([f32; 8]);

View File

@ -936,3 +936,10 @@ extern "C" {
newlen: ::size_t,
) -> ::c_int;
}
cfg_if! {
if #[cfg(libc_align)] {
mod align;
pub use self::align::*;
}
}

View File

@ -0,0 +1,3 @@
#[derive(Copy, Clone, Debug, PartialEq)]
#[repr(C, align(16))]
pub struct max_align_t([f64; 4]);

View File

@ -999,3 +999,10 @@ extern "C" {
newlen: ::size_t,
) -> ::c_int;
}
cfg_if! {
if #[cfg(libc_align)] {
mod align;
pub use self::align::*;
}
}

View File

@ -0,0 +1,3 @@
#[derive(Copy, Clone, Debug, PartialEq)]
#[repr(C, align(16))]
pub struct max_align_t([i64; 4]);

View File

@ -1035,3 +1035,10 @@ extern "C" {
newlen: ::size_t,
) -> ::c_int;
}
cfg_if! {
if #[cfg(libc_align)] {
mod align;
pub use self::align::*;
}
}

View File

@ -0,0 +1,3 @@
#[derive(Copy, Clone, Debug, PartialEq)]
#[repr(C, align(16))]
pub struct max_align_t([i64; 4]);

View File

@ -970,3 +970,10 @@ extern "C" {
newlen: ::size_t,
) -> ::c_int;
}
cfg_if! {
if #[cfg(libc_align)] {
mod align;
pub use self::align::*;
}
}

View File

@ -0,0 +1,3 @@
#[derive(Copy, Clone, Debug, PartialEq)]
#[repr(C, align(16))]
pub struct max_align_t([f64; 4]);

View File

@ -906,3 +906,10 @@ cfg_if! {
pub use self::not_x32::*;
}
}
cfg_if! {
if #[cfg(libc_align)] {
mod align;
pub use self::align::*;
}
}

View File

@ -2535,26 +2535,26 @@ extern "C" {
mqd: ::mqd_t,
msg_ptr: *mut ::c_char,
msg_len: ::size_t,
msq_prio: *mut ::c_uint,
msg_prio: *mut ::c_uint,
) -> ::ssize_t;
pub fn mq_timedreceive(
mqd: ::mqd_t,
msg_ptr: *mut ::c_char,
msg_len: ::size_t,
msq_prio: *mut ::c_uint,
msg_prio: *mut ::c_uint,
abs_timeout: *const ::timespec,
) -> ::ssize_t;
pub fn mq_send(
mqd: ::mqd_t,
msg_ptr: *const ::c_char,
msg_len: ::size_t,
msq_prio: ::c_uint,
msg_prio: ::c_uint,
) -> ::c_int;
pub fn mq_timedsend(
mqd: ::mqd_t,
msg_ptr: *const ::c_char,
msg_len: ::size_t,
msq_prio: ::c_uint,
msg_prio: ::c_uint,
abs_timeout: *const ::timespec,
) -> ::c_int;
pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int;

View File

@ -0,0 +1,3 @@
#[derive(Copy, Clone, Debug, PartialEq)]
#[repr(C, align(8))]
pub struct max_align_t(i64, i64);

View File

@ -835,3 +835,10 @@ extern "C" {
flags: ::c_uint,
) -> ::ssize_t;
}
cfg_if! {
if #[cfg(libc_align)] {
mod align;
pub use self::align::*;
}
}

View File

@ -0,0 +1,3 @@
#[derive(Copy, Clone, Debug, PartialEq)]
#[repr(C, align(8))]
pub struct max_align_t([f32; 4]);

View File

@ -836,3 +836,10 @@ pub const SYS_mlock2: ::c_long = 4000 + 359;
pub const SYS_copy_file_range: ::c_long = 4000 + 360;
pub const SYS_preadv2: ::c_long = 4000 + 361;
pub const SYS_pwritev2: ::c_long = 4000 + 362;
cfg_if! {
if #[cfg(libc_align)] {
mod align;
pub use self::align::*;
}
}

View File

@ -0,0 +1,3 @@
#[derive(Copy, Clone, Debug, PartialEq)]
#[repr(C, align(8))]
pub struct max_align_t([f64; 3]);

View File

@ -943,3 +943,10 @@ extern "C" {
flags: ::c_uint,
) -> ::ssize_t;
}
cfg_if! {
if #[cfg(libc_align)] {
mod align;
pub use self::align::*;
}
}

View File

@ -0,0 +1,3 @@
#[derive(Copy, Clone, Debug, PartialEq)]
#[repr(C, align(16))]
pub struct max_align_t([f32; 8]);

View File

@ -645,3 +645,10 @@ pub const TIOCM_RI: ::c_int = TIOCM_RNG;
extern "C" {
pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
}
cfg_if! {
if #[cfg(libc_align)] {
mod align;
pub use self::align::*;
}
}

View File

@ -0,0 +1,3 @@
#[derive(Copy, Clone, Debug, PartialEq)]
#[repr(C, align(16))]
pub struct max_align_t([f64; 4]);

View File

@ -917,3 +917,10 @@ pub const TIOCM_RI: ::c_int = TIOCM_RNG;
extern "C" {
pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
}
cfg_if! {
if #[cfg(libc_align)] {
mod align;
pub use self::align::*;
}
}

View File

@ -669,7 +669,7 @@ extern "C" {
#[cfg_attr(target_os = "macos", link_name = "fstat$INODE64")]
#[cfg_attr(target_os = "netbsd", link_name = "__fstat50")]
#[cfg_attr(
all(target_os = "freebsd", freebsd11),
all(target_os = "freebsd", any(freebsd11, freebsd10)),
link_name = "fstat@FBSD_1.0"
)]
pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int;
@ -679,7 +679,7 @@ extern "C" {
#[cfg_attr(target_os = "macos", link_name = "stat$INODE64")]
#[cfg_attr(target_os = "netbsd", link_name = "__stat50")]
#[cfg_attr(
all(target_os = "freebsd", freebsd11),
all(target_os = "freebsd", any(freebsd11, freebsd10)),
link_name = "stat@FBSD_1.0"
)]
pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int;
@ -722,7 +722,7 @@ extern "C" {
#[cfg_attr(target_os = "macos", link_name = "readdir$INODE64")]
#[cfg_attr(target_os = "netbsd", link_name = "__readdir30")]
#[cfg_attr(
all(target_os = "freebsd", freebsd11),
all(target_os = "freebsd", any(freebsd11, freebsd10)),
link_name = "readdir@FBSD_1.0"
)]
pub fn readdir(dirp: *mut ::DIR) -> *mut ::dirent;
@ -757,7 +757,7 @@ extern "C" {
) -> ::c_int;
#[cfg_attr(target_os = "macos", link_name = "fstatat$INODE64")]
#[cfg_attr(
all(target_os = "freebsd", freebsd11),
all(target_os = "freebsd", any(freebsd11, freebsd10)),
link_name = "fstatat@FBSD_1.1"
)]
pub fn fstatat(
@ -989,7 +989,7 @@ extern "C" {
#[cfg_attr(target_os = "macos", link_name = "lstat$INODE64")]
#[cfg_attr(target_os = "netbsd", link_name = "__lstat50")]
#[cfg_attr(
all(target_os = "freebsd", freebsd11),
all(target_os = "freebsd", any(freebsd11, freebsd10)),
link_name = "lstat@FBSD_1.0"
)]
pub fn lstat(path: *const c_char, buf: *mut stat) -> ::c_int;
@ -1048,7 +1048,7 @@ extern "C" {
native: ::pthread_t,
value: *mut *mut ::c_void,
) -> ::c_int;
pub fn pthread_exit(value: *mut ::c_void);
pub fn pthread_exit(value: *mut ::c_void) -> !;
pub fn pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int;
pub fn pthread_attr_destroy(attr: *mut ::pthread_attr_t) -> ::c_int;
pub fn pthread_attr_setstacksize(
@ -1242,7 +1242,7 @@ extern "C" {
#[cfg_attr(target_os = "netbsd", link_name = "__mknod50")]
#[cfg_attr(
all(target_os = "freebsd", freebsd11),
all(target_os = "freebsd", any(freebsd11, freebsd10)),
link_name = "mknod@FBSD_1.0"
)]
pub fn mknod(
@ -1458,7 +1458,7 @@ cfg_if! {
#[cfg_attr(target_os = "macos", link_name = "readdir_r$INODE64")]
#[cfg_attr(target_os = "netbsd", link_name = "__readdir_r30")]
#[cfg_attr(
all(target_os = "freebsd", freebsd11),
all(target_os = "freebsd", any(freebsd11, freebsd10)),
link_name = "readdir_r@FBSD_1.0"
)]
/// The 64-bit libc on Solaris and illumos only has readdir_r. If a

View File

@ -2094,26 +2094,26 @@ extern "C" {
mqd: ::mqd_t,
msg_ptr: *mut ::c_char,
msg_len: ::size_t,
msq_prio: *mut ::c_uint,
msg_prio: *mut ::c_uint,
) -> ::ssize_t;
pub fn mq_timedreceive(
mqd: ::mqd_t,
msg_ptr: *mut ::c_char,
msg_len: ::size_t,
msq_prio: *mut ::c_uint,
msg_prio: *mut ::c_uint,
abs_timeout: *const ::timespec,
) -> ::ssize_t;
pub fn mq_send(
mqd: ::mqd_t,
msg_ptr: *const ::c_char,
msg_len: ::size_t,
msq_prio: ::c_uint,
msg_prio: ::c_uint,
) -> ::c_int;
pub fn mq_timedsend(
mqd: ::mqd_t,
msg_ptr: *const ::c_char,
msg_len: ::size_t,
msq_prio: ::c_uint,
msg_prio: ::c_uint,
abs_timeout: *const ::timespec,
) -> ::c_int;
pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int;

View File

@ -2024,13 +2024,13 @@ extern "C" {
mqd: ::mqd_t,
msg_ptr: *mut ::c_char,
msg_len: ::size_t,
msq_prio: *mut ::c_uint,
msg_prio: *mut ::c_uint,
) -> ::ssize_t;
pub fn mq_send(
mqd: ::mqd_t,
msg_ptr: *const ::c_char,
msg_len: ::size_t,
msq_prio: ::c_uint,
msg_prio: ::c_uint,
) -> ::c_int;
pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int;
pub fn mq_setattr(

View File

@ -1361,7 +1361,7 @@ extern "C" {
pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int;
pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int;
pub fn pthread_exit(value: *mut ::c_void);
pub fn pthread_exit(value: *mut ::c_void) -> !;
pub fn pthread_attr_setdetachstate(
attr: *mut ::pthread_attr_t,
state: ::c_int,

9
src/windows/gnu/align.rs Normal file
View File

@ -0,0 +1,9 @@
cfg_if! {
if #[cfg(target_pointer_width = "64")] {
#[derive(Copy, Clone, Debug, PartialEq)]
#[repr(C, align(16))] pub struct max_align_t([f64; 4]);
} else if #[cfg(target_pointer_width = "32")] {
#[derive(Copy, Clone, Debug, PartialEq)]
#[repr(C, align(16))] pub struct max_align_t([i64; 6]);
}
}

View File

@ -14,3 +14,10 @@ extern "C" {
n: ::size_t,
) -> ::c_int;
}
cfg_if! {
if #[cfg(libc_align)] {
mod align;
pub use self::align::*;
}
}