Skip to content

Commit

Permalink
cfg unix
Browse files Browse the repository at this point in the history
  • Loading branch information
Dav1dde committed Mar 5, 2025
1 parent 78b3026 commit d4834f1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions symbolic-common/src/byteview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,10 @@ impl<'a> ByteView<'a> {
pub fn hint(&self, hint: AccessPattern) -> Result<(), io::Error> {
match self.backing.deref() {
ByteViewBacking::Buf(_) => Ok(()),
#[cfg(unix)]
ByteViewBacking::Mmap(mmap) => mmap.advise(hint.to_madvise()),
#[cfg(not(unix))]
ByteViewBacking::Mmap(_) => Ok(()),
}
}
}
Expand Down Expand Up @@ -311,6 +314,7 @@ pub enum AccessPattern {
}

impl AccessPattern {
#[cfg(unix)]
fn to_madvise(self) -> memmap2::Advice {
match self {
AccessPattern::Normal => memmap2::Advice::Normal,
Expand Down

0 comments on commit d4834f1

Please sign in to comment.