svn commit: r195761 - head/sys/sys

Robert Watson rwatson at FreeBSD.org
Sun Jul 19 15:21:43 UTC 2009


Author: rwatson
Date: Sun Jul 19 15:21:42 2009
New Revision: 195761
URL: http://svn.freebsd.org/changeset/base/195761

Log:
  Expose the definitions of 'struct vnet' and 'VNET_MAGIC_N' to userspace
  if _WANT_VNET is defined.  This is required so that libkvm can locate
  virtual network stack instances in order to reach their global variables
  for monitoring and crashdump analysis.
  
  Reviewed by:	bz
  Approved by:	re (kib)

Modified:
  head/sys/sys/vimage.h

Modified: head/sys/sys/vimage.h
==============================================================================
--- head/sys/sys/vimage.h	Sun Jul 19 14:20:53 2009	(r195760)
+++ head/sys/sys/vimage.h	Sun Jul 19 15:21:42 2009	(r195761)
@@ -33,13 +33,31 @@
 #ifndef	_SYS_VIMAGE_H_
 #define	_SYS_VIMAGE_H_
 
-#include <sys/proc.h>
+/*
+ * struct vnet describes a virtualized network stack, and is primarily a
+ * pointer to storage for virtualized global variables.  Expose to userspace
+ * as required for libkvm.
+ */
+#if defined(_KERNEL) || defined(_WANT_VNET)
 #include <sys/queue.h>
 
+struct vnet {
+	LIST_ENTRY(vnet)	 vnet_le;	/* all vnets list */
+	u_int			 vnet_magic_n;
+	u_int			 ifcnt;
+	u_int			 sockcnt;
+	void			*vnet_data_mem;
+	uintptr_t		 vnet_data_base;
+};
+
+#define	VNET_MAGIC_N 0x3e0d8f29
+#endif
+
 #ifdef _KERNEL
 
 #include <sys/lock.h>
 #include <sys/sx.h>
+#include <sys/proc.h>
 
 #ifdef INVARIANTS
 #define	VNET_DEBUG
@@ -115,19 +133,8 @@ void	vnet_foreach(void (*vnet_foreach_fn
 
 #endif /* VIMAGE */
 
-struct vnet {
-	LIST_ENTRY(vnet)	 vnet_le;	/* all vnets list */
-	u_int			 vnet_magic_n;
-	u_int			 ifcnt;
-	u_int			 sockcnt;
-	void			*vnet_data_mem;
-	uintptr_t		 vnet_data_base;
-};
-
 #define	curvnet curthread->td_vnet
 
-#define	VNET_MAGIC_N 0x3e0d8f29
-
 #ifdef VIMAGE
 #ifdef VNET_DEBUG
 #define	VNET_ASSERT(condition)						\


More information about the svn-src-head mailing list