sysctl(9): properly use xor in ENFORCE_FLAGS macro

Assert on not specifying any of the (soon to be) required flags as well
 as specifying both of them.

Pointed out by:	cem, hselasky
Reviewed by:	hselasky, kib
Approved by:	kib (mentor)
Differential Revision:	https://reviews.freebsd.org/D23678
This commit is contained in:
kaktus 2020-02-14 16:56:59 +00:00
parent 0e2fc41103
commit 02ac1b5a1e

View File

@ -270,9 +270,9 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);
#define __DESCR(d) ""
#endif
#ifdef notyet
#ifdef notyet
#define SYSCTL_ENFORCE_FLAGS(x) \
_Static_assert(((CTLFLAG_MPSAFE ^ CTLFLAG_NEEDGIANT) & (x)), \
_Static_assert((((x) & CTLFLAG_MPSAFE) != 0) ^ (((x) & CTLFLAG_NEEDGIANT) != 0), \
"Has to be either CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT")
#else
#define SYSCTL_ENFORCE_FLAGS(x)