From 813baa9862f4ce889a8f9cdbe884ee6b16a23788 Mon Sep 17 00:00:00 2001 From: Lars T Hansen Date: Thu, 4 Apr 2024 14:16:43 +0200 Subject: [PATCH] For #152 - Remove page_size dependency --- Cargo.lock | 11 ----------- Cargo.toml | 1 - src/procfsapi.rs | 3 +-- 3 files changed, 1 insertion(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 53a77ce..b1257f5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -311,16 +311,6 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" -[[package]] -name = "page_size" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30d5b2194ed13191c1999ae0704b7839fb18384fa22e49b57eeaa97d79ce40da" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "proc-macro2" version = "1.0.78" @@ -435,7 +425,6 @@ dependencies = [ "hostname", "libc", "log", - "page_size", "serde", "serde_json", "signal-hook", diff --git a/Cargo.toml b/Cargo.toml index 758d65d..b92bc71 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,6 @@ clap = { version = "4.5", features = ["derive"] } csv = "1.3" log = "0.4" env_logger = "0.11" -page_size = "0.6" libc = "0.2" signal-hook = "0.3" serde_json = "1.0.114" diff --git a/src/procfsapi.rs b/src/procfsapi.rs index 6da3d3d..287abfb 100644 --- a/src/procfsapi.rs +++ b/src/procfsapi.rs @@ -2,7 +2,6 @@ // system to be virtualized. In turn, that allows sensible test cases to be written. extern crate libc; -extern crate page_size; use crate::users::get_user_by_uid; @@ -86,7 +85,7 @@ impl ProcfsAPI for RealFS { } fn page_size_in_kib(&self) -> usize { - page_size::get() / 1024 + (unsafe { libc::sysconf(libc::_SC_PAGESIZE) as usize }) / 1024 } fn now_in_secs_since_epoch(&self) -> u64 {