Alias yanix::file::OFlags::RSYNC to SYNC on Android.

Android defines O_RSYNC to be the same as O_SYNC:

35bb46188c/libc/include/fcntl.h (L57)
This commit is contained in:
whitequark
2020-12-12 06:38:55 +00:00
committed by Dan Gohman
parent 1ec1834d6e
commit fc4eeae896

View File

@@ -90,11 +90,26 @@ bitflags! {
const WRONLY = libc::O_WRONLY;
const RDWR = libc::O_RDWR;
#[cfg(any(target_os = "linux",
target_os = "android",
target_os = "netbsd",
target_os = "openbsd",
target_os = "wasi",
target_os = "emscripten"))]
const RSYNC = libc::O_RSYNC;
const RSYNC = {
// Have to use cfg_if: https://github.com/bitflags/bitflags/issues/137
cfg_if! {
if #[cfg(any(target_os = "linux",
target_os = "netbsd",
target_os = "openbsd",
target_os = "wasi",
target_os = "emscripten"))] {
libc::O_RSYNC
} else if #[cfg(target_os = "android")] {
// Android defines O_RSYNC as O_SYNC
libc::O_SYNC
}
}
};
const SYNC = libc::O_SYNC;
const TRUNC = libc::O_TRUNC;
#[cfg(any(target_os = "linux",