From: Francesco Chemolli Date: Wed, 10 Nov 2021 19:07:44 +0000 (+0000) Subject: Fix build on openbsd 7.0 (#929) X-Git-Tag: SQUID_5_4_1~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=700de16195952cb5c48f520c92c1c7e48c4cf7ae;p=thirdparty%2Fsquid.git Fix build on openbsd 7.0 (#929) OpenBSD doesn't offer CPU_SET and CPU_ISSET. Implement their stubs as inline functions to give the compiler proper hints about arguments (non) use. Update buildtest.sh to try and use relative paths first. This prevents autoconf complaining and failing if the directory path includes characters from an unsafe set. --- diff --git a/compat/cpu.h b/compat/cpu.h index 867324f10e..32dfd98dc6 100644 --- a/compat/cpu.h +++ b/compat/cpu.h @@ -36,7 +36,8 @@ inline int sched_getaffinity(int, size_t, cpu_set_t *) { return ENOTSUP; } #endif #if !defined(CPU_SET) -#define CPU_SET(cpu, set) (void)0 +#define CPU_SET(cpunum, cpuset) CpuSet(cpunum, cpuset) +inline void CpuSet(int, const cpu_set_t *) {} #endif #if !defined(CPU_CLR) @@ -44,7 +45,8 @@ inline int sched_getaffinity(int, size_t, cpu_set_t *) { return ENOTSUP; } #endif #if !defined(CPU_ISSET) -#define CPU_ISSET(cpu, set) false +#define CPU_ISSET(cpunum, cpuset) CpuIsSet(cpunum, cpuset) +inline bool CpuIsSet(int, const cpu_set_t *) { return false; } #endif // glibc prior to 2.6 lacks CPU_COUNT diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 3e575d45f6..cb746dc93c 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -4361,6 +4361,7 @@ static void parse_CpuAffinityMap(CpuAffinityMap **const cpuAffinityMap) { #if !HAVE_CPU_AFFINITY + (void)cpuAffinityMap; debugs(3, DBG_CRITICAL, "FATAL: Squid built with no CPU affinity " << "support, do not set 'cpu_affinity_map'"); self_destruct(); diff --git a/src/comm.cc b/src/comm.cc index a0913f3245..b4818f3e77 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -112,6 +112,8 @@ comm_empty_os_read_buffers(int fd) if (fd_table[fd].flags.nonblocking && fd_table[fd].type != FD_MSGHDR) { while (FD_READ_METHOD(fd, buf, SQUID_TCP_SO_RCVBUF) > 0) {}; } +#else + (void)fd; #endif } diff --git a/test-suite/buildtest.sh b/test-suite/buildtest.sh index e0951b1ae1..3e050961f1 100755 --- a/test-suite/buildtest.sh +++ b/test-suite/buildtest.sh @@ -15,7 +15,6 @@ action="${1}" config="${2}" -base="`dirname ${0}`" # cache_file may be set by environment variable configcache="" @@ -66,9 +65,17 @@ fi # do not build any of the install's ... # # eval is need to correctly handle quoted arguments - eval "$base/../configure ${DISTCHECK_CONFIGURE_FLAGS} ${configcache}" \ - 2>&1 && \ - ${MAKE:-make} ${pjobs} ${MAKETEST} 2>&1 +if test -x "../configure" ; then + base="." +else + base="`dirname ${0}`" +fi + +echo "PWD: $PWD" +echo "$base/../configure ${DISTCHECK_CONFIGURE_FLAGS} ${configcache} ..." +eval "$base/../configure ${DISTCHECK_CONFIGURE_FLAGS} ${configcache}" \ + 2>&1 && \ + ${MAKE:-make} ${pjobs} ${MAKETEST} 2>&1 # Remember and then explicitly return the result of the last command # to the script caller. Probably not needed on most or all platforms.