Merge pull request #817 from mmichal10/env_ram_check

Unstubify RAM check in posix evn
This commit is contained in:
Robert Baldyga 2024-09-10 12:27:51 +02:00 committed by GitHub
commit bf679ecb49
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

11
env/posix/ocf_env.h vendored
View File

@ -195,9 +195,18 @@ static inline void env_secure_free(const void *ptr, size_t size)
} }
} }
#include <sys/sysinfo.h>
static inline uint64_t env_get_free_memory(void) 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 */ /* ALLOCATOR */