From f9202c6951f63bec3d00536e9b419ae0bc722f91 Mon Sep 17 00:00:00 2001 From: XMRig Date: Tue, 10 Oct 2017 16:31:19 +0300 Subject: [PATCH 1/7] #147 Fixed comparability with monero-stratum. --- src/net/JobId.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/net/JobId.h b/src/net/JobId.h index e68b3953..06189779 100644 --- a/src/net/JobId.h +++ b/src/net/JobId.h @@ -63,7 +63,7 @@ public: } const size_t size = strlen(id); - if (size < 4 || size >= sizeof(m_data)) { + if (size >= sizeof(m_data)) { return false; } From 4138d4a178f7b65da1c6b71a9dba14165aeb39c8 Mon Sep 17 00:00:00 2001 From: xmrig Date: Thu, 12 Oct 2017 22:40:20 +0300 Subject: [PATCH 2/7] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e6648bc5..311f8ca3 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ XMRig is high performance Monero (XMR) CPU miner, with the official full Windows Originally based on cpuminer-multi with heavy optimizations/rewrites and removing a lot of legacy code, since version 1.0.0 complete rewritten from scratch on C++. * This is the CPU-mining version, there is also a [NVIDIA GPU version](https://github.com/xmrig/xmrig-nvidia). +* [Roadmap](https://github.com/xmrig/xmrig/issues/106) for next releases. From 7e4d0d83ff45a4909a7b8731f93a03603fbe0c9f Mon Sep 17 00:00:00 2001 From: xmrig Date: Sun, 15 Oct 2017 03:42:45 +0300 Subject: [PATCH 3/7] Update CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 090b4363..aa1f8cf2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# v2.4.1 + - [#147](https://github.com/xmrig/xmrig/issues/147) Fixed comparability with monero-stratum. + # v2.4.0 - Added [HTTP API](https://github.com/xmrig/xmrig/wiki/API). - Added comments support in config file. From bea3bc74b2f53af187045047314c4d6c6e5b55f6 Mon Sep 17 00:00:00 2001 From: XMRig Date: Sun, 15 Oct 2017 04:52:00 +0300 Subject: [PATCH 4/7] v2.4.1. --- src/version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/version.h b/src/version.h index 7f80dea0..76f61596 100644 --- a/src/version.h +++ b/src/version.h @@ -27,7 +27,7 @@ #define APP_ID "xmrig" #define APP_NAME "XMRig" #define APP_DESC "XMRig CPU miner" -#define APP_VERSION "2.4.0" +#define APP_VERSION "2.4.1" #define APP_DOMAIN "xmrig.com" #define APP_SITE "www.xmrig.com" #define APP_COPYRIGHT "Copyright (C) 2016-2017 xmrig.com" @@ -35,7 +35,7 @@ #define APP_VER_MAJOR 2 #define APP_VER_MINOR 4 -#define APP_VER_BUILD 0 +#define APP_VER_BUILD 1 #define APP_VER_REV 0 #ifdef _MSC_VER From 1af1ba6b5fe4b3f65afec903dd80b6dfd5f07225 Mon Sep 17 00:00:00 2001 From: XMRig Date: Mon, 16 Oct 2017 01:26:55 +0300 Subject: [PATCH 5/7] #153 Force reconnect when duplicated job received. --- src/net/Client.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/net/Client.cpp b/src/net/Client.cpp index dfe202a4..c6d683a2 100644 --- a/src/net/Client.cpp +++ b/src/net/Client.cpp @@ -220,7 +220,8 @@ bool Client::parseJob(const rapidjson::Value ¶ms, int *code) } if (m_job == job) { - LOG_WARN("[%s:%u] duplicate job received, ignore", m_url.host(), m_url.port()); + LOG_WARN("[%s:%u] duplicate job received, reconnect", m_url.host(), m_url.port()); + close(); return false; } From 9c0fe7310242b84fe33af56a2493603f5324296c Mon Sep 17 00:00:00 2001 From: vcambur Date: Fri, 20 Oct 2017 08:41:08 +0000 Subject: [PATCH 6/7] Some FreeBSD fixes --- CMakeLists.txt | 8 ++++++++ src/Cpu_unix.cpp | 13 +++++++++++-- src/Mem_unix.cpp | 3 ++- src/Platform_unix.cpp | 3 ++- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 73c4421b..f0d81e2f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -122,6 +122,14 @@ elseif (APPLE) src/Mem_unix.cpp src/Platform_mac.cpp ) +elseif (CMAKE_SYSTEM_NAME STREQUAL FreeBSD) + set(SOURCES_OS + src/App_unix.cpp + src/Cpu_unix.cpp + src/Mem_unix.cpp + src/Platform_unix.cpp + ) +set(EXTRA_LIBS pthread kvm) else() set(SOURCES_OS src/App_unix.cpp diff --git a/src/Cpu_unix.cpp b/src/Cpu_unix.cpp index 5d3a6d64..ca1225df 100644 --- a/src/Cpu_unix.cpp +++ b/src/Cpu_unix.cpp @@ -20,8 +20,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - - +#ifdef __FreeBSD__ +#include +#include +#include +#include +#endif #include #include #include @@ -30,6 +34,9 @@ #include "Cpu.h" +#ifdef __FreeBSD__ +typedef cpuset_t cpu_set_t; +#endif void Cpu::init() { @@ -53,7 +60,9 @@ void Cpu::setAffinity(int id, uint64_t mask) } if (id == -1) { + #ifndef __FreeBSD__ sched_setaffinity(0, sizeof(&set), &set); + #endif } else { pthread_setaffinity_np(pthread_self(), sizeof(&set), &set); } diff --git a/src/Mem_unix.cpp b/src/Mem_unix.cpp index 7c41fd16..2cb14bc9 100644 --- a/src/Mem_unix.cpp +++ b/src/Mem_unix.cpp @@ -51,10 +51,11 @@ bool Mem::allocate(int algo, int threads, bool doubleHash, bool enabled) # if defined(__APPLE__) m_memory = static_cast(mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, VM_FLAGS_SUPERPAGE_SIZE_2MB, 0)); +# elif defined(__FreeBSD__) + m_memory = static_cast(mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_ALIGNED_SUPER | MAP_PREFAULT_READ, -1, 0)); # else m_memory = static_cast(mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB | MAP_POPULATE, 0, 0)); # endif - if (m_memory == MAP_FAILED) { m_memory = static_cast(_mm_malloc(size, 16)); return true; diff --git a/src/Platform_unix.cpp b/src/Platform_unix.cpp index 27d8de37..b6d16d6f 100644 --- a/src/Platform_unix.cpp +++ b/src/Platform_unix.cpp @@ -21,7 +21,6 @@ * along with this program. If not, see . */ - #include #include #include @@ -116,6 +115,7 @@ void Platform::setThreadPriority(int priority) setpriority(PRIO_PROCESS, 0, prio); +#ifdef SCHED_IDLE if (priority == 0) { sched_param param; param.sched_priority = 0; @@ -124,4 +124,5 @@ void Platform::setThreadPriority(int priority) sched_setscheduler(0, SCHED_BATCH, ¶m); } } +#endif } From 10df3ec227e253b3799d4420c42ac04a08244faf Mon Sep 17 00:00:00 2001 From: XMRig Date: Fri, 20 Oct 2017 19:54:18 +0300 Subject: [PATCH 7/7] Code style fixes for FreeBSD support pull request. --- CMakeLists.txt | 12 ++++-------- src/Cpu_unix.cpp | 18 ++++++++++++------ src/Platform_unix.cpp | 4 ++-- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f0d81e2f..7e102fc5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -122,14 +122,6 @@ elseif (APPLE) src/Mem_unix.cpp src/Platform_mac.cpp ) -elseif (CMAKE_SYSTEM_NAME STREQUAL FreeBSD) - set(SOURCES_OS - src/App_unix.cpp - src/Cpu_unix.cpp - src/Mem_unix.cpp - src/Platform_unix.cpp - ) -set(EXTRA_LIBS pthread kvm) else() set(SOURCES_OS src/App_unix.cpp @@ -141,6 +133,10 @@ else() set(EXTRA_LIBS pthread) endif() +if (CMAKE_SYSTEM_NAME STREQUAL FreeBSD) + set(EXTRA_LIBS ${EXTRA_LIBS} kvm) +endif() + add_definitions(/D__STDC_FORMAT_MACROS) add_definitions(/DUNICODE) add_definitions(/DRAPIDJSON_SSE2) diff --git a/src/Cpu_unix.cpp b/src/Cpu_unix.cpp index ca1225df..8de98c8c 100644 --- a/src/Cpu_unix.cpp +++ b/src/Cpu_unix.cpp @@ -20,12 +20,16 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + + #ifdef __FreeBSD__ -#include -#include -#include -#include +# include +# include +# include +# include #endif + + #include #include #include @@ -34,10 +38,12 @@ #include "Cpu.h" + #ifdef __FreeBSD__ typedef cpuset_t cpu_set_t; #endif + void Cpu::init() { # ifdef XMRIG_NO_LIBCPUID @@ -60,9 +66,9 @@ void Cpu::setAffinity(int id, uint64_t mask) } if (id == -1) { - #ifndef __FreeBSD__ +# ifndef __FreeBSD__ sched_setaffinity(0, sizeof(&set), &set); - #endif +# endif } else { pthread_setaffinity_np(pthread_self(), sizeof(&set), &set); } diff --git a/src/Platform_unix.cpp b/src/Platform_unix.cpp index b6d16d6f..ecccc49e 100644 --- a/src/Platform_unix.cpp +++ b/src/Platform_unix.cpp @@ -115,7 +115,7 @@ void Platform::setThreadPriority(int priority) setpriority(PRIO_PROCESS, 0, prio); -#ifdef SCHED_IDLE +# ifdef SCHED_IDLE if (priority == 0) { sched_param param; param.sched_priority = 0; @@ -124,5 +124,5 @@ void Platform::setThreadPriority(int priority) sched_setscheduler(0, SCHED_BATCH, ¶m); } } -#endif +# endif }