Commit Graph

47 Commits

Author SHA1 Message Date
Yuki Okushi 3fae7e9ce7 Fix style 2021-04-06 10:10:29 +09:00
JohnTitor 7a3e51a770 Make `pwrite64` available on uclibc 2021-03-30 15:19:36 +09:00
Jonah Petri 13090dfcc0 uclibc: fix x86_64-unknown-l4re-uclibc build 2021-02-13 15:04:45 -05:00
Jonah Petri 0ac10285d9 uclibc: style fixes 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
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
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
LinkTed c6e695f3fa Add more constants for Linux like OS 2020-09-11 19:25:05 +02: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
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
Josh Triplett 5a1df22a78 Make some inline functions like WIFEXITED and WEXITSTATUS const and safe 2020-08-19 23:32:39 -07: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 83b3730444
Merge pull request #1859 from joshtriplett/w_exitcode 2020-08-14 15:50:20 +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 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
Nikita Baksalyar 5d2f261ab9 Add sys/personality.h constants for Linux 2020-07-29 01:45:44 +01: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
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
Markus Reiter a422e34ca8 Add explanation for `ai_addr` field. 2020-05-22 06:56:55 +02:00
Will 00327ab0b9 define IPV6_HOPLIMIT for freebsd, linux, and macos 2020-05-01 14:30:45 +09:00
Yuki Okushi c1a4d6271d
Use wasi values for `errno`s 2020-04-14 02:48:35 +09:00
Yuki Okushi be0347bbec
Remove `IPV6_FLOWINFO` from emscripten 2020-04-14 02:48:34 +09:00
Yuki Okushi 3a12831879
Remove some items defined in `errqueue.h` from emscripten 2020-04-14 02:48:31 +09:00
Yuki Okushi 9b31f772bb
Add `CLOCK_TAI` to linux_like/mod.rs 2020-03-08 20:21:01 +09:00
Benjamin Saunders ad6279db35 Add some linux socket MTU constants 2020-03-06 14:37:38 -08:00
Yuki Okushi 483bb8171f Replace TODO with FIXME to make grep easy 2020-02-29 13:36:27 +09:00
Vickenty Fesunov 9358be36d6 Remove unnecessary parenthesis
This triggers a warning on a recent nightly, which in turn breaks CI due to
`#![deny(warnings)]` in libc-test/build.rs
2020-02-12 10:09:22 +01:00
Matthew McPherrin 73c243700c Add sock_extended_err and associated constants from errqueue.h
sock_extended_err is a struct returned as a control message when the sockopt
IP_RECVERR is set, when recvmsg has the MSG_ERRQUEUE flag set.  IP_RECVERR and
MSG_ERRQUEUE are constants both already defined here.
2019-12-02 01:06:43 -08:00
bors c899a796ae Auto merge of #1581 - baloo:baloo/linux/ipv6, r=gnzlbg
adds IPV6_ consts for linux
2019-11-25 14:07:08 +00:00
bors 122ca908ee Auto merge of #1578 - fatpelt:master, r=gnzlbg
- add ssm struct and setsockopt constants

Signed-off-by: patrick felt <patrick.felt@sling.com>
2019-11-25 12:13:04 +00:00
Arthur Gautier 0eb1462e14 Revert "IPV6_FLOWINFO does not work with asmjs"
This reverts commit 6ff2e8f12d.
2019-11-22 18:12:15 +00:00
bors d742eedf90 Auto merge of #1536 - Aaron1011:feature/const-fn, r=gnzlbg
Add support for making functions `const`

PR https://github.com/rust-lang/rust/pull/64906 adds the ability to write `const extern fn` and `const unsafe extern fn`, which will allow manys functions in `libc` to become `const`.

This is particuarly useful for functions which correspond to C macros (e.g. `CMSG_SPACE`). In C, these macros are constant expressions, allowing them to be used when declaring arrays. However, since the corresponding `libc` functions are not `const`, writing equivalent Rust code is impossible. Users must either perform an unecessary heap allocation, or pull in `bindgen` to evaluate the macro for specific values (e.g. `CMSG_SPACE(1)`).

However, the syntax `const extern fn` is not currently parsed by rust. To allow libc to use this without breaking backwards compatibility (i.e. bumping the minimum Rust version), I've taken the following approach:

1. A new off-by-default feature `extern-const-fn` is added to `libc`.
2. The internal `f!` macro has two versions, selected at compile-time by a `cfg_if`. When `extern-const-fn` is enabled, the declared `f!` macro passes through the `const` keyword from the macro user to the final definition (`pub const unsafe extern fn foo`. When  `extern-const-fn` is disabled, the `const` keyword passed by the macro user is discarded, resulting in a plain `pub extern const fn` being declared.

Unfortunately, I couldn't manage to get `macro_rules` to accept a normal `const` token in the proper place (after `pub`). I had to resort to placing it in curly brackets:

```rust
pub {const} fn foo(val: u8) -> i8 {
}
```

The `f!` macro then translates this to a function definition with `const` in the proper position.

I'd appreciate it if someone who's more familiar with `macro_rules!` could see if I missed a way to get the desired syntax.
2019-11-18 19:37:32 +00:00
Amanieu d'Antras 1f7352ca3d Deprecate vfork 2019-11-17 11:44:24 +00:00
Arthur Gautier 6ff2e8f12d IPV6_FLOWINFO does not work with asmjs
Signed-off-by: Arthur Gautier <baloo@gandi.net>
2019-11-05 21:32:27 +00:00
Arthur Gautier 44b7a20329 IPV6_MULTICAST_ALL is too recent for aarch64 test env
Signed-off-by: Arthur Gautier <baloo@gandi.net>
2019-11-05 21:29:44 +00:00
Arthur Gautier f3064f3784 IPV6_ROUTER_ALERT_ISOLATE looks too recent for test env
Signed-off-by: Arthur Gautier <baloo@gandi.net>
2019-11-05 20:08:18 +00:00
Arthur Gautier d5cdb38ebb IPV6 consts are shared between android and linux
Signed-off-by: Arthur Gautier <baloo@gandi.net>
2019-11-05 17:41:34 +00:00
patrick felt 919ba61a02 - add ssm struct and setsockopt constants
Signed-off-by: patrick felt <patrick.felt@sling.com>
2019-10-31 11:32:29 -06:00
Aaron Hill 5dfc2c8285
Add support for declaring 'const fn'
Add a new feature to enable this, since `const extern fn`
support is unstable
2019-10-27 20:59:38 -04:00
gnzlbg 939a2e5a3a Formatting 2019-09-12 15:12:33 +02:00
Temirkhan Myrzamadi 1937b45118 Add IP_RECVERR (unix/linux_like/mod.rs) 2019-07-28 15:29:35 +06:00
Bryant Mairs 7c265919ec Switch to manual trait impls for sigevent
sigevent structs on most platforms have padding or unused fields. Rather
than display those in the Debug impl by deriving it, manually implement
all extra_traits instead ignoring those fields.
2019-06-09 19:28:32 -07:00
gnzlbg 8f098a3e3a Rename the notbsd module to linux_like 2019-06-03 21:46:43 +02:00