diff --git a/src/bump_allocator.rs b/src/bump_allocator.rs index 1ccf13c..ef56ade 100644 --- a/src/bump_allocator.rs +++ b/src/bump_allocator.rs @@ -91,6 +91,10 @@ impl BumpAllocator { offset as usize } + + pub(crate) fn get_fd(&self) -> i32 { + self.backing_fd + } } #[cfg(test)] diff --git a/src/lib.rs b/src/lib.rs index 35a9d3f..49c3de6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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() +}