BUG/MINOR: cpuset: fix compilation on platform without cpu affinity

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
This commit is contained in:
Amaury Denoyelle 2021-04-23 16:58:08 +02:00
parent c5ed1f9d87
commit a6f9c5d2a7
4 changed files with 17 additions and 5 deletions

View 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>

View 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>

View 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>

View 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)) {