From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1921) id B1139384D188; Fri, 24 Jun 2022 05:43:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B1139384D188 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Sebastian Huber To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] sys/bitset.h: reduce visibility of BIT_* macros X-Act-Checkin: newlib-cygwin X-Git-Author: =?utf-8?q?Stefan_E=C3=9Fer?= X-Git-Refname: refs/heads/master X-Git-Oldrev: 4ac3ee88c7fbb3ceded25c2f341351f2776f316e X-Git-Newrev: a1071cb178bedabc7095344f72876eaaef7871c2 Message-Id: <20220624054319.B1139384D188@sourceware.org> Date: Fri, 24 Jun 2022 05:43:19 +0000 (GMT) X-BeenThere: newlib-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib GIT logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jun 2022 05:43:19 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3Da1071cb178b= edabc7095344f72876eaaef7871c2 commit a1071cb178bedabc7095344f72876eaaef7871c2 Author: Stefan E=C3=9Fer Date: Sun Dec 5 22:27:33 2021 +0100 sys/bitset.h: reduce visibility of BIT_* macros =20 Add two underscore characters "__" to names of BIT_* and BITSET_* macros to move them to the implementation name space and to prevent a name space pollution due to BIT_* macros in 3rd party programs with conflicting parameter signatures. =20 These prefixed macro names are used in kernel header files to define macros in e.g. sched.h, sys/cpuset.h and sys/domainset.h. =20 If C programs are built with either -D_KERNEL (automatically passed when building a kernel or kernel modules) or -D_WANT_FREENBSD_BITSET (or this macros is defined in the source code before including the bitset macros), then all macros are made visible with their previous names, too. E.g., both __BIT_SET() and BIT_SET() are visible with either of _KERNEL or _WANT_FREEBSD_BITSET defined. =20 The main reason for this change is that some 3rd party sources including sched.h have been found to contain conflicting BIT_* macros. =20 As a work-around, parts of shed.h have been made conditional and depend on _WITH_CPU_SET_T being set when sched.h is included. Ports that expect the full functionality provided by sched.h need to be built with -D_WITH_CPU_SET_T. But this leads to conflicts if BIT_* macros are defined in that program, too. =20 This patch set makes all of sched.h visible again without this parameter being passed and without any name space pollution due to BIT_* macros becoming visible when sched.h is included. =20 This patch set will be backported to the STABLE branches, but ports will need to use -D_WITH_CPU_SET_T as long as there are supported releases that do not contain these patches. =20 Reviewed by: kib, markj MFC after: 1 month Relnotes: yes Differential Revision: https://reviews.freebsd.org/D33235 Diff: --- newlib/libc/sys/rtems/include/sys/_bitset.h | 13 ++- newlib/libc/sys/rtems/include/sys/_cpuset.h | 2 +- newlib/libc/sys/rtems/include/sys/bitset.h | 130 +++++++++++++++++++-----= ---- newlib/libc/sys/rtems/include/sys/cpuset.h | 60 ++++++------- 4 files changed, 127 insertions(+), 78 deletions(-) diff --git a/newlib/libc/sys/rtems/include/sys/_bitset.h b/newlib/libc/sys/= rtems/include/sys/_bitset.h index e54f04cbe..1c167daf3 100644 --- a/newlib/libc/sys/rtems/include/sys/_bitset.h +++ b/newlib/libc/sys/rtems/include/sys/_bitset.h @@ -44,8 +44,8 @@ =20 #define __bitset_words(_s) (__howmany(_s, _BITSET_BITS)) =20 -#define BITSET_DEFINE(t, _s) \ -struct t { \ +#define __BITSET_DEFINE(_t, _s) \ +struct _t { \ long __bits[__bitset_words((_s))]; \ } =20 @@ -55,12 +55,17 @@ struct t { \ * Sadly we cannot declare a bitset struct with '__bits[]', because it's * the only member of the struct and the compiler complains. */ -#define BITSET_DEFINE_VAR(t) BITSET_DEFINE(t, 1) +#define __BITSET_DEFINE_VAR(_t) __BITSET_DEFINE(_t, 1) =20 /* * Define a default type that can be used while manually specifying size * to every call. */ -BITSET_DEFINE(bitset, 1); +__BITSET_DEFINE(bitset, 1); + +#if defined(_KERNEL) || defined(_WANT_FREEBSD_BITSET) +#define BITSET_DEFINE(_t, _s) __BITSET_DEFINE(_t, _s) +#define BITSET_DEFINE_VAR(_t) __BITSET_DEFINE_VAR(_t) +#endif =20 #endif /* !_SYS__BITSET_H_ */ diff --git a/newlib/libc/sys/rtems/include/sys/_cpuset.h b/newlib/libc/sys/= rtems/include/sys/_cpuset.h index dee341665..c6383f363 100644 --- a/newlib/libc/sys/rtems/include/sys/_cpuset.h +++ b/newlib/libc/sys/rtems/include/sys/_cpuset.h @@ -46,7 +46,7 @@ #endif #endif =20 -BITSET_DEFINE(_cpuset, CPU_SETSIZE); +__BITSET_DEFINE(_cpuset, CPU_SETSIZE); typedef struct _cpuset cpuset_t; =20 #endif /* !_SYS__CPUSET_H_ */ diff --git a/newlib/libc/sys/rtems/include/sys/bitset.h b/newlib/libc/sys/r= tems/include/sys/bitset.h index 88cda9dd9..00bdc23f9 100644 --- a/newlib/libc/sys/rtems/include/sys/bitset.h +++ b/newlib/libc/sys/rtems/include/sys/bitset.h @@ -51,36 +51,36 @@ (__constexpr_cond(__bitset_words((_s)) =3D=3D 1) ? \ 0 : ((n) / _BITSET_BITS)) =20 -#define BIT_CLR(_s, n, p) \ +#define __BIT_CLR(_s, n, p) \ ((p)->__bits[__bitset_word(_s, n)] &=3D ~__bitset_mask((_s), (n))) =20 -#define BIT_COPY(_s, f, t) (void)(*(t) =3D *(f)) +#define __BIT_COPY(_s, f, t) (void)(*(t) =3D *(f)) =20 -#define BIT_ISSET(_s, n, p) \ +#define __BIT_ISSET(_s, n, p) \ ((((p)->__bits[__bitset_word(_s, n)] & __bitset_mask((_s), (n))) !=3D 0)) =20 -#define BIT_SET(_s, n, p) \ +#define __BIT_SET(_s, n, p) \ ((p)->__bits[__bitset_word(_s, n)] |=3D __bitset_mask((_s), (n))) =20 -#define BIT_ZERO(_s, p) do { \ +#define __BIT_ZERO(_s, p) do { \ __size_t __i; \ for (__i =3D 0; __i < __bitset_words((_s)); __i++) \ (p)->__bits[__i] =3D 0L; \ } while (0) =20 -#define BIT_FILL(_s, p) do { \ +#define __BIT_FILL(_s, p) do { \ __size_t __i; \ for (__i =3D 0; __i < __bitset_words((_s)); __i++) \ (p)->__bits[__i] =3D -1L; \ } while (0) =20 -#define BIT_SETOF(_s, n, p) do { \ - BIT_ZERO(_s, p); \ +#define __BIT_SETOF(_s, n, p) do { \ + __BIT_ZERO(_s, p); \ (p)->__bits[__bitset_word(_s, n)] =3D __bitset_mask((_s), (n)); \ } while (0) =20 /* Is p empty. */ -#define BIT_EMPTY(_s, p) __extension__ ({ \ +#define __BIT_EMPTY(_s, p) __extension__ ({ \ __size_t __i; \ for (__i =3D 0; __i < __bitset_words((_s)); __i++) \ if ((p)->__bits[__i]) \ @@ -89,7 +89,7 @@ }) =20 /* Is p full set. */ -#define BIT_ISFULLSET(_s, p) __extension__ ({ \ +#define __BIT_ISFULLSET(_s, p) __extension__ ({ \ __size_t __i; \ for (__i =3D 0; __i < __bitset_words((_s)); __i++) \ if ((p)->__bits[__i] !=3D (long)-1) \ @@ -98,7 +98,7 @@ }) =20 /* Is c a subset of p. */ -#define BIT_SUBSET(_s, p, c) __extension__ ({ \ +#define __BIT_SUBSET(_s, p, c) __extension__ ({ \ __size_t __i; \ for (__i =3D 0; __i < __bitset_words((_s)); __i++) \ if (((c)->__bits[__i] & \ @@ -109,7 +109,7 @@ }) =20 /* Are there any common bits between b & c? */ -#define BIT_OVERLAP(_s, p, c) __extension__ ({ \ +#define __BIT_OVERLAP(_s, p, c) __extension__ ({ \ __size_t __i; \ for (__i =3D 0; __i < __bitset_words((_s)); __i++) \ if (((c)->__bits[__i] & \ @@ -119,7 +119,7 @@ }) =20 /* Compare two sets, returns 0 if equal 1 otherwise. */ -#define BIT_CMP(_s, p, c) __extension__ ({ \ +#define __BIT_CMP(_s, p, c) __extension__ ({ \ __size_t __i; \ for (__i =3D 0; __i < __bitset_words((_s)); __i++) \ if (((c)->__bits[__i] !=3D \ @@ -128,49 +128,49 @@ __i !=3D __bitset_words((_s)); \ }) =20 -#define BIT_OR(_s, d, s) do { \ +#define __BIT_OR(_s, d, s) do { \ __size_t __i; \ for (__i =3D 0; __i < __bitset_words((_s)); __i++) \ (d)->__bits[__i] |=3D (s)->__bits[__i]; \ } while (0) =20 -#define BIT_OR2(_s, d, s1, s2) do { \ +#define __BIT_OR2(_s, d, s1, s2) do { \ __size_t __i; \ for (__i =3D 0; __i < __bitset_words((_s)); __i++) \ (d)->__bits[__i] =3D (s1)->__bits[__i] | (s2)->__bits[__i];\ } while (0) =20 -#define BIT_AND(_s, d, s) do { \ +#define __BIT_AND(_s, d, s) do { \ __size_t __i; \ for (__i =3D 0; __i < __bitset_words((_s)); __i++) \ (d)->__bits[__i] &=3D (s)->__bits[__i]; \ } while (0) =20 -#define BIT_AND2(_s, d, s1, s2) do { \ +#define __BIT_AND2(_s, d, s1, s2) do { \ __size_t __i; \ for (__i =3D 0; __i < __bitset_words((_s)); __i++) \ (d)->__bits[__i] =3D (s1)->__bits[__i] & (s2)->__bits[__i];\ } while (0) =20 -#define BIT_ANDNOT(_s, d, s) do { \ +#define __BIT_ANDNOT(_s, d, s) do { \ __size_t __i; \ for (__i =3D 0; __i < __bitset_words((_s)); __i++) \ (d)->__bits[__i] &=3D ~(s)->__bits[__i]; \ } while (0) =20 -#define BIT_ANDNOT2(_s, d, s1, s2) do { \ +#define __BIT_ANDNOT2(_s, d, s1, s2) do { \ __size_t __i; \ for (__i =3D 0; __i < __bitset_words((_s)); __i++) \ (d)->__bits[__i] =3D (s1)->__bits[__i] & ~(s2)->__bits[__i];\ } while (0) =20 -#define BIT_XOR(_s, d, s) do { \ +#define __BIT_XOR(_s, d, s) do { \ __size_t __i; \ for (__i =3D 0; __i < __bitset_words((_s)); __i++) \ (d)->__bits[__i] ^=3D (s)->__bits[__i]; \ } while (0) =20 -#define BIT_XOR2(_s, d, s1, s2) do { \ +#define __BIT_XOR2(_s, d, s1, s2) do { \ __size_t __i; \ for (__i =3D 0; __i < __bitset_words((_s)); __i++) \ (d)->__bits[__i] =3D (s1)->__bits[__i] ^ (s2)->__bits[__i];\ @@ -182,42 +182,42 @@ * or a bit index. */ =20 -#define BIT_CLR_ATOMIC(_s, n, p) \ +#define __BIT_CLR_ATOMIC(_s, n, p) \ atomic_clear_long(&(p)->__bits[__bitset_word(_s, n)], \ __bitset_mask((_s), n)) =20 -#define BIT_SET_ATOMIC(_s, n, p) \ +#define __BIT_SET_ATOMIC(_s, n, p) \ atomic_set_long(&(p)->__bits[__bitset_word(_s, n)], \ __bitset_mask((_s), n)) =20 -#define BIT_SET_ATOMIC_ACQ(_s, n, p) \ +#define __BIT_SET_ATOMIC_ACQ(_s, n, p) \ atomic_set_acq_long(&(p)->__bits[__bitset_word(_s, n)], \ __bitset_mask((_s), n)) =20 -#define BIT_TEST_CLR_ATOMIC(_s, n, p) \ +#define __BIT_TEST_CLR_ATOMIC(_s, n, p) \ (atomic_testandclear_long( \ &(p)->__bits[__bitset_word((_s), (n))], (n)) !=3D 0) =20 -#define BIT_TEST_SET_ATOMIC(_s, n, p) \ +#define __BIT_TEST_SET_ATOMIC(_s, n, p) \ (atomic_testandset_long( \ &(p)->__bits[__bitset_word((_s), (n))], (n)) !=3D 0) =20 /* Convenience functions catering special cases. */ -#define BIT_AND_ATOMIC(_s, d, s) do { \ +#define __BIT_AND_ATOMIC(_s, d, s) do { \ __size_t __i; \ for (__i =3D 0; __i < __bitset_words((_s)); __i++) \ atomic_clear_long(&(d)->__bits[__i], \ ~(s)->__bits[__i]); \ } while (0) =20 -#define BIT_OR_ATOMIC(_s, d, s) do { \ +#define __BIT_OR_ATOMIC(_s, d, s) do { \ __size_t __i; \ for (__i =3D 0; __i < __bitset_words((_s)); __i++) \ atomic_set_long(&(d)->__bits[__i], \ (s)->__bits[__i]); \ } while (0) =20 -#define BIT_COPY_STORE_REL(_s, f, t) do { \ +#define __BIT_COPY_STORE_REL(_s, f, t) do { \ __size_t __i; \ for (__i =3D 0; __i < __bitset_words((_s)); __i++) \ atomic_store_rel_long(&(t)->__bits[__i], \ @@ -225,10 +225,10 @@ } while (0) =20 /* - * Note that `start` and the returned value from BIT_FFS_AT are + * Note that `start` and the returned value from __BIT_FFS_AT are * 1-based bit indices. */ -#define BIT_FFS_AT(_s, p, start) __extension__ ({ \ +#define __BIT_FFS_AT(_s, p, start) __extension__ ({ \ __size_t __i; \ long __bit, __mask; \ \ @@ -247,9 +247,9 @@ __bit; \ }) =20 -#define BIT_FFS(_s, p) BIT_FFS_AT((_s), (p), 0) +#define __BIT_FFS(_s, p) __BIT_FFS_AT((_s), (p), 0) =20 -#define BIT_FLS(_s, p) __extension__ ({ \ +#define __BIT_FLS(_s, p) __extension__ ({ \ __size_t __i; \ long __bit; \ \ @@ -264,7 +264,7 @@ __bit; \ }) =20 -#define BIT_COUNT(_s, p) __extension__ ({ \ +#define __BIT_COUNT(_s, p) __extension__ ({ \ __size_t __i; \ long __count; \ \ @@ -274,7 +274,7 @@ __count; \ }) =20 -#define _BIT_FOREACH_ADVANCE(_s, i, p, op) __extension__ ({ \ +#define __BIT_FOREACH_ADVANCE(_s, i, p, op) __extension__ ({ \ int __found; \ for (;;) { \ if (__bits !=3D 0) { \ @@ -296,24 +296,68 @@ /* * Non-destructively loop over all set or clear bits in the set. */ -#define _BIT_FOREACH(_s, i, p, op) \ +#define __BIT_FOREACH(_s, i, p, op) \ for (long __i =3D -1, __bits =3D 0; \ - _BIT_FOREACH_ADVANCE(_s, i, p, op); ) + __BIT_FOREACH_ADVANCE(_s, i, p, op); ) =20 -#define BIT_FOREACH_ISSET(_s, i, p) _BIT_FOREACH(_s, i, p, ) -#define BIT_FOREACH_ISCLR(_s, i, p) _BIT_FOREACH(_s, i, p, ~) +#define __BIT_FOREACH_ISSET(_s, i, p) __BIT_FOREACH(_s, i, p, ) +#define __BIT_FOREACH_ISCLR(_s, i, p) __BIT_FOREACH(_s, i, p, ~) =20 -#define BITSET_T_INITIALIZER(x) \ +#define __BITSET_T_INITIALIZER(x) \ { .__bits =3D { x } } =20 -#define BITSET_FSET(n) \ +#define __BITSET_FSET(n) \ [ 0 ... ((n) - 1) ] =3D (-1L) =20 -#define BITSET_SIZE(_s) (__bitset_words((_s)) * sizeof(long)) +#define __BITSET_SIZE(_s) (__bitset_words((_s)) * sizeof(long)) =20 /* * Dynamically allocate a bitset. */ -#define BITSET_ALLOC(_s, mt, mf) malloc(BITSET_SIZE((_s)), mt, (mf)) +#define __BITSET_ALLOC(_s, mt, mf) malloc(__BITSET_SIZE((_s)), mt, (mf)) + +#if defined(_KERNEL) || defined(_WANT_FREEBSD_BITSET) +#define BIT_AND(_s, d, s) __BIT_AND(_s, d, s) +#define BIT_AND2(_s, d, s1, s2) __BIT_AND2(_s, d, s1, s2) +#define BIT_ANDNOT(_s, d, s) __BIT_ANDNOT(_s, d, s) +#define BIT_ANDNOT2(_s, d, s1, s2) __BIT_ANDNOT2(_s, d, s1, s2) +#define BIT_AND_ATOMIC(_s, d, s) __BIT_AND_ATOMIC(_s, d, s) +#define BIT_CLR(_s, n, p) __BIT_CLR(_s, n, p) +#define BIT_CLR_ATOMIC(_s, n, p) __BIT_CLR_ATOMIC(_s, n, p) +#define BIT_CMP(_s, p, c) __BIT_CMP(_s, p, c) +#define BIT_COPY(_s, f, t) __BIT_COPY(_s, f, t) +#define BIT_COPY_STORE_REL(_s, f, t) __BIT_COPY_STORE_REL(_s, f, t) +#define BIT_COUNT(_s, p) __BIT_COUNT(_s, p) +#define BIT_EMPTY(_s, p) __BIT_EMPTY(_s, p) +#define BIT_FFS(_s, p) __BIT_FFS(_s, p) +#define BIT_FFS_AT(_s, p, start) __BIT_FFS_AT(_s, p, start) +#define BIT_FILL(_s, p) __BIT_FILL(_s, p) +#define BIT_FLS(_s, p) __BIT_FLS(_s, p) +#define BIT_FOREACH(_s, i, p, op) __BIT_FOREACH(_s, i, p, op) +#define BIT_FOREACH_ADVANCE(_s, i, p, op) __BIT_FOREACH_ADVANCE(_s, i, p, = op) +#define BIT_FOREACH_ISCLR(_s, i, p) __BIT_FOREACH_ISCLR(_s, i, p) +#define BIT_FOREACH_ISSET(_s, i, p) __BIT_FOREACH_ISSET(_s, i, p) +#define BIT_ISFULLSET(_s, p) __BIT_ISFULLSET(_s, p) +#define BIT_ISSET(_s, n, p) __BIT_ISSET(_s, n, p) +#define BIT_OR(_s, d, s) __BIT_OR(_s, d, s) +#define BIT_OR2(_s, d, s1, s2) __BIT_OR2(_s, d, s1, s2) +#define BIT_OR_ATOMIC(_s, d, s) __BIT_OR_ATOMIC(_s, d, s) +#define BIT_OVERLAP(_s, p, c) __BIT_OVERLAP(_s, p, c) +#define BIT_SET(_s, n, p) __BIT_SET(_s, n, p) +#define BIT_SETOF(_s, n, p) __BIT_SETOF(_s, n, p) +#define BIT_SET_ATOMIC(_s, n, p) __BIT_SET_ATOMIC(_s, n, p) +#define BIT_SET_ATOMIC_ACQ(_s, n, p) __BIT_SET_ATOMIC_ACQ(_s, n, p) +#define BIT_SUBSET(_s, p, c) __BIT_SUBSET(_s, p, c) +#define BIT_TEST_CLR_ATOMIC(_s, n, p) __BIT_TEST_CLR_ATOMIC(_s, n, p) +#define BIT_TEST_SET_ATOMIC(_s, n, p) __BIT_TEST_SET_ATOMIC(_s, n, p) +#define BIT_XOR(_s, d, s) __BIT_XOR(_s, d, s) +#define BIT_XOR2(_s, d, s1, s2) __BIT_XOR2(_s, d, s1, s2) +#define BIT_ZERO(_s, p) __BIT_ZERO(_s, p) + +#define BITSET_ALLOC(_s, mt, mf) __BITSET_ALLOC(_s, mt, mf) +#define BITSET_FSET(n) __BITSET_FSET(n) +#define BITSET_SIZE(_s) __BITSET_SIZE(_s) +#define BITSET_T_INITIALIZER(x) __BITSET_T_INITIALIZER(x) +#endif =20 #endif /* !_SYS_BITSET_H_ */ diff --git a/newlib/libc/sys/rtems/include/sys/cpuset.h b/newlib/libc/sys/r= tems/include/sys/cpuset.h index e46090b8a..e24bce30c 100644 --- a/newlib/libc/sys/rtems/include/sys/cpuset.h +++ b/newlib/libc/sys/rtems/include/sys/cpuset.h @@ -50,22 +50,22 @@ =20 #define CPUSETBUFSIZ ((2 + sizeof(long) * 2) * _NCPUWORDS) =20 -#define CPU_SETOF(n, p) BIT_SETOF(CPU_SETSIZE, n, p) -#define CPU_ISFULLSET(p) BIT_ISFULLSET(CPU_SETSIZE, p) -#define CPU_SUBSET(p, c) BIT_SUBSET(CPU_SETSIZE, p, c) -#define CPU_OVERLAP(p, c) BIT_OVERLAP(CPU_SETSIZE, p, c) -#define CPU_CLR_ATOMIC(n, p) BIT_CLR_ATOMIC(CPU_SETSIZE, n, p) -#define CPU_SET_ATOMIC(n, p) BIT_SET_ATOMIC(CPU_SETSIZE, n, p) -#define CPU_SET_ATOMIC_ACQ(n, p) BIT_SET_ATOMIC_ACQ(CPU_SETSIZE, n, p) -#define CPU_AND_ATOMIC(n, p) BIT_AND_ATOMIC(CPU_SETSIZE, n, p) -#define CPU_OR_ATOMIC(d, s) BIT_OR_ATOMIC(CPU_SETSIZE, d, s) -#define CPU_COPY_STORE_REL(f, t) BIT_COPY_STORE_REL(CPU_SETSIZE, f, t) -#define CPU_FFS(p) BIT_FFS(CPU_SETSIZE, p) -#define CPU_FLS(p) BIT_FLS(CPU_SETSIZE, p) -#define CPU_FOREACH_ISSET(i, p) BIT_FOREACH_ISSET(CPU_SETSIZE, i, p) -#define CPU_FOREACH_ISCLR(i, p) BIT_FOREACH_ISCLR(CPU_SETSIZE, i, p) -#define CPUSET_FSET BITSET_FSET(_NCPUWORDS) -#define CPUSET_T_INITIALIZER BITSET_T_INITIALIZER +#define CPU_SETOF(n, p) __BIT_SETOF(CPU_SETSIZE, n, p) +#define CPU_ISFULLSET(p) __BIT_ISFULLSET(CPU_SETSIZE, p) +#define CPU_SUBSET(p, c) __BIT_SUBSET(CPU_SETSIZE, p, c) +#define CPU_OVERLAP(p, c) __BIT_OVERLAP(CPU_SETSIZE, p, c) +#define CPU_CLR_ATOMIC(n, p) __BIT_CLR_ATOMIC(CPU_SETSIZE, n, p) +#define CPU_SET_ATOMIC(n, p) __BIT_SET_ATOMIC(CPU_SETSIZE, n, p) +#define CPU_SET_ATOMIC_ACQ(n, p) __BIT_SET_ATOMIC_ACQ(CPU_SETSIZE, n, p) +#define CPU_AND_ATOMIC(n, p) __BIT_AND_ATOMIC(CPU_SETSIZE, n, p) +#define CPU_OR_ATOMIC(d, s) __BIT_OR_ATOMIC(CPU_SETSIZE, d, s) +#define CPU_COPY_STORE_REL(f, t) __BIT_COPY_STORE_REL(CPU_SETSIZE, f, t) +#define CPU_FFS(p) __BIT_FFS(CPU_SETSIZE, p) +#define CPU_FLS(p) __BIT_FLS(CPU_SETSIZE, p) +#define CPU_FOREACH_ISSET(i, p) __BIT_FOREACH_ISSET(CPU_SETSIZE, i, p) +#define CPU_FOREACH_ISCLR(i, p) __BIT_FOREACH_ISCLR(CPU_SETSIZE, i, p) +#define CPUSET_FSET __BITSET_FSET(_NCPUWORDS) +#define CPUSET_T_INITIALIZER __BITSET_T_INITIALIZER =20 typedef cpuset_t cpu_set_t; =20 @@ -91,7 +91,7 @@ static __inline void CPU_FREE(cpu_set_t *set) =20 static __inline void CPU_ZERO_S(size_t setsize, cpu_set_t *set) { - BIT_ZERO(_cpu_set_bits(setsize), set); + __BIT_ZERO(_cpu_set_bits(setsize), set); } =20 static __inline void CPU_ZERO(cpu_set_t *set) @@ -101,7 +101,7 @@ static __inline void CPU_ZERO(cpu_set_t *set) =20 static __inline void CPU_FILL_S(size_t setsize, cpu_set_t *set) { - BIT_FILL(_cpu_set_bits(setsize), set); + __BIT_FILL(_cpu_set_bits(setsize), set); } =20 static __inline void CPU_FILL(cpu_set_t *set) @@ -111,7 +111,7 @@ static __inline void CPU_FILL(cpu_set_t *set) =20 static __inline void CPU_SET_S(int cpu, size_t setsize, cpu_set_t *set) { - BIT_SET(_cpu_set_bits(setsize), cpu, set); + __BIT_SET(_cpu_set_bits(setsize), cpu, set); } =20 static __inline void CPU_SET(int cpu, cpu_set_t *set) @@ -121,7 +121,7 @@ static __inline void CPU_SET(int cpu, cpu_set_t *set) =20 static __inline void CPU_CLR_S(int cpu, size_t setsize, cpu_set_t *set) { - BIT_CLR(_cpu_set_bits(setsize), cpu, set); + __BIT_CLR(_cpu_set_bits(setsize), cpu, set); } =20 static __inline void CPU_CLR(int cpu, cpu_set_t *set) @@ -131,7 +131,7 @@ static __inline void CPU_CLR(int cpu, cpu_set_t *set) =20 static __inline int CPU_ISSET_S(int cpu, size_t setsize, const cpu_set_t *= set) { - return BIT_ISSET(_cpu_set_bits(setsize), cpu, set); + return __BIT_ISSET(_cpu_set_bits(setsize), cpu, set); } =20 static __inline int CPU_ISSET(int cpu, const cpu_set_t *set) @@ -141,13 +141,13 @@ static __inline int CPU_ISSET(int cpu, const cpu_set_= t *set) =20 static __inline void CPU_COPY(const cpu_set_t *src, cpu_set_t *dest) { - BIT_COPY(_cpu_set_bits(setsize), src, dest); + __BIT_COPY(_cpu_set_bits(setsize), src, dest); } =20 static __inline void CPU_AND_S(size_t setsize, cpu_set_t *destset, const cpu_set_t *srcset1, const cpu_set_t *srcset2) { - BIT_AND2(_cpu_set_bits(setsize), destset, srcset1, srcset2); + __BIT_AND2(_cpu_set_bits(setsize), destset, srcset1, srcset2); } =20 static __inline void CPU_AND(cpu_set_t *destset, const cpu_set_t *srcset1, @@ -159,7 +159,7 @@ static __inline void CPU_AND(cpu_set_t *destset, const = cpu_set_t *srcset1, static __inline void CPU_OR_S(size_t setsize, cpu_set_t *destset, const cpu_set_t *srcset1, const cpu_set_t *srcset2) { - BIT_OR2(_cpu_set_bits(setsize), destset, srcset1, srcset2); + __BIT_OR2(_cpu_set_bits(setsize), destset, srcset1, srcset2); } =20 static __inline void CPU_OR(cpu_set_t *destset, const cpu_set_t *srcset1, @@ -171,7 +171,7 @@ static __inline void CPU_OR(cpu_set_t *destset, const c= pu_set_t *srcset1, static __inline void CPU_XOR_S(size_t setsize, cpu_set_t *destset, const cpu_set_t *srcset1, const cpu_set_t *srcset2) { - BIT_XOR2(_cpu_set_bits(setsize), destset, srcset1, srcset2); + __BIT_XOR2(_cpu_set_bits(setsize), destset, srcset1, srcset2); } =20 static __inline void CPU_XOR(cpu_set_t *destset, const cpu_set_t *srcset1, @@ -183,7 +183,7 @@ static __inline void CPU_XOR(cpu_set_t *destset, const = cpu_set_t *srcset1, static __inline void CPU_ANDNOT_S(size_t setsize, cpu_set_t *destset, const cpu_set_t *srcset1, const cpu_set_t *srcset2) { - BIT_ANDNOT2(_cpu_set_bits(setsize), destset, srcset1, srcset2); + __BIT_ANDNOT2(_cpu_set_bits(setsize), destset, srcset1, srcset2); } =20 static __inline void CPU_ANDNOT(cpu_set_t *destset, const cpu_set_t *srcse= t1, @@ -194,7 +194,7 @@ static __inline void CPU_ANDNOT(cpu_set_t *destset, con= st cpu_set_t *srcset1, =20 static __inline int CPU_COUNT_S(size_t setsize, const cpu_set_t *set) { - return (int)BIT_COUNT(_cpu_set_bits(setsize), set); + return (int)__BIT_COUNT(_cpu_set_bits(setsize), set); } =20 static __inline int CPU_COUNT(const cpu_set_t *set) @@ -205,7 +205,7 @@ static __inline int CPU_COUNT(const cpu_set_t *set) static __inline int CPU_EQUAL_S(size_t setsize, const cpu_set_t *set1, const cpu_set_t *set2) { - return BIT_CMP(_cpu_set_bits(setsize), set1, set2) =3D=3D 0; + return __BIT_CMP(_cpu_set_bits(setsize), set1, set2) =3D=3D 0; } =20 static __inline int CPU_EQUAL(const cpu_set_t *set1, const cpu_set_t *set2) @@ -215,12 +215,12 @@ static __inline int CPU_EQUAL(const cpu_set_t *set1, = const cpu_set_t *set2) =20 static __inline int CPU_CMP(const cpu_set_t *set1, const cpu_set_t *set2) { - return BIT_CMP(CPU_SETSIZE, set1, set2); + return __BIT_CMP(CPU_SETSIZE, set1, set2); } =20 static __inline int CPU_EMPTY(const cpu_set_t *set) { - return BIT_EMPTY(_cpu_set_bits(sizeof(*set)), set); + return __BIT_EMPTY(_cpu_set_bits(sizeof(*set)), set); } =20 __END_DECLS