aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llcommon/llsys.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2009-04-30 13:04:20 -0500
committerJacek Antonelli2009-04-30 13:07:16 -0500
commitca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch)
tree8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/llcommon/llsys.cpp
parentSecond Life viewer sources 1.22.11 (diff)
downloadmeta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz
Second Life viewer sources 1.23.0-RC
Diffstat (limited to 'linden/indra/llcommon/llsys.cpp')
-rw-r--r--linden/indra/llcommon/llsys.cpp37
1 files changed, 26 insertions, 11 deletions
diff --git a/linden/indra/llcommon/llsys.cpp b/linden/indra/llcommon/llsys.cpp
index 06982f0..2e93b2a 100644
--- a/linden/indra/llcommon/llsys.cpp
+++ b/linden/indra/llcommon/llsys.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -58,6 +59,17 @@
58# include <sys/sysinfo.h> 59# include <sys/sysinfo.h>
59const char MEMINFO_FILE[] = "/proc/meminfo"; 60const char MEMINFO_FILE[] = "/proc/meminfo";
60const char CPUINFO_FILE[] = "/proc/cpuinfo"; 61const char CPUINFO_FILE[] = "/proc/cpuinfo";
62#elif LL_SOLARIS
63# include <stdio.h>
64# include <unistd.h>
65# include <sys/utsname.h>
66# define _STRUCTURED_PROC 1
67# include <sys/procfs.h>
68# include <sys/types.h>
69# include <sys/stat.h>
70# include <fcntl.h>
71# include <errno.h>
72extern int errno;
61#endif 73#endif
62 74
63 75
@@ -288,19 +300,22 @@ U32 LLOSInfo::getProcessVirtualSizeKB()
288#endif 300#endif
289#if LL_LINUX 301#if LL_LINUX
290 LLFILE* status_filep = LLFile::fopen("/proc/self/status", "rb"); 302 LLFILE* status_filep = LLFile::fopen("/proc/self/status", "rb");
291 S32 numRead = 0; 303 if (status_filep)
292 char buff[STATUS_SIZE]; /* Flawfinder: ignore */ 304 {
305 S32 numRead = 0;
306 char buff[STATUS_SIZE]; /* Flawfinder: ignore */
293 307
294 size_t nbytes = fread(buff, 1, STATUS_SIZE-1, status_filep); 308 size_t nbytes = fread(buff, 1, STATUS_SIZE-1, status_filep);
295 buff[nbytes] = '\0'; 309 buff[nbytes] = '\0';
296 310
297 // All these guys return numbers in KB 311 // All these guys return numbers in KB
298 char *memp = strstr(buff, "VmSize:"); 312 char *memp = strstr(buff, "VmSize:");
299 if (memp) 313 if (memp)
300 { 314 {
301 numRead += sscanf(memp, "%*s %u", &virtual_size); 315 numRead += sscanf(memp, "%*s %u", &virtual_size);
316 }
317 fclose(status_filep);
302 } 318 }
303 fclose(status_filep);
304#elif LL_SOLARIS 319#elif LL_SOLARIS
305 char proc_ps[LL_MAX_PATH]; 320 char proc_ps[LL_MAX_PATH];
306 sprintf(proc_ps, "/proc/%d/psinfo", (int)getpid()); 321 sprintf(proc_ps, "/proc/%d/psinfo", (int)getpid());