Skip to content

Commit 0ba1fc4

Browse files
committed
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.
1 parent 88740ef commit 0ba1fc4

File tree

5 files changed

+39
-1
lines changed

5 files changed

+39
-1
lines changed

libc-test/semver/linux.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2025,6 +2025,7 @@ RESOLVE_IN_ROOT
20252025
RESOLVE_NO_MAGICLINKS
20262026
RESOLVE_NO_SYMLINKS
20272027
RESOLVE_NO_XDEV
2028+
RLIM64_INFINITY
20282029
RLIMIT_AS
20292030
RLIMIT_CORE
20302031
RLIMIT_CPU

src/unix/linux_like/android/mod.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,6 +1579,23 @@ pub const FIONREAD: ::c_int = 0x541B;
15791579
pub const TIOCCONS: ::c_int = 0x541D;
15801580
pub const TIOCSBRK: ::c_int = 0x5427;
15811581
pub const TIOCCBRK: ::c_int = 0x5428;
1582+
cfg_if! {
1583+
if #[cfg(any(target_arch = "x86",
1584+
target_arch = "x86_64",
1585+
target_arch = "arm",
1586+
target_arch = "aarch64",
1587+
target_arch = "riscv64",
1588+
target_arch = "s390x"))] {
1589+
pub const FICLONE: ::c_int = 0x40049409;
1590+
pub const FICLONERANGE: ::c_int = 0x4020940D;
1591+
} else if #[cfg(any(target_arch = "mips",
1592+
target_arch = "mips64",
1593+
target_arch = "powerpc",
1594+
target_arch = "powerpc64"))] {
1595+
pub const FICLONE: ::c_int = 0x80049409;
1596+
pub const FICLONERANGE: ::c_int = 0x8020940D;
1597+
}
1598+
}
15821599

15831600
pub const ST_RDONLY: ::c_ulong = 1;
15841601
pub const ST_NOSUID: ::c_ulong = 2;
@@ -3531,6 +3548,7 @@ extern "C" {
35313548
longindex: *mut ::c_int,
35323549
) -> ::c_int;
35333550

3551+
pub fn sync();
35343552
pub fn syncfs(fd: ::c_int) -> ::c_int;
35353553
}
35363554

src/unix/linux_like/linux/arch/generic/mod.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,18 @@ cfg_if! {
108108
cfg_if! {
109109
if #[cfg(any(target_arch = "x86",
110110
target_arch = "x86_64",
111-
target_arch = "aarch64"))] {
111+
target_arch = "arm",
112+
target_arch = "aarch64",
113+
target_arch = "riscv64",
114+
target_arch = "s390x"))] {
112115
pub const FICLONE: ::c_ulong = 0x40049409;
113116
pub const FICLONERANGE: ::c_ulong = 0x4020940D;
117+
} else if #[cfg(any(target_arch = "mips",
118+
target_arch = "mips64",
119+
target_arch = "powerpc",
120+
target_arch = "powerpc64"))] {
121+
pub const FICLONE: ::c_ulong = 0x80049409;
122+
pub const FICLONERANGE: ::c_ulong = 0x8020940D;
114123
}
115124
}
116125
// pub const SO_PREFER_BUSY_POLL: ::c_int = 69;

src/unix/linux_like/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,14 @@ pub const PROT_EXEC: ::c_int = 4;
556556
pub const XATTR_CREATE: ::c_int = 0x1;
557557
pub const XATTR_REPLACE: ::c_int = 0x2;
558558

559+
cfg_if! {
560+
if #[cfg(target_os = "android")] {
561+
pub const RLIM64_INFINITY: ::c_ulonglong = !0;
562+
} else {
563+
pub const RLIM64_INFINITY: ::rlim64_t = !0;
564+
}
565+
}
566+
559567
cfg_if! {
560568
if #[cfg(target_env = "ohos")] {
561569
pub const LC_CTYPE: ::c_int = 0;

src/unix/solarish/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3196,6 +3196,8 @@ extern "C" {
31963196
longopts: *const option,
31973197
longindex: *mut ::c_int,
31983198
) -> ::c_int;
3199+
3200+
pub fn sync();
31993201
}
32003202

32013203
#[link(name = "sendfile")]

0 commit comments

Comments
 (0)