]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix build on openbsd 7.0 (#929)
authorFrancesco Chemolli <kinkie@squid-cache.org>
Wed, 10 Nov 2021 19:07:44 +0000 (19:07 +0000)
committerAmos Jeffries <yadij@users.noreply.github.com>
Tue, 8 Feb 2022 18:41:44 +0000 (07:41 +1300)
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.

compat/cpu.h
src/cache_cf.cc
src/comm.cc
test-suite/buildtest.sh

index 867324f10e826456ec47eb2ed3c7a0757350db39..32dfd98dc6b0ac45f7293385efa7f77b9b138db5 100644 (file)
@@ -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
index 3e575d45f6a33a8e5332e0886212815bce71b9cd..cb746dc93c9a337dbfbe3c6cb8735ba83d1630a4 100644 (file)
@@ -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();
index a0913f3245a68a1fd89d2845bbb12f1ec158bcd0..b4818f3e7735a852e8ca8ade2d7f5d8f0307b763 100644 (file)
@@ -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
 }
 
index e0951b1ae146c4db61db749ae96ff4fc046c1c56..3e050961f140db4e09348b3cac6b85dd9da83c72 100755 (executable)
@@ -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.