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

Solaris based system rss size report. (#8138)

parent e288430c
...@@ -87,6 +87,7 @@ ...@@ -87,6 +87,7 @@
#include <sys/feature_tests.h> #include <sys/feature_tests.h>
#ifdef _DTRACE_VERSION #ifdef _DTRACE_VERSION
#define HAVE_EVPORT 1 #define HAVE_EVPORT 1
#define HAVE_PSINFO 1
#endif #endif
#endif #endif
......
...@@ -433,6 +433,27 @@ size_t zmalloc_get_rss(void) { ...@@ -433,6 +433,27 @@ size_t zmalloc_get_rss(void) {
return 0L; return 0L;
} }
#elif defined(HAVE_PSINFO)
#include <unistd.h>
#include <sys/procfs.h>
#include <fcntl.h>
size_t zmalloc_get_rss(void) {
struct prpsinfo info;
char filename[256];
int fd;
snprintf(filename,256,"/proc/%d/psinfo",getpid());
if ((fd = open(filename,O_RDONLY)) == -1) return 0;
if (ioctl(fd, PIOCPSINFO, &info) == -1) {
close(fd);
return 0;
}
close(fd);
return info.pr_rssize;
}
#else #else
size_t zmalloc_get_rss(void) { size_t zmalloc_get_rss(void) {
/* If we can't get the RSS in an OS-specific way for this system just /* If we can't get the RSS in an OS-specific way for this system just
......
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