Make CpuAffinitySet::applied() method non-const. According to CPU_SET(3) and, apparently, on some systems (e.g., OpenSuSE 10.3) CPU_COUNT macro expects a non-const argument. The patch fixes build error on these systems. === modified file 'src/CpuAffinitySet.cc' --- src/CpuAffinitySet.cc 2012-08-28 13:00:30 +0000 +++ src/CpuAffinitySet.cc 2012-08-30 07:08:15 +0000 @@ -50,30 +50,30 @@ CpuAffinitySet::apply() success = true; } if (!success) CPU_ZERO(&theOrigCpuSet); } void CpuAffinitySet::undo() { if (applied()) { if (sched_setaffinity(0, sizeof(theOrigCpuSet), &theOrigCpuSet)) { debugs(54, DBG_IMPORTANT, "ERROR: failed to restore original CPU " "affinity for process PID " << getpid() << ": " << xstrerror()); } CPU_ZERO(&theOrigCpuSet); } } bool -CpuAffinitySet::applied() const +CpuAffinitySet::applied() { return (CPU_COUNT(&theOrigCpuSet) > 0); } void CpuAffinitySet::set(const cpu_set_t &aCpuSet) { memcpy(&theCpuSet, &aCpuSet, sizeof(theCpuSet)); } === modified file 'src/CpuAffinitySet.h' --- src/CpuAffinitySet.h 2010-11-21 04:40:05 +0000 +++ src/CpuAffinitySet.h 2012-08-30 07:07:36 +0000 @@ -4,31 +4,31 @@ */ #ifndef SQUID_CPU_AFFINITY_SET_H #define SQUID_CPU_AFFINITY_SET_H #include "compat/cpu.h" /// cpu affinity management for a single process class CpuAffinitySet { public: CpuAffinitySet(); /// set CPU affinity for this process void apply(); /// undo CPU affinity changes for this process void undo(); /// whether apply() was called and was not undone - bool applied() const; + bool applied(); /// set CPU affinity mask void set(const cpu_set_t &aCpuSet); private: cpu_set_t theCpuSet; ///< configured CPU affinity for this process cpu_set_t theOrigCpuSet; ///< CPU affinity for this process before apply() }; #endif // SQUID_CPU_AFFINITY_SET_H