Author: kaktus
Date: Fri Feb 14 16:56:59 2020
New Revision: 357921
URL: https://svnweb.freebsd.org/changeset/base/357921

Log:
  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

Modified:
  head/sys/sys/sysctl.h

Modified: head/sys/sys/sysctl.h
==============================================================================
--- head/sys/sys/sysctl.h       Fri Feb 14 15:04:56 2020        (r357920)
+++ head/sys/sys/sysctl.h       Fri Feb 14 16:56:59 2020        (r357921)
@@ -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)
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to