diff options
author | Adam Moss <moss@lindenlab.com> | 2009-02-03 17:56:26 +0000 |
---|---|---|
committer | Adam Moss <moss@lindenlab.com> | 2009-02-03 17:56:26 +0000 |
commit | e188badaf29a1a02307f93864eed6737096bd9a1 (patch) | |
tree | 767259ad3385fd9ede9722e04752bea008469f8c /indra/llcommon | |
parent | 4ad54702fce32905402cb6055c085ac14de188a2 (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')
-rw-r--r-- | indra/llcommon/llbase32.cpp | 8 | ||||
-rw-r--r-- | indra/llcommon/llerrorlegacy.h | 1 | ||||
-rw-r--r-- | indra/llcommon/llfindlocale.cpp | 6 | ||||
-rw-r--r-- | indra/llcommon/llmemory.cpp | 30 | ||||
-rw-r--r-- | indra/llcommon/llpreprocessor.h | 11 | ||||
-rw-r--r-- | indra/llcommon/llprocessor.cpp | 37 | ||||
-rw-r--r-- | indra/llcommon/llstring.h | 7 | ||||
-rw-r--r-- | indra/llcommon/llsys.cpp | 11 | ||||
-rw-r--r-- | indra/llcommon/lltimer.h | 2 | ||||
-rw-r--r-- | indra/llcommon/stdtypes.h | 2 |
10 files changed, 102 insertions, 13 deletions
diff --git a/indra/llcommon/llbase32.cpp b/indra/llcommon/llbase32.cpp index c8b6ffff38..5e6ced9ce1 100644 --- a/indra/llcommon/llbase32.cpp +++ b/indra/llcommon/llbase32.cpp @@ -146,8 +146,6 @@ base32_encode(char *dst, size_t size, const void *data, size_t len) /* *TODO: Implement base32 encode. -#define ARRAY_LEN(a) (sizeof (a) / sizeof((a)[0])) - static inline int ascii_toupper(int c) { @@ -173,7 +171,7 @@ base32_decode(char *dst, size_t size, const void *data, size_t len) unsigned max_pad = 3; if (0 == base32_map[0]) { - for (i = 0; i < ARRAY_LEN(base32_map); i++) { + for (i = 0; i < LL_ARRAY_SIZE(base32_map); i++) { const char *x; x = memchr(base32_alphabet, ascii_toupper(i), sizeof base32_alphabet); @@ -197,7 +195,7 @@ base32_decode(char *dst, size_t size, const void *data, size_t len) } } - j = i % ARRAY_LEN(s); + j = i % LL_ARRAY_SIZE(s); s[j] = c; if (7 == j) { @@ -209,7 +207,7 @@ base32_decode(char *dst, size_t size, const void *data, size_t len) b[3] = ((s[4] & 1) << 7) | ((s[5] & 0x1f) << 2) | ((s[6] >> 3) & 0x03); b[4] = ((s[6] & 0x07) << 5) | (s[7] & 0x1f); - for (j = 0; j < ARRAY_LEN(b); j++) { + for (j = 0; j < LL_ARRAY_SIZE(b); j++) { if (q != end) *q = b[j]; q++; diff --git a/indra/llcommon/llerrorlegacy.h b/indra/llcommon/llerrorlegacy.h index 8b8af4cc9d..143fe20180 100644 --- a/indra/llcommon/llerrorlegacy.h +++ b/indra/llcommon/llerrorlegacy.h @@ -53,6 +53,7 @@ const int LL_ERR_FILE_NOT_FOUND = -43; const int LL_ERR_FILE_EMPTY = -44; const int LL_ERR_TCP_TIMEOUT = -23016; const int LL_ERR_CIRCUIT_GONE = -23017; +const int LL_ERR_PRICE_MISMATCH = -23018; diff --git a/indra/llcommon/llfindlocale.cpp b/indra/llcommon/llfindlocale.cpp index a511d3ffed..505f5c540b 100644 --- a/indra/llcommon/llfindlocale.cpp +++ b/indra/llcommon/llfindlocale.cpp @@ -417,10 +417,8 @@ static const IDToCode primary_to_code[] = { /*{LANG_WALON, "wa"},*/ {LANG_CHINESE, "zh"}, }; -static int num_primary_to_code = - sizeof(primary_to_code) / sizeof(*primary_to_code); -static int num_both_to_code = - sizeof(both_to_code) / sizeof(*both_to_code); +static int num_primary_to_code = LL_ARRAY_SIZE(primary_to_code); +static int num_both_to_code = LL_ARRAY_SIZE(both_to_code); static const int lcid_to_fl(LCID lcid, 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() diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h index 1ac2c9422b..2e4fd4787a 100644 --- a/indra/llcommon/llpreprocessor.h +++ b/indra/llcommon/llpreprocessor.h @@ -40,7 +40,16 @@ #include <endian.h> #endif // LL_LINUX -#if (defined(LL_WINDOWS) || (defined(LL_LINUX) && (__BYTE_ORDER == __LITTLE_ENDIAN)) || (defined(LL_DARWIN) && defined(__LITTLE_ENDIAN__))) +#if LL_SOLARIS +# ifdef __sparc // Since we're talking Solaris 10 and up, only 64 bit is supported. +# define LL_BIG_ENDIAN 1 +# define LL_SOLARIS_ALIGNED_CPU 1 // used to designate issues where SPARC alignment is addressed +# define LL_SOLARIS_NON_MESA_GL 1 // The SPARC GL does not provide a MESA-based GL API +# endif +# include <sys/isa_defs.h> // ensure we know which end is up +#endif // LL_SOLARIS + +#if (defined(LL_WINDOWS) || (defined(LL_LINUX) && (__BYTE_ORDER == __LITTLE_ENDIAN)) || (defined(LL_DARWIN) && defined(__LITTLE_ENDIAN__)) || (defined(LL_SOLARIS) && defined(__i386))) #define LL_LITTLE_ENDIAN 1 #else #define LL_BIG_ENDIAN 1 diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp index c6f9d3c758..469e544b16 100644 --- a/indra/llcommon/llprocessor.cpp +++ b/indra/llcommon/llprocessor.cpp @@ -279,7 +279,7 @@ bool CProcessor::AnalyzeIntelProcessor() // Only override the brand if we have it in the lookup table. We should // already have a string here from GetCPUInfo(). JC - if (CPUInfo.uiBrandID < (sizeof(INTEL_BRAND)/sizeof(INTEL_BRAND[0]))) + if ( CPUInfo.uiBrandID < LL_ARRAY_SIZE(INTEL_BRAND) ) { strcpy(CPUInfo.strBrandID, INTEL_BRAND[CPUInfo.uiBrandID]); @@ -1665,6 +1665,10 @@ const ProcessorInfo *CProcessor::GetCPUInfo() #elif LL_SOLARIS #include <kstat.h> +#if defined(__i386) +#include <sys/auxv.h> +#endif + // ====================== // Class constructor: ///////////////////////// @@ -1778,6 +1782,37 @@ const ProcessorInfo *CProcessor::GetCPUInfo() // DEBUG llinfo << "The system has " << ncpus << " CPUs with a clock rate of " << uqwFrequency << "MHz." << llendl; +#if defined (__i386) // we really don't care about the CPU extensions on SPARC but on x86... + + // Now get cpu extensions + + uint_t ui; + + (void) getisax(&ui, 1); + + if(ui & AV_386_FPU) + CPUInfo._Ext.FPU_FloatingPointUnit = true; + if(ui & AV_386_CX8) + CPUInfo._Ext.CX8_COMPXCHG8B_Instruction = true; + if(ui & AV_386_MMX) + CPUInfo._Ext.MMX_MultimediaExtensions = true; + if(ui & AV_386_AMD_MMX) + CPUInfo._Ext.MMX_MultimediaExtensions = true; + if(ui & AV_386_FXSR) + CPUInfo._Ext.FXSR_FastStreamingSIMD_ExtensionsSaveRestore = true; + if(ui & AV_386_SSE) + CPUInfo._Ext.SSE_StreamingSIMD_Extensions = true; + if(ui & AV_386_SSE2) + CPUInfo._Ext.SSE2_StreamingSIMD2_Extensions = true; +/* Left these here since they may get used later + if(ui & AV_386_SSE3) + CPUInfo._Ext.... = true; + if(ui & AV_386_AMD_3DNow) + CPUInfo._Ext.... = true; + if(ui & AV_386_AMD_3DNowx) + CPUInfo._Ext.... = true; +*/ +#endif return (&CPUInfo); } diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 8f6626b501..d728221b54 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -38,6 +38,13 @@ #include <wchar.h> #endif +#if LL_SOLARIS +// stricmp and strnicmp do not exist on Solaris: +#include <string.h> +#define stricmp strcasecmp +#define strnicmp strncasecmp +#endif + const char LL_UNKNOWN_CHAR = '?'; #if LL_DARWIN || LL_LINUX || LL_SOLARIS diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index cf281e92e7..f68d86ff7c 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -59,6 +59,17 @@ # include <sys/sysinfo.h> const char MEMINFO_FILE[] = "/proc/meminfo"; const char CPUINFO_FILE[] = "/proc/cpuinfo"; +#elif LL_SOLARIS +# include <stdio.h> +# include <unistd.h> +# include <sys/utsname.h> +# define _STRUCTURED_PROC 1 +# include <sys/procfs.h> +# include <sys/types.h> +# include <sys/stat.h> +# include <fcntl.h> +# include <errno.h> +extern int errno; #endif diff --git a/indra/llcommon/lltimer.h b/indra/llcommon/lltimer.h index 452df2ee58..e2cf1c7689 100644 --- a/indra/llcommon/lltimer.h +++ b/indra/llcommon/lltimer.h @@ -33,7 +33,7 @@ #ifndef LL_TIMER_H #define LL_TIMER_H -#if LL_LINUX || LL_DARWIN +#if LL_LINUX || LL_DARWIN || LL_SOLARIS #include <sys/time.h> #endif #include <limits.h> diff --git a/indra/llcommon/stdtypes.h b/indra/llcommon/stdtypes.h index 62fe7b98ff..6b25b2d355 100644 --- a/indra/llcommon/stdtypes.h +++ b/indra/llcommon/stdtypes.h @@ -105,6 +105,8 @@ typedef U32 TPACKETID; typedef U8 LLPCode; +#define LL_ARRAY_SIZE( _kArray ) ( sizeof( (_kArray) ) / sizeof( _kArray[0] ) ) + #if LL_LINUX && __GNUC__ <= 2 typedef int intptr_t; #endif |