]> 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)
committerSquid Anubis <squid-anubis@squid-cache.org>
Thu, 11 Nov 2021 08:00:23 +0000 (08:00 +0000)
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.

We have a const-correctness bug in std::unordered_map when supplying an
allocator that OpenBSD is strict about. Fix it.

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/base/ClpMap.h
src/cache_cf.cc
src/comm.cc
src/log/access_log.cc
test-suite/buildtest.sh

index 77ae00def6c6ce211b7a0372525a4cfd68acea8c..730d8079f09c260ab2dd7938ef8b6168f51d236e 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 046bf7775f6e89d025c7c91001f9abc167cee82e..12be45cad691ecba9c840c43026eb27373d553af 100644 (file)
@@ -105,7 +105,7 @@ private:
     using Entries = std::list<Entry, PoolingAllocator<Entry> >;
     using EntriesIterator = typename Entries::iterator;
 
-    using IndexItem = std::pair<Key, EntriesIterator>;
+    using IndexItem = std::pair<const Key, EntriesIterator>;
     /// key:entry_position mapping for fast entry lookups by key
     using Index = std::unordered_map<Key, EntriesIterator, std::hash<Key>, std::equal_to<Key>, PoolingAllocator<IndexItem> >;
     using IndexIterator = typename Index::iterator;
index afd58f42daae659560036672eda646b40029e7f6..175c7aa169276347448060230455f33331b63e78 100644 (file)
@@ -4149,6 +4149,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 49d1dcd1efdbafca3d9085f91930ff9fd8d33c84..8b7f0147b0c341c33a2c4571833414ec2c378baa 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 8b811da318c150cf2e0f953c2a8b70f1ba664600..2dca36b8eaa15fd0ccc14386b9d8fd1b4f7f4100 100644 (file)
@@ -57,7 +57,7 @@ static void mcast_encode(unsigned int *, size_t, const unsigned int *);
 
 #if USE_FORW_VIA_DB
 
-using HeaderValueCountsElement = std::pair<SBuf, uint64_t>;
+using HeaderValueCountsElement = std::pair<const SBuf, uint64_t>;
 /// counts the number of header field value occurrences
 using HeaderValueCounts = std::unordered_map<SBuf, uint64_t, std::hash<SBuf>, std::equal_to<SBuf>, PoolingAllocator<HeaderValueCountsElement> >;
 
index 15c039756ef67da6be88b2b47f932c4bf212eae9..343e37c1cbeeff9af3ef5670ff5af6930bf155ef 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.