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.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4fff23d9..7a1556d5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -142,6 +142,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/README.md b/README.md
index e58762fb..092edc2a 100644
--- a/README.md
+++ b/README.md
@@ -10,6 +10,7 @@ XMRig is high performance Monero (XMR) / Aeon CPU miner, with the official full
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.
diff --git a/src/Cpu_unix.cpp b/src/Cpu_unix.cpp
index 5d3a6d64..8de98c8c 100644
--- a/src/Cpu_unix.cpp
+++ b/src/Cpu_unix.cpp
@@ -22,6 +22,14 @@
*/
+#ifdef __FreeBSD__
+# include
+# include
+# include
+# include
+#endif
+
+
#include
#include
#include
@@ -31,6 +39,11 @@
#include "Cpu.h"
+#ifdef __FreeBSD__
+typedef cpuset_t cpu_set_t;
+#endif
+
+
void Cpu::init()
{
# ifdef XMRIG_NO_LIBCPUID
@@ -53,7 +66,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 061d50c1..d48c2833 100644
--- a/src/Mem_unix.cpp
+++ b/src/Mem_unix.cpp
@@ -51,10 +51,11 @@ bool Mem::allocate(const Options* options)
# 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..ecccc49e 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
}
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;
}
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;
}
diff --git a/src/version.h b/src/version.h
index 8bfcd89f..4f6ffe7d 100644
--- a/src/version.h
+++ b/src/version.h
@@ -33,8 +33,7 @@
#define APP_NAME "XMRig"
#define APP_DESC "XMRig CPU miner"
#endif
-
-#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"
@@ -42,7 +41,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