MINOR: cpuset: add ha_cpuset_or() to bitwise-OR two CPU sets

This operation was not implemented and will be needed later.
This commit is contained in:
Willy Tarreau 2023-07-12 12:08:36 +02:00
parent f2af7a5d20
commit 69d2ff7078
2 changed files with 17 additions and 0 deletions

View File

@ -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 <src> and <dst> stored in <dst>.
*/
void ha_cpuset_or(struct hap_cpuset *dst, struct hap_cpuset *src);
/* returns non-zero if CPU index <cpu> is set in <set>, otherwise 0. */
int ha_cpuset_isset(const struct hap_cpuset *set, int cpu);

View File

@ -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())