From faf14f5e5a030545ccc3e66f995551427d6c897b Mon Sep 17 00:00:00 2001 From: Admin Date: Wed, 14 Jun 2017 21:13:04 +0300 Subject: [PATCH] Fixes for OS X. --- src/Cpu_mac.cpp | 14 -------------- src/Cpu_unix.cpp | 4 ++++ src/net/Network_mac.cpp | 3 +-- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/Cpu_mac.cpp b/src/Cpu_mac.cpp index 1b7c6b0a..3b6c4400 100644 --- a/src/Cpu_mac.cpp +++ b/src/Cpu_mac.cpp @@ -42,18 +42,4 @@ void Cpu::init() void Cpu::setAffinity(int id, unsigned long mask) { - cpu_set_t set; - CPU_ZERO(&set); - - for (int i = 0; i < m_totalThreads; i++) { - if (mask & (1UL << i)) { - CPU_SET(i, &set); - } - } - - if (id == -1) { - sched_setaffinity(0, sizeof(&set), &set); - } else { - pthread_setaffinity_np(pthread_self(), sizeof(&set), &set); - } } diff --git a/src/Cpu_unix.cpp b/src/Cpu_unix.cpp index 1b7c6b0a..cddf54f1 100644 --- a/src/Cpu_unix.cpp +++ b/src/Cpu_unix.cpp @@ -42,6 +42,10 @@ void Cpu::init() void Cpu::setAffinity(int id, unsigned long mask) { + if (id == -1) { + return; + } + cpu_set_t set; CPU_ZERO(&set); diff --git a/src/net/Network_mac.cpp b/src/net/Network_mac.cpp index 79b58c51..c3c42a3e 100644 --- a/src/net/Network_mac.cpp +++ b/src/net/Network_mac.cpp @@ -24,7 +24,6 @@ #include - #include "net/Network.h" #include "version.h" @@ -34,7 +33,7 @@ char *Network::userAgent() const size_t max = 128; char *buf = static_cast(malloc(max)); - snprintf(buf, max, "%s/%s", APP_NAME, APP_VERSION); + snprintf(buf, max, "%s/%s (Macintosh; Intel Mac OS X) libuv/%s clang/%d.%d.%d", APP_NAME, APP_VERSION, uv_version_string(), __clang_major__, __clang_minor__, __clang_patchlevel__); return buf; }