runtime: add free_memory/0 implementation for OpenBSD (fix #23579) (#23583)

This commit is contained in:
Laurent Cheylus 2025-01-26 05:57:28 +00:00 committed by GitHub
parent c225e0415a
commit 67a8c81803
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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
}