Skip to content

Commit

Permalink
Update nix to 0.26
Browse files Browse the repository at this point in the history
  • Loading branch information
akiradeveloper committed May 17, 2024
1 parent 18f010f commit 55075b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ members = [
[workspace.dependencies]
bitflags = "2.5"
mio = "0.8"
nix = "0.19"
nix = "0.26"
4 changes: 3 additions & 1 deletion abuse/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use async_trait::async_trait;
use bitflags::bitflags;
use core::ffi::c_void;
use std::num::NonZeroUsize;
use mio::unix::SourceFd;
use mio::{Events, Interest, Poll, Token};
use nix::sys::mman::{mmap, munmap, MapFlags, ProtFlags};
Expand Down Expand Up @@ -229,7 +230,8 @@ pub async fn run_on(config: Config, engine: impl StorageEngine) {
tot_n_pages += xfr_io_vec[i].n_pages;
}
// mmap all pages in the bvecs at once.
let p = unsafe { mmap(null_p, (tot_n_pages << PAGE_SHIFT) as usize, prot_flags, map_flags, fd, 0) }.expect("failed to mmap");
let vm_len = tot_n_pages << PAGE_SHIFT;
let p = unsafe { mmap(None, NonZeroUsize::new(vm_len as usize).unwrap(), prot_flags, map_flags, fd, 0) }.expect("failed to mmap");

let mut cur = unsafe { std::mem::transmute::<*const c_void, usize>(p) };
let mut io_vecs = vec![];
Expand Down

0 comments on commit 55075b5

Please sign in to comment.