summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_sysctl.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1996-04-13 13:28:54 +0000
committerphk <phk@FreeBSD.org>1996-04-13 13:28:54 +0000
commit52978a6ce95dd0f923ee8fa236b96c972f6622d4 (patch)
tree2da1f90db23d7064e9d335fd9d985780399b96b9 /sys/kern/kern_sysctl.c
parente9d88ac949d739564ee257db43dcd19f6dd635c5 (diff)
downloadFreeBSD-src-52978a6ce95dd0f923ee8fa236b96c972f6622d4.zip
FreeBSD-src-52978a6ce95dd0f923ee8fa236b96c972f6622d4.tar.gz
Fix a longstanding bug and a buglet of no significance.
Now net.ipx works. Noticed by: John Hay -- John.Hay@csir.co.za
Diffstat (limited to 'sys/kern/kern_sysctl.c')
-rw-r--r--sys/kern/kern_sysctl.c41
1 files changed, 18 insertions, 23 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index 4a3169f..6255226 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -37,7 +37,7 @@
* SUCH DAMAGE.
*
* @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94
- * $Id: kern_sysctl.c,v 1.60 1996/03/11 02:18:22 hsu Exp $
+ * $Id: kern_sysctl.c,v 1.61 1996/04/07 13:03:06 phk Exp $
*/
#include <sys/param.h>
@@ -94,9 +94,14 @@ sysctl_order(void *arg)
/* First, find the highest oid we have */
j = l->ls_length;
oidpp = (struct sysctl_oid **) l->ls_items;
- for (k = 0; j--; oidpp++)
+ for (k = 0; j--; oidpp++) {
+ if ((*oidpp)->oid_arg1 == arg) {
+ *oidpp = 0;
+ continue;
+ }
if (*oidpp && (*oidpp)->oid_number > k)
k = (*oidpp)->oid_number;
+ }
/* Next, replace all OID_AUTO oids with new numbers */
j = l->ls_length;
@@ -112,10 +117,6 @@ sysctl_order(void *arg)
for (; j--; oidpp++) {
if (!*oidpp)
continue;
- if ((*oidpp)->oid_arg1 == arg) {
- *oidpp = 0;
- continue;
- }
if (((*oidpp)->oid_kind & CTLTYPE) == CTLTYPE_NODE)
if (!(*oidpp)->oid_handler)
sysctl_order((*oidpp)->oid_arg1);
@@ -160,26 +161,19 @@ sysctl_sysctl_debug_dump_node(struct linker_set *l, int i)
for (k=0; k<i; k++)
printf(" ");
- if ((*oidpp)->oid_number > 100) {
- printf("Junk! %p # %d %s k %x a1 %p a2 %x h %p\n",
- *oidpp,
- (*oidpp)->oid_number, (*oidpp)->oid_name,
- (*oidpp)->oid_kind, (*oidpp)->oid_arg1,
- (*oidpp)->oid_arg2, (*oidpp)->oid_handler);
- continue;
- }
printf("%d %s ", (*oidpp)->oid_number, (*oidpp)->oid_name);
printf("%c%c",
(*oidpp)->oid_kind & CTLFLAG_RD ? 'R':' ',
(*oidpp)->oid_kind & CTLFLAG_WR ? 'W':' ');
+ if ((*oidpp)->oid_handler)
+ printf(" *Handler");
+
switch ((*oidpp)->oid_kind & CTLTYPE) {
case CTLTYPE_NODE:
- if ((*oidpp)->oid_handler) {
- printf(" Node(proc)\n");
- } else {
- printf(" Node\n");
+ printf(" Node\n");
+ if (!(*oidpp)->oid_handler) {
sysctl_sysctl_debug_dump_node(
(*oidpp)->oid_arg1, i+2);
}
@@ -284,8 +278,10 @@ sysctl_sysctl_next_ls (struct linker_set *lsp, int *name, u_int namelen,
/* We really should call the handler here...*/
return 0;
lsp = (struct linker_set*)(*oidpp)->oid_arg1;
- return (sysctl_sysctl_next_ls (lsp, 0, 0, next+1,
- len, level+1, oidp));
+ if (!sysctl_sysctl_next_ls (lsp, 0, 0, next+1,
+ len, level+1, oidp))
+ return 0;
+ goto next;
}
if ((*oidpp)->oid_number < *name)
@@ -300,9 +296,7 @@ sysctl_sysctl_next_ls (struct linker_set *lsp, int *name, u_int namelen,
if (!sysctl_sysctl_next_ls (lsp, name+1, namelen-1,
next+1, len, level+1, oidp))
return (0);
- namelen = 1;
- *len = level;
- continue;
+ goto next;
}
if (((*oidpp)->oid_kind & CTLTYPE) != CTLTYPE_NODE)
continue;
@@ -314,6 +308,7 @@ sysctl_sysctl_next_ls (struct linker_set *lsp, int *name, u_int namelen,
if (!sysctl_sysctl_next_ls (lsp, name+1, namelen-1, next+1,
len, level+1, oidp))
return (0);
+ next:
namelen = 1;
*len = level;
}
OpenPOWER on IntegriCloud