Commit Graph

4424 Commits

Author SHA1 Message Date
Ariadne Conill dbb0e6cce9
musl: s390x: use c_int instead of c_ulong for terminal-related ioctl constants
Co-authored-by: Jubilee <46493976+workingjubilee@users.noreply.github.com>
2021-02-27 17:36:02 -07:00
Ariadne Conill db9d4cfe1c
musl: s390x: use c_int instead of c_ulong for ioctl constants
Co-authored-by: Jubilee <46493976+workingjubilee@users.noreply.github.com>
2021-02-27 17:35:22 -07:00
Lucy Phipps 51461b1bbe
use GNU/Linux siginfo_t on Android
needs testing
2021-02-27 17:17:21 +00:00
bors add972649f Auto merge of #2079 - de-vri-es:android-x86-accept4, r=joshtriplett,JohnTitor
Implement accept4 on x86 android with `socketcall` syscall.

Linux x86 kernels before 4.3 only support the `socketcall` syscall rather than individual syscalls for socket operations. Since `libc` does a raw syscall for `accept4` on Android, it doesn't work on x86 systems.

This PR instead implements `accept4` for x86 android using `socketcall`. The value for `SYS_ACCEPT4` (in contrast to `SYS_accept4` 👀) is taken from the `linux/net.h` header.

Also note that the `socketcall` syscall takes all arguments as array of long ints. I've double checked with `glibc` to check how they pass arguments, since the Linux man page only says this: "args points to a block containing the actual arguments" and "only standard library implementors and kernel hackers need to know about socketcall()".

This should fix https://github.com/rust-lang/rust/issues/82400
2021-02-27 13:11:19 +00:00
bors 31a2777d8f Implement accept4 on x86 android with `socketcall` syscall.
Linux x86 kernels before 4.3 only support the `socketcall` syscall rather than individual syscalls for socket operations. Since `libc` does a raw syscall for `accept4` on Android, it doesn't work on x86 systems.

This PR instead implements `accept4` for x86 android using `socketcall`. The value for `SYS_ACCEPT4` (in contrast to `SYS_accept4` 👀) is taken from the `linux/net.h` header.

Also note that the `socketcall` syscall takes all arguments as array of long ints. I've double checked with `glibc` to check how they pass arguments, since the Linux man page only says this: "args points to a block containing the actual arguments" and "only standard library implementors and kernel hackers need to know about socketcall()".

This should fix https://github.com/rust-lang/rust/issues/82400
2021-02-27 13:11:19 +00:00
bors d8fc4b2d5c Auto merge of #2083 - jasonbking:illumos, r=JohnTitor
Add additional illumos and Solaris constants

This adds some additional constants for `fcntl(2)` and `setsockopt(3SOCKET)`.
2021-02-27 11:56:14 +00:00
Jason King 0f8e3d054c Add several IPsec related options 2021-02-27 06:24:22 +00:00
Jason King 5ab626984f Additional solaris fcntl values 2021-02-27 06:14:26 +00:00
bors 83d8c39f54 Auto merge of #2080 - jbit:freebsd-bpf, r=JohnTitor
Add FreeBSD BPF structures

This PR adds BPF structures that are common between [FreeBSD 11](https://github.com/freebsd/freebsd-src/blob/release/11.0.0/sys/net/bpf.h), [FreeBSD 12](https://github.com/freebsd/freebsd-src/blob/release/12.0.0/sys/net/bpf.h), [FreeBSD mainline/13](https://github.com/freebsd/freebsd-src/blob/main/sys/net/bpf.h) and [DragonFlyBSD 5.9](https://github.com/DragonFlyBSD/DragonFlyBSD/blob/v5.9.0/sys/net/bpf.h).

It also fixes the definition of `BPF_ALIGNMENT`, which should be equal to `sizeof(long)`, which is `4` on 32bit FreeBSD.

https://www.freebsd.org/cgi/man.cgi?query=arch&sektion=7
> All supported ABIs can be	divided	into two groups:
> * ILP32: `int`, `long`, `void *` types machine representations all have 4-byte size.
> * LP64: `int` type machine representation uses 4 bytes, while `long` and `void *` are 8 bytes.

I introduced the private `SIZEOF_LONG` const, since I didn't want to introduce a dependency on rust 1.24+ by depending on `libc_const_size_of`.

These changes allow my experimental crate to build on FreeBSD: https://github.com/jbit/powerline
2021-02-26 18:22:44 +00:00
bors 8a88b7df1e Auto merge of #2078 - workingjubilee:fix-mips64-musl, r=Amanieu
Fix mips64-musl ioctl consts to c_int

This arch was overlooked or unspecified in earlier PRs that fixed
c_ulong to c_int for ioctl.h consts for musl, see PR #289, PR #301,
or PR #1097 for such prior art, however these are still args to
fn ioctl on mips64-musl, which is expecting c_ints.

Some numbers acquired casts to reflect the fact the data is being
used and (so should be written as) an unsized bitfield, even if
the value is greater than i32::MAX.

Currently rustc is not building on mips64-linux-musl because of this error.
2021-02-26 00:48:05 +00:00
Jubilee Young 9807fad7ac Stop directory-not-there errors in dox.sh 2021-02-25 16:22:58 -08:00
Jubilee Young fcae5a7a1a Disable aarch64-linux-android in CI 2021-02-25 13:31:02 -08:00
James Lee 4b55c8715c Add BPF structures for FreeBSD 2021-02-25 17:18:07 +11:00
James Lee ed1256a366 Fix BPF_ALIGNMENT for 32bit FreeBSD 2021-02-25 17:17:50 +11:00
Jubilee Young 5c07fcfd1c Add trace to CI 2021-02-24 17:46:29 -08:00
Jubilee Young 104154738c Fix mips64-musl ioctl consts to c_int
This arch was overlooked or unspecified in earlier PRs that fixed
c_ulong to c_int for ioctl.h consts for musl, see PR #289, PR #301,
or PR #1097 for such prior art, however these are still args to
fn ioctl on mips64-musl, which is expecting c_ints.

Some numbers acquired casts to reflect the fact the data is being
used and (so should be written as) an unsized bitfield, even if
the value is greater than i32::MAX.
2021-02-23 12:34:04 -08:00
bors ec101fadd6 Auto merge of #2075 - sunfishcode:sunfishcode/wasi-at-fdcwd, r=JohnTitor
WASI: define `AT_FDCWD` and update to latest WASI libc

Update to the latest WASI libc, define `AT_FDCWD`, update the signature
for __wasilibc_find_relpath, and add declarations for various
`__wasilibc_` utility functions.
2021-02-19 02:39:25 +00:00
Dan Gohman 197d9227cb WASI: define `AT_FDCWD` and update to latest WASI libc
Update to the latest WASI libc, define `AT_FDCWD`, update the signature
for __wasilibc_find_relpath, and add declarations for various
`__wasilibc_` utility functions.
2021-02-18 14:07:17 -08:00
bors f9562dd768 Auto merge of #2072 - smklein:solarish_directory, r=Amanieu
Add O_DIRECTORY to solarish

FYI `@pfmooney` . I was trying to port [nix](https://crates.io/crates/nix) to illumos, and noticed this in the illumos-gate [headers](221e47fb90/usr/src/uts/common/sys/fcntl.h), but not in libc.
2021-02-16 16:11:01 +00:00
Sean Klein 6873e2f930 Add O_DIRECTORY to solarish 2021-02-16 03:30:57 +00:00
Ariadne Conill 88de3880fb add definitions for s390x musl targets 2021-02-15 22:37:14 +00:00
bors b035574949 Auto merge of #2070 - nielx:haiku-raw-pointers, r=JohnTitor
Haiku: use raw pointers instead of references in convenience functions

The Haiku API has some convenience macros to make it easier to call certain
functions. In the libc implementation, these are implemented as unsafe
functions. The previous choice was to take certain pointer parameters as
references, and do the conversion to raw pointers when the actual external
function was called.

However, this causes issues with the image_info struct, which needs to be
initialized in Rust, before a native API call is used to enter data. Since
part of this structure consists of function pointers, mem::zeroed() cannot be
used, since in Rust function pointers cannot be NULL. Thus one needs to use the
MaybeUnit<T> API to properly initialize it. This then makes it problematic to
use the convenience functions, as a MaybeUnit<image_info> cannot be converted
into an &mut image_info before it is marked as initialized with valid data. It can
be converted into a raw *mut image_info, so if the function accepts this as a
parameter it can be used.

For consistency, all convenience functions have been converted from using
references to using raw pointers.
2021-02-14 07:55:01 +00:00
bors d4080d15c5 Auto merge of #1975 - skrap:feature/move-uclibc-under-linux, r=JohnTitor
Move uclibc under linux

This is a first cut at moving uclibc under linux, alongside `musl` and `gnu`.

All tests pass on a vexpress a9 running in qemu.  I am working on testing the other tier 3 uclibc targets: `mips-unknown-linux-uclibc` and `mipsel-unknown-linux-uclibc`.  ~Not having access to these platforms, I am working on getting them running in qemu, but it may take a bit.~

The style check doesn't pass.  I would appreciate some direction here.  Many of these constants are defined under 2-of-3 out of musl/glibc/uclibc, so I'm not sure whether I should transform:

```rust
#[cfg(not(target_env = "uclibc"))]
pub fn foo();
```
into 2 separate declarations, one each in `musl/mod.rs` and `gnu/mod.rs` or use a `cfg_if` block for each one (which explodes 2 lines into 5).

- [x] Help me choose which fix to use for the items defined in musl and gnu but not uclibc.

It's my guess that exploding into the `cfg_if` block is better for long-term maintainability, but I'd really appreciate opinions from the maintainers.
2021-02-13 21:16:19 +00:00
Jonah Petri 3378f0cebf style fixes to satisfy new rustfmt 2021-02-13 15:04:45 -05:00
Jonah Petri 13090dfcc0 uclibc: fix x86_64-unknown-l4re-uclibc build 2021-02-13 15:04:45 -05:00
Niels Sascha Reedijk 59afbfe9f6 Haiku: use raw pointers instead of references in convenience functions
The Haiku API has some convenience macros to make it easier to call certain
functions. In the libc implementation, these are implemented as unsafe
functions. The previous choice was to take certain pointer parameters as
references, and do the conversion to raw pointers when the actual external
function was called.

However, this causes issues with the image_info struct, which needs to be
initialized in Rust, before a native API call is used to enter data. Since
part of this structure consists of function pointers, mem::zeroed() cannot be
used, since in Rust function pointers cannot be NULL. Thus one needs to use the
MaybeUnit<T> API to properly initialize it. This then makes it problematic to
use the convenience functions, as a MaybeUnit<image_info> cannot be converted
into an &image_info before it is marked as initialized with valid data. It can
be converted into a raw *mut image_info, so if the function accepts this as a
parameter it can be used.

For consistency, all convenience functions have been converted from using
references to using raw pointers.
2021-02-13 11:07:39 +00:00
Jonah Petri 225363b690 move EPOLLEXCLUSIVE and EPOLLWAKEUP to linux/mod.rs 2021-02-12 20:44:53 -05:00
Jonah Petri 0ac10285d9 uclibc: style fixes 2021-02-12 20:43:02 -05:00
Jonah Petri 7775ce20b9 change getnameinfo flags type to int to conform to other libc implementations 2021-02-12 20:43:02 -05:00
Jonah Petri 10c54181b4 uclibc -> linux-like/linux: Manual consolitation of redundant structs and fns. 2021-02-12 20:42:59 -05:00
Jonah Petri fe8470be63 uclibc -> linux-like/linux: mostly mechanical removal of redundant symbols 2021-02-12 20:41:01 -05:00
Jonah Petri c4803a6783 Add ENOTSUP constant for uclibc 2021-02-12 20:41:01 -05:00
bors db71a574b2 Auto merge of #2068 - Minoru:bugfix/remove-unused-iconv.h, r=JohnTitor
Remove unused iconv.h includes

These are left over from 3e4d684dcd, which
added includes to *all* platforms despite adding bindings only to *some*
of them. This already broke OpenBSD which doesn't have iconv.h (fixed by
915d8fac81), and is just distasteful, so
down with those unused includes.

(This is a continuation to #2037 and #2067.)
2021-02-12 06:20:46 +00:00
bors a61fd8c79c Auto merge of #2066 - wmanley:preadv2-pwritev2, r=JohnTitor
Linux: Add `preadv2` and `pwritev2` and associated constants

These functions are the same as `preadv` and `pwritev` but have a flags
parameter.  `preadv2()` and `pwritev2()` first appeared in Linux 4.6.
Library support was added in glibc 2.26.

See the definition of the constants in [linux/fs.h](fcadab7404/tools/include/uapi/linux/fs.h (L288-L301)).
2021-02-12 05:14:49 +00:00
bors be0c2d4c48 Auto merge of #2024 - XanClic:statx-mount-id-v2, r=JohnTitor
Add mount ID to statx

This mirrors the modifications to `include/uapi/linux/stat.h` by [Linux commit fa2fcf4f1df1559a0a4ee0f46915b496cc2ebf60 (“statx: add mount ID”)](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=fa2fcf4f1df1559a0a4ee0f46915b496cc2ebf60).

What changed in v2 (v1: #2023):
* Skip testing the new `STATX_MNT_ID` constant, because it’s only part of Linux as of 5.8. That’s too new e.g. for Ubuntu 20.04.1 (with a kernel derived from 5.4), which is what’s used by the CI.
2021-02-12 04:17:39 +00:00
William Manley ce0eb2321d Move `RWF_*` constants into linux/gnu/mod.rs
From `linux/mod.rs`.  These constants are not exposed by musl so were
causing failures in CI.

These constants are really defined in `include/uapi/linux/fs.h` in Linux
and are not specific to any libc and I hope to make them more available in
the future.
2021-02-11 22:10:32 +00:00
William Manley 01f62b6149 preadv2/pwritev2: Only define these functions with glibc
They're not implemented by musl or bionic.
2021-02-11 14:59:15 +00:00
Alexander Batischev 17dec33a0f
Remove unused iconv.h includes
These are left over from 3e4d684dcd, which
added includes to *all* platforms despite adding bindings only to *some*
of them. This already broke OpenBSD which doesn't have iconv.h (fixed by
915d8fac81), and is just distasteful, so
down with those unused includes.
2021-02-11 16:51:55 +03:00
Max Reitz 5b109dd882 Add mount ID to statx
This corresponds to the Linux commit
fa2fcf4f1df1559a0a4ee0f46915b496cc2ebf60 ("statx: add mount ID").

Note that STATX_ALL is not modified to include this field, because it
has actually been deprecated in Linux and is now effectively defined as
equal to STATX_BASIC_STATS | STATX_BTIME (see Linux commit
581701b7efd60ba13d8a7eed60cbdd7fefaf6696, "uapi: deprecate STATX_ALL").

Because said commit fa2fcf4f1d is less than a year old, skip testing the
STATX_MNT_ID constant.

Signed-off-by: Max Reitz <mreitz@redhat.com>
2021-02-11 14:08:53 +01:00
bors 5019e1dfcb Auto merge of #2067 - semarie:openbsd-iconv, r=Amanieu
unbreak OpenBSD tests: iconv.h doesn't exist
2021-02-11 11:26:51 +00:00
Sébastien Marie 915d8fac81 unbreak OpenBSD tests: iconv.h doesn't exist 2021-02-11 11:19:46 +00:00
Max Reitz d6fbe9b85a Make statx's padding fields private
Padding and reserved fields should not be publicly accessible, because
they may be replaced by new (functional) fields at any time.

Searching for these padding fields on github or Google reveals no users,
so making them private should not break any existing users.

It is possible that there are projects outside of github that access
these fields, but if so, they should have been warned by the fact that
these fields are prefixed by double underscores.

Signed-off-by: Max Reitz <mreitz@redhat.com>
2021-02-11 11:24:27 +01:00
William Manley a18aee2068 Linux: Add `preadv2` and `pwritev2` and associated constants
These functions are the same as `preadv` and `pwritev` but have a flags
parameter.  `preadv2()` and `pwritev2()` first appeared in Linux 4.6.
Library support was added in glibc 2.26.
2021-02-11 00:27:53 +00:00
bors 2a2196d6dc Auto merge of #2037 - Minoru:feature/iconv, r=Amanieu
Add bindings for iconv calls
2021-02-10 23:29:48 +00:00
Alexander Batischev 3e4d684dcd
Add bindings for iconv calls
FreeBSD-likes all implement iconv:
- DragonflyBSD: bbb35c81f7/include/iconv.h
- FreeBSD: a6dc68c0e0/include/iconv.h

NetBSD-likes:
- NetBSD: 81a39f6087/include/iconv.h
- OpenBSD doesn't implement it

macOS: apparently ships a conforming implementation as a separate
library:
https://stackoverflow.com/questions/57734434/libiconv-or-iconv-undefined-symbol-on-mac-osx/57734435#57734435

Linux:
- glibc: https://sourceware.org/git/?p=glibc.git;a=blob;f=iconv/iconv.h;h=fdddf53d99c3046ef9c280db01a425c2f499043e;hb=HEAD
- musl: https://git.musl-libc.org/cgit/musl/tree/include/iconv.h?id=455f96857f91d14e193219ca00969354a981c09c
2021-02-11 01:22:49 +03:00
bors 3c907ed65b Auto merge of #2063 - JohnTitor:asmjs-ci, r=JohnTitor
Re-enable CI for `asmjs-unknown-emscripten`

#1591 was closed by #1697 but it was only for `wasm32-unknown-emscripten` actually. We should make a new issue and link to it instead if it's still broken.
r? `@ghost`
2021-02-10 06:04:03 +00:00
Yuki Okushi 29feed133c Re-enable CI for `asmjs-unknown-emscripten` 2021-02-10 15:02:40 +09:00
bors 734bb32cf3 Auto merge of #2062 - JohnTitor:wasi-wchar-t, r=JohnTitor
Declare `wchar_t` for WASI

Fixes #2045
r? `@ghost`
2021-02-10 04:03:56 +00:00
Yuki Okushi f0009bcc19 Declare `wchar_t` for WASI 2021-02-10 13:02:42 +09:00
bors 59c4f0c71e Auto merge of #2059 - GuillaumeGomez:upgrade-version, r=JohnTitor
Upgrade crate version to 0.2.86

Following #2058.

If you could make a release, it'd be awesome! Thanks in advance!
2021-02-08 14:13:20 +00:00