From 2c651f3e21c5eeb0cc361e7b03dcb507c96593d8 Mon Sep 17 00:00:00 2001 From: Brad Kittenbrink Date: Thu, 2 Apr 2020 10:55:31 -0700 Subject: Fixed -Wstring-plus-int related errors for compatibility with Xcode-11.4 --- indra/llcommon/llsdutil.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llsdutil.cpp b/indra/llcommon/llsdutil.cpp index 6a23c443a0..1f8384f415 100644 --- a/indra/llcommon/llsdutil.cpp +++ b/indra/llcommon/llsdutil.cpp @@ -506,7 +506,7 @@ struct Data const char* name; } typedata[] = { -#define def(type) { LLSD::type, #type + 4 } +#define def(type) { LLSD::type, &#type[4] } def(TypeUndefined), def(TypeBoolean), def(TypeInteger), -- cgit v1.2.3 From 7cd076c796126692c308df5416b42b24a96609fb Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Thu, 8 Oct 2020 16:48:25 -0600 Subject: DRTVWR-510 remove all LL_SOLARIS conditionals --- indra/llcommon/llapr.h | 2 +- indra/llcommon/llfasttimer.cpp | 8 +++--- indra/llcommon/llfasttimer.h | 10 +++---- indra/llcommon/llmemory.cpp | 31 +------------------- indra/llcommon/llpreprocessor.h | 11 +------ indra/llcommon/llsdutil.cpp | 2 +- indra/llcommon/llstring.h | 10 ++----- indra/llcommon/llsys.cpp | 63 ----------------------------------------- indra/llcommon/llthread.cpp | 2 +- indra/llcommon/lltimer.cpp | 6 ++-- indra/llcommon/lltimer.h | 2 +- indra/llcommon/lluuid.cpp | 4 +-- indra/llcommon/stdtypes.h | 2 +- 13 files changed, 22 insertions(+), 131 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index 255b50c8d0..565d7cfb63 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -29,7 +29,7 @@ #ifndef LL_LLAPR_H #define LL_LLAPR_H -#if LL_LINUX || LL_SOLARIS +#if LL_LINUX #include // Need PATH_MAX in APR headers... #endif diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp index 08ea668964..5b6a7b82f8 100644 --- a/indra/llcommon/llfasttimer.cpp +++ b/indra/llcommon/llfasttimer.cpp @@ -43,7 +43,7 @@ #if LL_WINDOWS #include "lltimer.h" -#elif LL_LINUX || LL_SOLARIS +#elif LL_LINUX #include #include #include "lltimer.h" @@ -64,7 +64,7 @@ bool BlockTimer::sLog = false; std::string BlockTimer::sLogName = ""; bool BlockTimer::sMetricLog = false; -#if LL_LINUX || LL_SOLARIS +#if LL_LINUX U64 BlockTimer::sClockResolution = 1000000000; // Nanosecond resolution #else U64 BlockTimer::sClockResolution = 1000000; // Microsecond resolution @@ -151,12 +151,12 @@ void BlockTimer::setLogLock(LLMutex* lock) //static -#if (LL_DARWIN || LL_LINUX || LL_SOLARIS) && !(defined(__i386__) || defined(__amd64__)) +#if (LL_DARWIN || LL_LINUX) && !(defined(__i386__) || defined(__amd64__)) U64 BlockTimer::countsPerSecond() { return sClockResolution; } -#else // windows or x86-mac or x86-linux or x86-solaris +#else // windows or x86-mac or x86-linux U64 BlockTimer::countsPerSecond() { #if LL_FASTTIMER_USE_RDTSC || !LL_WINDOWS diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h index 5628a05b00..dfc63d08a2 100644 --- a/indra/llcommon/llfasttimer.h +++ b/indra/llcommon/llfasttimer.h @@ -125,9 +125,9 @@ public: #endif -#if (LL_LINUX || LL_SOLARIS) && !(defined(__i386__) || defined(__amd64__)) +#if (LL_LINUX) && !(defined(__i386__) || defined(__amd64__)) // - // Linux and Solaris implementation of CPU clock - non-x86. + // Linux implementation of CPU clock - non-x86. // This is accurate but SLOW! Only use out of desperation. // // Try to use the MONOTONIC clock if available, this is a constant time counter @@ -153,12 +153,12 @@ public: return (U32)(getCPUClockCount64() >> 8); } -#endif // (LL_LINUX || LL_SOLARIS) && !(defined(__i386__) || defined(__amd64__)) +#endif // (LL_LINUX) && !(defined(__i386__) || defined(__amd64__)) -#if (LL_LINUX || LL_SOLARIS || LL_DARWIN) && (defined(__i386__) || defined(__amd64__)) +#if (LL_LINUX || LL_DARWIN) && (defined(__i386__) || defined(__amd64__)) // - // Mac+Linux+Solaris FAST x86 implementation of CPU clock + // Mac+Linux FAST x86 implementation of CPU clock static U32 getCPUClockCount32() { U32 low(0),high(0); diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index 1884d6f04f..7cf4bc0706 100644 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -35,7 +35,7 @@ # include # include # include -#elif LL_LINUX || LL_SOLARIS +#elif LL_LINUX # include #endif @@ -309,35 +309,6 @@ U64 LLMemory::getCurrentRSS() return rss; } -#elif LL_SOLARIS -#include -#include -#include -#define _STRUCTURED_PROC 1 -#include - -U64 LLMemory::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){ - LL_WARNS() << "LLmemory::getCurrentRSS() unable to open " << path << ". Returning 0 RSS!" << LL_ENDL; - return 0; - } - psinfo_t proc_psinfo; - if(read(proc_fd, &proc_psinfo, sizeof(psinfo_t)) != sizeof(psinfo_t)){ - LL_WARNS() << "LLmemory::getCurrentRSS() Unable to read from " << path << ". Returning 0 RSS!" << LL_ENDL; - close(proc_fd); - return 0; - } - - close(proc_fd); - - return((U64)proc_psinfo.pr_rssize * 1024); -} - #else U64 LLMemory::getCurrentRSS() diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h index bae402110a..b17a8e761a 100644 --- a/indra/llcommon/llpreprocessor.h +++ b/indra/llcommon/llpreprocessor.h @@ -34,16 +34,7 @@ #include #endif // LL_LINUX -#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 // 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))) +#if (defined(LL_WINDOWS) || (defined(LL_LINUX) && (__BYTE_ORDER == __LITTLE_ENDIAN)) || (defined(LL_DARWIN) && defined(__LITTLE_ENDIAN__))) #define LL_LITTLE_ENDIAN 1 #else #define LL_BIG_ENDIAN 1 diff --git a/indra/llcommon/llsdutil.cpp b/indra/llcommon/llsdutil.cpp index 3f3edb661f..eb3a96b133 100644 --- a/indra/llcommon/llsdutil.cpp +++ b/indra/llcommon/llsdutil.cpp @@ -33,7 +33,7 @@ #if LL_WINDOWS # define WIN32_LEAN_AND_MEAN # include // for htonl -#elif LL_LINUX || LL_SOLARIS +#elif LL_LINUX # include #elif LL_DARWIN # include diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 6b1a1e0a03..4263122f36 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -37,7 +37,7 @@ #include #include "llformat.h" -#if LL_LINUX || LL_SOLARIS +#if LL_LINUX #include #include #endif @@ -45,16 +45,10 @@ #include #include -#if LL_SOLARIS -// stricmp and strnicmp do not exist on Solaris: -#define stricmp strcasecmp -#define strnicmp strncasecmp -#endif - const char LL_UNKNOWN_CHAR = '?'; class LLSD; -#if LL_DARWIN || LL_LINUX || LL_SOLARIS +#if LL_DARWIN || LL_LINUX // Template specialization of char_traits for U16s. Only necessary on Mac and Linux (exists on Windows already) #include diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 1f8d558fbe..084546fba6 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -87,17 +87,6 @@ using namespace llsd; # include const char MEMINFO_FILE[] = "/proc/meminfo"; # include -#elif LL_SOLARIS -# include -# include -# include -# define _STRUCTURED_PROC 1 -# include -# include -# include -# include -# include -extern int errno; #endif LLCPUInfo gSysCPU; @@ -543,8 +532,6 @@ const std::string& LLOSInfo::getOSVersionString() const U32 LLOSInfo::getProcessVirtualSizeKB() { U32 virtual_size = 0; -#if LL_WINDOWS -#endif #if LL_LINUX # define STATUS_SIZE 2048 LLFILE* status_filep = LLFile::fopen("/proc/self/status", "rb"); @@ -564,24 +551,6 @@ U32 LLOSInfo::getProcessVirtualSizeKB() } fclose(status_filep); } -#elif LL_SOLARIS - char proc_ps[LL_MAX_PATH]; - sprintf(proc_ps, "/proc/%d/psinfo", (int)getpid()); - int proc_fd = -1; - if((proc_fd = open(proc_ps, O_RDONLY)) == -1){ - LL_WARNS() << "unable to open " << proc_ps << LL_ENDL; - return 0; - } - psinfo_t proc_psinfo; - if(read(proc_fd, &proc_psinfo, sizeof(psinfo_t)) != sizeof(psinfo_t)){ - LL_WARNS() << "Unable to read " << proc_ps << LL_ENDL; - close(proc_fd); - return 0; - } - - close(proc_fd); - - virtual_size = proc_psinfo.pr_size; #endif return virtual_size; } @@ -590,8 +559,6 @@ U32 LLOSInfo::getProcessVirtualSizeKB() U32 LLOSInfo::getProcessResidentSizeKB() { U32 resident_size = 0; -#if LL_WINDOWS -#endif #if LL_LINUX LLFILE* status_filep = LLFile::fopen("/proc/self/status", "rb"); if (status_filep != NULL) @@ -610,24 +577,6 @@ U32 LLOSInfo::getProcessResidentSizeKB() } fclose(status_filep); } -#elif LL_SOLARIS - char proc_ps[LL_MAX_PATH]; - sprintf(proc_ps, "/proc/%d/psinfo", (int)getpid()); - int proc_fd = -1; - if((proc_fd = open(proc_ps, O_RDONLY)) == -1){ - LL_WARNS() << "unable to open " << proc_ps << LL_ENDL; - return 0; - } - psinfo_t proc_psinfo; - if(read(proc_fd, &proc_psinfo, sizeof(psinfo_t)) != sizeof(psinfo_t)){ - LL_WARNS() << "Unable to read " << proc_ps << LL_ENDL; - close(proc_fd); - return 0; - } - - close(proc_fd); - - resident_size = proc_psinfo.pr_rssize; #endif return resident_size; } @@ -772,11 +721,6 @@ U32Kilobytes LLMemoryInfo::getPhysicalMemoryKB() const phys = (U64)(getpagesize()) * (U64)(get_phys_pages()); return U64Bytes(phys); -#elif LL_SOLARIS - U64 phys = 0; - phys = (U64)(getpagesize()) * (U64)(sysconf(_SC_PHYS_PAGES)); - return U64Bytes(phys); - #else return 0; @@ -1074,13 +1018,6 @@ LLSD LLMemoryInfo::loadStatsMap() } } -#elif LL_SOLARIS - U64 phys = 0; - - phys = (U64)(sysconf(_SC_PHYS_PAGES)) * (U64)(sysconf(_SC_PAGESIZE)/1024); - - stats.add("Total Physical KB", phys); - #elif LL_LINUX std::ifstream meminfo(MEMINFO_FILE); if (meminfo.is_open()) diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index 0b9dec969c..98905f3b71 100644 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -36,7 +36,7 @@ #include "lltracethreadrecorder.h" #include "llexception.h" -#if LL_LINUX || LL_SOLARIS +#if LL_LINUX #include #endif diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp index 76e892212a..aaa6df325c 100644 --- a/indra/llcommon/lltimer.cpp +++ b/indra/llcommon/lltimer.cpp @@ -32,7 +32,7 @@ #if LL_WINDOWS # include "llwin32headerslean.h" -#elif LL_LINUX || LL_SOLARIS || LL_DARWIN +#elif LL_LINUX || LL_DARWIN # include # include #else @@ -74,7 +74,7 @@ U32 micro_sleep(U64 us, U32 max_yields) ms_sleep((U32)(us / 1000)); return 0; } -#elif LL_LINUX || LL_SOLARIS || LL_DARWIN +#elif LL_LINUX || LL_DARWIN static void _sleep_loop(struct timespec& thiswait) { struct timespec nextwait; @@ -187,7 +187,7 @@ F64 calc_clock_frequency() #endif // LL_WINDOWS -#if LL_LINUX || LL_DARWIN || LL_SOLARIS +#if LL_LINUX || LL_DARWIN // Both Linux and Mac use gettimeofday for accurate time F64 calc_clock_frequency() { diff --git a/indra/llcommon/lltimer.h b/indra/llcommon/lltimer.h index ec70213447..010f290b24 100644 --- a/indra/llcommon/lltimer.h +++ b/indra/llcommon/lltimer.h @@ -27,7 +27,7 @@ #ifndef LL_TIMER_H #define LL_TIMER_H -#if LL_LINUX || LL_DARWIN || LL_SOLARIS +#if LL_LINUX || LL_DARWIN #include #endif #include diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp index b05630c6b5..e3b293e465 100644 --- a/indra/llcommon/lluuid.cpp +++ b/indra/llcommon/lluuid.cpp @@ -601,9 +601,7 @@ S32 LLUUID::getNodeID(unsigned char *node_id) #define HAVE_NETINET_IN_H #ifdef HAVE_NETINET_IN_H #include -#if LL_SOLARIS -#include -#elif !LL_DARWIN +#if !LL_DARWIN #include #endif #endif diff --git a/indra/llcommon/stdtypes.h b/indra/llcommon/stdtypes.h index 6c9871e76c..887f6ab733 100644 --- a/indra/llcommon/stdtypes.h +++ b/indra/llcommon/stdtypes.h @@ -57,7 +57,7 @@ typedef unsigned __int64 U64; #else typedef long long int S64; typedef long long unsigned int U64; -#if LL_DARWIN || LL_LINUX || LL_SOLARIS +#if LL_DARWIN || LL_LINUX #define S64L(a) (a##LL) #define U64L(a) (a##ULL) #endif -- cgit v1.2.3 From d12305496f73e0b55e8e1ec327a2567ca713da22 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Mon, 19 Oct 2020 13:46:04 -0600 Subject: DRTVWR-510 clean up obsolete downstream-from-mDebugGPU code --- indra/llcommon/llmemory.cpp | 54 +-------------------------------------------- indra/llcommon/llmemory.h | 4 +--- 2 files changed, 2 insertions(+), 56 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index 7cf4bc0706..ea84e4c1ea 100644 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -55,7 +55,6 @@ static LLTrace::SampleStatHandle sVirtualMem("virtual_mem", "virtu U32Kilobytes LLMemory::sAllocatedMemInKB(0); U32Kilobytes LLMemory::sAllocatedPageSizeInKB(0); U32Kilobytes LLMemory::sMaxHeapSizeInKB(U32_MAX); -BOOL LLMemory::sEnableMemoryFailurePrevention = FALSE; void ll_assert_aligned_func(uintptr_t ptr,U32 alignment) { @@ -75,10 +74,9 @@ void ll_assert_aligned_func(uintptr_t ptr,U32 alignment) } //static -void LLMemory::initMaxHeapSizeGB(F32Gigabytes max_heap_size, BOOL prevent_heap_failure) +void LLMemory::initMaxHeapSizeGB(F32Gigabytes max_heap_size) { sMaxHeapSizeInKB = U32Kilobytes::convert(max_heap_size); - sEnableMemoryFailurePrevention = prevent_heap_failure ; } //static @@ -158,56 +156,6 @@ void LLMemory::logMemoryInfo(BOOL update) LL_INFOS() << "Current max usable memory(KB): " << sMaxPhysicalMemInKB << LL_ENDL ; } -//return 0: everything is normal; -//return 1: the memory pool is low, but not in danger; -//return -1: the memory pool is in danger, is about to crash. -//static -bool LLMemory::isMemoryPoolLow() -{ - static const U32Megabytes LOW_MEMORY_POOL_THRESHOLD(64); - const static U32Megabytes MAX_SIZE_CHECKED_MEMORY_BLOCK(64); - static void* last_reserved_address = NULL ; - - if(!sEnableMemoryFailurePrevention) - { - return false ; //no memory failure prevention. - } - - if(sAvailPhysicalMemInKB < (LOW_MEMORY_POOL_THRESHOLD / 4)) //out of physical memory - { - return true ; - } - - if(sAllocatedPageSizeInKB + (LOW_MEMORY_POOL_THRESHOLD / 4) > sMaxHeapSizeInKB) //out of virtual address space. - { - return true ; - } - - bool is_low = (S32)(sAvailPhysicalMemInKB < LOW_MEMORY_POOL_THRESHOLD - || sAllocatedPageSizeInKB + LOW_MEMORY_POOL_THRESHOLD > sMaxHeapSizeInKB) ; - - //check the virtual address space fragmentation - if(!is_low) - { - if(!last_reserved_address) - { - last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK.value()) ; - } - else - { - last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK.value()) ; - if(!last_reserved_address) //failed, try once more - { - last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK.value()) ; - } - } - - is_low = !last_reserved_address ; //allocation failed - } - - return is_low ; -} - //static U32Kilobytes LLMemory::getAvailableMemKB() { diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h index f04ae5f5cb..24f86cc11e 100644 --- a/indra/llcommon/llmemory.h +++ b/indra/llcommon/llmemory.h @@ -344,10 +344,9 @@ public: // Return value is zero if not known. static U64 getCurrentRSS(); static void* tryToAlloc(void* address, U32 size); - static void initMaxHeapSizeGB(F32Gigabytes max_heap_size, BOOL prevent_heap_failure); + static void initMaxHeapSizeGB(F32Gigabytes max_heap_size); static void updateMemoryInfo() ; static void logMemoryInfo(BOOL update = FALSE); - static bool isMemoryPoolLow(); static U32Kilobytes getAvailableMemKB() ; static U32Kilobytes getMaxMemKB() ; @@ -359,7 +358,6 @@ private: static U32Kilobytes sAllocatedPageSizeInKB ; static U32Kilobytes sMaxHeapSizeInKB; - static BOOL sEnableMemoryFailurePrevention; }; // LLRefCount moved to llrefcount.h -- cgit v1.2.3