Remove unused functions to avoid deprecated sysctl
This commit is contained in:
parent
18d66db516
commit
37527baf51
@ -39,18 +39,6 @@ public:
|
||||
#else
|
||||
virtual const c8* getTextFromClipboard() const = 0;
|
||||
#endif
|
||||
|
||||
//! Get the processor speed in megahertz
|
||||
/** \param MHz The integer variable to store the speed in.
|
||||
\return True if successful, false if not */
|
||||
virtual bool getProcessorSpeedMHz(u32* MHz) const = 0;
|
||||
|
||||
//! Get the total and available system RAM
|
||||
/** \param Total: will contain the total system memory
|
||||
\param Avail: will contain the available memory
|
||||
\return True if successful, false if not */
|
||||
virtual bool getSystemMemory(u32* Total, u32* Avail) const = 0;
|
||||
|
||||
};
|
||||
|
||||
} // end namespace
|
||||
|
@ -14,11 +14,6 @@
|
||||
#if !defined(_IRR_SOLARIS_PLATFORM_) && !defined(__CYGWIN__) && !defined(__HAIKU__)
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#if defined(ANDROID) || (defined(__linux__) && !defined(__GLIBC__))
|
||||
#include <linux/sysctl.h>
|
||||
#else
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -184,89 +179,5 @@ const c8* COSOperator::getTextFromClipboard() const
|
||||
#endif
|
||||
|
||||
|
||||
bool COSOperator::getProcessorSpeedMHz(u32* MHz) const
|
||||
{
|
||||
#if defined(_IRR_WINDOWS_API_) && !defined(_WIN32_WCE ) && !defined (_IRR_XBOX_PLATFORM_)
|
||||
LONG Error;
|
||||
|
||||
HKEY Key;
|
||||
Error = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
||||
__TEXT("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0"),
|
||||
0, KEY_READ, &Key);
|
||||
|
||||
if(Error != ERROR_SUCCESS)
|
||||
return false;
|
||||
|
||||
DWORD Speed = 0;
|
||||
DWORD Size = sizeof(Speed);
|
||||
Error = RegQueryValueEx(Key, __TEXT("~MHz"), NULL, NULL, (LPBYTE)&Speed, &Size);
|
||||
|
||||
RegCloseKey(Key);
|
||||
|
||||
if (Error != ERROR_SUCCESS)
|
||||
return false;
|
||||
else if (MHz)
|
||||
*MHz = Speed;
|
||||
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
|
||||
return true;
|
||||
|
||||
#elif defined(_IRR_OSX_PLATFORM_)
|
||||
struct clockinfo CpuClock;
|
||||
size_t Size = sizeof(clockinfo);
|
||||
|
||||
if (!sysctlbyname("kern.clockrate", &CpuClock, &Size, NULL, 0))
|
||||
return false;
|
||||
else if (MHz)
|
||||
*MHz = CpuClock.hz;
|
||||
return true;
|
||||
#else
|
||||
// could probably be read from "/proc/cpuinfo" or "/proc/cpufreq"
|
||||
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool COSOperator::getSystemMemory(u32* Total, u32* Avail) const
|
||||
{
|
||||
#if defined(_IRR_WINDOWS_API_) && !defined (_IRR_XBOX_PLATFORM_)
|
||||
MEMORYSTATUS MemoryStatus;
|
||||
MemoryStatus.dwLength = sizeof(MEMORYSTATUS);
|
||||
|
||||
// cannot fail
|
||||
GlobalMemoryStatus(&MemoryStatus);
|
||||
|
||||
if (Total)
|
||||
*Total = (u32)(MemoryStatus.dwTotalPhys>>10);
|
||||
if (Avail)
|
||||
*Avail = (u32)(MemoryStatus.dwAvailPhys>>10);
|
||||
|
||||
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
|
||||
return true;
|
||||
|
||||
#elif defined(_IRR_POSIX_API_) && !defined(__FreeBSD__)
|
||||
#if defined(_SC_PHYS_PAGES) && defined(_SC_AVPHYS_PAGES)
|
||||
long ps = sysconf(_SC_PAGESIZE);
|
||||
long pp = sysconf(_SC_PHYS_PAGES);
|
||||
long ap = sysconf(_SC_AVPHYS_PAGES);
|
||||
|
||||
if ((ps==-1)||(pp==-1)||(ap==-1))
|
||||
return false;
|
||||
|
||||
if (Total)
|
||||
*Total = (u32)((ps*(long long)pp)>>10);
|
||||
if (Avail)
|
||||
*Avail = (u32)((ps*(long long)ap)>>10);
|
||||
return true;
|
||||
#else
|
||||
// TODO: implement for non-availablity of symbols/features
|
||||
return false;
|
||||
#endif
|
||||
#else
|
||||
// TODO: implement for OSX
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
} // end namespace
|
||||
|
||||
|
@ -39,17 +39,6 @@ public:
|
||||
virtual const c8* getTextFromClipboard() const;
|
||||
#endif
|
||||
|
||||
//! gets the processor speed in megahertz
|
||||
//! \param Mhz:
|
||||
//! \return Returns true if successful, false if not
|
||||
virtual bool getProcessorSpeedMHz(u32* MHz) const;
|
||||
|
||||
//! gets the total and available system RAM in kB
|
||||
//! \param Total: will contain the total system memory
|
||||
//! \param Avail: will contain the available memory
|
||||
//! \return Returns true if successful, false if not
|
||||
virtual bool getSystemMemory(u32* Total, u32* Avail) const;
|
||||
|
||||
private:
|
||||
|
||||
core::stringc OperatingSystem;
|
||||
|
Loading…
Reference in New Issue
Block a user