DragonflyBSD compilation fixes

This commit is contained in:
SChernykh 2022-12-17 12:14:28 +01:00
parent 2ea37cdf37
commit 7d4d48e83b
5 changed files with 38 additions and 17 deletions

View file

@ -16,10 +16,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#if defined(__FreeBSD__) || defined(__DragonFly__)
#ifdef XMRIG_OS_FREEBSD
# include <sys/types.h>
# include <sys/param.h>
# include <sys/cpuset.h>
# ifndef __DragonFly__
# include <sys/cpuset.h>
# endif
# include <pthread_np.h>
#endif
@ -41,11 +43,6 @@
#include "version.h"
#if defined(__FreeBSD__) || defined(__DragonFly__)
typedef cpuset_t cpu_set_t;
#endif
char *xmrig::Platform::createUserAgent()
{
constexpr const size_t max = 256;
@ -74,6 +71,19 @@ char *xmrig::Platform::createUserAgent()
#ifndef XMRIG_FEATURE_HWLOC
#ifdef __DragonFly__
bool xmrig::Platform::setThreadAffinity(uint64_t cpu_id)
{
return true;
}
#else
#ifdef XMRIG_OS_FREEBSD
typedef cpuset_t cpu_set_t;
#endif
bool xmrig::Platform::setThreadAffinity(uint64_t cpu_id)
{
cpu_set_t mn;
@ -89,7 +99,9 @@ bool xmrig::Platform::setThreadAffinity(uint64_t cpu_id)
std::this_thread::sleep_for(std::chrono::milliseconds(1));
return result;
}
#endif
#endif // __DragonFly__
#endif // XMRIG_FEATURE_HWLOC
void xmrig::Platform::setProcessPriority(int)