diff --git a/src/tape/file_formats/mod.rs b/src/tape/file_formats/mod.rs index e94818b2..bf41b8a4 100644 --- a/src/tape/file_formats/mod.rs +++ b/src/tape/file_formats/mod.rs @@ -288,9 +288,12 @@ impl BlockHeader { pub fn new() -> Box { use std::alloc::{alloc_zeroed, Layout}; + // align to PAGESIZE, so that we can use it with SG_IO + let page_size = unsafe { libc::sysconf(libc::_SC_PAGESIZE) } as usize; + let mut buffer = unsafe { let ptr = alloc_zeroed( - Layout::from_size_align(Self::SIZE, std::mem::align_of::()) + Layout::from_size_align(Self::SIZE, page_size) .unwrap(), ); Box::from_raw(