Unverified Commit bdcd4b3d authored by David CARLIER's avatar David CARLIER Committed by GitHub
Browse files

zmalloc_get_rss implementation for haiku. (#10687)



also fixing already defined constants build warning while at it.
Co-authored-by: default avatarOran Agra <oran@redislabs.com>
parent 4e761eb7
...@@ -91,6 +91,8 @@ typedef long long ustime_t; /* microsecond time type. */ ...@@ -91,6 +91,8 @@ typedef long long ustime_t; /* microsecond time type. */
#include "crc64.h" #include "crc64.h"
/* min/max */ /* min/max */
#undef min
#undef max
#define min(a, b) ((a) < (b) ? (a) : (b)) #define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b)) #define max(a, b) ((a) > (b) ? (a) : (b))
......
...@@ -492,6 +492,23 @@ size_t zmalloc_get_rss(void) { ...@@ -492,6 +492,23 @@ size_t zmalloc_get_rss(void) {
return 0L; 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) #elif defined(HAVE_PSINFO)
#include <unistd.h> #include <unistd.h>
#include <sys/procfs.h> #include <sys/procfs.h>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment