Replace `static mut OLD_SIGBUS_HANDLER` with AtomicU8 + AtomicPtr to remove data race UB when concurrent benchmarks call open() from multiple threads. Key changes: - Use `Once::call_once` to guarantee single handler installation - Publish old handler to atomics BEFORE installing new handler (closes the handler-active-but-state-unpublished race window) - Read atomics with Acquire in signal handler (async-signal-safe) - Align si_addr to page boundary before mmap(MAP_FIXED) - Add concurrent test: 8 threads open all 5 variants simultaneously
25 lines
581 B
Rust
25 lines
581 B
Rust
pub mod data_gen;
|
|
pub mod line_index;
|
|
pub mod metrics;
|
|
pub mod mmap_reader;
|
|
pub mod pread_reader;
|
|
pub mod report;
|
|
pub mod runner;
|
|
pub mod suites;
|
|
pub mod types;
|
|
|
|
use std::path::Path;
|
|
|
|
/// A single reader backend (mmap or pread)
|
|
pub trait FileReaderBackend {
|
|
fn name(&self) -> &str;
|
|
fn open(path: &Path) -> std::io::Result<Self>
|
|
where
|
|
Self: Sized;
|
|
fn file_size(&self) -> u64;
|
|
fn total_lines(&self) -> usize;
|
|
fn get_line(&self, idx: usize) -> Option<String>;
|
|
fn read_range(&self, offset: u64, len: usize) -> Option<Vec<u8>>;
|
|
fn close(self);
|
|
}
|