Compare commits
52 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
9ae8907b3e | ||
|
a80f3e8190 | ||
|
b3d1ca6cb2 | ||
|
0290b1ed3c | ||
|
869209389e | ||
|
c6530e352f | ||
|
706f588b36 | ||
|
eb20dfbc94 | ||
|
f69ba3ea1d | ||
|
88ff807700 | ||
|
e76e75cdff | ||
|
083c61754b | ||
|
146bbda33f | ||
|
c9f90e6770 | ||
|
6a2a8579ae | ||
|
29dd2c2138 | ||
|
4e5aef0a8a | ||
|
039c42b1fe | ||
|
1e45349890 | ||
|
d64bbfa9c0 | ||
|
d5605a29b4 | ||
|
4c28fa6009 | ||
|
ad9ae6a143 | ||
|
a5b0bc04cc | ||
|
f491e99bf9 | ||
|
402c44b547 | ||
|
ac4086b273 | ||
|
f00769f758 | ||
|
6ceb4dfc4f | ||
|
3a2941b719 | ||
|
99826a6b51 | ||
|
4a9a7434f6 | ||
|
dbb721cb5e | ||
|
2a93bb2cee | ||
|
7dfb4d9dc0 | ||
|
22eca8e0d5 | ||
|
ecb46643e2 | ||
|
73d959a259 | ||
|
a95b179a60 | ||
|
2e4a83547d | ||
|
fd30294ca0 | ||
|
9b16a2736a | ||
|
ea7aa4ccef | ||
|
d81845e1ab | ||
|
f9d07229b4 | ||
|
2d15c10e0f | ||
|
5bd6a1c028 | ||
|
356e666e61 | ||
|
bdf12bca0f | ||
|
c44ae06d54 | ||
|
c7de9e6561 | ||
|
00c9f89213 |
19
CHANGELOG.md
19
CHANGELOG.md
@ -1,3 +1,22 @@
|
||||
# v5.5.1
|
||||
- [#1469](https://github.com/xmrig/xmrig/issues/1469) Fixed build with gcc 4.8.
|
||||
- [#1473](https://github.com/xmrig/xmrig/pull/1473) Added RandomX auto-config for mobile Ryzen APUs.
|
||||
- [#1477](https://github.com/xmrig/xmrig/pull/1477) Fixed build with Clang.
|
||||
- [#1489](https://github.com/xmrig/xmrig/pull/1489) RandomX JIT compiler tweaks.
|
||||
- [#1493](https://github.com/xmrig/xmrig/pull/1493) Default value for Intel MSR preset changed to `15`.
|
||||
- Fixed unwanted resume after RandomX dataset change.
|
||||
|
||||
# v5.5.0
|
||||
- [#179](https://github.com/xmrig/xmrig/issues/179) Added support for [environment variables](https://xmrig.com/docs/miner/environment-variables) in config file.
|
||||
- [#1445](https://github.com/xmrig/xmrig/pull/1445) Removed `rx/v` algorithm.
|
||||
- [#1453](https://github.com/xmrig/xmrig/issues/1453) Fixed crash on 32bit systems.
|
||||
- [#1459](https://github.com/xmrig/xmrig/issues/1459) Fixed crash on very low memory systems.
|
||||
- [#1465](https://github.com/xmrig/xmrig/pull/1465) Added fix for 1st-gen Ryzen crashes.
|
||||
- [#1466](https://github.com/xmrig/xmrig/pull/1466) Added `cn-pico/tlo` algorithm.
|
||||
- Added `--randomx-no-rdmsr` command line option.
|
||||
- Added console title for Windows with miner name and version.
|
||||
- On Windows `priority` option now also change base priority.
|
||||
|
||||
# v5.4.0
|
||||
- [#1434](https://github.com/xmrig/xmrig/pull/1434) Added RandomSFX (`rx/sfx`) algorithm for Safex Cash.
|
||||
- [#1445](https://github.com/xmrig/xmrig/pull/1445) Added RandomV (`rx/v`) algorithm for *new* MoneroV.
|
||||
|
@ -13,7 +13,8 @@ option(WITH_HTTP "Enable HTTP protocol support (client/server)" ON)
|
||||
option(WITH_DEBUG_LOG "Enable debug log output" OFF)
|
||||
option(WITH_TLS "Enable OpenSSL support" ON)
|
||||
option(WITH_ASM "Enable ASM PoW implementations" ON)
|
||||
option(WITH_MSR "Enable MSR support" ON)
|
||||
option(WITH_MSR "Enable MSR mod & 1st-gen Ryzen fix" ON)
|
||||
option(WITH_ENV_VARS "Enable environment variables support in config file" ON)
|
||||
option(WITH_EMBEDDED_CONFIG "Enable internal embedded JSON config" OFF)
|
||||
option(WITH_OPENCL "Enable OpenCL backend" ON)
|
||||
option(WITH_CUDA "Enable CUDA backend" ON)
|
||||
|
@ -1,6 +1,6 @@
|
||||
# XMRig
|
||||
|
||||
**:warning: [Monero will change PoW algorithm to RandomX on November 30.](https://github.com/xmrig/xmrig/issues/1204)**
|
||||
**:warning: [Monero changed PoW algorithm to RandomX on November 30.](https://github.com/xmrig/xmrig/issues/1204)**
|
||||
|
||||
[![Github All Releases](https://img.shields.io/github/downloads/xmrig/xmrig/total.svg)](https://github.com/xmrig/xmrig/releases)
|
||||
[![GitHub release](https://img.shields.io/github/release/xmrig/xmrig/all.svg)](https://github.com/xmrig/xmrig/releases)
|
||||
@ -38,7 +38,7 @@ Network:
|
||||
-u, --user=USERNAME username for mining server
|
||||
-p, --pass=PASSWORD password for mining server
|
||||
-O, --userpass=U:P username:password pair for mining server
|
||||
-k, --keepalive send keepalived packet for prevent timeout (needs pool support)
|
||||
-k, --keepalive send keepalive packet for prevent timeout (needs pool support)
|
||||
--nicehash enable nicehash.com support
|
||||
--rig-id=ID rig identifier for pool-side statistics (needs pool support)
|
||||
--tls enable SSL/TLS support (needs pool support)
|
||||
@ -62,11 +62,12 @@ CPU backend:
|
||||
--cpu-no-yield prefer maximum hashrate rather than system response/stability
|
||||
--no-huge-pages disable huge pages support
|
||||
--asm=ASM ASM optimizations, possible values: auto, none, intel, ryzen, bulldozer
|
||||
--randomx-init=N threads count to initialize RandomX dataset
|
||||
--randomx-init=N thread count to initialize RandomX dataset
|
||||
--randomx-no-numa disable NUMA support for RandomX
|
||||
--randomx-mode=MODE RandomX mode: auto, fast, light
|
||||
--randomx-1gb-pages use 1GB hugepages for dataset (Linux only)
|
||||
--randomx-wrmsr=N write value (0-15) to Intel MSR register 0x1a4 or do nothing (-1) (Linux only)
|
||||
--randomx-wrmsr=N write custom value (0-15) to Intel MSR register 0x1a4 or disable MSR mod (-1)
|
||||
--randomx-no-rdmsr disable reverting initial MSR values on exit
|
||||
|
||||
API:
|
||||
--api-worker-id=ID custom worker-id for API
|
||||
|
@ -81,6 +81,7 @@ if (WITH_RANDOMX)
|
||||
|
||||
if (WITH_MSR AND NOT XMRIG_ARM AND CMAKE_SIZEOF_VOID_P EQUAL 8 AND (XMRIG_OS_WIN OR XMRIG_OS_LINUX))
|
||||
add_definitions(/DXMRIG_FEATURE_MSR)
|
||||
add_definitions(/DXMRIG_FIX_RYZEN)
|
||||
message("-- WITH_MSR=ON")
|
||||
|
||||
if (XMRIG_OS_WIN)
|
||||
@ -93,6 +94,7 @@ if (WITH_RANDOMX)
|
||||
list(APPEND SOURCES_CRYPTO src/crypto/rx/msr/MsrItem.cpp)
|
||||
else()
|
||||
remove_definitions(/DXMRIG_FEATURE_MSR)
|
||||
remove_definitions(/DXMRIG_FIX_RYZEN)
|
||||
message("-- WITH_MSR=OFF")
|
||||
endif()
|
||||
else()
|
||||
|
@ -25,7 +25,6 @@ Option `coin` useful for pools without algorithm negotiation support or daemon t
|
||||
| `cn/zls` | 2 MB | 2.14.0+ | CryptoNight variant 2 with 3/4 iterations. |
|
||||
| `cn/double` | 2 MB | 2.14.0+ | CryptoNight variant 2 with double iterations. |
|
||||
| `cn/r` | 2 MB | 2.13.0+ | CryptoNightR (Monero's variant 4). |
|
||||
| `cn/wow` | 2 MB | 2.12.0+ | CryptoNightR (Wownero). |
|
||||
| `cn/gpu` | 2 MB | 2.11.0+ | CryptoNight-GPU. |
|
||||
| `cn-pico` | 256 KB | 2.10.0+ | CryptoNight-Pico. |
|
||||
| `cn/half` | 2 MB | 2.9.0+ | CryptoNight variant 2 with half iterations. |
|
||||
|
@ -45,6 +45,7 @@ class IRxStorage
|
||||
public:
|
||||
virtual ~IRxStorage() = default;
|
||||
|
||||
virtual bool isAllocated() const = 0;
|
||||
virtual HugePagesInfo hugePages() const = 0;
|
||||
virtual RxDataset *dataset(const Job &job, uint32_t nodeId) const = 0;
|
||||
virtual void init(const RxSeed &seed, uint32_t threads, bool hugePages, bool oneGbPages, RxConfig::Mode mode, int priority) = 0;
|
||||
|
@ -154,7 +154,8 @@ bool xmrig::CpuWorker<N>::selfTest()
|
||||
|
||||
# ifdef XMRIG_ALGO_CN_PICO
|
||||
if (m_algorithm.family() == Algorithm::CN_PICO) {
|
||||
return verify(Algorithm::CN_PICO_0, test_output_pico_trtl);
|
||||
return verify(Algorithm::CN_PICO_0, test_output_pico_trtl) &&
|
||||
verify(Algorithm::CN_PICO_TLO, test_output_pico_tlo);
|
||||
}
|
||||
# endif
|
||||
|
||||
|
@ -78,9 +78,15 @@ xmrig::CudaWorker::CudaWorker(size_t id, const CudaLaunchData &data) :
|
||||
break;
|
||||
}
|
||||
|
||||
if (!m_runner || !m_runner->init()) {
|
||||
if (!m_runner) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_runner->init()) {
|
||||
delete m_runner;
|
||||
|
||||
m_runner = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -47,7 +47,7 @@ xmrig::CudaBaseRunner::~CudaBaseRunner()
|
||||
bool xmrig::CudaBaseRunner::init()
|
||||
{
|
||||
m_ctx = CudaLib::alloc(m_data.thread.index(), m_data.thread.bfactor(), m_data.thread.bsleep());
|
||||
if (CudaLib::deviceInfo(m_ctx, m_data.thread.blocks(), m_data.thread.threads(), m_data.algorithm, m_data.thread.datasetHost()) != 0) {
|
||||
if (!callWrapper(CudaLib::deviceInfo(m_ctx, m_data.thread.blocks(), m_data.thread.threads(), m_data.algorithm, m_data.thread.datasetHost()))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -31,8 +31,9 @@
|
||||
#include "crypto/rx/RxDataset.h"
|
||||
|
||||
|
||||
xmrig::CudaRxRunner::CudaRxRunner(size_t index, const CudaLaunchData &data) : CudaBaseRunner(index, data),
|
||||
m_datasetHost(data.thread.datasetHost() > 0)
|
||||
xmrig::CudaRxRunner::CudaRxRunner(size_t index, const CudaLaunchData &data) :
|
||||
CudaBaseRunner(index, data),
|
||||
m_datasetHost(data.thread.datasetHost() > 0)
|
||||
{
|
||||
m_intensity = m_data.thread.threads() * m_data.thread.blocks();
|
||||
const size_t scratchpads_size = m_intensity * m_data.algorithm.l3();
|
||||
|
@ -41,7 +41,7 @@ xmrig::CudaDevice::CudaDevice(uint32_t index, int32_t bfactor, int32_t bsleep) :
|
||||
m_index(index)
|
||||
{
|
||||
auto ctx = CudaLib::alloc(index, bfactor, bsleep);
|
||||
if (CudaLib::deviceInfo(ctx, 0, 0, Algorithm::INVALID) != 0) {
|
||||
if (!CudaLib::deviceInfo(ctx, 0, 0, Algorithm::INVALID)) {
|
||||
CudaLib::release(ctx);
|
||||
|
||||
return;
|
||||
@ -107,7 +107,7 @@ uint32_t xmrig::CudaDevice::smx() const
|
||||
|
||||
void xmrig::CudaDevice::generate(const Algorithm &algorithm, CudaThreads &threads) const
|
||||
{
|
||||
if (CudaLib::deviceInfo(m_ctx, -1, -1, algorithm) != 0) {
|
||||
if (!CudaLib::deviceInfo(m_ctx, -1, -1, algorithm)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
|
||||
#include "backend/cuda/wrappers/CudaLib.h"
|
||||
#include "base/kernel/Env.h"
|
||||
#include "crypto/rx/RxAlgo.h"
|
||||
|
||||
|
||||
@ -49,6 +50,7 @@ static const char *kAlloc = "alloc";
|
||||
static const char *kCnHash = "cnHash";
|
||||
static const char *kDeviceCount = "deviceCount";
|
||||
static const char *kDeviceInfo = "deviceInfo";
|
||||
static const char *kDeviceInfo_v2 = "deviceInfo_v2";
|
||||
static const char *kDeviceInit = "deviceInit";
|
||||
static const char *kDeviceInt = "deviceInt";
|
||||
static const char *kDeviceName = "deviceName";
|
||||
@ -61,6 +63,7 @@ static const char *kRelease = "release";
|
||||
static const char *kRxHash = "rxHash";
|
||||
static const char *kRxPrepare = "rxPrepare";
|
||||
static const char *kSetJob = "setJob";
|
||||
static const char *kSetJob_v2 = "setJob_v2";
|
||||
static const char *kSymbolNotFound = "symbol not found";
|
||||
static const char *kVersion = "version";
|
||||
|
||||
@ -69,6 +72,7 @@ using alloc_t = nvid_ctx * (*)(uint32_
|
||||
using cnHash_t = bool (*)(nvid_ctx *, uint32_t, uint64_t, uint64_t, uint32_t *, uint32_t *);
|
||||
using deviceCount_t = uint32_t (*)();
|
||||
using deviceInfo_t = int32_t (*)(nvid_ctx *, int32_t, int32_t, int32_t, int32_t);
|
||||
using deviceInfo_v2_t = bool (*)(nvid_ctx *, int32_t, int32_t, const char *, int32_t);
|
||||
using deviceInit_t = bool (*)(nvid_ctx *);
|
||||
using deviceInt_t = int32_t (*)(nvid_ctx *, CudaLib::DeviceProperty);
|
||||
using deviceName_t = const char * (*)(nvid_ctx *);
|
||||
@ -81,6 +85,7 @@ using release_t = void (*)(nvid_ctx *);
|
||||
using rxHash_t = bool (*)(nvid_ctx *, uint32_t, uint64_t, uint32_t *, uint32_t *);
|
||||
using rxPrepare_t = bool (*)(nvid_ctx *, const void *, size_t, bool, uint32_t);
|
||||
using setJob_t = bool (*)(nvid_ctx *, const void *, size_t, int32_t);
|
||||
using setJob_v2_t = bool (*)(nvid_ctx *, const void *, size_t, const char *);
|
||||
using version_t = uint32_t (*)(Version);
|
||||
|
||||
|
||||
@ -88,6 +93,7 @@ static alloc_t pAlloc = nullptr;
|
||||
static cnHash_t pCnHash = nullptr;
|
||||
static deviceCount_t pDeviceCount = nullptr;
|
||||
static deviceInfo_t pDeviceInfo = nullptr;
|
||||
static deviceInfo_v2_t pDeviceInfo_v2 = nullptr;
|
||||
static deviceInit_t pDeviceInit = nullptr;
|
||||
static deviceInt_t pDeviceInt = nullptr;
|
||||
static deviceName_t pDeviceName = nullptr;
|
||||
@ -100,6 +106,7 @@ static release_t pRelease = nullptr;
|
||||
static rxHash_t pRxHash = nullptr;
|
||||
static rxPrepare_t pRxPrepare = nullptr;
|
||||
static setJob_t pSetJob = nullptr;
|
||||
static setJob_v2_t pSetJob_v2 = nullptr;
|
||||
static version_t pVersion = nullptr;
|
||||
|
||||
|
||||
@ -117,7 +124,7 @@ String CudaLib::m_loader;
|
||||
bool xmrig::CudaLib::init(const char *fileName)
|
||||
{
|
||||
if (!m_initialized) {
|
||||
m_loader = fileName == nullptr ? defaultLoader() : fileName;
|
||||
m_loader = fileName == nullptr ? defaultLoader() : Env::expand(fileName);
|
||||
m_ready = uv_dlopen(m_loader, &cudaLib) == 0 && load();
|
||||
m_initialized = true;
|
||||
}
|
||||
@ -144,6 +151,18 @@ bool xmrig::CudaLib::cnHash(nvid_ctx *ctx, uint32_t startNonce, uint64_t height,
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::CudaLib::deviceInfo(nvid_ctx *ctx, int32_t blocks, int32_t threads, const Algorithm &algorithm, int32_t dataset_host) noexcept
|
||||
{
|
||||
const Algorithm algo = RxAlgo::id(algorithm);
|
||||
|
||||
if (pDeviceInfo_v2) {
|
||||
return pDeviceInfo_v2(ctx, blocks, threads, algo.isValid() ? algo.shortName() : nullptr, dataset_host);
|
||||
}
|
||||
|
||||
return pDeviceInfo(ctx, blocks, threads, algo, dataset_host) == 0;
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::CudaLib::deviceInit(nvid_ctx *ctx) noexcept
|
||||
{
|
||||
return pDeviceInit(ctx);
|
||||
@ -164,7 +183,12 @@ bool xmrig::CudaLib::rxPrepare(nvid_ctx *ctx, const void *dataset, size_t datase
|
||||
|
||||
bool xmrig::CudaLib::setJob(nvid_ctx *ctx, const void *data, size_t size, const Algorithm &algorithm) noexcept
|
||||
{
|
||||
return pSetJob(ctx, data, size, RxAlgo::id(algorithm));
|
||||
const Algorithm algo = RxAlgo::id(algorithm);
|
||||
if (pSetJob_v2) {
|
||||
return pSetJob_v2(ctx, data, size, algo.shortName());
|
||||
}
|
||||
|
||||
return pSetJob(ctx, data, size, algo);
|
||||
}
|
||||
|
||||
|
||||
@ -186,12 +210,6 @@ const char *xmrig::CudaLib::pluginVersion() noexcept
|
||||
}
|
||||
|
||||
|
||||
int xmrig::CudaLib::deviceInfo(nvid_ctx *ctx, int32_t blocks, int32_t threads, const Algorithm &algorithm, int32_t dataset_host) noexcept
|
||||
{
|
||||
return pDeviceInfo(ctx, blocks, threads, RxAlgo::id(algorithm), dataset_host);
|
||||
}
|
||||
|
||||
|
||||
int32_t xmrig::CudaLib::deviceInt(nvid_ctx *ctx, DeviceProperty property) noexcept
|
||||
{
|
||||
return pDeviceInt(ctx, property);
|
||||
@ -291,11 +309,13 @@ bool xmrig::CudaLib::load()
|
||||
return false;
|
||||
}
|
||||
|
||||
uv_dlsym(&cudaLib, kDeviceInfo_v2, reinterpret_cast<void**>(&pDeviceInfo_v2));
|
||||
uv_dlsym(&cudaLib, kSetJob_v2, reinterpret_cast<void**>(&pSetJob_v2));
|
||||
|
||||
try {
|
||||
DLSYM(Alloc);
|
||||
DLSYM(CnHash);
|
||||
DLSYM(DeviceCount);
|
||||
DLSYM(DeviceInfo);
|
||||
DLSYM(DeviceInit);
|
||||
DLSYM(DeviceInt);
|
||||
DLSYM(DeviceName);
|
||||
@ -307,8 +327,15 @@ bool xmrig::CudaLib::load()
|
||||
DLSYM(Release);
|
||||
DLSYM(RxHash);
|
||||
DLSYM(RxPrepare);
|
||||
DLSYM(SetJob);
|
||||
DLSYM(Version);
|
||||
|
||||
if (!pDeviceInfo_v2) {
|
||||
DLSYM(DeviceInfo);
|
||||
}
|
||||
|
||||
if (!pSetJob_v2) {
|
||||
DLSYM(SetJob);
|
||||
}
|
||||
} catch (std::exception &ex) {
|
||||
return false;
|
||||
}
|
||||
@ -319,7 +346,7 @@ bool xmrig::CudaLib::load()
|
||||
}
|
||||
|
||||
|
||||
const char *xmrig::CudaLib::defaultLoader()
|
||||
xmrig::String xmrig::CudaLib::defaultLoader()
|
||||
{
|
||||
# if defined(__APPLE__)
|
||||
return "/System/Library/Frameworks/OpenCL.framework/OpenCL"; // FIXME
|
||||
|
@ -74,6 +74,7 @@ public:
|
||||
static inline const String &loader() { return m_loader; }
|
||||
|
||||
static bool cnHash(nvid_ctx *ctx, uint32_t startNonce, uint64_t height, uint64_t target, uint32_t *rescount, uint32_t *resnonce);
|
||||
static bool deviceInfo(nvid_ctx *ctx, int32_t blocks, int32_t threads, const Algorithm &algorithm, int32_t dataset_host = -1) noexcept;
|
||||
static bool deviceInit(nvid_ctx *ctx) noexcept;
|
||||
static bool rxHash(nvid_ctx *ctx, uint32_t startNonce, uint64_t target, uint32_t *rescount, uint32_t *resnonce) noexcept;
|
||||
static bool rxPrepare(nvid_ctx *ctx, const void *dataset, size_t datasetSize, bool dataset_host, uint32_t batchSize) noexcept;
|
||||
@ -81,7 +82,6 @@ public:
|
||||
static const char *deviceName(nvid_ctx *ctx) noexcept;
|
||||
static const char *lastError(nvid_ctx *ctx) noexcept;
|
||||
static const char *pluginVersion() noexcept;
|
||||
static int deviceInfo(nvid_ctx *ctx, int32_t blocks, int32_t threads, const Algorithm &algorithm, int32_t dataset_host = -1) noexcept;
|
||||
static int32_t deviceInt(nvid_ctx *ctx, DeviceProperty property) noexcept;
|
||||
static nvid_ctx *alloc(uint32_t id, int32_t bfactor, int32_t bsleep) noexcept;
|
||||
static std::string version(uint32_t version);
|
||||
@ -95,7 +95,7 @@ public:
|
||||
|
||||
private:
|
||||
static bool load();
|
||||
static const char *defaultLoader();
|
||||
static String defaultLoader();
|
||||
|
||||
static bool m_initialized;
|
||||
static bool m_ready;
|
||||
|
@ -16,12 +16,12 @@
|
||||
#define ALGO_CN_HEAVY_TUBE 15
|
||||
#define ALGO_CN_HEAVY_XHV 16
|
||||
#define ALGO_CN_PICO_0 17
|
||||
#define ALGO_RX_0 18
|
||||
#define ALGO_RX_WOW 19
|
||||
#define ALGO_RX_LOKI 20
|
||||
#define ALGO_RX_ARQMA 21
|
||||
#define ALGO_RX_SFX 22
|
||||
#define ALGO_RX_V 23
|
||||
#define ALGO_CN_PICO_TLO 18
|
||||
#define ALGO_RX_0 19
|
||||
#define ALGO_RX_WOW 20
|
||||
#define ALGO_RX_LOKI 21
|
||||
#define ALGO_RX_ARQMA 22
|
||||
#define ALGO_RX_SFX 23
|
||||
#define ALGO_AR2_CHUKWA 24
|
||||
#define ALGO_AR2_WRKZ 25
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -40,6 +40,12 @@ bool ocl_generic_rx_generator(const OclDevice &device, const Algorithm &algorith
|
||||
return false;
|
||||
}
|
||||
|
||||
// Mobile Ryzen APUs
|
||||
if (device.type() == OclDevice::Raven) {
|
||||
threads.add(OclThread(device.index(), (device.computeUnits() > 4) ? 256 : 128, 8, 1, true, true, 6));
|
||||
return true;
|
||||
}
|
||||
|
||||
const size_t mem = device.globalMemSize();
|
||||
auto config = RxAlgo::base(algorithm);
|
||||
bool gcnAsm = false;
|
||||
|
@ -52,7 +52,7 @@ xmrig::OclRxBaseRunner::OclRxBaseRunner(size_t index, const OclLaunchData &data)
|
||||
m_worksize = 8;
|
||||
}
|
||||
|
||||
if (data.device.type() == OclDevice::Vega_10 || data.device.type() == OclDevice::Vega_20) {
|
||||
if (data.device.type() == OclDevice::Vega_10 || data.device.type() == OclDevice::Vega_20 || data.device.type() == OclDevice::Raven) {
|
||||
m_gcn_version = 14;
|
||||
}
|
||||
|
||||
|
@ -28,10 +28,12 @@
|
||||
#include <uv.h>
|
||||
|
||||
|
||||
#include "backend/opencl/wrappers/OclLib.h"
|
||||
#include "backend/common/Tags.h"
|
||||
#include "backend/opencl/wrappers/OclError.h"
|
||||
#include "backend/opencl/wrappers/OclLib.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/kernel/Env.h"
|
||||
|
||||
|
||||
#if defined(OCL_DEBUG_REFERENCE_COUNT)
|
||||
# define LOG_REFS(x, ...) xmrig::Log::print(xmrig::Log::WARNING, x, ##__VA_ARGS__)
|
||||
@ -188,7 +190,7 @@ static String getOclString(FUNC fn, OBJ obj, PARAM param)
|
||||
bool xmrig::OclLib::init(const char *fileName)
|
||||
{
|
||||
if (!m_initialized) {
|
||||
m_loader = fileName == nullptr ? defaultLoader() : fileName;
|
||||
m_loader = fileName == nullptr ? defaultLoader() : Env::expand(fileName);
|
||||
m_ready = uv_dlopen(m_loader, &oclLib) == 0 && load();
|
||||
m_initialized = true;
|
||||
}
|
||||
@ -257,7 +259,7 @@ bool xmrig::OclLib::load()
|
||||
}
|
||||
|
||||
|
||||
const char *xmrig::OclLib::defaultLoader()
|
||||
xmrig::String xmrig::OclLib::defaultLoader()
|
||||
{
|
||||
# if defined(__APPLE__)
|
||||
return "/System/Library/Frameworks/OpenCL.framework/OpenCL";
|
||||
|
@ -102,7 +102,7 @@ public:
|
||||
|
||||
private:
|
||||
static bool load();
|
||||
static const char *defaultLoader();
|
||||
static String defaultLoader();
|
||||
|
||||
static bool m_initialized;
|
||||
static bool m_ready;
|
||||
|
@ -26,17 +26,13 @@
|
||||
#include <uv.h>
|
||||
|
||||
|
||||
#ifndef _WIN32
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "base/api/Api.h"
|
||||
#include "3rdparty/http-parser/http_parser.h"
|
||||
#include "base/api/interfaces/IApiListener.h"
|
||||
#include "base/api/requests/HttpApiRequest.h"
|
||||
#include "base/io/json/Json.h"
|
||||
#include "base/kernel/Base.h"
|
||||
#include "base/kernel/Env.h"
|
||||
#include "base/tools/Buffer.h"
|
||||
#include "base/tools/Chrono.h"
|
||||
#include "core/config/Config.h"
|
||||
@ -158,7 +154,7 @@ void xmrig::Api::exec(IApiRequest &request)
|
||||
|
||||
auto &reply = request.reply();
|
||||
reply.AddMember("id", StringRef(m_id), allocator);
|
||||
reply.AddMember("worker_id", StringRef(m_workerId), allocator);
|
||||
reply.AddMember("worker_id", m_workerId.toJSON(), allocator);
|
||||
reply.AddMember("uptime", (Chrono::currentMSecsSinceEpoch() - m_timestamp) / 1000, allocator);
|
||||
reply.AddMember("restricted", request.isRestricted(), allocator);
|
||||
reply.AddMember("resources", getResources(request.doc()), allocator);
|
||||
@ -245,12 +241,8 @@ void xmrig::Api::genId(const String &id)
|
||||
|
||||
void xmrig::Api::genWorkerId(const String &id)
|
||||
{
|
||||
memset(m_workerId, 0, sizeof(m_workerId));
|
||||
|
||||
if (id.size() > 0) {
|
||||
strncpy(m_workerId, id.data(), sizeof(m_workerId) - 1);
|
||||
}
|
||||
else {
|
||||
gethostname(m_workerId, sizeof(m_workerId) - 1);
|
||||
m_workerId = Env::expand(id);
|
||||
if (m_workerId.isEmpty()) {
|
||||
m_workerId = Env::hostname();
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
#include "base/kernel/interfaces/IBaseListener.h"
|
||||
#include "base/tools/Object.h"
|
||||
#include "base/tools/String.h"
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
@ -71,7 +72,7 @@ private:
|
||||
|
||||
Base *m_base;
|
||||
char m_id[32]{};
|
||||
char m_workerId[128]{};
|
||||
String m_workerId;
|
||||
const uint64_t m_timestamp;
|
||||
Httpd *m_httpd = nullptr;
|
||||
std::vector<IApiListener *> m_listeners;
|
||||
|
@ -5,8 +5,8 @@
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -69,21 +69,23 @@ public:
|
||||
|
||||
virtual ~IApiRequest() = default;
|
||||
|
||||
virtual bool accept() = 0;
|
||||
virtual bool hasParseError() const = 0;
|
||||
virtual bool isDone() const = 0;
|
||||
virtual bool isNew() const = 0;
|
||||
virtual bool isRestricted() const = 0;
|
||||
virtual const rapidjson::Value &json() const = 0;
|
||||
virtual const String &rpcMethod() const = 0;
|
||||
virtual const String &url() const = 0;
|
||||
virtual int version() const = 0;
|
||||
virtual Method method() const = 0;
|
||||
virtual rapidjson::Document &doc() = 0;
|
||||
virtual rapidjson::Value &reply() = 0;
|
||||
virtual RequestType type() const = 0;
|
||||
virtual Source source() const = 0;
|
||||
virtual void done(int status) = 0;
|
||||
virtual bool accept() = 0;
|
||||
virtual bool hasParseError() const = 0;
|
||||
virtual bool isDone() const = 0;
|
||||
virtual bool isNew() const = 0;
|
||||
virtual bool isRestricted() const = 0;
|
||||
virtual const rapidjson::Value &json() const = 0;
|
||||
virtual const String &rpcMethod() const = 0;
|
||||
virtual const String &url() const = 0;
|
||||
virtual int version() const = 0;
|
||||
virtual Method method() const = 0;
|
||||
virtual rapidjson::Document &doc() = 0;
|
||||
virtual rapidjson::Value &reply() = 0;
|
||||
virtual RequestType type() const = 0;
|
||||
virtual Source source() const = 0;
|
||||
virtual void done(int status) = 0;
|
||||
virtual void setRpcError(int code, const char *message = nullptr) = 0;
|
||||
virtual void setRpcResult(rapidjson::Value &result) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -5,8 +5,8 @@
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -53,6 +53,10 @@ static inline const char *rpcError(int code) {
|
||||
return "Invalid params";
|
||||
}
|
||||
|
||||
if (code >= HTTP_STATUS_BAD_REQUEST && code <= HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED) {
|
||||
return http_status_str(static_cast<http_status>(code));
|
||||
}
|
||||
|
||||
return "Internal error";
|
||||
}
|
||||
|
||||
@ -82,7 +86,7 @@ xmrig::HttpApiRequest::HttpApiRequest(const HttpData &req, bool restricted) :
|
||||
return;
|
||||
}
|
||||
|
||||
m_rpcMethod = Json::getString(json(), "method");
|
||||
m_rpcMethod = Json::getString(m_body, "method");
|
||||
if (m_rpcMethod.isEmpty()) {
|
||||
done(RPC_INVALID_REQUEST);
|
||||
|
||||
@ -129,6 +133,10 @@ bool xmrig::HttpApiRequest::accept()
|
||||
|
||||
const rapidjson::Value &xmrig::HttpApiRequest::json() const
|
||||
{
|
||||
if (type() == REQ_JSON_RPC) {
|
||||
return Json::getValue(m_body, "params");
|
||||
}
|
||||
|
||||
return m_body;
|
||||
}
|
||||
|
||||
@ -150,25 +158,14 @@ void xmrig::HttpApiRequest::done(int status)
|
||||
m_res.setStatus(HTTP_STATUS_OK);
|
||||
|
||||
if (status != HTTP_STATUS_OK) {
|
||||
if (status == HTTP_STATUS_NOT_FOUND) {
|
||||
status = RPC_METHOD_NOT_FOUND;
|
||||
}
|
||||
|
||||
Value error(kObjectType);
|
||||
error.AddMember("code", status, allocator);
|
||||
error.AddMember("message", StringRef(rpcError(status)), allocator);
|
||||
|
||||
reply().AddMember(StringRef(kError), error, allocator);
|
||||
setRpcError(status == HTTP_STATUS_NOT_FOUND ? RPC_METHOD_NOT_FOUND : status);
|
||||
}
|
||||
else if (!reply().HasMember(kResult)) {
|
||||
Value result(kObjectType);
|
||||
result.AddMember("status", "OK", allocator);
|
||||
|
||||
reply().AddMember(StringRef(kResult), result, allocator);
|
||||
setRpcResult(result);
|
||||
}
|
||||
|
||||
reply().AddMember("jsonrpc", "2.0", allocator);
|
||||
reply().AddMember(StringRef(kId), Value().CopyFrom(Json::getValue(json(), kId), allocator), allocator);
|
||||
}
|
||||
else {
|
||||
m_res.setStatus(status);
|
||||
@ -176,3 +173,38 @@ void xmrig::HttpApiRequest::done(int status)
|
||||
|
||||
m_res.end();
|
||||
}
|
||||
|
||||
|
||||
void xmrig::HttpApiRequest::setRpcError(int code, const char *message)
|
||||
{
|
||||
using namespace rapidjson;
|
||||
auto &allocator = doc().GetAllocator();
|
||||
|
||||
Value error(kObjectType);
|
||||
error.AddMember("code", code, allocator);
|
||||
error.AddMember("message", message ? StringRef(message) : StringRef(rpcError(code)), allocator);
|
||||
|
||||
rpcDone(kError, error);
|
||||
}
|
||||
|
||||
|
||||
void xmrig::HttpApiRequest::setRpcResult(rapidjson::Value &result)
|
||||
{
|
||||
rpcDone(kResult, result);
|
||||
}
|
||||
|
||||
|
||||
void xmrig::HttpApiRequest::rpcDone(const char *key, rapidjson::Value &value)
|
||||
{
|
||||
ApiRequest::done(0);
|
||||
|
||||
using namespace rapidjson;
|
||||
auto &allocator = doc().GetAllocator();
|
||||
|
||||
reply().AddMember(StringRef(key), value, allocator);
|
||||
reply().AddMember("jsonrpc", "2.0", allocator);
|
||||
reply().AddMember(StringRef(kId), Value().CopyFrom(Json::getValue(m_body, kId), allocator), allocator);
|
||||
|
||||
m_res.setStatus(HTTP_STATUS_OK);
|
||||
m_res.end();
|
||||
}
|
||||
|
@ -5,8 +5,8 @@
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -53,8 +53,12 @@ protected:
|
||||
const rapidjson::Value &json() const override;
|
||||
Method method() const override;
|
||||
void done(int status) override;
|
||||
void setRpcError(int code, const char *message = nullptr) override;
|
||||
void setRpcResult(rapidjson::Value &result) override;
|
||||
|
||||
private:
|
||||
void rpcDone(const char *key, rapidjson::Value &value);
|
||||
|
||||
const HttpData &m_req;
|
||||
HttpApiResponse m_res;
|
||||
int m_parsed = 0;
|
||||
|
@ -12,6 +12,7 @@ set(HEADERS_BASE
|
||||
src/base/kernel/config/BaseConfig.h
|
||||
src/base/kernel/config/BaseTransform.h
|
||||
src/base/kernel/Entry.h
|
||||
src/base/kernel/Env.h
|
||||
src/base/kernel/interfaces/IBaseListener.h
|
||||
src/base/kernel/interfaces/IClient.h
|
||||
src/base/kernel/interfaces/IClientListener.h
|
||||
@ -66,6 +67,7 @@ set(SOURCES_BASE
|
||||
src/base/kernel/config/BaseConfig.cpp
|
||||
src/base/kernel/config/BaseTransform.cpp
|
||||
src/base/kernel/Entry.cpp
|
||||
src/base/kernel/Env.cpp
|
||||
src/base/kernel/Platform.cpp
|
||||
src/base/kernel/Process.cpp
|
||||
src/base/kernel/Signals.cpp
|
||||
@ -167,3 +169,15 @@ else()
|
||||
remove_definitions(/DXMRIG_FEATURE_HTTP)
|
||||
remove_definitions(/DXMRIG_FEATURE_API)
|
||||
endif()
|
||||
|
||||
|
||||
if (WITH_ENV_VARS AND CMAKE_CXX_COMPILER_ID MATCHES GNU AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
|
||||
set(WITH_ENV_VARS OFF)
|
||||
endif()
|
||||
|
||||
|
||||
if (WITH_ENV_VARS)
|
||||
add_definitions(/DXMRIG_FEATURE_ENV)
|
||||
else()
|
||||
remove_definitions(/DXMRIG_FEATURE_ENV)
|
||||
endif()
|
||||
|
@ -5,8 +5,8 @@
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -40,7 +40,9 @@ static const rapidjson::Value kNullValue;
|
||||
|
||||
bool xmrig::Json::getBool(const rapidjson::Value &obj, const char *key, bool defaultValue)
|
||||
{
|
||||
assert(obj.IsObject());
|
||||
if (isEmpty(obj)) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
auto i = obj.FindMember(key);
|
||||
if (i != obj.MemberEnd() && i->value.IsBool()) {
|
||||
@ -51,9 +53,17 @@ bool xmrig::Json::getBool(const rapidjson::Value &obj, const char *key, bool def
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::Json::isEmpty(const rapidjson::Value &obj)
|
||||
{
|
||||
return !obj.IsObject() || obj.ObjectEmpty();
|
||||
}
|
||||
|
||||
|
||||
const char *xmrig::Json::getString(const rapidjson::Value &obj, const char *key, const char *defaultValue)
|
||||
{
|
||||
assert(obj.IsObject());
|
||||
if (isEmpty(obj)) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
auto i = obj.FindMember(key);
|
||||
if (i != obj.MemberEnd() && i->value.IsString()) {
|
||||
@ -66,7 +76,9 @@ const char *xmrig::Json::getString(const rapidjson::Value &obj, const char *key,
|
||||
|
||||
const rapidjson::Value &xmrig::Json::getArray(const rapidjson::Value &obj, const char *key)
|
||||
{
|
||||
assert(obj.IsObject());
|
||||
if (isEmpty(obj)) {
|
||||
return kNullValue;
|
||||
}
|
||||
|
||||
auto i = obj.FindMember(key);
|
||||
if (i != obj.MemberEnd() && i->value.IsArray()) {
|
||||
@ -79,7 +91,9 @@ const rapidjson::Value &xmrig::Json::getArray(const rapidjson::Value &obj, const
|
||||
|
||||
const rapidjson::Value &xmrig::Json::getObject(const rapidjson::Value &obj, const char *key)
|
||||
{
|
||||
assert(obj.IsObject());
|
||||
if (isEmpty(obj)) {
|
||||
return kNullValue;
|
||||
}
|
||||
|
||||
auto i = obj.FindMember(key);
|
||||
if (i != obj.MemberEnd() && i->value.IsObject()) {
|
||||
@ -92,7 +106,9 @@ const rapidjson::Value &xmrig::Json::getObject(const rapidjson::Value &obj, cons
|
||||
|
||||
const rapidjson::Value &xmrig::Json::getValue(const rapidjson::Value &obj, const char *key)
|
||||
{
|
||||
assert(obj.IsObject());
|
||||
if (isEmpty(obj)) {
|
||||
return kNullValue;
|
||||
}
|
||||
|
||||
auto i = obj.FindMember(key);
|
||||
if (i != obj.MemberEnd()) {
|
||||
@ -105,7 +121,9 @@ const rapidjson::Value &xmrig::Json::getValue(const rapidjson::Value &obj, const
|
||||
|
||||
int xmrig::Json::getInt(const rapidjson::Value &obj, const char *key, int defaultValue)
|
||||
{
|
||||
assert(obj.IsObject());
|
||||
if (isEmpty(obj)) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
auto i = obj.FindMember(key);
|
||||
if (i != obj.MemberEnd() && i->value.IsInt()) {
|
||||
@ -118,7 +136,9 @@ int xmrig::Json::getInt(const rapidjson::Value &obj, const char *key, int defaul
|
||||
|
||||
int64_t xmrig::Json::getInt64(const rapidjson::Value &obj, const char *key, int64_t defaultValue)
|
||||
{
|
||||
assert(obj.IsObject());
|
||||
if (isEmpty(obj)) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
auto i = obj.FindMember(key);
|
||||
if (i != obj.MemberEnd() && i->value.IsInt64()) {
|
||||
@ -131,7 +151,9 @@ int64_t xmrig::Json::getInt64(const rapidjson::Value &obj, const char *key, int6
|
||||
|
||||
uint64_t xmrig::Json::getUint64(const rapidjson::Value &obj, const char *key, uint64_t defaultValue)
|
||||
{
|
||||
assert(obj.IsObject());
|
||||
if (isEmpty(obj)) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
auto i = obj.FindMember(key);
|
||||
if (i != obj.MemberEnd() && i->value.IsUint64()) {
|
||||
@ -144,7 +166,9 @@ uint64_t xmrig::Json::getUint64(const rapidjson::Value &obj, const char *key, ui
|
||||
|
||||
unsigned xmrig::Json::getUint(const rapidjson::Value &obj, const char *key, unsigned defaultValue)
|
||||
{
|
||||
assert(obj.IsObject());
|
||||
if (isEmpty(obj)) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
auto i = obj.FindMember(key);
|
||||
if (i != obj.MemberEnd() && i->value.IsUint()) {
|
||||
@ -169,5 +193,5 @@ rapidjson::Value xmrig::Json::normalize(double value, bool zero)
|
||||
|
||||
bool xmrig::JsonReader::isEmpty() const
|
||||
{
|
||||
return !m_obj.IsObject() || m_obj.ObjectEmpty();
|
||||
return Json::isEmpty(m_obj);
|
||||
}
|
||||
|
@ -5,8 +5,8 @@
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -37,6 +37,7 @@ class Json
|
||||
{
|
||||
public:
|
||||
static bool getBool(const rapidjson::Value &obj, const char *key, bool defaultValue = false);
|
||||
static bool isEmpty(const rapidjson::Value &obj);
|
||||
static const char *getString(const rapidjson::Value &obj, const char *key, const char *defaultValue = nullptr);
|
||||
static const rapidjson::Value &getArray(const rapidjson::Value &obj, const char *key);
|
||||
static const rapidjson::Value &getObject(const rapidjson::Value &obj, const char *key);
|
||||
|
@ -27,9 +27,10 @@
|
||||
#include <cstdio>
|
||||
|
||||
|
||||
#include "base/tools/Handle.h"
|
||||
#include "base/io/log/backends/ConsoleLog.h"
|
||||
#include "base/tools/Handle.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
xmrig::ConsoleLog::ConsoleLog()
|
||||
@ -48,7 +49,7 @@ xmrig::ConsoleLog::ConsoleLog()
|
||||
|
||||
uv_tty_set_mode(m_tty, UV_TTY_MODE_NORMAL);
|
||||
|
||||
# ifdef WIN32
|
||||
# ifdef XMRIG_OS_WIN
|
||||
m_stream = reinterpret_cast<uv_stream_t*>(m_tty);
|
||||
|
||||
HANDLE handle = GetStdHandle(STD_INPUT_HANDLE);
|
||||
@ -59,6 +60,8 @@ xmrig::ConsoleLog::ConsoleLog()
|
||||
SetConsoleMode(handle, mode | ENABLE_EXTENDED_FLAGS);
|
||||
}
|
||||
}
|
||||
|
||||
SetConsoleTitleA(APP_NAME " " APP_VERSION);
|
||||
# endif
|
||||
}
|
||||
|
||||
@ -75,7 +78,7 @@ void xmrig::ConsoleLog::print(int, const char *line, size_t, size_t size, bool c
|
||||
return;
|
||||
}
|
||||
|
||||
# ifdef _WIN32
|
||||
# ifdef XMRIG_OS_WIN
|
||||
uv_buf_t buf = uv_buf_init(const_cast<char *>(line), static_cast<unsigned int>(size));
|
||||
|
||||
if (!isWritable()) {
|
||||
@ -99,7 +102,7 @@ bool xmrig::ConsoleLog::isSupported() const
|
||||
}
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef XMRIG_OS_WIN
|
||||
bool xmrig::ConsoleLog::isWritable() const
|
||||
{
|
||||
if (!m_stream || uv_is_writable(m_stream) != 1) {
|
||||
|
@ -54,7 +54,7 @@ private:
|
||||
|
||||
uv_tty_t *m_tty = nullptr;
|
||||
|
||||
# ifdef _WIN32
|
||||
# ifdef XMRIG_OS_WIN
|
||||
bool isWritable() const;
|
||||
|
||||
uv_stream_t *m_stream = nullptr;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user