From: Willy Tarreau Date: Wed, 12 Jul 2023 10:08:36 +0000 (+0200) Subject: MINOR: cpuset: add ha_cpuset_or() to bitwise-OR two CPU sets X-Git-Tag: v2.9-dev5~57 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d3ecc67a01c9021eedc9501e0fbfda1991f377a5;p=thirdparty%2Fhaproxy.git MINOR: cpuset: add ha_cpuset_or() to bitwise-OR two CPU sets This operation was not implemented and will be needed later. --- diff --git a/include/haproxy/cpuset.h b/include/haproxy/cpuset.h index dd1043ef55..2d1b5d3759 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 b89433a4d0..42daca463a 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())