]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: cpuset: switch to sched_setaffinity for FreeBSD 14 and above.
authorDavid CARLIER <devnexen@gmail.com>
Thu, 6 Jan 2022 18:53:50 +0000 (18:53 +0000)
committerWilly Tarreau <w@1wt.eu>
Fri, 7 Jan 2022 05:53:51 +0000 (06:53 +0100)
Following up previous update on cpuset-t.h. Ultimately, at some point
 the cpuset_setaffinity code path could be removed.

src/haproxy.c

index ba91d34fe1707f33d0cabebdddbcd35e847ebe9a..cdd1ae8342763e9560c58a54bb8f14668d70deec 100644 (file)
@@ -3233,12 +3233,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 */
 
-#ifdef __FreeBSD__
-                       struct hap_cpuset *set = &cpu_map.proc;
-                       ret = cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, sizeof(set->cpuset), &set->cpuset);
-#elif defined(__linux__) || defined(__DragonFly__)
                        struct hap_cpuset *set = &cpu_map.proc;
+#if defined(CPUSET_USE_CPUSET) || defined(__DragonFly__)
                        sched_setaffinity(0, sizeof(set->cpuset), &set->cpuset);
+#elif defined(__FreeBSD__)
+                       ret = cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, sizeof(set->cpuset), &set->cpuset);
 #endif
                }
 #endif