Commit Graph

2620 Commits

Author SHA1 Message Date
kolapapa 1f5debf70e restore the type of the parameter flags of getnameinfo to c_int 2020-12-10 19:15:22 +08:00
Victor Hsieh 53d7168806 Android: correct statfs64.f_fsid type & visibility
The visibility has been not public since the initial commit[1]. But there
is no reason to hide this struct member specifically.

The type has also been "__fsid_t" in Android's bionic[2], so fix that as
well. This makes it consistent with statfs.f_fsid nicely.

[1] a36da11fb9
[2] https://cs.android.com/search?q=file:bionic%2Flibc%20f_fsid
2020-12-09 09:35:59 -08:00
Jack Lloyd 3635a90210 Add the Aarch64 HWCAP_ values for Android 2020-12-07 14:01:19 -05:00
Jack Lloyd 7f9ed8cee1 Add getauxval for 64-bit Android 2020-12-07 13:13:26 -05:00
Yuki Okushi 990659966e Fix `thread_state64` on `aarch64-apple-darwin` 2020-12-07 12:27:24 +09:00
David Craven 53a8be9696 Address review comments. 2020-12-03 17:33:05 +01:00
David Craven d7a80e0a1f Followup to #1649. 2020-12-03 14:38:07 +01:00
bors 8e62c98274 Auto merge of #1982 - Thomasdezeeuw:freebsd-getrandom, r=JohnTitor
Add getrandom to FreeBSD

Introduced in FreeBSD 12.0.

Manual page: https://www.freebsd.org/cgi/man.cgi?query=getrandom.

Not sure if the constants should be `c_int`, just matching the `flags` argument in the function, in c they're macros.
2020-11-27 07:30:39 +00:00
Joshua M. Clulow 6b78ca9e72 add missing TCP socket options for illumos
The socket2 crate now depends on TCP_MAXSEG, and the rest of the options
may as well come along for the ride.
2020-11-25 16:34:58 -08:00
bors 84c12a458a Auto merge of #1979 - kolapapa:uclibc-dnslookup, r=JohnTitor
add `getnameinfo` && `EAI_NODATA` in uclibc

when compiling `dns-lookup v1.0.5` in target `mipsel-unknown-linux-uclibc`
```shell
error[E0432]: unresolved import `libc::getnameinfo`
error[E0531]: cannot find unit struct, unit variant or constant `EAI_NODATA` in crate `c`
```
2020-11-25 02:51:32 +00:00
bors 5598401c18 Auto merge of #1972 - zonyitoo:master, r=JohnTitor
Add IPV6_BINDANY on FreeBSD

https://github.com/freebsd/freebsd/blob/master/sys/netinet6/in6.h#L493
2020-11-24 19:53:33 +00:00
bors f4bd085cb8 Auto merge of #1970 - KentaTada:add-sockoptions-consts-aarch64, r=JohnTitor
Add constants of socket options on aarch64

Signed-off-by: Kenta Tada <Kenta.Tada@sony.com>
2020-11-24 18:31:05 +00:00
Thomas de Zeeuw 99b3635079 Add getrandom to FreeBSD
Introduced in FreeBSD 12.0.

Manual page: https://www.freebsd.org/cgi/man.cgi?query=getrandom.
2020-11-24 11:08:27 +01:00
kolapapa 2e14399344
Update src/unix/uclibc/mod.rs
change `getnameinfo` flags type to `c_uint`

Co-authored-by: Yuki Okushi <huyuumi.dev@gmail.com>
2020-11-23 21:11:53 +08:00
Yuki Okushi ce0787f047 Fix link warnings on rustdoc 2020-11-23 21:56:37 +09:00
kolapapa 105ef736fb add `getnameinfo` && `EAI_NODATA` in uclibc 2020-11-23 17:10:09 +08:00
zonyitoo 9578fa1942 Add IPV6_BINDANY on FreeBSD 2020-11-07 12:08:32 +08:00
Kenta Tada 4ecb610fa2 Add constants of socket options on aarch64
Signed-off-by: Kenta Tada <Kenta.Tada@sony.com>
2020-11-05 23:15:18 +09:00
Maarten de Vries 36affa26b8 Implement accept4 on Android as raw syscall.
This avoids relying on Android 5.0 / API level 21. The Linux kernel used
by Android supports the syscall (except in truly ancient Android
versions), but the Android libc did not expose a wrapper.
2020-11-03 10:17:51 +01:00
Tudor Sidea f3aab7a7ec Adding dl_iterate_phdr function to uclibc
Adding dl_iterate_phdr function and related structs and types to the
uclibc module as per the file include/link.h found in the uClibc-ng
repository as of version 1.0.36. This is necessary in order for rust to
work with a new target armv7-unknown-linux-uclibceabihf.
2020-10-31 17:57:12 +02:00
Jason King 9cd5c4be8d Add additional TCP options; fix TCP_KEEPIDLE 2020-10-30 00:42:56 +00:00
Jason King c35cc0a188 Add additional solarish TCP options 2020-10-30 00:32:04 +00:00
bors 727d0ed7cc Auto merge of #1962 - coolreader18:redox-sock, r=JohnTitor
Update redox socket constants
2020-10-29 06:01:55 +00:00
Noah 0358ea8b36
Add sys/file.h constants 2020-10-28 14:54:30 -05:00
Noah cfde22846d
Add NI_* constants 2020-10-27 22:41:11 -05:00
0e4ef622 a44cc0071a
Add endservent, getservbyport, getservent, setservent 2020-10-27 20:39:55 -05:00
Noah 0b694e466b
Update redox socket constants 2020-10-27 20:21:13 -05:00
Lzu Tao 42dce281b2 Add dl_iterate_phdr for openbsd 2020-10-27 18:03:33 +07:00
Lzu Tao 6711eefc8c Add dl_iterate_phdr for netbsd 2020-10-27 18:03:33 +07:00
Lzu Tao 89c90cd298 Add dl_iterate_phdr for freebsd 2020-10-27 09:59:37 +07:00
bors 2d0d4747c4 Auto merge of #1958 - JohnTitor:fix-dragonfly-build, r=nagisa
Allow `deprecated` attribute on `f!` macros to fix dragonfly build

Fixes #1957
cc `@nagisa` I think this should resolve the build :)
2020-10-25 05:02:11 +00:00
bors 6ca151e678 Auto merge of #1956 - JohnTitor:time64, r=JohnTitor
Add a deprecation note to `time_t` on musl

cc #1848
2020-10-25 03:15:05 +00:00
Yuki Okushi d40c7ebdf6 Allow deprecated `time_t` on musl 2020-10-25 11:16:26 +09:00
Yuki Okushi e471884df5 Add a deprecation note to `time_t` on musl 2020-10-25 11:16:26 +09:00
Yuki Okushi d371bdcc1e Fix `deprecated` attribute for `__error` 2020-10-25 10:37:49 +09:00
Yuki Okushi ae193eaae0 Allow attributes in `f!` and related macros 2020-10-25 10:37:26 +09:00
bors e0a4fb0397 Auto merge of #1902 - george-hopkins:mptcp, r=JohnTitor
linux: Add definitions for Multipath TCP

The Linux kernel recently gained support for [Multipath TCP](https://en.wikipedia.org/wiki/Multipath_TCP), a protocol which builds upon TCP. This patch adds `IPPROTO_MPTCP` to open new sockets and `TCP_ULP` to query the upper layer protocol of traditional TCP sockets (which is set to `mptcp` for all underlying connections)

Source: [tcp: Define IPPROTO_MPTCP](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=faf391c3826cd29feae02078ca2022d2f912f7cc)

cc #1896
2020-10-24 23:20:17 +00:00
George Hopkins 7f2619fdf9
Apply suggestions from code review
Co-authored-by: Yuki Okushi <huyuumi.dev@gmail.com>
2020-10-24 19:19:56 +02:00
brian-cook e90e708724 Bring the MUSL version of siginfo_t up-to-date. 2020-10-23 16:19:50 -05:00
Kenta Tada 1f97fa1db0 Add constants of socket options
Signed-off-by: Kenta Tada <Kenta.Tada@sony.com>
2020-10-23 16:21:21 +09:00
Fredrik Fornwall 90b2f51207 Add lockf() operations to Android
Reference:
https://github.com/aosp-mirror/platform_bionic/blob/master/libc/include/bits/lockf.h#L39-L46
2020-10-22 00:24:46 +02:00
George Hopkins 2a212c84fb linux: Add definitions for Multipath TCP
We leave IPPROTO_MAX as is for the time being. However, in recent
kernel releases IPPROTO_MAX is actually higher and reflects the
addition of IPPROTO_MPTCP.
2020-10-21 07:22:41 +02:00
Yuki Okushi 419a976810
Rollup merge of #1944 - nroi:include-sendfile64, r=JohnTitor
Include sendfile64() for Linux

`sendfile` uses the `off_t` type, which is platform dependent. On 64-bit architectures, I can pass an `off64_t` as the third argument to `libc::sendfile`, but on 32-bit architectures, this does not compile. `sendfile64` on the other hand uses a 64-bit wide offset even on 32-bit architectures, so that `off64_t` can be used.

Excerpt from `man 2 sendfile`:

> The original Linux sendfile() system call was not designed to handle large file offsets. Consequently, Linux 2.4 added sendfile64(), with a wider type for the offset argument.

I hope that supporting Linux versions below 2.4 is not a requirement for libc.
2020-10-21 07:18:52 +09:00
Fabian Muscariello a8c1d9746e Include sendfile64() for Linux 2020-10-20 16:35:09 +02:00
Kenta Tada 8b68710f94 Add definitions for Linux debug related MAGIC
Signed-off-by: Kenta Tada <Kenta.Tada@sony.com>
2020-10-20 23:22:16 +09:00
Yuki Okushi 2c99f4bebc Fix build for `sparc-unknown-linux-gnu` 2020-10-20 14:05:05 +09:00
bors 17b70c1f9b Auto merge of #1832 - qwandor-google:master, r=JohnTitor
Android: Add preadv and pwritev.

From sys/uio.h. Note that preadv64/pwritev64 are already included in
src/unix/linux_like/mod.rs.
2020-10-19 16:33:07 +00:00
Andrew Walbran d04bb8e23e Android: Add preadv and pwritev.
From sys/uio.h. Note that preadv64/pwritev64 are already included in
src/unix/linux_like/mod.rs.
Also fix parameter names of process_vm_[readv,writev] to match Bionic
header.
2020-10-19 12:24:27 +01:00
DarcInc 16e0a0bf5f Adding nmount to freebsd and removing fdatasync from freebsd 10 2020-10-18 21:46:15 -04:00
bors 582c5cf0c0 Auto merge of #1703 - eduardosm:remove-af_alg_iv-as_slice, r=JohnTitor
Add deprecation notice to `af_alg_iv::as_slice` and trait implementations that depend on it

These trait implementations exposed an unsound API (see https://github.com/rust-lang/libc/issues/1501).
2020-10-16 17:00:24 +00:00
Eduardo Sánchez Muñoz d73e8a3d86 af_alg_iv: Move the deprecated attribute to the struct definition and specify version. 2020-10-16 11:41:15 +02:00
rupansh-arch 86b92f37fc android: process_vm*: fix return type 2020-10-16 05:24:37 +05:30
rupansh-arch 8624caf9ab expose process_vm_readv, process_vm_writev for android
Signed-off-by: rupansh-arch <rupanshsekar@hotmail.com>
2020-10-16 05:24:37 +05:30
Eduardo Sánchez Muñoz 5b221b2179 Re-add trait implementations of `af_alg_iv` and mark them as deprecated. 2020-10-15 22:40:43 +02:00
Eduardo Sánchez Muñoz 4b6ffb7aaf Remove `af_alg_iv::as_slice` and trait implementations that depend on it
These trait implementations exposed an unsound API (see
https://github.com/rust-lang/libc/issues/1501)
2020-10-15 22:23:07 +02:00
Max Blachman a6c451d17f add clock_nanosleep to freebsd 12 and netbsd 2020-10-15 10:11:43 -07:00
Robert Collins e9c6804523 Add missing NetBSD RLIMIT_ constants 2020-10-10 20:37:47 +02:00
Yuki Okushi a410c35f11
Merge pull request #1914 from db48x/add-clearerr 2020-10-08 04:34:01 +09:00
Daniel Brooks e4eec2a1c5 add clearerr 2020-10-07 04:35:31 -07:00
Andrew Walbran 4f40b35cca Android: Add VMADDR_ constants. 2020-10-07 11:56:56 +01:00
Josh Triplett b4c81e9871
Merge pull request #1912 from pfmooney/illumos-pthread-getattr
pthread_getattr_np is not present on illumos
2020-10-04 22:04:13 -07:00
Yuki Okushi 02fe5de20b
Merge pull request #1911 from joshtriplett/master
Fix bootstrap on redox
2020-10-05 11:21:09 +09:00
Josh Triplett c4b0d5efd3 Fix bootstrap on redox
Avoid attempting to enable the static_nobundle feature twice, which
results in rustc error E0636.
2020-10-04 14:42:39 -07:00
Patrick Mooney 8f57688dde pthread_getattr_np is not present on illumos 2020-10-04 18:47:00 +00:00
Yuki Okushi 458f49c8e6
Merge pull request #1894 from alistair23/alistair/rv32 2020-10-02 08:58:32 +09:00
Josh Triplett 2ae4135cbd
Merge pull request #1889 from LinkTed/master
Add more constants for Linux like OS
2020-10-01 12:00:24 -07:00
Alistair Francis bdfd01599e unix: riscv32: Move type defines inside confif
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2020-10-01 07:15:39 -07:00
Josh Triplett 3e9945eb04
Merge pull request #1897 from Aaron1011/feature/sys-pidfd-open-clone3
Add SYS_pidfd_open and SYS_clone3
2020-09-30 20:14:47 -07:00
Alistair Francis c6c9181874 unix: riscv32: Fix CI failure
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2020-09-30 18:58:05 -07:00
Alistair Francis 6801218fd4 linux: riscv32: Add support for the 64-bit time_t RV32 glibc port
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2020-09-30 07:29:38 -07:00
Yuki Okushi 9c17cad7f0
Merge pull request #1899 from joshtriplett/support-static-glibc 2020-09-30 17:18:45 +09:00
Yuki Okushi b3f8975d3e
Merge pull request #1903 from bartelsielski/master
Add struct ip_mreqn to more Linux targets
2020-09-30 15:47:38 +09:00
Yuki Okushi bffed84b3f
Merge pull request #1904 from glaubitz/sparc-linux
Fix type definition for c_char on sparc-unknown-linux-gnu
2020-09-30 12:43:57 +09:00
Yuki Okushi 8cdddfd6b8
Merge pull request #1905 from qwandor-google/vsock
Android: Add vsock constants and struct.
2020-09-30 12:40:51 +09:00
Yuki Okushi 0293c44929
Merge pull request #1895 from schultetwin1/master
Add UIO_MAXIOV constant to uclibc
2020-09-30 12:23:14 +09:00
Andrew Walbran 37357abbfc Android: Add vsock constants and struct. 2020-09-29 13:41:00 +01:00
John Paul Adrian Glaubitz 772a3acfa6 Fix type definition for c_char on sparc-unknown-linux-gnu
On sparc-unknown-linux-gnu, char is signed, not unsigned.
2020-09-27 23:27:30 +02:00
Bartel Sielski f64da93c68 Add struct ip_mreqn to more Linux targets
Support was previously added to gnu x86_64 and all musl targets but
others were not included because of a roundtrip issue [1].

This commit adds support for the ip_mreqn struct on all Linux GNU
targets which did not have the roundtrip issue.

[1]: https://github.com/rust-lang/libc/issues/1558

Signed-off-by: Bartel Sielski <bartel.sielski@gmail.com>
2020-09-25 15:50:23 +02:00
Josh Triplett 5bf6ee5d8e Consolidate handling of libdl, and handle crt-static
Move the link line for `libdl` up to `src/unix/mod.rs`, making it easier
to see all the libraries `libc` links to.

This also makes `libdl` respect `target-feature=+crt-static`.
2020-09-21 01:15:03 -07:00
Josh Triplett e005f4cad5 Consolidate handling of libutil, and handle crt-static
The two library blocks that specify `#[link(name = "util")]` do not
actually reference any functions in `libutil`; the functions that do use
`libutil` don't have any reference to it. And having two library blocks
specify it results in two separate inclusions of `-lutil` on the linker
command line. Move the link lines up to `src/unix/mod.rs`, making it
easier to see all the libraries `libc` links to.

This also makes `libutil` respect `target-feature=+crt-static`.
2020-09-21 01:15:00 -07:00
Josh Triplett ac0a783953 Add support for building with static glibc
This will need corresponding changes in rust-lang/rust to activate, but
this will make it possible to make those changes.

Note that despite the apparent redundancy in config directives, the link
directives cannot be simplified any further. Attempting to factor out
the checks for `target_feature = "crt-static"` does not work.
2020-09-21 01:14:06 -07:00
Aaron Hill 8e58e82c02
Add SYS_pidfd_open and SYS_clone3
These syscalls were added recently, and therefore have consistent
numbers across different architetures (other than the weird offsetting
on some platforms).
2020-09-17 06:05:23 -04:00
Matt Schulte d66df29623 Add UIO_MAXIOV constant to uclibc
!1880 added UIO_MAXIOV to libc, but did not add it to uclibc. This
causes build breaks for std against uclibc.
2020-09-16 21:28:07 -07:00
Dan Gohman 51af18df79 Define some `sysconf` constants for WASI. 2020-09-13 11:59:19 -07:00
Daniil Bondarev 773f5562ba Use safe_f! consistently across platforms
The pr #1870 introduced safe_f! macro, which made some functions like
WIFEXITED and WEXITSTATUS const and safe on linux_like platform only,
which causes inconsistency when trying to use those functions in crates
compiled across multiple platforms, as using unsafe on those functions
will generate unused_unsafe warning on linux platforms and lack of
unsafe block will fail compilation on non-linux platforms.

To avoid the inconsistency, this commit applies the same macro for all
the same functions on other platforms too.
2020-09-12 23:38:06 -07:00
LinkTed c6e695f3fa Add more constants for Linux like OS 2020-09-11 19:25:05 +02:00
Yuki Okushi 59544d95bc
Merge pull request #1887 from psumbera/master
add pthread_getattr_np() and pthread_attr_getstack() for Solaris
2020-09-10 14:11:16 +09:00
Yuki Okushi 2a0b8fe390
Merge pull request #1886 from sunfishcode/main
Define several more constants for WASI.
2020-09-10 14:08:50 +09:00
Petr Sumbera 9f6a7ceee8 add pthread_getattr_np() and pthread_attr_getstack() support for illumos and Solaris systems 2020-09-09 16:30:56 +02:00
Dan Gohman a02da55c4b Define several more constants for WASI.
Define `O_NOCTTY`, `R_OK`, `POLLIN`, and related constants using the
current values from WASI libc.
2020-09-03 23:05:34 -07:00
MeiK 7cc22dbabd Add getitimer and setitimer for macOS
Add getitimer and setitimer for macOS
2020-09-03 18:31:25 +08:00
Yuki Okushi af7749c1e5
Merge pull request #1882 from alindima/master
Add missing syscall numbers for aarch64-musl
2020-09-02 13:41:23 +09:00
Yuki Okushi d21380bb50
Merge pull request #1881 from JohnColanduoni/apple-o-symlink
Add support for Apple's O_SYMLINK flag
2020-09-02 13:36:04 +09:00
Yuki Okushi f19436de85
Merge pull request #1880 from Thomasdezeeuw/io-max-consts
Add IOV_MAX and UIO_MAXIOV constants
2020-09-02 13:34:08 +09:00
Yuki Okushi 75ab4a0124
Merge pull request #1875 from cmusser/master 2020-09-02 13:31:54 +09:00
alindima a75f9347e1 Add missing syscall numbers for aarch64-musl 2020-08-31 11:03:01 +03:00
John Colanduoni abd18481b7 Add support for Apple's O_SYMLINK flag 2020-08-29 19:41:16 -07:00
Thomas de Zeeuw 41fb480527 Add IOV_MAX and UIO_MAXIOV constants
These constant can be used to determine the maximum number of iovecs can
be passed to functions like readv/writev.

Linux like uses UIO_MAXIOV, while the BSD family uses IOV_MAX.
2020-08-28 15:03:50 +02:00
Chuck Musser 2e3748a53c Restore the __error() function, but add a deprecation warning. 2020-08-23 19:23:21 -07:00
Chuck Musser c354c216ff Dragonfly: expose __errno_location() rather than define __error().
Expose __errno_location() (introduced in DragonFlyBSD 5.8), which
returns the current thread's errno value. This is similar to Linux
and avoids having a separate module that defines both errno (which
depends on the thread_local feature) and an __error() function.
2020-08-23 09:37:00 -07:00
Niels Sascha Reedijk 43ad09ee63 Haiku: add [get/set]priority()
These methods were added in Haiku R1 beta 2.
2020-08-22 21:57:11 +00:00
Daniil Bondarev ce5cb03544 Added clock_getcpuclockid to more targets
Previously clock_getcpuclockid was enabled only on linux, with this
change it is enabled on all linux_like and freebsdlike.
2020-08-21 22:12:48 -07:00
Yuki Okushi ace7ba86e5
Merge pull request #1870 from joshtriplett/safe-functions 2020-08-21 04:23:12 +09:00
Josh Triplett 5a1df22a78 Make some inline functions like WIFEXITED and WEXITSTATUS const and safe 2020-08-19 23:32:39 -07:00
Josh Triplett b1144cc924 libc can't use derive(Copy,Clone) because it doesn't work in rustc 2020-08-19 22:58:10 -07:00
Jed Brown 3f9f49aacd add fmemopen, open_memstream, and open_wmemstream for POSIX.1-2008
Skip test on aarch64 due to https://github.com/rust-lang/libc/issues/1765
2020-08-19 19:08:00 -06:00
Yuki Okushi c9ff3e9b4e
Merge pull request #1864 from sajattack/psp-corrections
PSP: A few corrections to types and function signatures
2020-08-20 04:26:34 +09:00
Yuki Okushi 50318f7665
Merge pull request #1863 from ifreund/aarch64-musl-ucontext_t
Add ucontext_t for aarch64-unknown-linux-musl
2020-08-20 04:25:29 +09:00
Paul Sajna bf8327bc06 PSP: A few corrections to types and function signatures 2020-08-19 01:25:16 -07:00
Isaac Freund 2259b0b154
Add ucontext_t for aarch64-unknown-linux-musl 2020-08-19 10:18:21 +02:00
Yuki Okushi b1793090f4
Merge pull request #1861 from joshtriplett/p_pidfd 2020-08-19 07:45:41 +09:00
Josh Triplett e709b3f78a Define P_PIDFD, used with waitid
Linux defines a waitid type `P_PIDFD`, for use with process file
descriptors (`pidfd`). Add that constant.

In libc-test, add linux/wait.h to the Linux-specific and
Android-specific headers, to get the definition. Exclude it on Android
and musl for now, though, as the versions in CI don't have it yet.
2020-08-18 14:11:08 -07:00
Yuki Okushi c6c865ef5e
Merge pull request #1862 from fornwall/android-regex 2020-08-17 00:06:30 +09:00
Yuki Okushi 83b3730444
Merge pull request #1859 from joshtriplett/w_exitcode 2020-08-14 15:50:20 +09:00
Basix 1bd882e910 Add execl* functions on Windows 2020-08-12 20:12:33 +09:00
Fredrik Fornwall faecad7f01 Expose regex.h for Android 2020-08-12 10:17:18 +02:00
Yuki Okushi 6ff0689d88
Merge pull request #1858 from joshtriplett/siginfo-pid-uid
Expose si_pid and si_uid from siginfo_t as functions
2020-08-11 16:05:55 +09:00
Yuki Okushi 67005e0625
Merge pull request #1860 from joshtriplett/cld
Add CLD_ constants
2020-08-11 15:59:18 +09:00
Josh Triplett 57298d0637 Add W_STOPCODE to construct a stop code
On Linux, `sys/wait.h` defines a `W_STOPCODE` macro to construct a stop
code from the signal number of a stopping signal. Provide an equivalent
function.

Suggested-by: Ivan Tham <pickfire@riseup.net>
2020-08-10 20:23:03 -07:00
Josh Triplett a4178c59ee siginfo: Provide functions for si_utime and si_stime
The SIGCHLD variant of the siginfo structure also provides fields for
user and system time; expose those as well.
2020-08-10 20:20:30 -07:00
Josh Triplett e3bce7511b siginfo: In the struct used to access sifields, don't name the first 3 fields
The first 3 fields of `siginfo_t` have different orders on MIPS. When
casting `siginfo_t` to a different type to access the fields of the
`sifields` union, avoid giving names to the first three fields, since
they're only present for memory layout and shouldn't be accessed from
the casted structure type.
2020-08-10 20:16:50 -07:00
Josh Triplett 13d0cdb68f Expose si_pid, si_uid, and si_status from siginfo_t as functions
On Linux, siginfo_t cannot expose these fields directly due to
https://github.com/rust-lang/libc/issues/716 , so expose them as
functions, just like si_addr and si_value.

In order to get alignment correct on both 32-bit and 64-bit
architectures, define an sifields union that includes a pointer field,
to ensure that it has the same alignment as a pointer.
2020-08-10 01:24:22 -07:00
Josh Triplett 220505181f Add CLD_ constants
These constants appear in the si_code field of a SIGCHLD signal or
waitid-returned siginfo value.
2020-08-09 16:59:09 -07:00
Josh Triplett 631da86c92 Add W_EXITCODE to construct an exit code
On Linux, `sys/wait.h` defines a `W_EXITCODE` macro to construct an exit
code from a return value and a signal number. Provide an equivalent
function.
2020-08-09 16:40:54 -07:00
Fábio Botelho 8ced4c0a8c Add mac/ios pthread_from_mach_thread_np
Allows us to get a pthread id from a match thread id.
From pthread.h [1]:

```
__API_AVAILABLE(macos(10.5), ios(2.0))
_Nullable pthread_t pthread_from_mach_thread_np(mach_port_t);
```

[1] - https://opensource.apple.com/source/libpthread/libpthread-416.40.3/pthread/pthread.h.auto.html
2020-08-09 18:17:08 +01:00
Yuki Okushi ab3c229140
Merge pull request #1854 from jclulow/illumos-openpty
add openpty and forkpty implementation for illumos systems
2020-08-07 06:28:47 +09:00
Joshua M. Clulow 1f0ea0da73 add openpty and forkpty implementation for illumos systems
At time of writing, illumos systems do not provide an implementation of
the openpty() and forkpty() wrappers provided on some other UNIX
systems.  While we expect to grow an implementation, it seems prudent to
provide a compatibility routine here first to unblock illumos support in
the popular nix crate.
2020-08-05 20:39:45 -07: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
Yuki Okushi 510badd75f
Merge pull request #1853 from coolreader18/nameinfo-consts
Add more constants for getnameinfo on android
2020-08-05 05:29:30 +09:00
coolreader18 ec5c0ae6bc Add more constants for getnameinfo 2020-08-02 14:49:54 -05:00
Joshua M. Clulow 1c9d5eaa41 add ucred(3C) support for illumos and Solaris systems
This series of routines allows the caller to determine the credentials
of another process by pid, or of the process on the remote end of a UNIX
domain socket.  The ucred_t is an opaque object with accessor routines,
and must be freed through ucred_free(3C) after use.
2020-08-01 21:47:13 -07:00
Nikita Baksalyar 5d2f261ab9 Add sys/personality.h constants for Linux 2020-07-29 01:45:44 +01:00
Yuki Okushi ac930a2536
Merge pull request #1844 from asomers/CTL_P1003_1B_MAXID
Deprecate CTL_P1003_1B_MAXID
2020-07-29 04:12:55 +09:00
Yuki Okushi b1268e43cd
Merge pull request #1843 from amanda-tait/fuchsia-cmsg 2020-07-28 18:38:42 +09:00
amanda-tait 5d116747c3 Fix style in CMSG_* "macros" for fuchsia
This change addresses two style errors found in PR review:
* indent and linebreak in CMSG_NXTHDR
* prefer `0 as *mut cmsghdr` over `core::ptr::nul_mut()`
2020-07-27 22:03:13 -04:00
Alan Somers 554ea4b8bd Deprecate CTL_P1003_1B_MAXID
It's been removed in FreeBSD 13 (svn r363622), and never had any
legitimate use outside of the base system anyway.
2020-07-27 14:59:32 -06:00
Glenn Hope 2d5fc45139 Create macros for defining Copy and Clone on psp's enums and parenthetical structs
Fix styling

Re-run CI
2020-07-27 13:51:47 -07:00
Amanda Tait 59749267fa Add CMSG_* "macro" support to Fuchsia
This change defines and implements functions for the Fuchsia platform
corresponding to the C library CMSG_* macros, used for processing socket
control messages sent or received using the recv_msg(2)/send_msg(2)
syscalls.
2020-07-27 10:46:05 -04:00
Yuki Okushi 04804c7bd0
Merge pull request #1839 from kellda/_aligned_malloc
Add "_aligned_malloc" on windows platform
2020-07-26 23:06:18 +09:00
kellda 32b1303947 Add "_aligned_malloc" on windows platform 2020-07-25 20:21:35 +00:00
Yuki Okushi f944fce982
Merge pull request #1834 from GabrielMajeri/ptrace-event-stop
Add `PTRACE_EVENT_STOP`
2020-07-26 05:03:07 +09:00
Gabriel Majeri c78e0b82e1 Add `PTRACE_EVENT_STOP` 2020-07-25 20:36:22 +03:00
Bryan Donlan da16adf57b Expose IP_FREEBIND constant for linux 2020-07-24 18:27:30 +00:00
Yuki Okushi b2e250e3bd
Merge pull request #1831 from xonatius/patch-1 2020-07-24 17:03:56 +09:00
Daniil Bondarev 482420f63d
Fixed style suggestion
Co-authored-by: Yuki Okushi <huyuumi.dev@gmail.com>
2020-07-23 16:28:11 -07:00
Yuki Okushi 65be52f339
Merge pull request #1830 from JohnTitor/utmpx
Declare `utmpx` on musl
2020-07-24 04:45:34 +09:00
Daniil Bondarev 42bb28d615 Added clock_getcpuclockid to linux
https://man7.org/linux/man-pages/man3/clock_getcpuclockid.3.html
2020-07-21 23:48:04 -07:00
Yuki Okushi 05c4574f3a
Declare `utmpx` on musl 2020-07-22 09:51:21 +09:00
Yuki Okushi dce0ec0adb
Merge pull request #1828 from stefano-garzarella/vsock-vmaddr-local 2020-07-21 08:07:53 +09:00
Stefano Garzarella e93797a689 linux: add VMADDR_CID_LOCAL
In Linux we replaced VMADDR_CID_RESERVED with VMADDR_CID_LOCAL
in commit ef343b35d46667668a099655fca4a5b2e43a5dfe.
It is available since Linux v5.6, and it can be used to do
local communication if supported.

This patch deprecates VMADDR_CID_RESERVED for backward
compatibility.

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
2020-07-20 21:33:00 +02:00
Dan Gohman 351c435814 Add a declaration for `posix_fadvise64` on Linux.
As with the other *64 functions in Linux, `posix_fadvise64` is like
`posix_fadvise` but uses `off64_t` instead of `off_t`.
2020-07-20 07:42:25 -07:00
Yuki Okushi b17047fc2d
Merge pull request #1797 from overdrivenpotato/psp 2020-07-20 05:04:47 +09:00
Paul Sajna cb177721d9 use s! macro on structs
fix compilation errors

rustfmt

fix style

add f! for const fns

remove unneccessary const functions
2020-07-19 11:06:17 -07:00
Paul Sajna d1312c2997 add or deny missing debug implementations
rustfmt
2020-07-19 11:06:15 -07:00
Marko Mijalkovic 47de170655 Reorganize psp definitions into one file 2020-07-19 11:06:15 -07:00
Marko Mijalkovic 9a2c83d944 Declare all extern blocks as `extern "C"` 2020-07-19 11:06:15 -07:00
Marko Mijalkovic 91beafead9 Flatten imports in gu.rs
Fix style errors
2020-07-19 11:06:04 -07:00
Marko Mijalkovic 6b6fe5bf0e Add PSP user mode API 2020-07-19 10:29:44 -07:00
Simonas Kazlauskas 91fee24f12
Move the SEAL constants to freebsd12 module 2020-07-20 01:16:47 +09:00
Simonas Kazlauskas 6b14cfbf93
Add some missing fcntl flags for freebsd 2020-07-20 01:14:26 +09:00
Patrick Mooney e1b9757128 Expose EPOLLEXCLUSIVE on illumos platform
Initially the EPOLLEXCLUSIVE definition was hidden on the illumos
platform as it lacked explicit support.  After further review, it was
concluded that EPOLLEXCLUSIVE can safely be considered a no-op, when not
fully implemented by the OS, making it safe for use on illumos.
2020-07-17 18:28:33 +00:00
Yuki Okushi 68e1fd8faa
openbsd: Fix `WIFSTOPPED` following upstream
b66614995a/sys/sys/wait.h (L52)
2020-07-15 01:39:07 +09:00
Simon Wörner fabdb14a0c added ptrace_vm_entry struct 2020-07-10 01:28:40 +02:00
Simon Wörner 2ea1dee37b added ptrace io struct and defines 2020-07-09 17:31:15 +02:00
Jake Goulding 8c2daaea67 Limit macOS `$INODE64` symbol names to x86 and x86_64
The new ARM-based platform doesn't need these as there's no legacy
constraints.

Tested via

**demo.c**

```c

int main() {
  fstat(0, NULL);
  fstatat(0, NULL, NULL, 0);
  lstat(NULL, NULL);
  stat(NULL, NULL);
  readdir(NULL);
  readdir_r(NULL, NULL, NULL);
}
```

**Compilation**

```none
% SDKROOT=/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk MACOSX_DEPLOYMENT_TARGET=11.5 cc -arch arm64 demo.c

% nm a.out
0000000100008030 d __dyld_private
0000000100000000 T __mh_execute_header
                 U _fstat
                 U _fstatat
                 U _lstat
0000000100003e64 T _main
                 U _readdir
                 U _readdir_r
                 U _stat
                 U dyld_stub_binder
```

This has also been experimentally compiled on a Developer Transition Kit.
2020-07-08 07:27:40 -04:00
Alan Somers 6f2139e1c4 Fix _ALIGNBYTES on FreeBSD x86 with Rust <= 1.23.0.
Fixes #1775
2020-07-07 14:16:25 -06:00
Yuki Okushi 0c2027f05a
Merge pull request #1811 from sunfishcode/wasi-more
Add more WASI libc definitions.
2020-07-07 07:04:08 +09:00
Dan Gohman 753ad8205f Add more WASI libc definitions.
This adds various WASI libc definitions to the Rust libc bindings that I
needed while porting some applications to WASI.

It also removes the `pause` binding since newer versions of WASI libc
have removed this function as well. (WASI currently has no syscall with
this functionality.)
2020-07-06 05:50:17 -07:00
Greg V 962b984773 FreeBSD: new rand()/srand() ABI in 13
https://reviews.freebsd.org/rS357382
2020-07-06 15:31:37 +03:00
Greg V 9fc2574548 FreeBSD: chase CTL_UNSPEC to CTL_SYSCTL, IPPROTO_SEP to IPPROTO_DCCP renames
Plus, add new constants for sysctls that give names to existing magic numbers.

https://reviews.freebsd.org/rS350749
https://reviews.freebsd.org/rS352486
2020-07-06 15:31:37 +03:00
Greg V 9340bb3516 FreeBSD: add mcontext_t/ucontext_t (only amd64 for now) 2020-07-06 15:31:37 +03:00
Greg V 1366bda058 FreeBSD: make wchar_t unsigned on arm/aarch64
Wide chars are unsigned when normal chars are
2020-07-06 15:31:37 +03:00
Greg V 45e7b8bef4 FreeBSD: fix SIGSTKSZ on arm/aarch64 / add MINSIGSTKSZ 2020-07-06 15:31:37 +03:00
Greg V e9a75ddd76 FreeBSD: use stat header in freebsd11/freebsd12 on aarch64
sys/stat.h is a machine-independent header, but it has ifdefs for i386.
The version that was called x86_64.rs should be used on powerpc64 too,
but I don't have a machine to test that on.
2020-07-06 15:31:37 +03:00
Greg V 8c23f77704 freebsdlike: move aio_ and mq_ functions to #[link(name = "rt")]
I just got 'libxul.so: Undefined symbol "mq_close"' when rebuilding Firefox..
How did no one catch this before??

This is correct for both FreeBSD and DragonFly:
https://github.com/freebsd/freebsd/blob/master/lib/librt/Symbol.map
e7ab884bd4/lib/librt/mq.c
e7ab884bd4/lib/librt/aio.c
2020-07-06 15:31:37 +03:00
Marcin Konicki c17a4c1711
Add missing sysconf constants for Haiku
Hi,

Could you add some missing Haiku constants (i'm guessing they were added after Haiku port was last updated)?

These are defined in `unistd.h`: 194a45c6b4/headers/posix/unistd.h (L134-L137)
2020-07-03 22:09:46 +02:00
Yuki Okushi 7a507b64c2
Merge pull request #1806 from alexcrichton/aarch64-mcontet
Add ucontext_t/mcontext_t for aarch64 Android
2020-07-03 11:25:35 +09:00
Yuki Okushi fdc5cf4a1b
Merge pull request #1750 from asomers/super_magic 2020-07-03 11:09:29 +09:00
Alan Somers c9b8fc8305 Add more *_SUPER_MAGIC defines from the latest Linux kernel 2020-07-02 18:34:48 -06:00
Yuki Okushi 20fabe6bf5
Fix ordering of allowed lints 2020-07-03 07:58:01 +09:00
Alex Crichton 8059eda19d Add ucontext_t/mcontext_t for aarch64 Android
This ended up just getting copied from Linux as it appears to be the
same.
2020-07-02 09:33:15 -07:00
Yuki Okushi bfb1b1301d
Add some syscalls from `fs/open.c` on linux/aarch64 2020-07-02 19:02:42 +09:00
Dan Gohman c7011f43a6 Declare `seekdir` and `telldir` for WASI.
These declarations are the same as those for other platforms.
2020-07-01 23:44:33 -07:00
Yuki Okushi a9d7538413
Update comment to clarify 2020-07-02 00:36:19 +09:00
kolapapa b672d88e53 add uclibc `SOCK_RDM` field 2020-07-01 12:14:33 +08:00
Andrew Walbran 51acd7f488 Android: Add various constants and functions.
In particular:
Add timerfd constants and functions, from sys/timerfd.h.
Add EFD_SEMAPHORE and group all EFD_ constants together.
Add sigtimedwait function, from signal.h.
Add missing fallocate constants and functions, from linux/falloc.h and fcntl.h.
Add xattr functions, from sys/xattr.h.
Add SCHED_ and SEEK_ constants, from linux/sched.h and bits/seek_constants.h.
Add rlimit functions, from sys/resource.h.
Add RENAME_ constants, from stdio.h.
Add ino64_t type, from sys/types.h.
2020-06-30 17:56:11 +01:00
Andrew Walbran 5f0466501c Android: Update to latest version of NDK. 2020-06-30 17:56:11 +01:00
Alan Somers 1d68e9aa69 Sort linux's *_SUPER_MAGIC definitions 2020-06-30 08:25:08 -06:00
Yuki Okushi b6396caf31
Merge pull request #1792 from jasonbking/cmsg 2020-06-27 19:17:32 +09:00
Jason King 40c46f4306 Add ancillary socket data accessor functions for solarish OSes 2020-06-26 20:58:43 +00:00
Bill Fraser 775c52e669 add wexecv, wexecve, wexecvp, wexecvpe 2020-06-26 11:28:12 -07:00
Yuki Okushi 3118fb455e
Merge pull request #1793 from reitermarkus/xtensa-support-master
Add `MSG_` constants for Xtensa.
2020-06-23 19:15:50 +09:00
Simon Wörner 4a9413ba54 added freebsd register structs 2020-06-22 17:33:09 +02: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
Patrick Mooney b53ccb8740 illumos: Add eventfd support 2020-06-09 20:57:33 +00:00
Patrick Mooney 714ab82741 solarish: Add missing constants 2020-06-08 17:26:40 -05:00
Brian Cain e6dc360605 linux hexagon: add missing defines
This commit defines ETIMEDOUT, SIGSTKSZ, MINSIGSTKSZ
2020-06-04 11:02:28 -05:00
Yuki Okushi 5c033e0db1
Add `ip_mreqn` on the more targets 2020-05-29 09:40:24 +09:00
Yuki Okushi 42393b7d38
FreeBSD: Follow upstream `WIFSIGNALED` change 2020-05-29 04:27:57 +09:00