cvs commit: src/sys/sys _task.h

Bruce Evans bde at zeta.org.au
Fri Jul 30 05:43:20 PDT 2004


On Wed, 28 Jul 2004, Brooks Davis wrote:

> On Wed, Jul 28, 2004 at 11:23:02AM -0600, Scott Long wrote:
> > I'd be quite happy with
> >
> > #ifndef _KERNEL
> > #error "No user-servicable parts inside"
> >
> > or similar as is in /sys/sys/timetc.h.  Either way, pollution bad,
> > fluffy bunnies good.

This would add 2 style bugs that are not as in /sys/sys/timetc.h:
- capitalization of an error message
- misspelling of "serviceable"

> First we need to get our house in order.  I count at least 52 includes
> of net/if_var.h in our userland.  We could go ahead and add:
>
> #if defined(BURN_BRIDGES) && !defined(_KERNEL)
> #error "No user-servicable parts inside"
> #endif
>
> That would break all the offenders when we branch without forcing us to
> deal with yet another thing before 5.3.

Another way to properly break them is to put the user-serviceable
#error in kernel-only headers like <sys/mutex.h>.  This shows that
mounds of kernel interfaces are exported to userland via the nested
pollution in <net/if_var.h> (not just the mutex and task structs
which can be obtained without collateral pollution by including
just <sys/_mutex.h> and <sys/_task.h> (and their prerequisites...).

I never got much further than the following in cleaning this up:

%%%
Index: if_var.h
===================================================================
RCS file: /home/ncvs/src/sys/net/if_var.h,v
retrieving revision 1.80
diff -u -2 -r1.80 if_var.h
--- if_var.h	22 Jun 2004 20:13:25 -0000	1.80
+++ if_var.h	23 Jun 2004 02:00:09 -0000
@@ -59,25 +60,22 @@
  */

-#ifdef __STDC__
-/*
- * Forward structure declarations for function prototypes [sic].
- */
-struct	mbuf;
-struct	thread;
+struct	ether_header;
 struct	rtentry;
 struct	rt_addrinfo;
 struct	socket;
-struct	ether_header;
-#endif
+struct	thread;

-#include <sys/queue.h>		/* get TAILQ macros */
+#include <sys/event.h>			/* XXX XXX */
+#include <sys/queue.h>

 #ifdef _KERNEL
-#include <sys/mbuf.h>
-#include <sys/eventhandler.h>
-#endif /* _KERNEL */
-#include <sys/lock.h>		/* XXX */
-#include <sys/mutex.h>		/* XXX */
-#include <sys/event.h>		/* XXX */
+#include <sys/eventhandler.h>		/* XXX XXX */
+#include <sys/lock.h>			/* XXX XXX */
+#include <sys/mbuf.h>			/* XXX XXX */
+#include <sys/mutex.h>			/* XXX XXX */
+#else
+#include <sys/_lock.h>			/* XXX */
+#include <sys/_mutex.h>			/* XXX */
+#endif

 #define	IF_DUNIT_NONE	-1
%%%

(2 XXX's means that the pollution is worse than for 1 XXX.)

This may depend on other depollution.  Pollution in <sys/eventhandler.h>
is especially bad because lots of kernel files depend on it.

Bruce


More information about the cvs-src mailing list