]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: cpuset: fix build issue on macos introduced by previous change
authorDavid CARLIER <devnexen@gmail.com>
Sat, 8 Jan 2022 09:59:38 +0000 (09:59 +0000)
committerWilly Tarreau <w@1wt.eu>
Tue, 11 Jan 2022 14:09:49 +0000 (15:09 +0100)
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.

src/haproxy.c

index 17108b52f934a47501bf7cc772840e7f6c2c7da3..67ce74ea1130b099f9ba11d9284e2198718d0dca 100644 (file)
@@ -3238,10 +3238,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
                }