Skip to content

Commit df7e56a

Browse files
enable unistd::{sync, syncfs} on Android (#2296)
1 parent 338d2b3 commit df7e56a

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

changelog/2296.added.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Enable unistd::{sync, syncfs} for Android

src/unistd.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,7 +1378,7 @@ pub fn chroot<P: ?Sized + NixPath>(path: &P) -> Result<()> {
13781378
/// Commit filesystem caches to disk
13791379
///
13801380
/// See also [sync(2)](https://pubs.opengroup.org/onlinepubs/9699919799/functions/sync.html)
1381-
#[cfg(any(freebsdlike, target_os = "linux", netbsdlike))]
1381+
#[cfg(any(freebsdlike, linux_android, netbsdlike))]
13821382
pub fn sync() {
13831383
unsafe { libc::sync() };
13841384
}
@@ -1387,7 +1387,7 @@ pub fn sync() {
13871387
/// descriptor `fd` to disk
13881388
///
13891389
/// See also [syncfs(2)](https://man7.org/linux/man-pages/man2/sync.2.html)
1390-
#[cfg(target_os = "linux")]
1390+
#[cfg(linux_android)]
13911391
pub fn syncfs(fd: RawFd) -> Result<()> {
13921392
let res = unsafe { libc::syncfs(fd) };
13931393

0 commit comments

Comments
 (0)