On Fri, 3 Sep 2010, pluknet wrote:

On 3 September 2010 21:23, Matthew D Fleming <m...@freebsd.org> wrote:
Log:
?Fix user-space libsbuf build. ?Why isn't CTASSERT available to
?user-space?

Well, user headers shouldn't be enlisted to check for kernel bugs that
can be checked well enough in the kernel.

Modified:
?head/sys/kern/subr_sbuf.c

Modified: head/sys/kern/subr_sbuf.c
==============================================================================
--- head/sys/kern/subr_sbuf.c ? Fri Sep ?3 16:12:39 2010 ? ? ? ?(r212181)
+++ head/sys/kern/subr_sbuf.c ? Fri Sep ?3 17:23:26 2010 ? ? ? ?(r212182)
@@ -116,8 +116,10 @@ _assert_sbuf_state(const char *fun, stru

?#endif /* _KERNEL && INVARIANTS */

+#ifdef _KERNEL
?CTASSERT(powerof2(SBUF_MAXEXTENDSIZE));
?CTASSERT(powerof2(SBUF_MAXEXTENDINCR));
+#endif

?static int
?sbuf_extendsize(int size)

Hi,

as I can see, the next (and maybe preferred) model is used in system headers:

#ifdef CTASSERT
CTASSERT(...);
#endif

Needed, even in the kernel, since CTASSERT() is only defined if the
kernel-only header <sys/systm.h> has been included.

If this macro were defined in a user header, then it would have to be
more global (probably defined in <sys/cdefs.h>) but not in the application
namespace (probably spelled __CTASSERT()), so it would be uglier.

Bruce
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to