]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Do not zero the destination set in CpuAnd() replacement for CPU_AND()
authorAlex Rousskov <rousskov@measurement-factory.com>
Wed, 20 Oct 2010 04:16:57 +0000 (22:16 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Wed, 20 Oct 2010 04:16:57 +0000 (22:16 -0600)
because the destination set may be one of the source sets. This fixes

   ERROR: invalid CPU affinity for process PID 17935, may be caused by
   an invalid core in 'cpu_affinity_map' or by external affinity
   restrictions

errors on systems with partial CPU affinity support lacking their own CPU_AND.

based on 3p2-plus r10834.

compat/cpu.h

index 9e58847b82ea197843c5c6f5da16a33edda7ebe9..cc5530c6874de4715c4aedb0194fd3e0eb9d6d5a 100644 (file)
@@ -38,10 +38,11 @@ CpuCount(const cpu_set_t *set)
 inline void
 CpuAnd(cpu_set_t *destset, const cpu_set_t *srcset1, const cpu_set_t *srcset2)
 {
-    CPU_ZERO(destset);
     for (int i = 0; i < CPU_SETSIZE; ++i) {
         if (CPU_ISSET(i, srcset1) && CPU_ISSET(i, srcset2))
             CPU_SET(i, destset);
+        else
+            CPU_CLR(i, destset);
     }
 }
 #endif /* CPU_AND */
@@ -61,6 +62,7 @@ typedef struct {
 #define CPU_AND(destset, srcset1, srcset2) (void)0
 #define CPU_ZERO(set) (void)0
 #define CPU_SET(cpu, set) (void)0
+#define CPU_CLR(cpu, set) (void)0
 inline int sched_setaffinity(int, size_t, cpu_set_t *) { return ENOTSUP; }
 inline int sched_getaffinity(int, size_t, cpu_set_t *) { return ENOTSUP; }