summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Gohman <dev@sunfishcode.online>2023-03-28 04:23:56 -0700
committerDan Gohman <dev@sunfishcode.online>2023-04-18 02:33:20 -0700
commit0ba1fc4d6658317ca1ad79e5b62677ba4c772f0c (patch)
tree7718e877887b82265419d7ef2b94de71d2d00db3
parent88740efbf6e093bb021f2b67e518e247a47a61fd (diff)
downloadrust-libc-0ba1fc4d6658317ca1ad79e5b62677ba4c772f0c.tar.gz
Upstream a few more constants from rustix.
- And a definition for `RLIM64_INFINITY` on linux_like platforms. - Declare the `sync` function on Android and solarish. - Solaris: https://docs.oracle.com/cd/E26502_01/html/E29032/sync-2.html - Illumos: https://illumos.org/man/2/sync - Enable `FICLONE` and `FICLONERANGE` on more architectures.
-rw-r--r--libc-test/semver/linux.txt1
-rw-r--r--src/unix/linux_like/android/mod.rs18
-rw-r--r--src/unix/linux_like/linux/arch/generic/mod.rs11
-rw-r--r--src/unix/linux_like/mod.rs8
-rw-r--r--src/unix/solarish/mod.rs2
5 files changed, 39 insertions, 1 deletions
diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt
index 178f76d946..27bd9accc2 100644
--- a/libc-test/semver/linux.txt
+++ b/libc-test/semver/linux.txt
@@ -2025,6 +2025,7 @@ RESOLVE_IN_ROOT
RESOLVE_NO_MAGICLINKS
RESOLVE_NO_SYMLINKS
RESOLVE_NO_XDEV
+RLIM64_INFINITY
RLIMIT_AS
RLIMIT_CORE
RLIMIT_CPU
diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs
index e2fa0826f2..fd4b0593b4 100644
--- a/src/unix/linux_like/android/mod.rs
+++ b/src/unix/linux_like/android/mod.rs
@@ -1579,6 +1579,23 @@ pub const FIONREAD: ::c_int = 0x541B;
pub const TIOCCONS: ::c_int = 0x541D;
pub const TIOCSBRK: ::c_int = 0x5427;
pub const TIOCCBRK: ::c_int = 0x5428;
+cfg_if! {
+ if #[cfg(any(target_arch = "x86",
+ target_arch = "x86_64",
+ target_arch = "arm",
+ target_arch = "aarch64",
+ target_arch = "riscv64",
+ target_arch = "s390x"))] {
+ pub const FICLONE: ::c_int = 0x40049409;
+ pub const FICLONERANGE: ::c_int = 0x4020940D;
+ } else if #[cfg(any(target_arch = "mips",
+ target_arch = "mips64",
+ target_arch = "powerpc",
+ target_arch = "powerpc64"))] {
+ pub const FICLONE: ::c_int = 0x80049409;
+ pub const FICLONERANGE: ::c_int = 0x8020940D;
+ }
+}
pub const ST_RDONLY: ::c_ulong = 1;
pub const ST_NOSUID: ::c_ulong = 2;
@@ -3531,6 +3548,7 @@ extern "C" {
longindex: *mut ::c_int,
) -> ::c_int;
+ pub fn sync();
pub fn syncfs(fd: ::c_int) -> ::c_int;
}
diff --git a/src/unix/linux_like/linux/arch/generic/mod.rs b/src/unix/linux_like/linux/arch/generic/mod.rs
index cffe748de9..4693978311 100644
--- a/src/unix/linux_like/linux/arch/generic/mod.rs
+++ b/src/unix/linux_like/linux/arch/generic/mod.rs
@@ -108,9 +108,18 @@ cfg_if! {
cfg_if! {
if #[cfg(any(target_arch = "x86",
target_arch = "x86_64",
- target_arch = "aarch64"))] {
+ target_arch = "arm",
+ target_arch = "aarch64",
+ target_arch = "riscv64",
+ target_arch = "s390x"))] {
pub const FICLONE: ::c_ulong = 0x40049409;
pub const FICLONERANGE: ::c_ulong = 0x4020940D;
+ } else if #[cfg(any(target_arch = "mips",
+ target_arch = "mips64",
+ target_arch = "powerpc",
+ target_arch = "powerpc64"))] {
+ pub const FICLONE: ::c_ulong = 0x80049409;
+ pub const FICLONERANGE: ::c_ulong = 0x8020940D;
}
}
// pub const SO_PREFER_BUSY_POLL: ::c_int = 69;
diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs
index db57745967..584e308ce2 100644
--- a/src/unix/linux_like/mod.rs
+++ b/src/unix/linux_like/mod.rs
@@ -557,6 +557,14 @@ pub const XATTR_CREATE: ::c_int = 0x1;
pub const XATTR_REPLACE: ::c_int = 0x2;
cfg_if! {
+ if #[cfg(target_os = "android")] {
+ pub const RLIM64_INFINITY: ::c_ulonglong = !0;
+ } else {
+ pub const RLIM64_INFINITY: ::rlim64_t = !0;
+ }
+}
+
+cfg_if! {
if #[cfg(target_env = "ohos")] {
pub const LC_CTYPE: ::c_int = 0;
pub const LC_NUMERIC: ::c_int = 1;
diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs
index 88f9cab9d6..12c88f31a1 100644
--- a/src/unix/solarish/mod.rs
+++ b/src/unix/solarish/mod.rs
@@ -3196,6 +3196,8 @@ extern "C" {
longopts: *const option,
longindex: *mut ::c_int,
) -> ::c_int;
+
+ pub fn sync();
}
#[link(name = "sendfile")]