diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -136,7 +136,7 @@ struct sysctl_oid *oidp; SYSCTL_ASSERT_LOCKED(); - RB_FOREACH(oidp, sysctl_oid_list, list) { + SYSCTL_FOREACH(oidp, list) { if (strcmp(oidp->oid_name, name) == 0) { return (oidp); } @@ -1005,7 +1005,7 @@ struct sysctl_oid *oidp; SYSCTL_ASSERT_LOCKED(); - RB_FOREACH(oidp, sysctl_oid_list, l) { + SYSCTL_FOREACH(oidp, l) { for (k=0; koid_name) == 0) break; } diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h --- a/sys/sys/sysctl.h +++ b/sys/sys/sysctl.h @@ -918,6 +918,9 @@ NULL); \ }) +#define SYSCTL_FOREACH(oidp, list) \ + RB_FOREACH(oidp, sysctl_oid_list, list) + /* * A macro to generate a read-only sysctl to indicate the presence of optional * kernel features.