]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: cpuset: add ha_cpuset_or() to bitwise-OR two CPU sets
authorWilly Tarreau <w@1wt.eu>
Wed, 12 Jul 2023 10:08:36 +0000 (12:08 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 4 Sep 2023 17:39:17 +0000 (19:39 +0200)
This operation was not implemented and will be needed later.

include/haproxy/cpuset.h
src/cpuset.c

index dd1043ef556876a6f792b4c3a41b9581f31d5964..2d1b5d37598e8718bd7bdfd4cfd25694189907fc 100644 (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);
 
index b89433a4d034039471655bd6eb6ee010bad4eaf5..42daca463a4d3607f4fb4422b49cc8e7a49c5776 100644 (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())