Jethro Grassie
4 years ago
No known key found for this signature in database
GPG Key ID: DE8ED755616565BB
2 changed files with
5 additions and
11 deletions
-
CMakeLists.txt
-
src/base/kernel/Platform_mac.cpp
|
|
@ -143,6 +143,8 @@ elseif (XMRIG_OS_APPLE) |
|
|
|
src/App_unix.cpp |
|
|
|
src/crypto/common/VirtualMemory_unix.cpp |
|
|
|
) |
|
|
|
find_library(IOKIT_LIBRARY IOKit) |
|
|
|
set(EXTRA_LIBS ${IOKIT_LIBRARY}) |
|
|
|
else() |
|
|
|
list(APPEND SOURCES_OS |
|
|
|
src/App_unix.cpp |
|
|
|
|
|
@ -22,6 +22,8 @@ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
#include <IOKit/IOKitLib.h> |
|
|
|
#include <IOKit/ps/IOPowerSources.h> |
|
|
|
#include <mach/thread_act.h> |
|
|
|
#include <mach/thread_policy.h> |
|
|
|
#include <stdio.h> |
|
|
@ -111,15 +113,5 @@ void xmrig::Platform::setThreadPriority(int priority) |
|
|
|
|
|
|
|
bool xmrig::Platform::isOnBatteryPower() |
|
|
|
{ |
|
|
|
for (int i = 0; i <= 1; ++i) { |
|
|
|
char buf[64]; |
|
|
|
snprintf(buf, 64, "/sys/class/power_supply/BAT%d/status", i); |
|
|
|
std::ifstream f(buf); |
|
|
|
if (f.is_open()) { |
|
|
|
std::string status; |
|
|
|
f >> status; |
|
|
|
return (status == "Discharging"); |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
return IOPSGetTimeRemainingEstimate() != kIOPSTimeRemainingUnlimited; |
|
|
|
} |
|
|
|