feat: add function to get fd of memfd

This commit is contained in:
2024-04-18 09:28:45 +02:00
parent d409a38eca
commit 6edbb046fa
2 changed files with 12 additions and 0 deletions

View File

@@ -91,6 +91,10 @@ impl BumpAllocator {
offset as usize
}
pub(crate) fn get_fd(&self) -> i32 {
self.backing_fd
}
}
#[cfg(test)]

View File

@@ -1,6 +1,14 @@
#![feature(test)]
#![feature(lazy_cell)]
use bump_allocator::BUMP_ALLOCATOR;
mod allocator;
mod bump_allocator;
pub mod sharedptr;
pub fn get_shared_mem_fd() -> i32 {
let allocator = BUMP_ALLOCATOR.lock().unwrap();
allocator.get_fd()
}