summaryrefslogtreecommitdiff
path: root/indra/llcommon/llmemory.cpp
diff options
context:
space:
mode:
authorAdam Moss <moss@lindenlab.com>2009-02-03 17:56:26 +0000
committerAdam Moss <moss@lindenlab.com>2009-02-03 17:56:26 +0000
commite188badaf29a1a02307f93864eed6737096bd9a1 (patch)
tree767259ad3385fd9ede9722e04752bea008469f8c /indra/llcommon/llmemory.cpp
parent4ad54702fce32905402cb6055c085ac14de188a2 (diff)
QAR-1177 maint-viewer-12 + uploadfees-viewer combo mergeme
svn merge -r108355:109316 svn+ssh://svn.lindenlab.com/svn/linden/branches/moss/maint-viewer-12-uploadfees-qa108314 Whew.
Diffstat (limited to 'indra/llcommon/llmemory.cpp')
-rw-r--r--indra/llcommon/llmemory.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp
index 29f916bc46..a6de3d2d69 100644
--- a/indra/llcommon/llmemory.cpp
+++ b/indra/llcommon/llmemory.cpp
@@ -39,7 +39,7 @@
# include <sys/types.h>
# include <mach/task.h>
# include <mach/mach_init.h>
-#elif defined(LL_LINUX)
+#elif LL_LINUX || LL_SOLARIS
# include <unistd.h>
#endif
@@ -389,6 +389,34 @@ bail:
return rss;
}
+#elif LL_SOLARIS
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#define _STRUCTURED_PROC 1
+#include <sys/procfs.h>
+
+U64 getCurrentRSS()
+{
+ char path [LL_MAX_PATH]; /* Flawfinder: ignore */
+
+ sprintf(path, "/proc/%d/psinfo", (int)getpid());
+ int proc_fd = -1;
+ if((proc_fd = open(path, O_RDONLY)) == -1){
+ llwarns << "LLmemory::getCurrentRSS() unable to open " << path << ". Returning 0 RSS!" << llendl;
+ return 0;
+ }
+ psinfo_t proc_psinfo;
+ if(read(proc_fd, &proc_psinfo, sizeof(psinfo_t)) != sizeof(psinfo_t)){
+ llwarns << "LLmemory::getCurrentRSS() Unable to read from " << path << ". Returning 0 RSS!" << llendl;
+ close(proc_fd);
+ return 0;
+ }
+
+ close(proc_fd);
+
+ return((U64)proc_psinfo.pr_rssize * 1024);
+}
#else
U64 getCurrentRSS()