mirror of https://mirror.osredm.com/root/redis.git
zmalloc_get_rss implementation for haiku. (#10687)
also fixing already defined constants build warning while at it. Co-authored-by: Oran Agra <oran@redislabs.com>
This commit is contained in:
parent
4e761eb7e2
commit
bdcd4b3df8
|
@ -91,6 +91,8 @@ typedef long long ustime_t; /* microsecond time type. */
|
|||
#include "crc64.h"
|
||||
|
||||
/* min/max */
|
||||
#undef min
|
||||
#undef max
|
||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||
#define max(a, b) ((a) > (b) ? (a) : (b))
|
||||
|
||||
|
|
|
@ -492,6 +492,23 @@ size_t zmalloc_get_rss(void) {
|
|||
|
||||
return 0L;
|
||||
}
|
||||
#elif defined(__HAIKU__)
|
||||
#include <OS.h>
|
||||
|
||||
size_t zmalloc_get_rss(void) {
|
||||
area_info info;
|
||||
thread_info th;
|
||||
size_t rss = 0;
|
||||
ssize_t cookie = 0;
|
||||
|
||||
if (get_thread_info(find_thread(0), &th) != B_OK)
|
||||
return 0;
|
||||
|
||||
while (get_next_area_info(th.team, &cookie, &info) == B_OK)
|
||||
rss += info.ram_size;
|
||||
|
||||
return rss;
|
||||
}
|
||||
#elif defined(HAVE_PSINFO)
|
||||
#include <unistd.h>
|
||||
#include <sys/procfs.h>
|
||||
|
|
Loading…
Reference in New Issue