freebsd-dev/include
Stefan Eßer 5e04571cf3 sys/bitset.h: reduce visibility of BIT_* macros
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.

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.

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.

The main reason for this change is that some 3rd party sources
including sched.h have been found to contain conflicting BIT_*
macros.

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.

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.

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.

Reviewed by:	kib, markj
MFC after:	1 month
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D33235
2021-12-05 23:00:25 +01:00
..
arpa SPDX: license IDs for some ISC-related files. 2017-12-08 15:57:29 +00:00
gssapi Add META_MODE support. 2015-06-13 19:20:56 +00:00
protocols Clean up global variable declarations in the dump and restore 2020-04-04 00:56:56 +00:00
rpc include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
rpcsvc Increase YPMAXRECORD to 16M to be compatible with Linux. 2019-08-12 20:27:33 +00:00
xlocale Implement strerror_l(). 2020-12-16 09:02:09 +00:00
_ctype.h include: further adoption of SPDX licensing ID tags. 2017-11-20 19:45:28 +00:00
a.out.h include: further adoption of SPDX licensing ID tags. 2017-11-20 19:45:28 +00:00
ar.h include: further adoption of SPDX licensing ID tags. 2017-11-20 19:45:28 +00:00
assert.h include: further adoption of SPDX licensing ID tags. 2017-11-20 19:45:28 +00:00
bitstring.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
complex.h Implementations of cexpl() 2021-11-05 13:51:42 +02:00
cpio.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
ctype.h include: further adoption of SPDX licensing ID tags. 2017-11-20 19:45:28 +00:00
db.h include: further adoption of SPDX licensing ID tags. 2017-11-20 19:45:28 +00:00
dirent.h include: further adoption of SPDX licensing ID tags. 2017-11-20 19:45:28 +00:00
dlfcn.h Implement RTLD_DEEPBIND. 2020-05-15 11:58:01 +00:00
elf-hints.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
elf.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
err.h Avoid implicit gcc nonnull attribute in vwarnx(). 2018-01-28 19:37:30 +00:00
fmtmsg.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
fnmatch.h include: further adoption of SPDX licensing ID tags. 2017-11-20 19:45:28 +00:00
fstab.h include: further adoption of SPDX licensing ID tags. 2017-11-20 19:45:28 +00:00
fts.h include: further adoption of SPDX licensing ID tags. 2017-11-20 19:45:28 +00:00
ftw.h SPDX: license IDs for some ISC-related files. 2017-12-08 15:57:29 +00:00
getopt.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
glob.h include: further adoption of SPDX licensing ID tags. 2017-11-20 19:45:28 +00:00
grp.h include: further adoption of SPDX licensing ID tags. 2017-11-20 19:45:28 +00:00
gssapi.h
hesiod.h SPDX: license IDs for some ISC-related files. 2017-12-08 15:57:29 +00:00
iconv.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
ieeefp.h
ifaddrs.h SPDX: mostly fixes to previous changes. 2017-12-13 16:13:17 +00:00
inttypes.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
iso646.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
kenv.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
langinfo.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
libgen.h Remove basename_r(3). 2017-12-08 22:06:18 +00:00
limits.h Reduce NL_ARGMAX to 4096 to match Linux. 2018-10-04 21:55:58 +00:00
link.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
locale.h include: further adoption of SPDX licensing ID tags. 2017-11-20 19:45:28 +00:00
Makefile Add real sched.h 2021-11-10 21:18:53 +02:00
Makefile.depend new depends 2015-06-16 23:37:19 +00:00
malloc_np.h Add memalign(3), mostly for glibc compatibility. 2020-05-14 21:12:08 +00:00
malloc.h Make include/malloc.h usable again. 2020-05-12 18:17:57 +00:00
memory.h include: further adoption of SPDX licensing ID tags. 2017-11-20 19:45:28 +00:00
mk-osreldate.sh Move to using newvers -c instead of VARS_ONLY=1 2019-05-23 17:19:05 +00:00
monetary.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
mpool.h include: further adoption of SPDX licensing ID tags. 2017-11-20 19:45:28 +00:00
mqueue.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
ndbm.h include: further adoption of SPDX licensing ID tags. 2017-11-20 19:45:28 +00:00
netconfig.h netconfig.h: sync with upstream. 2017-11-27 17:18:31 +00:00
netdb.h Fix mismatch from r342379. 2018-12-23 20:51:13 +00:00
nl_types.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
nlist.h include: further adoption of SPDX licensing ID tags. 2017-11-20 19:45:28 +00:00
nss.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
nsswitch.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
paths.h Add search of LOCALBASE/share/calendar for calendars supplied by a port. 2020-10-23 09:22:23 +00:00
printf.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
proc_service.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
pthread_np.h Revert r361770 "Add pthread_getname_np() and pthread_setname_np() aliases" for now. 2020-06-04 09:06:03 +00:00
pthread.h Reduce code duplication in machine/_types.h 2021-06-14 16:30:16 +01:00
pwd.h include: further adoption of SPDX licensing ID tags. 2017-11-20 19:45:28 +00:00
ranlib.h include: further adoption of SPDX licensing ID tags. 2017-11-20 19:45:28 +00:00
readpassphrase.h SPDX: license IDs for some ISC-related files. 2017-12-08 15:57:29 +00:00
regex.h <regex.h>: reserve a regcomp field for REG_POSIX 2020-07-31 12:40:31 +00:00
res_update.h SPDX: license IDs for some ISC-related files. 2017-12-08 15:57:29 +00:00
resolv.h SPDX: license IDs for some ISC-related files. 2017-12-08 15:57:29 +00:00
runetype.h Remove __NO_TLS. 2021-02-23 20:08:10 +02:00
sched.h sys/bitset.h: reduce visibility of BIT_* macros 2021-12-05 23:00:25 +01:00
search.h Improve typing of POSIX search tree functions. 2016-10-13 18:25:40 +00:00
semaphore.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
setjmp.h include: further adoption of SPDX licensing ID tags. 2017-11-20 19:45:28 +00:00
signal.h Add sigsetop extensions commonly found in musl libc and glibc 2019-12-12 01:41:55 +00:00
spawn.h posix_spawn: add closefrom non-portable action 2021-11-30 03:43:54 +02:00
stab.h include: further adoption of SPDX licensing ID tags. 2017-11-20 19:45:28 +00:00
stdalign.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
stdbool.h Remove obsolete check for GCC < 3 and support for Intel Compiler 2020-10-24 23:21:06 +00:00
stddef.h include: further adoption of SPDX licensing ID tags. 2017-11-20 19:45:28 +00:00
stdio.h libc: provide fputc_unlocked 2020-02-02 19:45:12 +00:00
stdlib.h libc: add clearenv function 2021-11-07 16:20:15 +01:00
stdnoreturn.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
string.h libc: add mempcpy(3) and wmempcpy(3) 2021-07-15 19:40:28 +03:00
stringlist.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
strings.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
sysexits.h include: further adoption of SPDX licensing ID tags. 2017-11-20 19:45:28 +00:00
tar.h include: further adoption of SPDX licensing ID tags. 2017-11-20 19:45:28 +00:00
termios.h Add tcgetwinsize(3) and tcsetwinsize(3) to termios 2020-12-25 20:43:09 +02:00
tgmath.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
time.h time.h: reduce CLOCK_ namespace pollution, move to _clock_id.h 2021-07-30 17:20:22 -06:00
timeconv.h include: further adoption of SPDX licensing ID tags. 2017-11-20 19:45:28 +00:00
timers.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
ttyent.h Improve missing tty handling in init(8). This removes a check that did 2018-02-27 10:54:15 +00:00
uchar.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
ulimit.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
unistd.h Add _Fork() 2021-08-03 21:19:32 +03:00
unwind.h SPDX: license IDs for some ISC-related files. 2017-12-08 15:57:29 +00:00
utime.h include: further adoption of SPDX licensing ID tags. 2017-11-20 19:45:28 +00:00
utmpx.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
uuid.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
varargs.h We don't support gcc < 4.2.1, so varargs.h now is just #error 2018-02-12 14:48:14 +00:00
wchar.h libc: add mempcpy(3) and wmempcpy(3) 2021-07-15 19:40:28 +03:00
wctype.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
wordexp.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00
xlocale.h include: General further adoption of SPDX licensing ID tags. 2017-11-25 17:09:43 +00:00