diff --git a/include/haproxy/cpuset.h b/include/haproxy/cpuset.h index e5e176368..0ff0f5c11 100644 --- a/include/haproxy/cpuset.h +++ b/include/haproxy/cpuset.h @@ -23,6 +23,10 @@ int ha_cpuset_clr(struct hap_cpuset *set, int cpu); */ void ha_cpuset_and(struct hap_cpuset *dst, struct hap_cpuset *src); +/* Bitwise OR equivalent operation between and stored in . + */ +void ha_cpuset_or(struct hap_cpuset *dst, struct hap_cpuset *src); + /* returns non-zero if CPU index is set in , otherwise 0. */ int ha_cpuset_isset(const struct hap_cpuset *set, int cpu); diff --git a/src/cpuset.c b/src/cpuset.c index b6820fe15..acc61f170 100644 --- a/src/cpuset.c +++ b/src/cpuset.c @@ -60,6 +60,19 @@ void ha_cpuset_and(struct hap_cpuset *dst, struct hap_cpuset *src) #endif } +void ha_cpuset_or(struct hap_cpuset *dst, struct hap_cpuset *src) +{ +#if defined(CPUSET_USE_CPUSET) + CPU_OR(&dst->cpuset, &dst->cpuset, &src->cpuset); + +#elif defined(CPUSET_USE_FREEBSD_CPUSET) + CPU_OR(&dst->cpuset, &src->cpuset); + +#elif defined(CPUSET_USE_ULONG) + dst->cpuset |= src->cpuset; +#endif +} + int ha_cpuset_isset(const struct hap_cpuset *set, int cpu) { if (cpu >= ha_cpuset_size())