Commit Graph

2620 Commits

Author SHA1 Message Date
Yuki Okushi 9f2acfaa53 Fix build for `s390x-unknown-linux-musl` 2021-03-01 04:13:17 +09:00
bors 5fd6540db9 Auto merge of #2071 - kaniini:s390x-musl, r=Amanieu
add definitions for s390x musl targets

Add support for s390x musl targets to libc.

I haven't added CI because I am not familiar with the pipelines, but would be glad to do so if somebody outlines what needs to be done.
2021-02-28 04:14:47 +00:00
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
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
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 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
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
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
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 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
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
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
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
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
Yuki Okushi f0009bcc19 Declare `wchar_t` for WASI 2021-02-10 13:02:42 +09:00
Thomas de Zeeuw a8a28adcc2 Add SO_LINGER_SEC on macOS 2021-02-08 13:20:18 +01:00
bors 05cc7961af Auto merge of #2034 - nielx:haiku-native, r=JohnTitor
Haiku: add definitions for the Haiku's native sytem API.

On the Haiku platform, the POSIX (and BSD) API coexists with the native API,
that has its origins on the BeOS platform. Unlike other UNIX-like platforms,
the native API is not an extension of the POSIX API, but instead exists sui
generis, and many of the POSIX concepts have their own native variety, with
relatively limited interoperability.

Nonetheless, the native API coexists in the same library as the standard C and
POSIX functions, namely libroot.so, and therefore this crate is a good place
to add bindings to it.

This commit implements most of Haiku's support kit, the most important parts
of the kernel kit, and a part of the storage kit.
2021-02-08 10:48:13 +00:00
Guillaume Gomez d51b418bfe Add getmntinfo and getmntinfo functions, MNT_WAIT and MNT_NOWAIT constants 2021-02-07 22:47:16 +01:00
kellda 7c136e5050 Drop support for CloudABI 2021-02-03 19:29:15 +00:00
Amanieu d'Antras 9d393107c6 Rustfmt 2021-02-01 22:52:54 +00:00
Amanieu d'Antras 60da93f9cc Don't mark time_t as deprecated on musl in rustc build 2021-02-01 22:01:47 +00:00
Alan Somers c070417497 Add aio_readv and aio_writev
They are new in FreeBSD 13.
2021-01-29 16:06:09 -07:00
Alan Somers e3482c13c1 Refactor freebsd to add a new FreeBSD 13 module 2021-01-29 16:05:51 -07:00
Niels Sascha Reedijk 813d7d839b Haiku: fix various issues pointed out by the automated tests
No changes to other platforms.
2021-01-28 14:31:24 +00:00
Niels Sascha Reedijk c3f7febb83 Haiku: add definitions for the Haiku's native sytem API.
On the Haiku platform, the POSIX (and BSD) API coexists with the native API,
that has its origins on the BeOS platform. Unlike other UNIX-like platforms,
the native API is not an extension of the POSIX API, but instead exists sui
generis, and many of the POSIX concepts have their own native variety, with
relatively limited interoperability.

Nontheless, the native API coexists in the same library as the standard C and
POSIX functions, namely libroot.so, and therefore this crate is a good place
to add bindings to it.

This commit implements most of Haiku's support kit, the most important parts
of the kernel kit, and a part of the storage kit.
2021-01-28 14:13:41 +00:00
bors 024d1515ae Auto merge of #2043 - tweksteen:set_abort_message, r=JohnTitor
android: add android_set_abort_message

As definied in set_abort_message.h [1].

[1] https://android.googlesource.com/platform/bionic/+/master/libc/include/android/set_abort_message.h
2021-01-28 11:07:54 +00:00
Thiébaud Weksteen 9df0cdf5fe android: add android_set_abort_message
As definied in set_abort_message.h [1]. Update buils.rs to include
Android-specific headers.

[1] https://android.googlesource.com/platform/bionic/+/master/libc/include/android/set_abort_message.h
2021-01-28 10:33:31 +01:00
Josh Triplett 6859d47e78 Remove link directives for libutil on linux-gnu targets
These are all handled in src/unix/mod.rs now, which also addresses the
crt-static case; no linux-gnu target should have any link directives in
any other module.

This fixes static linking with glibc for various architectures.
2021-01-28 00:21:42 -08:00
bors 77180b6db8 Auto merge of #2042 - pfmooney:illumos-portnotify, r=JohnTitor
Add port_notify struct for illumos and Solaris

This adds a missing struct for configuring event ports notifications.  The `libc-test` suite passes on illumos (OmniOSCE) and is assumed to pass on Solaris, given that the interface has been present since Oracle forked from OpenSolaris.
2021-01-27 03:18:36 +00:00
bors 5421f0bde5 Auto merge of #2041 - pfmooney:illumos-timers, r=JohnTitor
Add timer interface for illumos and Solaris

This adds the `timer_*` family of functions present in illumos (and Solaris), along with the associated types.  The `libc-test` suite passes on an illumos (OmniOSCE) machine.  While I do not have resources available to test on Solaris, these interfaces have been stable since Oracle forked.
2021-01-27 02:21:19 +00:00
bors 3e2f350b84 Auto merge of #2039 - Amanieu:aarch64_ilp32, r=JohnTitor
Add support for the ILP32 variant of AArch64

This also fixes mutex initializers on big-endian AArch64.
2021-01-27 01:17:56 +00:00
bors 9b7dd7c8ec Auto merge of #2040 - slp:add_preadv_pwritev, r=JohnTitor
Add preadv and pwritev for macOS

Add declarations for the preadv and pwritev system calls, introduced
in macOS 11.0 (Big Sur).

Signed-off-by: Sergio Lopez <slp@redhat.com>
2021-01-26 23:07:29 +00:00
bors 50adb91fb7 Auto merge of #2005 - operutka:fix-uclibc-dependencies, r=Amanieu
Fix missing dl lib on armv5te-unknown-linux-uclibceabi

I'm unable to link my executable for the Linux uClibc environment because of some missing symbols from the dl lib:
```
/home/operutka/goodcam/goodcam-server/target/armv5te-unknown-linux-uclibceabi/release/deps/goodcam_server-aefb92c403e8cd55.goodcam_server.dzc3futp-cgu.0.rcgu.o: In function `mio::sys::unix::dlsym::fetch::he5e2964820cfd29d':
      goodcam_server.dzc3futp-cgu.0:(.text._ZN3mio3sys4unix5dlsym5fetch17he5e2964820cfd29dE+0x30): undefined reference to `dlsym'
/home/operutka/goodcam/goodcam-server/target/armv5te-unknown-linux-uclibceabi/release/deps/goodcam_server-aefb92c403e8cd55.goodcam_server.dzc3futp-cgu.0.rcgu.o: In function `std::sys::unix::weak::fetch::h5ed4b0fa5792ef5c':
      goodcam_server.dzc3futp-cgu.0:(.text._ZN3std3sys4unix4weak5fetch17h5ed4b0fa5792ef5cE+0x3c): undefined reference to `dlsym'
```

The libc crate is being used at both of these points.

This change fixes the issue for me. I've tested it with two different GCC cross toolchains for armv5te and it seems to be OK.

_Note: I'm building my own std using the unstable build-std Cargo feature._
2021-01-26 21:34:59 +00:00
Patrick Mooney 0d61dcb7f3 Add port_notify struct for illumos and Solaris 2021-01-22 16:45:39 +00:00
Patrick Mooney 5675256b80 Add timer interface for illumos and Solaris 2021-01-22 04:21:43 +00:00
Sergio Lopez 81c3e9835d Add preadv and pwritev for macOS
Add declarations for the preadv and pwritev system calls, introduced
in macOS 11.0 (Big Sur).

Signed-off-by: Sergio Lopez <slp@redhat.com>
2021-01-21 16:26:32 +01:00
Amanieu d'Antras dc02daae5b Fix build with rustc-dep-of-std in the latest nightly 2021-01-20 16:53:06 +00:00
Amanieu d'Antras 062a415aed Add support for the ILP32 variant of AArch64
This commit also fixes mutex initializers on big-endian.
2021-01-20 16:40:07 +00:00
Sébastien Marie cf0793a926 openbsd: make WIFCONTINUED() safe 2021-01-16 17:54:22 +00:00
bors bb8fe9a756 Auto merge of #2028 - IsaacWoods:master, r=JohnTitor
Fix error when building rustc with a custom libc

When pulling a custom `libc` into a `rustc` build (with the `rustc-dep-of-std` feature set), the following error occurs:
```
error: unused attribute
  --> /hdd/libc/src/lib.rs:29:1
   |
29 | #![no_std]
   | ^^^^^^^^^^
   |
   = note: `-D unused-attributes` implied by `-D warnings`

error: crate-level attribute should be in the root module
  --> /hdd/libc/src/lib.rs:29:1
   |
29 | #![no_std]
   | ^^^^^^^^^^
```

I think this is because both the `no_std` and `no_core` attributes are specified, although the error message doesn't make this very clear. This PR changes this so `no_std` is only supplied when the `rustc-dep-of-std` feature is not.
2021-01-11 23:11:49 +00:00
Tamir Duberstein b24d95891d
Correctly define SOCK_CLOEXEC on Fuchsia
https://cs.opensource.google/fuchsia/fuchsia/+/master:zircon/third_party/ulib/musl/include/sys/socket.h;l=60-63;drc=7c5e521391fddb98fd8f6970da7c410899ddf5cf
2021-01-09 14:20:29 -05:00
Isaac Woods 48c4482b13 Fix conflict between no_std and no_core when building rustc with custom libc 2021-01-09 00:14:14 +00:00
Yuki Okushi 66500eeb18 Move structs to `s_no_extra_traits` 2021-01-07 18:10:00 +09:00
Yuki Okushi a39cf0d704 Define some consts on 1.25 ot higher 2021-01-07 16:11:21 +09:00
Damian Jarek 1581af0304 Define basic Linux SocketCAN constants and types
Add definitions from `linux/can.h`, which is a "base" header for remainder
of SocketCAN functionality.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2021-01-07 09:22:43 +09:00
bors 6deb8a935a Auto merge of #2020 - joshtriplett:ifla, r=JohnTitor
Add more IFLA_ values
2021-01-05 19:40:36 +00:00
Josh Triplett 2076d1cd3f Add more IFLA_ values 2021-01-05 11:39:47 -08:00
bors 2ec333c3b6 Auto merge of #2008 - bsteinb:macos-aarch64-mcontext, r=JohnTitor
Make test suite pass on macOS on aarch64

While working on #2007 I tried to run `cargo test` in `libc-test`, which failed, because the definition of `__darwin_mcontext64` was incomplete (see #1990). This adds definitions for the exception state and the floating point state as well.

`libc-test` still does not pass, because I use the type `[u128; 32]` for the `__v` field of `__darwin_arm_neon_state64` (in C it is `__uint128_t __v[32]`. `ctest2` does not translate `u128` to `__uint128_t` and the generated C code does not compile. Any ideas for working around this?
2021-01-05 11:12:12 +00:00
Benedikt Steinbusch ee84dae71c move declarations of mcontext_t and ucontext_t 2021-01-05 11:23:48 +01:00
bors a98a649bc3 Auto merge of #2019 - kolapapa:mipsel-uclibc, r=JohnTitor
Add EPOLLEXCLUSIVE && EPOLLWAKEUP
2021-01-05 04:00:03 +00:00
kolapapa 46af3376bd Add EPOLLEXCLUSIVE && EPOLLWAKEUP 2021-01-04 14:42:14 +08:00
Alan Somers f40f3068a0 aio functions do not require librt on FreeBSD
On FreeBSD, the aio_ functions require librt _only_ if they use
SIGEV_THREAD completion notification.  However, due to Rust's originally
poor support for C unions, libc doesn't even expose some of the fields of
struct sigevent that SIGEV_THREAD requires.  Accordingly, there is no
need to link librt to programs using aio via libc.

This change partially reverts 8c23f77704
from PR #1630 .

While I'm here, fix the linkage of lio_listio on DragonflyBSD.  It
_does_ require librt.
2021-01-03 11:06:05 -07:00
Benedikt Steinbusch d377b52d73 fix glob symbol name on macOS aarch64 2021-01-01 03:11:34 +01:00
Benedikt Steinbusch ea2bc2c065 add new constants for macOS Big Sur 2021-01-01 02:48:07 +01:00
Benedikt Steinbusch 3fc0015790 fix values of constants on macOS aarch64 2021-01-01 02:46:37 +01:00
Benedikt Steinbusch bdc755b487 add declaration of max_align_t for macOS on aarch64 2021-01-01 02:41:26 +01:00
Benedikt Steinbusch 42fe29064e provide declaration of boolean_t for macOS on aarch64 2021-01-01 02:41:26 +01:00
Benedikt Steinbusch a15491e325 move declaration of __darwin_mcontext64 etc. into align.rs 2021-01-01 01:54:37 +01:00
Benedikt Steinbusch 2ec0e61663 use [u64; 2] with manual alignment instead of u128 2021-01-01 01:25:29 +01:00
Benedikt Steinbusch 10347e8604 provide complete definition of __darwin_mcontext64 on aarch64 2021-01-01 01:25:29 +01:00
bors 7e7452fa28 Auto merge of #2013 - Thomasdezeeuw:freebsd-constants, r=JohnTitor
Add SO_DOMAIN constants to FreeBSD
2020-12-29 11:42:28 +00:00
Thomas de Zeeuw 01f7008527 Add SO_DOMAIN constant to FreeBSD 2020-12-29 12:04:13 +01:00
bors 0a975d9dd2 Auto merge of #2011 - tamird:ip-freebind, r=JohnTitor
Define IP_FREEBIND for Fuchsia

https://cs.opensource.google/fuchsia/fuchsia/+/master:zircon/third_party/ulib/musl/include/netinet/in.h;l=196;drc=bdf60afa9193c8a9190ee6bb6b5a0a11ad8876b6
2020-12-29 00:41:45 +00:00
bors c7619f7f67 Auto merge of #2010 - tamird:if-namsiz, r=JohnTitor
Define IFNAMSIZ for Fuchsia

https://cs.opensource.google/fuchsia/fuchsia/+/master:zircon/third_party/ulib/musl/include/net/if.h;l=72;drc=bdf60afa9193c8a9190ee6bb6b5a0a11ad8876b6
2020-12-28 23:36:26 +00:00
bors c9e8bab1e0 Auto merge of #2007 - bsteinb:macos-aarch64-symbols, r=JohnTitor
Fix symbols names on macOS aarch64

libSystem on macOS Big Sur on aarch64 exports these symbols without the `$suffix`es. See also: https://github.com/GuillaumeGomez/sysinfo/issues/372
2020-12-28 22:37:15 +00:00
Tamir Duberstein a829a10a86
Define IP_FREEBIND for Fuchsia
https://cs.opensource.google/fuchsia/fuchsia/+/master:zircon/third_party/ulib/musl/include/netinet/in.h;l=196;drc=bdf60afa9193c8a9190ee6bb6b5a0a11ad8876b6
2020-12-26 09:43:51 -05:00
Tamir Duberstein ceb2dffc5e
Define IFNAMSIZ for Fuchsia
https://cs.opensource.google/fuchsia/fuchsia/+/master:zircon/third_party/ulib/musl/include/net/if.h;l=72;drc=bdf60afa9193c8a9190ee6bb6b5a0a11ad8876b6
2020-12-26 09:40:18 -05:00
bors 6e7a919ce3 Auto merge of #2004 - dylni:define-cld-constants-for-more-targets, r=JohnTitor
Define CLD_ constants for more targets

This is an extension of #1860 to support more targets. The values for these constants should be correct, but I'm not familiar with most of the targets, so they should be verified.

These files should define the constants too, but the targets are closed source, so I don't know their values:
- [src/unix/solarish/mod.rs](https://github.com/rust-lang/libc/blob/master/src/unix/solarish/mod.rs)
- [src/vxworks/mod.rs](https://github.com/rust-lang/libc/blob/master/src/vxworks/mod.rs)
2020-12-24 09:01:49 +00:00
Benedikt Steinbusch ecffd09397 fix symbols names on macOS aarch64 2020-12-23 21:44:37 +01:00
dylni d116ee592d Define CLD_ constants for more targets 2020-12-21 21:31:14 -05:00
Sam Balana a7f09b96e1
Add ip_mreqn for Fuchsia
Adds the ip_mreqn struct for the Fuchsia platform, as defined by ip(7).
Enables joining an IPv4 multicast group by NIC ID rather than by its
assigned IPv4 address.
2020-12-21 16:44:51 -08:00
bors c7b9771cee Auto merge of #1999 - Jakob-Naucke:fix-statfs-magic-s390x, r=JohnTitor
Declare statfs MAGIC constants as c_uint on s390x

Hi, I work in container development on Linux on Z at IBM.
On s390x (IBM Z) in GNU/Linux, a statfs `f_type` is 4 bytes wide, contrary to 8 bytes on most architectures.
This is already implemented in libc:
```sh
$ grep -r f_type src/unix/linux_like/linux/gnu/b64 | uniq
src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs:        pub f_type: ::__fsword_t,
src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs:        pub f_type: ::__fsword_t,
src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs:        pub f_type: ::__fsword_t,
src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs:        pub f_type: ::c_long,
src/unix/linux_like/linux/gnu/b64/mips64/mod.rs:        pub f_type: ::c_long,
src/unix/linux_like/linux/gnu/b64/s390x.rs:        pub f_type: ::c_uint,             # s390x is uint
src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs:        pub f_type: ::__fsword_t,
```
However, the `*_MAGIC` constants (such as `EXT4_SUPER_MAGIC`) in `src/unix/linux_like/linux/gnu/mod.rs` are defined as `c_long`, when they should be `c_uint` on s390x.
This ends up biting me [here](https://github.com/kata-containers/cgroups-rs/blob/master/src/hierarchies.rs#L231).
Thus, I suggest the attached change to only define these constants for architectures other than s390x and instead define them as uint for s390x.
This is safe since none of the constants are any wider than 32bit.
Please let me know if you think this could be done more elegantly.
2020-12-21 15:36:35 +00:00
Jakob Naucke 3d09b9f67c
Declare statfs MAGIC constants as c_uint on s390x
Previously, statfs MAGIC constants like EXT4_SUPER_MAGIC were defined as c_long
for linux-gnu, whereas a statfs f_type is a c_uint on s390x. This commit
exempts these definitions from s390x and instead defines these constants as
c_uint on s390x. This is safe as none of these constants are wider than 32bit.

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2020-12-21 11:08:00 +01:00
Luca Barbato 0b861016eb Populate mcontext_t on aarch64-linux-musl
It is used by wasmtime.
2020-12-19 06:36:17 +01:00
Ondrej Perutka 6df758a249 Fix missing dl lib on armv5te-unknown-linux-uclibceabi 2020-12-18 11:51:35 +01:00
bors f26757a8fd Auto merge of #1998 - dylni:make-si-status-method-more-compatible, r=JohnTitor
Make si_status method more compatible

Now that [this PR](https://github.com/rust-lang/libc/pull/1858/files) has been merged, `siginfo_t::si_status` is a method for some targets and a field on others. This PR adds the method on targets that already expose the field, which lets the method be used without target detection.

I think this change is backward compatible, but it would be better if someone else could confirm that. The struct would now have a method and a field with the same name on some targets. If that's incompatible, another method could be added that accesses the field or calls the method depending on the target, but this is cleaner.
2020-12-17 07:29:33 +00:00
bors 80eb0cf292 Auto merge of #1992 - victorhsieh:master, r=JohnTitor
Android: make statfs64.f_fsid public

This has been the case since the initial commit
a36da11fb9. But there is no reason to hide
this struct member specifically.
2020-12-17 05:40:34 +00:00
dylni 29b4faed15 Make si_status method more compatible 2020-12-17 00:21:54 -05:00
bors 0ec925dfe5 Auto merge of #1990 - JohnTitor:arm-macos-state64, r=JohnTitor
Fix `thread_state64` on `aarch64-apple-darwin`

Fixes #1977
2020-12-12 23:19:02 +00:00
whitequark 4f47a74be1
Declare `O_RSYNC` for Android.
Bionic defines it to be `O_SYNC`.
2020-12-12 15:30:46 +00:00
whitequark 8b6fb595d7
Declare `seekdir` and `telldir` for Android.
These declarations are the same as those for other platforms.
2020-12-12 07:00:30 +00:00