Commit Graph

2675 Commits

Author SHA1 Message Date
gnzlbg
c1e0a3f3b1 Always use the latest ctest 2019-02-12 18:34:56 +01:00
bors
810b8c6a84 Auto merge of #1251 - jasonbking:solarish-sq, r=gnzlbg
Add support for illumos target

This change adds support for an illumos os target to libc.  Similar to the BSDs, there is a large deal of overlap (given the common history), so the 'solaris' directory was renamed to 'solarish' (it's the closest thing to an official term to refer to things descending from Solaris as well as Solaris).  There were also a number of missing definitions (as well as a couple missing functions) that have proved necessary for building a number of rust programs on illumos or Solaris.

Portions contributed by @papertigers .
2019-02-12 15:52:52 +00:00
bors
d6977c827e Auto merge of #1250 - gnzlbg:removeppc, r=gnzlbg
Do not allow rustup to fail

Currently if rustup fails to download something the build will continue until that something is needed. This makes the job fail early and clearly.
2019-02-12 09:31:10 +00:00
Jason King
821fd8a9dd Fix style 2019-02-12 02:28:17 +00:00
Vitaly _Vi Shukela
4d0694ce0b
Add IP[V6]_[RECV]ORIGDSTADDR for Linux and Android 2019-02-12 04:20:31 +03:00
Jason King
0b488bf94b Only disable rustfmt style checl 2019-02-12 00:32:58 +00:00
Jason King
4ec33ade65 Disable rustfmt bot due to rust-lang/rustfmt#3341 2019-02-12 00:13:48 +00:00
Jason King
9638d0dee0 Rename solaris dir to solarish to indicate it's including both Solaris
and Solaris-derived distributions (i.e. illumos).  In addition, a number
of missing definitions (and compatability functions) that have been
found necessary to run a number of rust binaries on illumos have been
added.

Portions were contributed by Mike Zeller <mike@mikezeller.net>
2019-02-11 21:38:30 +00:00
gnzlbg
4a56c47a17 Increase the number of retries for curl 2019-02-09 18:22:35 +01:00
gnzlbg
d42ef14eba Retry rustup target add 3 times 2019-02-09 17:54:52 +01:00
gnzlbg
a7674aa428 Do not allow rustup to fail 2019-02-09 13:59:29 +01:00
bors
34f1c30de2 Auto merge of #1241 - semarie:openbsd-rfc2235, r=gnzlbg
unbreak openbsd after #1217
2019-02-09 10:43:10 +00:00
bors
ed160db4b3 Auto merge of #1249 - arnavb:patch-1, r=gnzlbg
Fix license badge
2019-02-09 08:23:45 +00:00
Sébastien Marie
c408759161 unbreak openbsd after #1217 2019-02-09 07:15:18 +01:00
Arnav Borborah
152fd7e6d2
Fix license badge 2019-02-08 20:22:24 -05:00
David Holroyd
d3c0eec149 Remove struct which is now a duplicate 2019-02-08 23:18:16 +00:00
David Holroyd
d6310d63b3 Qualify type name 2019-02-08 23:18:16 +00:00
David Holroyd
250aa2496a openbsd doesn't have mmsghdr either! 2019-02-08 23:18:02 +00:00
David Holroyd
d676d6e97a dragonflybsd lacks sendmmsg()/recvmsg() 2019-02-08 23:05:01 +00:00
David Holroyd
80f1b51ac0 openbsd lacks sendmmsg()/recvmmsg() 2019-02-08 19:14:06 +00:00
David Holroyd
b8b510b734 freebsd timespec is const 2019-02-08 19:14:06 +00:00
David Holroyd
ad1bd7eb85 Match the freebsd types 2019-02-08 19:14:06 +00:00
David Holroyd
c6f899c3c1 Remove duplicate definition 2019-02-08 19:14:06 +00:00
David Holroyd
d26c2ab8c2 timespec pointer also const on andriod 2019-02-08 19:14:06 +00:00
David Holroyd
a4c25a99e4 Push definitions down a level to avoid macos
I guess the previous lint failure was about avoiding #[cfg], and doing
this instead.
2019-02-08 19:14:06 +00:00
David Holroyd
91639b6bc8 Use cfg_attr like other items 2019-02-08 19:14:06 +00:00
David Holroyd
eff3d81138 Fix wrong C type name 2019-02-08 19:14:06 +00:00
David Holroyd
4036d6cb98 mmsghdr pointer is const in android I think 2019-02-08 19:14:06 +00:00
David Holroyd
8fe9d252b0 Qualify type names 2019-02-08 19:14:06 +00:00
David Holroyd
0b14c2cfaf Not available on macos I think 2019-02-08 19:14:06 +00:00
David Holroyd
bc224d976b Hoist {send,recv}mmsg() to test target support
Will likely alter this after seeing CI results across platforms.
2019-02-08 19:14:06 +00:00
bors
ff97bdb074 Auto merge of #1247 - gnzlbg:build_all_platforms, r=gnzlbg
Build all platforms

cc @alexcrichton this needs a more thorough review. It turns out libc failed to build on a lot of older Rust versions for various reasons and platforms, so it took a while to fix the build on all of them.
2019-02-08 17:45:38 +00:00
gnzlbg
5c796c5897 Align Rust-version support table of the README 2019-02-07 20:06:50 +01:00
gnzlbg
ca12725dbf Document platform support in the README 2019-02-07 13:44:32 +01:00
gnzlbg
a17a91cdbf Fix build on all platforms
This PR fixes the build on all platforms and all Rust version down to the
minimum Rust version supported by libc: Rust 1.13.0.

The `build.rs` is extended with logic to detect the newer Rust features used by
`libc` since Rust 1.13.0:

* Rust 1.19.0: `untagged_unions`. APIs using untagged unions are gated on
  `cfg(libc_unions)` and not available on older Rust versions.

* Rust 1.25.0: `repr(align)`. Because `repr(align)` cannot be parsed by older
  Rust versions, all uses of `repr(align)` are split into `align.rs` and
  `no_align.rs` modules, which are gated on the `cfg(libc_align)` at the top
  level. These modules sometimes contain macros that are expanded at the top
  level to avoid privacy issues (`pub(crate)` is not available in older Rust
  versions). Closes #1242 .

* Rust : `const` `mem::size_of`. These uses are worked around with hardcoded
  constants on older Rust versions.

Also, `repr(packed)` structs cannot automatically `derive()` some traits like
`Debug`. These have been moved into `s_no_extra_traits!` and the lint of missing
`Debug` implementations on public items is silenced for these. We can manually
implement the `extra_traits` for these in a follow up PR. This is tracked
in #1243. Also, `extra_traits` does not enable `align` manually anymore.

Since `f64::to_bits` is not available in older Rust versions, its usage
has been replaced with a `transmute` to an `u64` which is what that method
does under the hood.

Closes #1232 .
2019-02-07 13:44:32 +01:00
gnzlbg
8f1acf4643 Build all platforms in CI
This commit adds a `ci/build.sh` script that checks that libc builds correctly
for some common configurations (`--no-default-features`, `default`,
`extra_traits`) on most targets supported by Rust since Rust 1.13.0 (the oldest
Rust version that libc supports).

The build matrix is refactored into two stages.

The first stage is called `tools-and-build-and-tier1` and it aims to discover
issues quickly by running the documentation and linter builds, as well as
checking that the library builds correctly on all targets in all supported
channels and "problematic" Rust versions; Rust versions adding major new
features like `repr(align)`, `union`, etc. This first stage also runs
libc-test for the tier-1 targets on linux and osx. These builds finish
quickly because no emulation is necessary.

The second stage is called `tier2` and it runs libc-test for all other targets
for which we are currently able to do so.

Closes #1229 .
2019-02-07 13:44:32 +01:00
bors
a2bf9f1d92 Auto merge of #1246 - gnzlbg:rustfmt_style, r=gnzlbg
Check style using rustfmt and reformat

A couple of recent PRs attempt to reformat the library using rustfmt and run into issues against libc's style checker because rustfmt default settings differ.

This PR uses the rustfmt-preview from nightly to check that the library is appropriately formatted, adding a style as similar to libc's style as possible, so that both style checkers work properly simultaneously.
2019-02-07 12:08:51 +00:00
gnzlbg
0a5484ea72 Check style using rustfmt and reformat 2019-02-07 11:13:38 +01:00
bors
f9b96ee6a1 Auto merge of #1235 - asomers:cmsg_osx, r=gnzlbg
Fix cmsg(3) bugs for musl and OSX

This PR fixes bugs in the cmsg(3) family of functions for Linux/musl and OSX, introduced by PR #1098 and PR #1212 .  It also adds an integration test which hopefully will validate these functions on every platform.
2019-02-05 17:19:39 +00:00
Alan Somers
38cf5b15c6 Add an integration test for the cmsg(3) functions.
Since these are defined in C as macros, they must be reimplemented in
libc as Rust functions.  They're hard to get exactly right, and they
vary from platform to platform.  The test builds custom C code that uses
the real macros, and compares its output to the Rust versions' output
for various inputs.

Skip the CMSG_NXTHDR test on sparc64 linux because it hits a Bus Error.

Issue #1239

Skip the entire cmsg test program on s390x because it dumps core
seemingly before the kernel finishes booting.

Issue #1240
2019-02-05 08:26:17 -07:00
Alan Somers
eddc8d342b Specialize CMSG_NXTHDR for Android and Emscripten 2019-02-05 08:26:14 -07:00
Alan Somers
4300666bf3 Fix Linux's CMSG_NXTHDR and CMSG_SPACE definitions.
This is an error from PR #1098.  The wrong definitions coincidentally
work on Linux/glibc, but fail on Linux/musl.
2019-02-05 08:26:14 -07:00
Alan Somers
73df81fcec Fix CMSG_NXTHDR for OSX.
This was an oversight from PR #1212.  It's been revealed by the new cmsg
test.
2019-02-05 08:24:59 -07:00
bors
be1a8dedf0 Auto merge of #1234 - gnzlbg:android_runtest, r=gnzlbg
Update runtest-android

Keep the implementation in sync with packed_simd and stdsimd.
2019-02-05 08:36:09 +00:00
bors
942f6ae707 Auto merge of #1217 - Susurrus:rfc_2235, r=gnzlbg
RFC 2235 - Implement PartialEq,Eq,Hash,Debug for all types

First pass at implementing [RFC2235](https://github.com/rust-lang/rfcs/blob/master/text/2235-libc-struct-traits.md). I just started with `PartialEq`/`Eq` and tested locally on my x64 Linux system. Definitely going to run into other types for other platforms that need this treatment, but thought I'd start small.

Open question is whether this should also rely on the `align` feature, which should improve which types can be auto-derived versus manually implemented (as it removed a lot of odd-sized padding arrays). My first pass here doesn't do that, but I might test it out to see if it does simplify quite a few structs. I think it might also be nice to have as it makes it easier for contributors to add new structs.

Part of rust-lang/rust#57715
2019-02-05 07:38:45 +00:00
bors
1f63b26009 Auto merge of #1230 - vdagonneau:master, r=gnzlbg
Added inotify bindings.

Hi, I'd like to add inotify bindings. This is a first throw at it. Can you guide me through the process of merging it ?
2019-02-04 13:31:03 +00:00
bors
f8a2c53646 Auto merge of #1221 - MikaelUrankar:powerpc64-unknown-freebsd, r=gnzlbg
Add powerpc64-unknown-freebsd

FreeBSD review: https://reviews.freebsd.org/D18367
2019-02-04 13:02:43 +00:00
Vincent Dagonneau
dfb7c0caba Added the proper libc header to libc-test; Removed some defines as they seem to be too new. 2019-02-04 09:11:21 +01:00
Bryant Mairs
e33f7609bd Ignore the style executable used for testing
This is used for running style checks on the libc codebase but shouldn't
be committed, so adding it to the .gitignore file.
2019-02-02 16:32:00 -08:00
Bryant Mairs
f3684584c9 Check for Copy impls for all types 2019-02-02 16:32:00 -08:00