From 2eea6d25e1ea390789f16942dafb6ebdb17421cc Mon Sep 17 00:00:00 2001 From: Wood Date: Tue, 14 Oct 2025 17:33:13 +0800 Subject: [PATCH] fix build errors for syscall_bypass.rs --- src/perf/syscall_bypass.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/perf/syscall_bypass.rs b/src/perf/syscall_bypass.rs index 476d9ea..c0f61f6 100644 --- a/src/perf/syscall_bypass.rs +++ b/src/perf/syscall_bypass.rs @@ -318,16 +318,18 @@ impl IOOptimizer { #[cfg(unix)] { use std::fs::OpenOptions; - // use std::os::unix::fs::OpenOptionsExt; use std::os::fd::AsRawFd; - + #[cfg(target_os = "linux")] - let file = OpenOptions::new() - .read(true) - .write(true) - .create(true) - .custom_flags(libc::O_DIRECT) // 直接I/O,绕过页面缓存 - .open(file_path)?; + let file = { + use std::os::unix::fs::OpenOptionsExt; + OpenOptions::new() + .read(true) + .write(true) + .create(true) + .custom_flags(libc::O_DIRECT) // 直接I/O,绕过页面缓存 + .open(file_path)? + }; #[cfg(not(target_os = "linux"))] let file = OpenOptions::new()