From 67a8c818039e7475c492715fa8b55896348033cb Mon Sep 17 00:00:00 2001 From: Laurent Cheylus Date: Sun, 26 Jan 2025 05:57:28 +0000 Subject: [PATCH] runtime: add free_memory/0 implementation for OpenBSD (fix #23579) (#23583) --- vlib/runtime/free_memory_impl_openbsd.c.v | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 vlib/runtime/free_memory_impl_openbsd.c.v diff --git a/vlib/runtime/free_memory_impl_openbsd.c.v b/vlib/runtime/free_memory_impl_openbsd.c.v new file mode 100644 index 0000000000..30b9b7c201 --- /dev/null +++ b/vlib/runtime/free_memory_impl_openbsd.c.v @@ -0,0 +1,15 @@ +module runtime + +fn free_memory_impl() usize { + $if cross ? { + return 1 + } + $if !cross ? { + $if openbsd { + page_size := usize(C.sysconf(C._SC_PAGESIZE)) + av_phys_pages := usize(C.sysconf(C._SC_AVPHYS_PAGES)) + return page_size * av_phys_pages + } + } + return 1 +}