From 80fc84344e612a979d1eb048b2c02c41417b36be Mon Sep 17 00:00:00 2001 From: Alejandro Soto Date: Mon, 27 Dec 2021 02:54:50 -0600 Subject: Implement init hook --- src/util.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/util.rs') diff --git a/src/util.rs b/src/util.rs index 2ad8c00..c21442f 100644 --- a/src/util.rs +++ b/src/util.rs @@ -3,7 +3,7 @@ use std::{ os::unix::io::{IntoRawFd, RawFd}, }; -use nix::unistd::close; +use nix::unistd::{close, sysconf, SysconfVar}; use quick_error::quick_error; quick_error! { @@ -98,3 +98,7 @@ pub fn display_or<'a, T: fmt::Display + 'a>( Params(maybe, default) } + +pub fn page_size() -> usize { + sysconf(SysconfVar::PAGE_SIZE).unwrap().unwrap() as usize +} -- cgit v1.2.3