fix build errors for syscall_bypass.rs
This commit is contained in:
@@ -318,16 +318,18 @@ impl IOOptimizer {
|
|||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
{
|
{
|
||||||
use std::fs::OpenOptions;
|
use std::fs::OpenOptions;
|
||||||
// use std::os::unix::fs::OpenOptionsExt;
|
|
||||||
use std::os::fd::AsRawFd;
|
use std::os::fd::AsRawFd;
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
let file = OpenOptions::new()
|
let file = {
|
||||||
.read(true)
|
use std::os::unix::fs::OpenOptionsExt;
|
||||||
.write(true)
|
OpenOptions::new()
|
||||||
.create(true)
|
.read(true)
|
||||||
.custom_flags(libc::O_DIRECT) // 直接I/O,绕过页面缓存
|
.write(true)
|
||||||
.open(file_path)?;
|
.create(true)
|
||||||
|
.custom_flags(libc::O_DIRECT) // 直接I/O,绕过页面缓存
|
||||||
|
.open(file_path)?
|
||||||
|
};
|
||||||
|
|
||||||
#[cfg(not(target_os = "linux"))]
|
#[cfg(not(target_os = "linux"))]
|
||||||
let file = OpenOptions::new()
|
let file = OpenOptions::new()
|
||||||
|
|||||||
Reference in New Issue
Block a user