Commit Graph

2609 Commits

Author SHA1 Message Date
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
Bryant Mairs
fa9cb78b4a Check for Debug impls for all types
This was not compile-tested on all platforms, but instead all `pub enum`
types had a `Debug` impl derived for them.
2019-02-02 16:32:00 -08:00
Bryant Mairs
cd1e16d1af Implement Hash for all types 2019-02-02 16:32:00 -08:00
Bryant Mairs
79ae1217c2 Implement Debug for all types 2019-02-02 13:06:58 -08:00
Bryant Mairs
868a85d05d Implement PartialEq,Eq for all types 2019-02-02 13:06:58 -08:00
MikaelUrankar
69c9c541f7 char is unsigned on FreeBSD aarch64 and powerpc64 2019-02-02 19:38:46 +01:00
Your Name
6c1e2dec8f Add powerpc64-unknown-freebsd 2019-02-02 19:38:46 +01:00
Alex Crichton
118c7aeb19
Merge pull request #1236 from MikaelUrankar/freebsd_arm
Add FreeBSD armv6 and armv7 targets
2019-02-02 11:51:23 -06:00
MikaelUrankar
e628de2d7d Add armv6 and armv7 FreeBSD targets 2019-02-02 16:19:08 +01:00
gnzlbg
6732bf1d41 Update runtest-android 2019-01-30 15:35:08 +01:00
Vincent Dagonneau
da27966859 Fixed typo; Added inotify headers to the libc-test. 2019-01-28 20:56:15 +01:00
Vincent Dagonneau
eb3e48c62f Added inotify headers to the libc-test. 2019-01-28 19:41:29 +01:00
Vincent Dagonneau
01752b3cb4 Added inotify bindings. 2019-01-26 10:29:53 +01:00
Bryant Mairs
51a0587b53 Remove Cargo.lock
This was an artifact from when a git dependency on ctest was used. This
is no longer the case, so removing it to simplify future PRs.
2019-01-23 08:42:58 -08:00
bors
42cd3ba272 Auto merge of #1228 - gnzlbg:release, r=gnzlbg
Bump to 0.2.48

Bumps libc version to 0.2.48. This release contains the breaking changes performed in #1222 .
2019-01-23 13:32:05 +00:00
gnzlbg
9148ae9023 Bump to 0.2.48 2019-01-23 14:14:01 +01:00
bors
e979ffff51 Auto merge of #1222 - MikaelUrankar:stack_t_bsd, r=gnzlbg
fix stack_t on FreeBSD

FreeBSD 10.x is EOL, in FreeBSD 11 and later, ss_sp is actually a void* [1]
dragonflybsd still uses c_char [2]

[1] https://svnweb.freebsd.org/base/releng/11.2/sys/sys/signal.h?revision=334459&view=markup#l438
[2] https://github.com/DragonFlyBSD/DragonFlyBSD/blob/master/sys/sys/signal.h#L339

should be committed with https://github.com/rust-lang/rust/pull/57810
2019-01-23 11:08:59 +00:00