From: Amaury Denoyelle Date: Tue, 27 Apr 2021 14:45:29 +0000 (+0200) Subject: BUG/MEDIUM: cpuset: fix build on MacOS X-Git-Tag: v2.4-dev18~40 X-Git-Url: http://git.haproxy.org/?a=commitdiff_plain;h=8f685c11e0641d478a03422a7e879cdf88333513;p=haproxy-2.5.git BUG/MEDIUM: cpuset: fix build on MacOS The compilation fails due to the following commit: fc6ac53dca8391ba9c32bc716fb61267b475ba71 BUG/MAJOR: fix build on musl with cpu_set_t support The new global variable cpu_map conflicted with a local variable of the same name in the code path for the apple platform when setting the process affinity. This does not need to be backported. --- diff --git a/src/haproxy.c b/src/haproxy.c index 4dcf837..5d3e735 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -3194,13 +3194,13 @@ int main(int argc, char **argv) ha_cpuset_count(&cpu_map.thread[i])) {/* only do this if the thread has a THREAD map */ #if defined(__APPLE__) int j; - unsigned long cpu_map = cpu_map.thread[i].cpuset; + unsigned long set = cpu_map.thread[i].cpuset; - while ((j = ffsl(cpu_map)) > 0) { + while ((j = ffsl(set)) > 0) { thread_affinity_policy_data_t cpu_set = { j - 1 }; thread_port_t mthread = pthread_mach_thread_np(ha_thread_info[i].pthread); thread_policy_set(mthread, THREAD_AFFINITY_POLICY, (thread_policy_t)&cpu_set, 1); - cpu_map &= ~(1UL << (j - 1)); + set &= ~(1UL << (j - 1)); } #else struct hap_cpuset *set = &cpu_map.thread[i];