From 77d949bdcc17c559bbfbdf8e39eb74fd929d87e6 Mon Sep 17 00:00:00 2001 From: Michal Mielewczyk Date: Tue, 6 Jun 2023 13:13:47 +0200 Subject: [PATCH] Unstubify RAM check in posix evn Signed-off-by: Michal Mielewczyk --- env/posix/ocf_env.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/env/posix/ocf_env.h b/env/posix/ocf_env.h index 9220d1e..c82cf64 100644 --- a/env/posix/ocf_env.h +++ b/env/posix/ocf_env.h @@ -195,9 +195,18 @@ static inline void env_secure_free(const void *ptr, size_t size) } } +#include + static inline uint64_t env_get_free_memory(void) { - return (uint64_t)(-1); + struct sysinfo info; + int ret; + + ret = sysinfo(&info); + if (ret != 0) + return 0; + + return (uint64_t)info.totalram * info.mem_unit; } /* ALLOCATOR */