diff options
author | David CARLIER <devnexen@gmail.com> | 2022-05-08 13:12:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-08 15:12:17 +0300 |
commit | bdcd4b3df81fdd7247a3fd1f1013e5cb8bae7659 (patch) | |
tree | 6a9fdcd0becc944ece38f5590d1e1835da9a39b6 /src | |
parent | 4e761eb7e2a4317f1ca27bf04e68c87e0e81d137 (diff) | |
download | redis-bdcd4b3df81fdd7247a3fd1f1013e5cb8bae7659.tar.gz |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/server.h | 2 | ||||
-rw-r--r-- | src/zmalloc.c | 17 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/server.h b/src/server.h index 61cff37a5..e4b12f4ff 100644 --- a/src/server.h +++ b/src/server.h @@ -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)) diff --git a/src/zmalloc.c b/src/zmalloc.c index ba0368530..d19d87b7d 100644 --- a/src/zmalloc.c +++ b/src/zmalloc.c @@ -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> |