From: Alex Rousskov Date: Wed, 20 Oct 2010 04:16:57 +0000 (-0600) Subject: Do not zero the destination set in CpuAnd() replacement for CPU_AND() X-Git-Tag: take1~163 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7aba0fdb9e1a77935a4e5ca0cfaedebd285222e7;p=thirdparty%2Fsquid.git Do not zero the destination set in CpuAnd() replacement for CPU_AND() 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. --- diff --git a/compat/cpu.h b/compat/cpu.h index 9e58847b82..cc5530c687 100644 --- a/compat/cpu.h +++ b/compat/cpu.h @@ -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; }