Index: cpukit/ChangeLog
===================================================================
--- cpukit/ChangeLog	(revision 429ba3b6ee67e69af97f1156bc1abc7037e346cd)
+++ cpukit/ChangeLog	(revision 0739963874c598138e042011d5f23e4182383b9c)
@@ -1,2 +1,7 @@
+2004-04-19	Ralf Corsepius <ralf_corsepius@rtems.org>
+
+	* libnetworking/sys/sysctl.h: Partial update from FreeBSD.
+	* libnetworking/kern/kern_sysctl.c: Partial update from FreeBSD.
+
 2004-04-17	Ralf Corsepius <ralf_corsepius@rtems.org>
 
Index: cpukit/libnetworking/kern/kern_sysctl.c
===================================================================
--- cpukit/libnetworking/kern/kern_sysctl.c	(revision 429ba3b6ee67e69af97f1156bc1abc7037e346cd)
+++ cpukit/libnetworking/kern/kern_sysctl.c	(revision 0739963874c598138e042011d5f23e4182383b9c)
@@ -17,8 +17,4 @@
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
@@ -442,5 +438,5 @@
  * "Staff-functions"
  *
- * These functions implement a presently undocumented interface 
+ * These functions implement a presently undocumented interface
  * used by the sysctl program to walk the tree, and get the type
  * so it can print the value.
@@ -552,5 +548,5 @@
 			name++;
 
-			if ((oid->oid_kind & CTLTYPE) != CTLTYPE_NODE) 
+			if ((oid->oid_kind & CTLTYPE) != CTLTYPE_NODE)
 				break;
 
@@ -569,5 +565,5 @@
 
 static int
-sysctl_sysctl_next_ls(struct sysctl_oid_list *lsp, int *name, u_int namelen, 
+sysctl_sysctl_next_ls(struct sysctl_oid_list *lsp, int *name, u_int namelen,
 	int *next, int *len, int level, struct sysctl_oid **oidpp)
 {
@@ -583,11 +579,11 @@
 
 		if (!namelen) {
-			if ((oidp->oid_kind & CTLTYPE) != CTLTYPE_NODE) 
+			if ((oidp->oid_kind & CTLTYPE) != CTLTYPE_NODE)
 				return 0;
-			if (oidp->oid_handler) 
+			if (oidp->oid_handler)
 				/* We really should call the handler here...*/
 				return 0;
 			lsp = (struct sysctl_oid_list *)oidp->oid_arg1;
-			if (!sysctl_sysctl_next_ls(lsp, 0, 0, next+1, 
+			if (!sysctl_sysctl_next_ls(lsp, 0, 0, next+1,
 				len, level+1, oidpp))
 				return 0;
@@ -604,5 +600,5 @@
 				return 0;
 			lsp = (struct sysctl_oid_list *)oidp->oid_arg1;
-			if (!sysctl_sysctl_next_ls(lsp, name+1, namelen-1, 
+			if (!sysctl_sysctl_next_ls(lsp, name+1, namelen-1,
 				next+1, len, level+1, oidpp))
 				return (0);
@@ -616,5 +612,5 @@
 
 		lsp = (struct sysctl_oid_list *)oidp->oid_arg1;
-		if (!sysctl_sysctl_next_ls(lsp, name+1, namelen-1, next+1, 
+		if (!sysctl_sysctl_next_ls(lsp, name+1, namelen-1, next+1,
 			len, level+1, oidpp))
 			return (0);
@@ -662,5 +658,5 @@
 	*len = 0;
 
-	for (p = name; *p && *p != '.'; p++) 
+	for (p = name; *p && *p != '.'; p++)
 		;
 	i = *p;
@@ -693,5 +689,5 @@
 		oidp = SLIST_FIRST(lsp);
 		name = p+1;
-		for (p = name; *p && *p != '.'; p++) 
+		for (p = name; *p && *p != '.'; p++)
 				;
 		i = *p;
@@ -709,5 +705,5 @@
 	struct sysctl_oid *op = 0;
 
-	if (!req->newlen) 
+	if (!req->newlen)
 		return ENOENT;
 	if (req->newlen >= MAXPATHLEN)	/* XXX arbitrary, undocumented */
@@ -735,5 +731,5 @@
 }
 
-SYSCTL_PROC(_sysctl, 3, name2oid, CTLFLAG_RW|CTLFLAG_ANYBODY, 0, 0, 
+SYSCTL_PROC(_sysctl, 3, name2oid, CTLFLAG_RW|CTLFLAG_ANYBODY, 0, 0,
 	sysctl_sysctl_name2oid, "I", "");
 
@@ -979,5 +975,5 @@
 	req.oldfunc = sysctl_old_kernel;
 	req.newfunc = sysctl_new_kernel;
-	req.lock = 1;
+	req.lock = REQ_LOCKED;
 
 	SYSCTL_LOCK();
@@ -985,5 +981,5 @@
 	error = sysctl_root(0, name, namelen, &req);
 
-	if (req.lock == 2)
+	if (req.lock == REQ_WIRED)
 #ifdef __rtems__
     printf ("kern_sysctl: vsunlock needs to be called!\n");
@@ -991,5 +987,5 @@
 		vsunlock(req.oldptr, req.oldlen);
 #endif
-    
+
 	SYSCTL_UNLOCK();
 
@@ -1085,9 +1081,10 @@
 sysctl_wire_old_buffer(struct sysctl_req *req, size_t len)
 {
-	if (req->lock == 1 && req->oldptr && req->oldfunc == sysctl_old_user) {
+	if (req->lock == REQ_LOCKED && req->oldptr && 
+	    req->oldfunc == sysctl_old_user) {
 #ifndef __rtems__
 		vslock(req->oldptr, req->oldlen);
 #endif
-		req->lock = 2;
+		req->lock = REQ_WIRED;
 	}
 }
@@ -1106,5 +1103,5 @@
 			indx++;
 			if (oid->oid_kind & CTLFLAG_NOLOCK)
-				req->lock = 0;
+				req->lock = REQ_UNLOCKED;
 			if ((oid->oid_kind & CTLTYPE) == CTLTYPE_NODE) {
 				if (oid->oid_handler != NULL ||
@@ -1170,5 +1167,5 @@
 			return (error);
 	}
-  
+
 	/* Is this sysctl writable by only privileged users? */
 	if (req->newptr && !(oid->oid_kind & CTLFLAG_ANYBODY)) {
@@ -1184,5 +1181,5 @@
 	}
 #endif
-  
+
 	if (!oid->oid_handler)
 		return EINVAL;
@@ -1285,5 +1282,5 @@
 	req.oldfunc = sysctl_old_user;
 	req.newfunc = sysctl_new_user;
-	req.lock = 1;
+	req.lock = REQ_LOCKED;
 
 	SYSCTL_LOCK();
@@ -1305,8 +1302,8 @@
 	req = req2;
 #ifndef __rtems__
-	if (req.lock == 2)
+	if (req.lock == REQ_WIRED)
 		vsunlock(req.oldptr, req.oldlen);
 #endif
-  
+
 	SYSCTL_UNLOCK();
 
@@ -1441,5 +1438,5 @@
 	case KINFO_METER:
 		name[0] = CTL_VM;
-		name[1] = VM_METER;
+		name[1] = VM_TOTAL;
 		error = userland_sysctl(td, name, 2, uap->where, uap->size,
 			0, 0, 0, &size);
Index: cpukit/libnetworking/sys/sysctl.h
===================================================================
--- cpukit/libnetworking/sys/sysctl.h	(revision 429ba3b6ee67e69af97f1156bc1abc7037e346cd)
+++ cpukit/libnetworking/sys/sysctl.h	(revision 0739963874c598138e042011d5f23e4182383b9c)
@@ -94,5 +94,5 @@
  * be implemented.
  * e.g. SYSCTL_INT(_parent, OID_AUTO, name, CTLFLAG_RW, &variable, 0, "");
- */ 
+ */
 #define OID_AUTO	(-1)
 
@@ -107,4 +107,9 @@
 	struct sysctl_req *req
 
+/* definitions for sysctl_req 'lock' member */
+#define REQ_UNLOCKED	0	/* not locked and not wired */
+#define REQ_LOCKED	1	/* locked and not wired */
+#define REQ_WIRED	2	/* locked and wired */
+
 /*
  * This describes the access space for a sysctl request.  This is needed
@@ -113,5 +118,5 @@
 struct sysctl_req {
 	struct thread	*td;		/* used for access checking */
-	int		lock;
+	int		lock;		/* locking/wiring state */
 	void		*oldptr;
 	size_t		oldlen;
@@ -329,5 +334,5 @@
 #define KERN_NISDOMAINNAME	22	/* string: YP domain name */
 #define KERN_UPDATEINTERVAL	23	/* int: update process sleep time */
-#define KERN_OSRELDATE		24	/* int: OS release date */
+#define KERN_OSRELDATE		24	/* int: kernel release date */
 #define KERN_NTP_PLL		25	/* node: NTP PLL control */
 #define	KERN_BOOTFILE		26	/* string: name of booted kernel */
