]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: cpuset: fix cpuset size for FreeBSD
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 15 Oct 2021 13:22:31 +0000 (15:22 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 15 Oct 2021 15:16:11 +0000 (17:16 +0200)
Fix the macro used to retrieve the max number of cpus on FreeBSD. The
MAXCPU is not properly defined in userspace and always set to 1 despite
the machine architecture. Replace it with CPU_SETSIZE.

See https://freebsd-hackers.freebsd.narkive.com/gw4BeLum/smp-in-machine-params-h#post6

Without this, the following config file is rejected on FreeBSD even if
the machine is SMP :
  global
    cpu-map 1-2 0-1

This must be backported up to 2.4.

src/cpuset.c

index 46e572dab75a50f90aff1250320804812781e7c8..c1632c5e46c0fb487cc287e15c99c960bd9ba6fd 100644 (file)
@@ -110,12 +110,9 @@ void ha_cpuset_assign(struct hap_cpuset *dst, const struct hap_cpuset *src)
 
 int ha_cpuset_size()
 {
-#if defined(CPUSET_USE_CPUSET)
+#if defined(CPUSET_USE_CPUSET) || defined(CPUSET_USE_FREEBSD_CPUSET)
        return CPU_SETSIZE;
 
-#elif defined(CPUSET_USE_FREEBSD_CPUSET)
-       return MAXCPU;
-
 #elif defined(CPUSET_USE_ULONG)
        return LONGBITS;