Commit Graph

41 Commits

Author SHA1 Message Date
Yuki Okushi 3fae7e9ce7 Fix style 2021-04-06 10:10:29 +09:00
Amanieu d'Antras 9d393107c6 Rustfmt 2021-02-01 22:52:54 +00:00
Dark Kirb e9a1268320 Add DevkitPPC support
DevkitPPC does not support unix sockets natively, meaning that bindings
to these functions was removed for powerpc targets with "nintendo" as
vendor.

Suggested target json files:

Nintendo Gamecube:
```
{
  "arch": "powerpc",
  "data-layout": "E-m:e-p:32:32-i64:64-n32",
  "dynamic-linking": false,
  "env": "newlib",
  "executables": true,
  "has-elf-tls": false,
  "has-rpath": true,
  "linker-flavor": "gcc",
  "llvm-target": "powerpc-eabi",
  "max-atomic-width": 32,
  "os": "dolphin",
  "target-c-int-width": "32",
  "target-endian": "big",
  "target-family": "unix",
  "target-mcount": "_mcount",
  "target-pointer-width": "32",
  "vendor": "nintendo"
}
```

Nintendo Wii:
```
{
  "arch": "powerpc",
  "data-layout": "E-m:e-p:32:32-i64:64-n32",
  "dynamic-linking": false,
  "env": "newlib",
  "executables": true,
  "has-elf-tls": false,
  "has-rpath": true,
  "linker-flavor": "gcc",
  "llvm-target": "powerpc-eabi",
  "max-atomic-width": 32,
  "os": "revolution",
  "target-c-int-width": "32",
  "target-endian": "big",
  "target-family": "unix",
  "target-mcount": "_mcount",
  "target-pointer-width": "32",
  "vendor": "nintendo"
}
```
2020-08-05 08:19:48 +01:00
Markus Reiter 156f82c216 Add `AF_INET6` for Xtensa. 2020-06-22 08:30:36 +02:00
Markus Reiter 82453b3c3f Add `MSG_` constants for Xtensa. 2020-06-22 07:23:17 +02:00
Markus Reiter a422e34ca8 Add explanation for `ai_addr` field. 2020-05-22 06:56:55 +02:00
Markus Reiter 0dec549f8d Add types for newlib on Xtensa. 2020-05-22 06:56:55 +02:00
Yuki Okushi f9f56830f8
Re-define `__priority_which`s as c_uint in linux-gnu 2020-05-21 21:57:46 +09:00
Patrick Mooney 1a15af9af5 Clean up unnecessary cfg_attr attributes 2020-03-29 14:29:18 -05:00
Markus Reiter b1d6c663d3 Add Newlib clock constants and functions. 2020-02-20 01:15:28 +01:00
gnzlbg 939a2e5a3a Formatting 2019-09-12 15:12:33 +02:00
FenrirWolf fd037479db Define newlib socket types by target arch 2019-08-18 09:30:16 -06:00
leo60228 eb287a1ad8 Update socket types to freebsd 2019-08-16 20:43:33 -04:00
Torbjørn Birch Moltu 2c10c4c887 Add FIONCLEX for Linux 2019-06-07 20:00:55 +02:00
gnzlbg 8f403e5ac2 Update MUSL Linux kernel headers and re-enable Linux tests 2019-05-27 22:23:02 +02:00
gnzlbg d52732581a Test strerror_r on Android and Linux 2019-05-23 16:29:28 +02:00
gnzlbg 759c837611 [breaking change] incorrect API of gettimeofday
The second argument of `gettimeofday` was a `*mut c_void` on all targets,
but that type is incorrect in the following targets, where it should be
a `*mut timezone` instead:

On these other targets it appears that the signature of gettimeofday was incorrect (it takes a time-zone pointer instead of a void pointer):

linux+gnu: http://man7.org/linux/man-pages/man2/gettimeofday.2.html
freebsd: https://www.freebsd.org/cgi/man.cgi?query=gettimeofday&apropos=0&sektion=2&manpath=FreeBSD+11.2-stable&arch=default&format=html
openbsd: https://man.openbsd.org/gettimeofday.2
android: https://github.com/ricardoquesada/android-ndk/blob/master/usr/include/sys/time.h
dragonfly: https://www.dragonflybsd.org/cgi/web-man?command=gettimeofday&section=2

This commit corrects the type on these targets, which is a breaking change. Due
to how this API is commonly used (e.g. passing `ptr::null_mut` to the second
argument), breakage should be minimal. Users wanting to support both versions
can just write `ptr as *mut _` instead.

Closes #1338.
2019-05-22 10:39:06 +02:00
leo60228 62ad61f973 Fix accidental syntax error (oops) 2019-05-09 19:12:02 -04:00
leo60228 6bc0914be2 Fix FIONBIO type 2019-05-09 19:11:04 -04:00
leo60228 5400c6e695 Add more FreeBSD TCP_ constants 2019-05-09 19:10:38 -04:00
leo60228 75df0e19eb Add more FreeBSD IPv6 constants 2019-05-09 19:08:42 -04:00
leo60228 5d91cb3409 Add FIOCLEX 2019-05-09 19:03:12 -04:00
leo60228 e3c95f143b Add IP_ and IPV6_ 2019-05-09 19:02:53 -04:00
leo60228 c8e8ec6f23 Use FreeBSD SO_ constants on newlib
This is necessary to set socket options on the Nintendo Switch, which uses a socket implementation directly ported from FreeBSD.
2019-05-09 18:34:16 -04:00
Charles Lew 1cf0294e2d Fix getgrgid_r to accept gid_t. 2019-04-29 22:12:41 +08:00
ischeinkman 372ae7953f Removed repeated IPPROTO constants. 2019-02-23 15:59:20 -08:00
ischeinkman f64ee03115 Removed newlib struct duplicates. 2019-02-23 14:49:30 -08:00
gnzlbg f5cbdbc2b9 Clean libc-test for apple targets
This cleans up the build.rs of `libc-test` for apple targets.

I wanted to update the docker containers of some targets so that we can start
testing newer currently-skipped APIs properly, but it is impossible to figure
out which headers and APIs are skipped for each target.

This PR separates the testing of apple targets into its own self-contained
function. This allows seeing exactly which headers are included, and which items
are skipped. A lot of work will be required to separate the testing of all major
platforms and make the script reasonable.

During the clean up, I discovered that, at least for apple targets, deprecated
but not removed APIs are not tested. I re-enabled testing for those, and fixed
`daemon`, which was not properly linking its symbol. I also added the
`#[deprecated]` attribute to the `#[deprecated]` APIs of the apple targets. The
attribute is available since Rust 1.9.0 and the min. Rust version we support is
Rust 1.13.0.

Many other APIs are also currently not tested "because they are weird" which I
interpret as "the test failed for an unknown reason", as a consequence:

* the signatures of execv, execve, and execvp are incorrect (see
  https://github.com/rust-lang/libc/issues/1272)

* the `sig_t` type is called `sighandler_t` in libc for some reason:
  https://github.com/rust-lang/libc/issues/1273

This probably explains why some other things, like the
`sa_handler`/`sa_sigaction` fields of `sigaction` were skipped. The field is
actually a union, which can be either a `sig_t` for the `sa_handler` field, or
some other type for the `sa_sigaction` field, but because the distinction was
not made, the field was not checked.

The latest ctest version can check volatile pointers, so a couple of skipped
tests are now tested using this feature.
2019-02-22 19:18:02 +01:00
gnzlbg 7ac0fe53eb Cleanup dox mess 2019-02-13 14:48:50 +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
Alan Somers 36baf9323d Fix uname on FreeBSD
On FreeBSD, uname is an inline function.  The uname that is present in
libc.so is for FreeBSD 1.0 compatibility.  It expects a buffer of a
different size.

Fixes #1190
Reported-by: Alex Zepeda
2019-01-03 08:53:50 -07:00
gnzlbg 5c1a6b8a6d splice the common libc functions and ctypes throughout the library 2018-11-21 20:58:02 +01:00
Linus Färnstrand 2819634696 Add align feature to pthread structs 2018-07-29 18:54:45 +02:00
roblabla ae81dc8df4 Add aarch64 support to newlib bindings 2017-11-14 10:15:16 +01:00
luozijun 9108f5b51d Add network interface flag constants for all platforms
Add network interface flag constants for all platforms.
2017-11-09 16:54:03 +08:00
Jessica Hamilton 03ed3ff7a9 Move various POLL* and RTLD_LAZY constants into submodules.
Unfortunately, these differ on Haiku, and using #[cfg(...)] is
not allowed in unix/mod.rs.
2017-09-26 06:08:32 +00:00
Alex Crichton 22b98dedfe Add asmjs/wasm32 to CI
Rebase of #610 and also move emscripten up much higher in the hierarchy to
ensure that it doesn't have too much of a ripple effect on other platforms.

This involved moving down a good number of definitions, but hopefully was done
with care to not break anything!
2017-08-26 22:15:29 -07:00
Bryant Mairs e41975a2b2 Remove fexecve() from Haiku and MacOS/iOS.
It's not supported on those platforms
2017-08-16 23:18:37 -07:00
Nicolas Dusart 76bf82927f define INADDR_* constants in unix platforms 2017-07-24 23:35:19 +02:00
Fenrir 5c38f427ec Add memalign for newlib 2017-07-09 22:30:28 -06:00
Fenrir 91f66733ca Add experimental newlib bindings 2017-07-06 12:58:18 -06:00