summaryrefslogtreecommitdiff
path: root/src/zmalloc.c
diff options
context:
space:
mode:
authorDavid CARLIER <devnexen@gmail.com>2022-05-08 13:12:17 +0100
committerGitHub <noreply@github.com>2022-05-08 15:12:17 +0300
commitbdcd4b3df81fdd7247a3fd1f1013e5cb8bae7659 (patch)
tree6a9fdcd0becc944ece38f5590d1e1835da9a39b6 /src/zmalloc.c
parent4e761eb7e2a4317f1ca27bf04e68c87e0e81d137 (diff)
downloadredis-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/zmalloc.c')
-rw-r--r--src/zmalloc.c17
1 files changed, 17 insertions, 0 deletions
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>