Add SIGRTMAX and SIGRTMIN on linux-like systems
Fixes#1883. This is based on https://github.com/rust-lang/libc/pull/2195, which has not seen activity in a while.
The original issue was resolved by making `__libc_current_sigrtmax` and `__libc_current_sigrtmax` `pub`.
I also added a test similar to `errqueue`'s, where the actual value of the macro is compared to `libc`'s implementation.
Closes#2195
Signal controlling constants for windows
This is replacement of #1626, because I have lost the repository with that branch in the meantime. The content is the same (unless I've made some mistake copying it over), just rebased onto current master.
One would expect Android to include the Unix and Linux lists, as it's
Linux based. However because Android is missing too many definitions I
found it easier to create a fully separate list for Android
specifically.
This first step add the infrastructure to test if libc follows semantic
versioning.
In the build step it creates a test file which imports all functions,
constants, etc. that are expected to be public. This file is generated
from the files in the (not yet included) semver directory. These files
include the function and constants expected to be public per target
family, vendor, OS, etc.
See the do_semver function in the build file of libc-test for the
details.
Skip definitions from the kernel on non-glibc Linux targets.
They're libc-independent, so we only need to check them on one
libc. We don't want to break CI if musl or another libc doesn't
have the definitions yet. (We do still want to check them on
every glibc target, though, as some of them can vary by
architecture.)
Update to the latest WASI libc, define `AT_FDCWD`, update the signature
for __wasilibc_find_relpath, and add declarations for various
`__wasilibc_` utility functions.
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.)
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.
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 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>
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>
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.
Depending on the compilation environment (e.g., whether the 3XNET or
3SOCKET version of these functions is in play, whether EXTENSIONS has
been defined, etc) these functions may be declared to return either void
or int. The return value is hard coded as zero, and can be ignored to
better align with other platforms where these functions are always void.
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.
These syscalls were added recently, and therefore have consistent
numbers across different architetures (other than the weird offsetting
on some platforms).
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.
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.
VMADDR_CID_RESERVED is NOT available from Linux v5.6.
VMADDR_CID_LOCAL is available only on Linux >= v5.6.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
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.
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.)
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.
This patchs adds missing flag values for getnameinfo()
on FreeBSD, the following flags have been added from
the FreeBSD tree.
/*
* Flag values for getnameinfo()
*/
#define NI_NOFQDN 0x00000001
#define NI_NUMERICHOST 0x00000002
#define NI_NAMEREQD 0x00000004
#define NI_NUMERICSERV 0x00000008
#define NI_DGRAM 0x00000010
#define NI_NUMERICSCOPE 0x00000020
Signed-off-by: Valdemar Erk <valdemar@erk.io>
The `fanotify` API[0] is a linux-specific API for notification and interception
of filesystem events. In some ways it is similar to `inotify`, but with
different advantages/tradeoffs. It is particularly well suited to full
filesystem/mount monitoring (vs per directory) and for allowing/denying access
to files (`inotify` lacks this capability).
The `fanotify` API has been updated several times since it was enabled in Linux
2.6.37. Presently I've only included support for the original `fanotify`
features, and the `FAN_MARK_FILESYSTEM` addition made in Linux 4.20. There are
subsequent updates in 5.0 and 5.1 not covered in this initial commit.
This commit adds the relevant constants and types from
`uapi/linux/fanotify.h`[1] and two new functions (`fanotify_init`[2] and
`fanotify_wrap`[3]) to `src/unix/linux_like/linux/mod.rs`. While I believe this
API is also present on Android I have presently limited my attention to Linux.
Although this commit focuses on Linux 4.20.x's `fanotify` API/constants I have
skipped adding constants for `FAN_ALL_CLASS_BITS`, `FAN_ALL_INIT_FLAGS`,
`FAN_ALL_MARK_FLAGS`, `FAN_ALL_EVENTS`, `FAN_ALL_PERM_EVENTS` and
`FAN_ALL_OUTGOING_EVENTS` even though they are present in this kernel version's
headers. These defines were deprecated[4] in later releases with instructions to
not use them in new programs or extend them with new values. It would be a shame
for new Rust programs to use deprecated #defines!
[0]: http://man7.org/linux/man-pages/man7/fanotify.7.html
[1]: d54f4fba88/include/uapi/linux/fanotify.h
[2]: http://man7.org/linux/man-pages/man2/fanotify_init.2.html
[3]: http://man7.org/linux/man-pages/man2/fanotify_mark.2.html
[4]: 23c9deeb32 (diff-4c9ca62be6bf38cc08f7ea9daf16e379)