summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShikha Panwar <shikhapanwar@google.com>2023-01-09 08:34:11 +0000
committerShikha Panwar <shikhapanwar@google.com>2023-01-30 13:28:58 +0000
commitca8f0726644d786a9addfb241af4a8a9af3f35d5 (patch)
treeaa9e0535c27fd6f2a2e421e617dddabebc41012f
parentd1edf0c485de02e5d6a4b46f12248a8f4082386d (diff)
downloadrust-libc-ca8f0726644d786a9addfb241af4a8a9af3f35d5.tar.gz
ANDROID: Add syncfs API in liblibc
This is required to sync everything in a single filesystem. Other solutions like sync() flushes all filesystems which is unnecessary, it is also impractical to call fsync on all files of the filesystem. This patch also excludes syncfs for arm from CI.
-rw-r--r--libc-test/build.rs3
-rw-r--r--libc-test/semver/android.txt1
-rw-r--r--src/unix/linux_like/android/mod.rs2
3 files changed, 6 insertions, 0 deletions
diff --git a/libc-test/build.rs b/libc-test/build.rs
index e3ea9fc737..72515b8efb 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -1806,6 +1806,9 @@ fn test_android(target: &str) {
// Added in API level 28, but some tests use level 24.
"getrandom" => true,
+ // Added in API level 28, but some tests use level 24.
+ "syncfs" => true,
+
_ => false,
}
});
diff --git a/libc-test/semver/android.txt b/libc-test/semver/android.txt
index b812a28199..85065952dd 100644
--- a/libc-test/semver/android.txt
+++ b/libc-test/semver/android.txt
@@ -3517,6 +3517,7 @@ swapoff
swapon
symlink
symlinkat
+syncfs
syscall
sysconf
sysinfo
diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs
index adec24a0a0..7425faef86 100644
--- a/src/unix/linux_like/android/mod.rs
+++ b/src/unix/linux_like/android/mod.rs
@@ -3506,6 +3506,8 @@ extern "C" {
longopts: *const option,
longindex: *mut ::c_int,
) -> ::c_int;
+
+ pub fn syncfs(fd: ::c_int) -> ::c_int;
}
cfg_if! {