From 0081cb4570997ef8ce5f054769f2587d4ad96bda Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Sat, 8 Jan 2022 09:59:38 +0000 Subject: [PATCH] BUILD: cpuset: fix build issue on macos introduced by previous change The build on macos was broken by recent commit df91cbd58 ("MINOR: cpuset: switch to sched_setaffinity for FreeBSD 14 and above."), let's move the variable declaration inside the ifdef. (cherry picked from commit bb10dad5a8321ecc437ef637385ee3a0e7c09747) Signed-off-by: Christopher Faulet --- src/haproxy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/haproxy.c b/src/haproxy.c index b8ca2b1..16aaf46 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -3267,10 +3267,11 @@ int main(int argc, char **argv) #ifdef USE_CPU_AFFINITY if (!in_parent && ha_cpuset_count(&cpu_map.proc)) { /* only do this if the process has a CPU map */ - struct hap_cpuset *set = &cpu_map.proc; #if defined(CPUSET_USE_CPUSET) || defined(__DragonFly__) + struct hap_cpuset *set = &cpu_map.proc; sched_setaffinity(0, sizeof(set->cpuset), &set->cpuset); #elif defined(__FreeBSD__) + struct hap_cpuset *set = &cpu_map.proc; ret = cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, sizeof(set->cpuset), &set->cpuset); #endif } -- 1.7.10.4