]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: cpuset: fix compilation on platform without cpu affinity
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 23 Apr 2021 14:58:08 +0000 (16:58 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 23 Apr 2021 15:04:24 +0000 (17:04 +0200)
The compilation is currently broken on platform without USE_CPU_AFFINITY
set. An error has been reported by the cygwin build of the CI.

This does not need to be backported.

In file included from include/haproxy/global-t.h:27,
                 from include/haproxy/global.h:26,
                 from include/haproxy/fd.h:33,
                 from src/ev_poll.c:22:
include/haproxy/cpuset-t.h:32:3: error: #error "No cpuset support implemented on this platform"
   32 | # error "No cpuset support implemented on this platform"
      |   ^~~~~
include/haproxy/cpuset-t.h:37:2: error: unknown type name ‘CPUSET_REPR’
   37 |  CPUSET_REPR cpuset;
      |  ^~~~~~~~~~~
make: *** [Makefile:944: src/ev_poll.o] Error 1
make: *** Waiting for unfinished jobs....
In file included from include/haproxy/global-t.h:27,
                 from include/haproxy/global.h:26,
                 from include/haproxy/fd.h:33,
                 from include/haproxy/connection.h:30,
                 from include/haproxy/ssl_sock.h:27,
                 from src/ssl_sample.c:30:
include/haproxy/cpuset-t.h:32:3: error: #error "No cpuset support implemented on this platform"
   32 | # error "No cpuset support implemented on this platform"
      |   ^~~~~
include/haproxy/cpuset-t.h:37:2: error: unknown type name ‘CPUSET_REPR’
   37 |  CPUSET_REPR cpuset;
      |  ^~~~~~~~~~~
make: *** [Makefile:944: src/ssl_sample.o] Error 1

include/haproxy/global-t.h
src/cfgparse-global.c
src/cfgparse.c
src/haproxy.c

index 03a6a5030937cc183b2626649b8b1b7ab02c08ef..f2cf5ce551547695714e1d792140f2dd72ab84a9 100644 (file)
@@ -24,7 +24,9 @@
 
 #include <haproxy/api-t.h>
 #include <haproxy/buf-t.h>
+#ifdef USE_CPU_AFFINITY
 #include <haproxy/cpuset-t.h>
+#endif
 #include <haproxy/freq_ctr-t.h>
 #include <haproxy/vars-t.h>
 
index 47de32a6b1f3fd951526fb8e3bf49dc86d16ef3f..c653fb49d6612ae4b6866d57d2e3776368cc2d48 100644 (file)
@@ -13,7 +13,9 @@
 
 #include <haproxy/buf.h>
 #include <haproxy/cfgparse.h>
+#ifdef USE_CPU_AFFINITY
 #include <haproxy/cpuset.h>
+#endif
 #include <haproxy/compression.h>
 #include <haproxy/global.h>
 #include <haproxy/log.h>
index 507d072fa3741205dae2a1669dcbb7b1b1b0a38a..f891697a1d2960b418a10aa21a579f01fc659b75 100644 (file)
@@ -44,7 +44,9 @@
 #include <haproxy/channel.h>
 #include <haproxy/check.h>
 #include <haproxy/chunk.h>
+#ifdef USE_CPU_AFFINITY
 #include <haproxy/cpuset.h>
+#endif
 #include <haproxy/connection.h>
 #include <haproxy/errors.h>
 #include <haproxy/filters.h>
index e19b8148a72e8949b1436a3c80de708a9fc15876..cd0edcf097d0ba34b4e35cfc17ef537b1ab36ca3 100644 (file)
@@ -92,7 +92,9 @@
 #include <haproxy/chunk.h>
 #include <haproxy/cli.h>
 #include <haproxy/connection.h>
+#ifdef USE_CPU_AFFINITY
 #include <haproxy/cpuset.h>
+#endif
 #include <haproxy/dns.h>
 #include <haproxy/dynbuf.h>
 #include <haproxy/errors.h>
@@ -1270,7 +1272,6 @@ static void init(int argc, char **argv)
        struct proxy *px;
        struct post_check_fct *pcf;
        int ideal_maxconn;
-       int i;
 
        global.mode = MODE_STARTING;
        old_argv = copy_argv(argc, argv);
@@ -1579,11 +1580,16 @@ static void init(int argc, char **argv)
 
        global.maxsock = 10; /* reserve 10 fds ; will be incremented by socket eaters */
 
-       for (i = 0; i < MAX_PROCS; ++i) {
-               ha_cpuset_zero(&global.cpu_map.proc[i]);
-               ha_cpuset_zero(&global.cpu_map.proc_t1[i]);
-               ha_cpuset_zero(&global.cpu_map.thread[i]);
+#ifdef USE_CPU_AFFINITY
+       {
+               int i;
+               for (i = 0; i < MAX_PROCS; ++i) {
+                       ha_cpuset_zero(&global.cpu_map.proc[i]);
+                       ha_cpuset_zero(&global.cpu_map.proc_t1[i]);
+                       ha_cpuset_zero(&global.cpu_map.thread[i]);
+               }
        }
+#endif
 
        /* in wait mode, we don't try to read the configuration files */
        if (!(global.mode & MODE_MWORKER_WAIT)) {