]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix FreeBSD 14 build (#975)
authorDavid CARLIER <devnexen@gmail.com>
Mon, 7 Feb 2022 00:35:28 +0000 (00:35 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Mon, 7 Feb 2022 13:52:00 +0000 (13:52 +0000)
FreeBSD 14 defines 3-parameter CPU_AND() macro as a `do {} while` loop.
Our (void) in front of that loop creates a syntax error.

    CpuAffinitySet.cc:41:16: error: expected expression
    (void) CPU_AND(&cpuSet, &cpuSet, &theOrigCpuSet);

That (void) was added in commit 7ec6d51 to "remove GNU-specific syntax",
but we cannot tell what specific problem that 10-year old change solved.
Known 3-parameter CPU_AND(3) documentation says the call returns void.

Also included a missing header providing IPPROTO_TCP definition.

src/CpuAffinitySet.cc
src/comm/Tcp.cc

index 96f9faf37f855f7f3c1205784ca148fcb4eb9ae3..2d74d012b8b4cbae410e7badd861af40f9e754df 100644 (file)
@@ -38,7 +38,7 @@ CpuAffinitySet::apply()
     } else {
         cpu_set_t cpuSet;
         memcpy(&cpuSet, &theCpuSet, sizeof(cpuSet));
-        (void) CPU_AND(&cpuSet, &cpuSet, &theOrigCpuSet);
+        CPU_AND(&cpuSet, &cpuSet, &theOrigCpuSet);
         if (CPU_COUNT(&cpuSet) <= 0) {
             debugs(54, DBG_IMPORTANT, "ERROR: invalid CPU affinity for process "
                    "PID " << getpid() << ", may be caused by an invalid core in "
index a0d450f020376627ab3301a8ee7492b917425676..9c2e3500ec1f4329aad39b04d7cac9e293e03e2c 100644 (file)
@@ -15,6 +15,9 @@
 #if HAVE_NETINET_TCP_H
 #include <netinet/tcp.h>
 #endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
 #if HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif