* Change sysctl from using linker_set to construct its tree using SLISTs.

This makes it possible to change the sysctl tree at runtime.

* Change KLD to find and register any sysctl nodes contained in the loaded
  file and to unregister them when the file is unloaded.

Reviewed by: Archie Cobbs <archie@whistle.com>,
	Peter Wemm <peter@netplex.com.au> (well they looked at it anyway)
This commit is contained in:
Doug Rabson 1999-02-16 10:49:55 +00:00
parent d207e2138a
commit ce02431ffa
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=44078
38 changed files with 338 additions and 268 deletions

View File

@ -38,7 +38,7 @@
*
* from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91
* Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
* $Id: vm_machdep.c,v 1.117 1999/02/08 00:37:35 dillon Exp $
* $Id: vm_machdep.c,v 1.118 1999/02/08 02:42:12 dillon Exp $
*/
#include "npx.h"
@ -576,6 +576,7 @@ grow_stack(p, sp)
}
#endif
SYSCTL_DECL(_vm_stats_misc);
static int cnt_prezero;

View File

@ -38,7 +38,7 @@
*
* from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91
* Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
* $Id: vm_machdep.c,v 1.117 1999/02/08 00:37:35 dillon Exp $
* $Id: vm_machdep.c,v 1.118 1999/02/08 02:42:12 dillon Exp $
*/
#include "npx.h"
@ -576,6 +576,7 @@ grow_stack(p, sp)
}
#endif
SYSCTL_DECL(_vm_stats_misc);
static int cnt_prezero;

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: kern_linker.c,v 1.24 1999/01/27 21:49:56 dillon Exp $
* $Id: kern_linker.c,v 1.25 1999/01/27 23:45:39 dillon Exp $
*/
#include "opt_ddb.h"
@ -232,6 +232,42 @@ linker_file_sysuninit(linker_file_t lf)
}
}
static void
linker_file_register_sysctls(linker_file_t lf)
{
struct linker_set* sysctls;
KLD_DPF(FILE, ("linker_file_register_sysctls: registering SYSCTLs for %s\n",
lf->filename));
sysctls = (struct linker_set*)
linker_file_lookup_symbol(lf, "sysctl_set", 0);
KLD_DPF(FILE, ("linker_file_register_sysctls: SYSCTLs %p\n", sysctls));
if (!sysctls)
return;
sysctl_register_set(sysctls);
}
static void
linker_file_unregister_sysctls(linker_file_t lf)
{
struct linker_set* sysctls;
KLD_DPF(FILE, ("linker_file_unregister_sysctls: registering SYSCTLs for %s\n",
lf->filename));
sysctls = (struct linker_set*)
linker_file_lookup_symbol(lf, "sysctl_set", 0);
KLD_DPF(FILE, ("linker_file_unregister_sysctls: SYSCTLs %p\n", sysctls));
if (!sysctls)
return;
sysctl_unregister_set(sysctls);
}
int
linker_load_file(const char* filename, linker_file_t* result)
{
@ -271,6 +307,7 @@ linker_load_file(const char* filename, linker_file_t* result)
foundfile = 1;
if (lf) {
linker_file_sysinit(lf);
linker_file_register_sysctls(lf);
*result = lf;
error = 0;
@ -412,8 +449,10 @@ linker_file_unload(linker_file_t file)
}
/* Don't try to run SYSUNINITs if we are unloaded due to a link error */
if (file->flags & LINKER_FILE_LINKED)
if (file->flags & LINKER_FILE_LINKED) {
linker_file_sysuninit(file);
linker_file_unregister_sysctls(file);
}
TAILQ_REMOVE(&files, file, link);
lockmgr(&lock, LK_RELEASE, 0, curproc);
@ -933,6 +972,7 @@ linker_preload(void* arg)
}
sysinit_add((struct sysinit **)sysinits->ls_items);
}
linker_file_register_sysctls(lf);
}
}
}

View File

@ -37,7 +37,7 @@
* SUCH DAMAGE.
*
* @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94
* $Id: kern_sysctl.c,v 1.81 1998/12/27 18:03:29 dfr Exp $
* $Id: kern_sysctl.c,v 1.83 1999/01/10 07:45:31 phk Exp $
*/
#include "opt_compat.h"
@ -66,82 +66,87 @@ static struct sysctl_lock {
static int sysctl_root SYSCTL_HANDLER_ARGS;
extern struct linker_set sysctl_;
struct sysctl_oid_list sysctl__children; /* root list */
/*
* Initialization of the MIB tree.
*
* Order by number in each linker_set.
* Order by number in each list.
*/
static int
sysctl_order_cmp(const void *a, const void *b)
void sysctl_register_oid(struct sysctl_oid *oidp)
{
struct sysctl_oid const * const *pa;
struct sysctl_oid const * const *pb;
struct sysctl_oid_list *parent = oidp->oid_parent;
struct sysctl_oid *p;
struct sysctl_oid *q;
int n;
pa = (struct sysctl_oid const * const *)a;
pb = (struct sysctl_oid const * const *)b;
if (*pa == NULL && *pb == NULL)
return 0;
if (*pa == NULL)
return (1);
if (*pb == NULL)
return (-1);
return ((*pa)->oid_number - (*pb)->oid_number);
}
static void
sysctl_order(void *arg)
{
int j, k;
struct linker_set *l = (struct linker_set *) arg;
struct sysctl_oid **oidpp;
/* First, find the highest oid we have */
j = l->ls_length;
oidpp = (struct sysctl_oid **) l->ls_items;
for (k = 0; j--; oidpp++) {
if (!*oidpp)
continue;
if ((*oidpp)->oid_arg1 == arg) {
*oidpp = 0;
continue;
/*
* If this oid has a number OID_AUTO, give it a number which
* is greater than any current oid. Make sure it is at least
* 100 to leave space for pre-assigned oid numbers.
*/
if (oidp->oid_number == OID_AUTO) {
/* First, find the highest oid in the parent list >99 */
n = 99;
SLIST_FOREACH(p, parent, oid_link) {
if (p->oid_number > n)
n = p->oid_number;
}
if ((*oidpp)->oid_number > k)
k = (*oidpp)->oid_number;
oidp->oid_number = n + 1;
}
/* Next, replace all OID_AUTO oids with new numbers */
j = l->ls_length;
oidpp = (struct sysctl_oid **) l->ls_items;
k += 100;
for (; j--; oidpp++)
if (*oidpp && (*oidpp)->oid_number == OID_AUTO)
(*oidpp)->oid_number = k++;
/* Finally: sort by oid */
j = l->ls_length;
oidpp = (struct sysctl_oid **) l->ls_items;
for (; j--; oidpp++) {
if (!*oidpp)
continue;
if (((*oidpp)->oid_kind & CTLTYPE) == CTLTYPE_NODE)
if (!(*oidpp)->oid_handler)
sysctl_order((*oidpp)->oid_arg1);
/*
* Insert the oid into the parent's list in order.
*/
q = NULL;
SLIST_FOREACH(p, parent, oid_link) {
if (oidp->oid_number < p->oid_number)
break;
q = p;
}
qsort(l->ls_items, l->ls_length, sizeof l->ls_items[0],
sysctl_order_cmp);
if (q)
SLIST_INSERT_AFTER(q, oidp, oid_link);
else
SLIST_INSERT_HEAD(parent, oidp, oid_link);
}
SYSINIT(sysctl, SI_SUB_KMEM, SI_ORDER_ANY, sysctl_order, &sysctl_);
void
sysctl_order_all(void)
void sysctl_unregister_oid(struct sysctl_oid *oidp)
{
sysctl_order(&sysctl_);
SLIST_REMOVE(oidp->oid_parent, oidp, sysctl_oid, oid_link);
}
/*
* Bulk-register all the oids in a linker_set.
*/
void sysctl_register_set(struct linker_set *lsp)
{
int count = lsp->ls_length;
int i;
for (i = 0; i < count; i++)
sysctl_register_oid((struct sysctl_oid *) lsp->ls_items[i]);
}
void sysctl_unregister_set(struct linker_set *lsp)
{
int count = lsp->ls_length;
int i;
for (i = 0; i < count; i++)
sysctl_unregister_oid((struct sysctl_oid *) lsp->ls_items[i]);
}
/*
* Register the kernel's oids on startup.
*/
extern struct linker_set sysctl_set;
static void sysctl_register_all(void *arg)
{
sysctl_register_set(&sysctl_set);
}
SYSINIT(sysctl, SI_SUB_KMEM, SI_ORDER_ANY, sysctl_register_all, 0);
/*
* "Staff-functions"
*
@ -161,36 +166,31 @@ sysctl_order_all(void)
*/
static void
sysctl_sysctl_debug_dump_node(struct linker_set *l, int i)
sysctl_sysctl_debug_dump_node(struct sysctl_oid_list *l, int i)
{
int j, k;
struct sysctl_oid **oidpp;
int k;
struct sysctl_oid *oidp;
j = l->ls_length;
oidpp = (struct sysctl_oid **) l->ls_items;
for (; j--; oidpp++) {
if (!*oidpp)
continue;
SLIST_FOREACH(oidp, l, oid_link) {
for (k=0; k<i; k++)
printf(" ");
printf("%d %s ", (*oidpp)->oid_number, (*oidpp)->oid_name);
printf("%d %s ", oidp->oid_number, oidp->oid_name);
printf("%c%c",
(*oidpp)->oid_kind & CTLFLAG_RD ? 'R':' ',
(*oidpp)->oid_kind & CTLFLAG_WR ? 'W':' ');
oidp->oid_kind & CTLFLAG_RD ? 'R':' ',
oidp->oid_kind & CTLFLAG_WR ? 'W':' ');
if ((*oidpp)->oid_handler)
if (oidp->oid_handler)
printf(" *Handler");
switch ((*oidpp)->oid_kind & CTLTYPE) {
switch (oidp->oid_kind & CTLTYPE) {
case CTLTYPE_NODE:
printf(" Node\n");
if (!(*oidpp)->oid_handler) {
if (!oidp->oid_handler) {
sysctl_sysctl_debug_dump_node(
(*oidpp)->oid_arg1, i+2);
oidp->oid_arg1, i+2);
}
break;
case CTLTYPE_INT: printf(" Int\n"); break;
@ -206,7 +206,7 @@ sysctl_sysctl_debug_dump_node(struct linker_set *l, int i)
static int
sysctl_sysctl_debug SYSCTL_HANDLER_ARGS
{
sysctl_sysctl_debug_dump_node(&sysctl_, 0);
sysctl_sysctl_debug_dump_node(&sysctl__children, 0);
return ENOENT;
}
@ -218,9 +218,9 @@ sysctl_sysctl_name SYSCTL_HANDLER_ARGS
{
int *name = (int *) arg1;
u_int namelen = arg2;
int i, j, error = 0;
struct sysctl_oid **oidpp;
struct linker_set *lsp = &sysctl_;
int error = 0;
struct sysctl_oid *oid;
struct sysctl_oid_list *lsp = &sysctl__children;
char buf[10];
while (namelen) {
@ -236,31 +236,28 @@ sysctl_sysctl_name SYSCTL_HANDLER_ARGS
name++;
continue;
}
oidpp = (struct sysctl_oid **) lsp->ls_items;
j = lsp->ls_length;
lsp = 0;
for (i = 0; i < j; i++, oidpp++) {
if (*oidpp && ((*oidpp)->oid_number != *name))
SLIST_FOREACH(oid, lsp, oid_link) {
if (oid->oid_number != *name)
continue;
if (req->oldidx)
error = SYSCTL_OUT(req, ".", 1);
if (!error)
error = SYSCTL_OUT(req, (*oidpp)->oid_name,
strlen((*oidpp)->oid_name));
error = SYSCTL_OUT(req, oid->oid_name,
strlen(oid->oid_name));
if (error)
return (error);
namelen--;
name++;
if (((*oidpp)->oid_kind & CTLTYPE) != CTLTYPE_NODE)
if ((oid->oid_kind & CTLTYPE) != CTLTYPE_NODE)
break;
if ((*oidpp)->oid_handler)
if (oid->oid_handler)
break;
lsp = (struct linker_set*)(*oidpp)->oid_arg1;
lsp = (struct sysctl_oid_list *)oid->oid_arg1;
break;
}
}
@ -270,58 +267,52 @@ sysctl_sysctl_name SYSCTL_HANDLER_ARGS
SYSCTL_NODE(_sysctl, 1, name, CTLFLAG_RD, sysctl_sysctl_name, "");
static int
sysctl_sysctl_next_ls (struct linker_set *lsp, int *name, u_int namelen,
int *next, int *len, int level, struct sysctl_oid **oidp)
sysctl_sysctl_next_ls (struct sysctl_oid_list *lsp, int *name, u_int namelen,
int *next, int *len, int level, struct sysctl_oid **oidpp)
{
int i, j;
struct sysctl_oid **oidpp;
struct sysctl_oid *oidp;
oidpp = (struct sysctl_oid **) lsp->ls_items;
j = lsp->ls_length;
*len = level;
for (i = 0; i < j; i++, oidpp++) {
if (!*oidpp)
continue;
*next = (*oidpp)->oid_number;
*oidp = *oidpp;
SLIST_FOREACH(oidp, lsp, oid_link) {
*next = oidp->oid_number;
*oidpp = oidp;
if (!namelen) {
if (((*oidpp)->oid_kind & CTLTYPE) != CTLTYPE_NODE)
if ((oidp->oid_kind & CTLTYPE) != CTLTYPE_NODE)
return 0;
if ((*oidpp)->oid_handler)
if (oidp->oid_handler)
/* We really should call the handler here...*/
return 0;
lsp = (struct linker_set*)(*oidpp)->oid_arg1;
lsp = (struct sysctl_oid_list *)oidp->oid_arg1;
if (!sysctl_sysctl_next_ls (lsp, 0, 0, next+1,
len, level+1, oidp))
len, level+1, oidpp))
return 0;
goto next;
}
if ((*oidpp)->oid_number < *name)
if (oidp->oid_number < *name)
continue;
if ((*oidpp)->oid_number > *name) {
if (((*oidpp)->oid_kind & CTLTYPE) != CTLTYPE_NODE)
if (oidp->oid_number > *name) {
if ((oidp->oid_kind & CTLTYPE) != CTLTYPE_NODE)
return 0;
if ((*oidpp)->oid_handler)
if (oidp->oid_handler)
return 0;
lsp = (struct linker_set*)(*oidpp)->oid_arg1;
lsp = (struct sysctl_oid_list *)oidp->oid_arg1;
if (!sysctl_sysctl_next_ls (lsp, name+1, namelen-1,
next+1, len, level+1, oidp))
next+1, len, level+1, oidpp))
return (0);
goto next;
}
if (((*oidpp)->oid_kind & CTLTYPE) != CTLTYPE_NODE)
if ((oidp->oid_kind & CTLTYPE) != CTLTYPE_NODE)
continue;
if ((*oidpp)->oid_handler)
if (oidp->oid_handler)
continue;
lsp = (struct linker_set*)(*oidpp)->oid_arg1;
lsp = (struct sysctl_oid_list *)oidp->oid_arg1;
if (!sysctl_sysctl_next_ls (lsp, name+1, namelen-1, next+1,
len, level+1, oidp))
len, level+1, oidpp))
return (0);
next:
namelen = 1;
@ -337,7 +328,7 @@ sysctl_sysctl_next SYSCTL_HANDLER_ARGS
u_int namelen = arg2;
int i, j, error;
struct sysctl_oid *oid;
struct linker_set *lsp = &sysctl_;
struct sysctl_oid_list *lsp = &sysctl__children;
int newoid[CTL_MAXNAME];
i = sysctl_sysctl_next_ls (lsp, name, namelen, newoid, &j, 1, &oid);
@ -350,11 +341,11 @@ sysctl_sysctl_next SYSCTL_HANDLER_ARGS
SYSCTL_NODE(_sysctl, 2, next, CTLFLAG_RD, sysctl_sysctl_next, "");
static int
name2oid (char *name, int *oid, int *len, struct sysctl_oid **oidp)
name2oid (char *name, int *oid, int *len, struct sysctl_oid **oidpp)
{
int i, j;
struct sysctl_oid **oidpp;
struct linker_set *lsp = &sysctl_;
int i;
struct sysctl_oid *oidp;
struct sysctl_oid_list *lsp = &sysctl__children;
char *p;
if (!*name)
@ -372,34 +363,30 @@ name2oid (char *name, int *oid, int *len, struct sysctl_oid **oidp)
if (i == '.')
*p = '\0';
j = lsp->ls_length;
oidpp = (struct sysctl_oid **) lsp->ls_items;
oidp = SLIST_FIRST(lsp);
while (j-- && *len < CTL_MAXNAME) {
if (!*oidpp)
continue;
if (strcmp(name, (*oidpp)->oid_name)) {
oidpp++;
while (oidp && *len < CTL_MAXNAME) {
if (strcmp(name, oidp->oid_name)) {
oidp = SLIST_NEXT(oidp, oid_link);
continue;
}
*oid++ = (*oidpp)->oid_number;
*oid++ = oidp->oid_number;
(*len)++;
if (!i) {
if (oidp)
*oidp = *oidpp;
if (oidpp)
*oidpp = oidp;
return (0);
}
if (((*oidpp)->oid_kind & CTLTYPE) != CTLTYPE_NODE)
if ((oidp->oid_kind & CTLTYPE) != CTLTYPE_NODE)
break;
if ((*oidpp)->oid_handler)
if (oidp->oid_handler)
break;
lsp = (struct linker_set*)(*oidpp)->oid_arg1;
j = lsp->ls_length;
oidpp = (struct sysctl_oid **)lsp->ls_items;
lsp = (struct sysctl_oid_list *)oidp->oid_arg1;
oidp = SLIST_FIRST(lsp);
name = p+1;
for (p = name; *p && *p != '.'; p++)
;
@ -449,43 +436,41 @@ sysctl_sysctl_oidfmt SYSCTL_HANDLER_ARGS
{
int *name = (int *) arg1, error;
u_int namelen = arg2;
int indx, j;
struct sysctl_oid **oidpp;
struct linker_set *lsp = &sysctl_;
int indx;
struct sysctl_oid *oid;
struct sysctl_oid_list *lsp = &sysctl__children;
j = lsp->ls_length;
oidpp = (struct sysctl_oid **) lsp->ls_items;
oid = SLIST_FIRST(lsp);
indx = 0;
while (j-- && indx < CTL_MAXNAME) {
if (*oidpp && ((*oidpp)->oid_number == name[indx])) {
while (oid && indx < CTL_MAXNAME) {
if (oid->oid_number == name[indx]) {
indx++;
if (((*oidpp)->oid_kind & CTLTYPE) == CTLTYPE_NODE) {
if ((*oidpp)->oid_handler)
if ((oid->oid_kind & CTLTYPE) == CTLTYPE_NODE) {
if (oid->oid_handler)
goto found;
if (indx == namelen)
goto found;
lsp = (struct linker_set*)(*oidpp)->oid_arg1;
j = lsp->ls_length;
oidpp = (struct sysctl_oid **)lsp->ls_items;
lsp = (struct sysctl_oid_list *)oid->oid_arg1;
oid = SLIST_FIRST(lsp);
} else {
if (indx != namelen)
return EISDIR;
goto found;
}
} else {
oidpp++;
oid = SLIST_NEXT(oid, oid_link);
}
}
return ENOENT;
found:
if (!(*oidpp)->oid_fmt)
if (!oid->oid_fmt)
return ENOENT;
error = SYSCTL_OUT(req,
&(*oidpp)->oid_kind, sizeof((*oidpp)->oid_kind));
&oid->oid_kind, sizeof(oid->oid_kind));
if (!error)
error = SYSCTL_OUT(req, (*oidpp)->oid_fmt,
strlen((*oidpp)->oid_fmt)+1);
error = SYSCTL_OUT(req, oid->oid_fmt,
strlen(oid->oid_fmt)+1);
return (error);
}
@ -741,59 +726,57 @@ sysctl_root SYSCTL_HANDLER_ARGS
{
int *name = (int *) arg1;
u_int namelen = arg2;
int indx, i, j;
struct sysctl_oid **oidpp;
struct linker_set *lsp = &sysctl_;
int indx, i;
struct sysctl_oid *oid;
struct sysctl_oid_list *lsp = &sysctl__children;
j = lsp->ls_length;
oidpp = (struct sysctl_oid **) lsp->ls_items;
oid = SLIST_FIRST(lsp);
indx = 0;
while (j-- && indx < CTL_MAXNAME) {
if (*oidpp && ((*oidpp)->oid_number == name[indx])) {
while (oid && indx < CTL_MAXNAME) {
if (oid->oid_number == name[indx]) {
indx++;
if ((*oidpp)->oid_kind & CTLFLAG_NOLOCK)
if (oid->oid_kind & CTLFLAG_NOLOCK)
req->lock = 0;
if (((*oidpp)->oid_kind & CTLTYPE) == CTLTYPE_NODE) {
if ((*oidpp)->oid_handler)
if ((oid->oid_kind & CTLTYPE) == CTLTYPE_NODE) {
if (oid->oid_handler)
goto found;
if (indx == namelen)
return ENOENT;
lsp = (struct linker_set*)(*oidpp)->oid_arg1;
j = lsp->ls_length;
oidpp = (struct sysctl_oid **)lsp->ls_items;
lsp = (struct sysctl_oid_list *)oid->oid_arg1;
oid = SLIST_FIRST(lsp);
} else {
if (indx != namelen)
return EISDIR;
goto found;
}
} else {
oidpp++;
oid = SLIST_NEXT(oid, oid_link);
}
}
return ENOENT;
found:
/* If writing isn't allowed */
if (req->newptr && (!((*oidpp)->oid_kind & CTLFLAG_WR) ||
(((*oidpp)->oid_kind & CTLFLAG_SECURE) && securelevel > 0)))
if (req->newptr && (!(oid->oid_kind & CTLFLAG_WR) ||
((oid->oid_kind & CTLFLAG_SECURE) && securelevel > 0)))
return (EPERM);
/* Most likely only root can write */
if (!((*oidpp)->oid_kind & CTLFLAG_ANYBODY) &&
if (!(oid->oid_kind & CTLFLAG_ANYBODY) &&
req->newptr && req->p &&
(i = suser(req->p->p_ucred, &req->p->p_acflag)))
return (i);
if (!(*oidpp)->oid_handler)
if (!oid->oid_handler)
return EINVAL;
if (((*oidpp)->oid_kind & CTLTYPE) == CTLTYPE_NODE) {
i = ((*oidpp)->oid_handler) (*oidpp,
if ((oid->oid_kind & CTLTYPE) == CTLTYPE_NODE) {
i = (oid->oid_handler) (oid,
name + indx, namelen - indx,
req);
} else {
i = ((*oidpp)->oid_handler) (*oidpp,
(*oidpp)->oid_arg1, (*oidpp)->oid_arg2,
i = (oid->oid_handler) (oid,
oid->oid_arg1, oid->oid_arg2,
req);
}
return (i);

View File

@ -33,6 +33,7 @@
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/queue.h>
#include <sys/sysctl.h>
#include <posix4/posix4.h>
@ -45,12 +46,16 @@ static int facility[CTL_P1003_1B_MAXID - 1];
#if 1
SYSCTL_DECL(_p1003_1b);
#define P1B_SYSCTL(num, name) \
SYSCTL_INT(_p1003_1b, num, \
name, CTLFLAG_RD, facility + num - 1, 0, "");
#else
SYSCTL_DECL(_kern_p1003_1b);
#define P1B_SYSCTL(num, name) \
SYSCTL_INT(_kern_p1003_1b, OID_AUTO, \
name, CTLFLAG_RD, facility + num - 1, 0, "");
@ -58,7 +63,6 @@ SYSCTL_NODE(_kern, OID_AUTO, p1003_1b, CTLFLAG_RW, 0, "P1003.1B");
#endif
P1B_SYSCTL(CTL_P1003_1B_ASYNCHRONOUS_IO, asynchronous_io);
P1B_SYSCTL(CTL_P1003_1B_MAPPED_FILES, mapped_files);
P1B_SYSCTL(CTL_P1003_1B_MEMLOCK, memlock);

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)uipc_mbuf.c 8.2 (Berkeley) 1/4/94
* $Id: uipc_mbuf.c,v 1.36 1998/07/03 08:36:48 phk Exp $
* $Id: uipc_mbuf.c,v 1.37 1998/07/27 03:59:48 dg Exp $
*/
#include <sys/param.h>
@ -60,6 +60,7 @@ int max_protohdr;
int max_hdr;
int max_datalen;
SYSCTL_DECL(_kern_ipc);
SYSCTL_INT(_kern_ipc, KIPC_MAX_LINKHDR, max_linkhdr, CTLFLAG_RW,
&max_linkhdr, 0, "");
SYSCTL_INT(_kern_ipc, KIPC_MAX_PROTOHDR, max_protohdr, CTLFLAG_RW,

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)uipc_proto.c 8.1 (Berkeley) 6/10/93
* $Id: uipc_proto.c,v 1.16 1998/06/21 14:53:18 bde Exp $
* $Id: uipc_proto.c,v 1.17 1998/08/23 03:06:59 wollman Exp $
*/
#include <sys/param.h>
@ -39,6 +39,7 @@
#include <sys/domain.h>
#include <sys/protosw.h>
#include <sys/socket.h>
#include <sys/queue.h>
#include <sys/sysctl.h>
#include <sys/un.h>
#include <sys/unpcb.h>

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)uipc_socket.c 8.3 (Berkeley) 4/15/94
* $Id: uipc_socket.c,v 1.53 1999/01/27 21:49:57 dillon Exp $
* $Id: uipc_socket.c,v 1.54 1999/02/02 07:23:28 fenner Exp $
*/
#include <sys/param.h>
@ -60,6 +60,8 @@ so_gen_t so_gencnt; /* generation count for sockets */
MALLOC_DEFINE(M_SONAME, "soname", "socket name");
MALLOC_DEFINE(M_PCB, "pcb", "protocol control block");
SYSCTL_DECL(_kern_ipc);
static int somaxconn = SOMAXCONN;
SYSCTL_INT(_kern_ipc, KIPC_SOMAXCONN, somaxconn, CTLFLAG_RW, &somaxconn,
0, "");

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* From: @(#)uipc_usrreq.c 8.3 (Berkeley) 1/4/94
* $Id: uipc_usrreq.c,v 1.38 1999/01/21 08:29:04 dillon Exp $
* $Id: uipc_usrreq.c,v 1.39 1999/01/21 09:02:18 dillon Exp $
*/
#include <sys/param.h>
@ -445,14 +445,17 @@ static u_long unpdg_recvspace = 4*1024;
static int unp_rights; /* file descriptors in flight */
SYSCTL_DECL(_net_local_stream);
SYSCTL_INT(_net_local_stream, OID_AUTO, sendspace, CTLFLAG_RW,
&unpst_sendspace, 0, "");
SYSCTL_INT(_net_local_stream, OID_AUTO, recvspace, CTLFLAG_RW,
&unpst_recvspace, 0, "");
SYSCTL_DECL(_net_local_dgram);
SYSCTL_INT(_net_local_dgram, OID_AUTO, maxdgram, CTLFLAG_RW,
&unpdg_sendspace, 0, "");
SYSCTL_INT(_net_local_dgram, OID_AUTO, recvspace, CTLFLAG_RW,
&unpdg_recvspace, 0, "");
SYSCTL_DECL(_net_local);
SYSCTL_INT(_net_local, OID_AUTO, inflight, CTLFLAG_RD, &unp_rights, 0, "");
static int

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94
* $Id: vfs_syscalls.c,v 1.115 1999/01/28 17:32:00 dillon Exp $
* $Id: vfs_syscalls.c,v 1.116 1999/01/30 12:27:00 phk Exp $
*/
/* For 4.3 integer FS ID compatibility */
@ -2942,6 +2942,8 @@ struct __getcwd_args {
u_int buflen;
};
#endif
SYSCTL_DECL(_vfs_cache);
#define STATNODE(mode, name, var) \
SYSCTL_INT(_vfs_cache, OID_AUTO, name, mode, var, 0, "");

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_init.c 8.3 (Berkeley) 1/4/94
* $Id: vfs_init.c,v 1.42 1999/01/28 00:57:47 dillon Exp $
* $Id: vfs_init.c,v 1.43 1999/01/28 17:32:00 dillon Exp $
*/
@ -331,9 +331,7 @@ int
vfs_register(struct vfsconf *vfc)
{
struct linker_set *l;
struct sysctl_oid **oidpp;
struct vfsconf *vfsp;
int i, exists;
vfsp = NULL;
l = &sysctl__vfs;
@ -343,35 +341,6 @@ vfs_register(struct vfsconf *vfc)
return EEXIST;
vfc->vfc_typenum = maxvfsconf++;
if (vfc->vfc_vfsops->vfs_oid != NULL) {
/*
* Attach the oid to the "vfs" node of the sysctl tree if
* it isn't already there (it will be there for statically
* configured vfs's).
*/
exists = 0;
for (i = l->ls_length,
oidpp = (struct sysctl_oid **)l->ls_items;
i-- != 0; oidpp++)
if (*oidpp == vfc->vfc_vfsops->vfs_oid) {
exists = 1;
break;
}
if (exists == 0)
for (i = l->ls_length,
oidpp = (struct sysctl_oid **)l->ls_items;
i-- != 0; oidpp++) {
if (*oidpp == NULL ||
*oidpp == &sysctl___vfs_mod0 ||
*oidpp == &sysctl___vfs_mod1) {
*oidpp = vfc->vfc_vfsops->vfs_oid;
break;
}
}
vfc->vfc_vfsops->vfs_oid->oid_number = vfc->vfc_typenum;
sysctl_order_all();
}
if (vfsp)
vfsp->vfc_next = vfc;
else
@ -390,8 +359,6 @@ vfs_register(struct vfsconf *vfc)
int
vfs_unregister(struct vfsconf *vfc)
{
struct linker_set *l;
struct sysctl_oid **oidpp;
struct vfsconf *vfsp, *prev_vfsp;
int error, i, maxtypenum;
@ -416,18 +383,6 @@ vfs_unregister(struct vfsconf *vfc)
prev_vfsp->vfc_next = vfsp->vfc_next;
else
vfsconf = vfsp->vfc_next;
if (vfsp->vfc_vfsops->vfs_oid != NULL) {
l = &sysctl__vfs;
for (i = l->ls_length,
oidpp = (struct sysctl_oid **)l->ls_items;
i--; oidpp++) {
if (*oidpp == vfsp->vfc_vfsops->vfs_oid) {
*oidpp = NULL;
sysctl_order_all();
break;
}
}
}
maxtypenum = VFS_GENERIC;
for (vfsp = vfsconf; vfsp != NULL; vfsp = vfsp->vfc_next)
if (maxtypenum < vfsp->vfc_typenum)

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94
* $Id: vfs_syscalls.c,v 1.115 1999/01/28 17:32:00 dillon Exp $
* $Id: vfs_syscalls.c,v 1.116 1999/01/30 12:27:00 phk Exp $
*/
/* For 4.3 integer FS ID compatibility */
@ -2942,6 +2942,8 @@ struct __getcwd_args {
u_int buflen;
};
#endif
SYSCTL_DECL(_vfs_cache);
#define STATNODE(mode, name, var) \
SYSCTL_INT(_vfs_cache, OID_AUTO, name, mode, var, 0, "");

View File

@ -175,6 +175,7 @@ sysctl_bdg SYSCTL_HANDLER_ARGS
return error ;
}
SYSCTL_DECL(_net_link_ether);
SYSCTL_PROC(_net_link_ether, OID_AUTO, bridge, CTLTYPE_INT|CTLFLAG_RW,
&do_bridge, 0, &sysctl_bdg, "I", "Bridging");

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)if_ethersubr.c 8.1 (Berkeley) 6/10/93
* $Id: if_ethersubr.c,v 1.54 1999/01/12 12:07:00 eivind Exp $
* $Id: if_ethersubr.c,v 1.55 1999/01/31 08:17:16 julian Exp $
*/
#include "opt_atalk.h"
@ -679,6 +679,7 @@ ether_ifattach(ifp)
#endif /* NETGRAPH */
}
SYSCTL_DECL(_net_link);
SYSCTL_NODE(_net_link, IFT_ETHER, ether, CTLFLAG_RW, 0, "Ethernet");
int

View File

@ -26,7 +26,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: if_mib.c,v 1.5 1997/08/02 14:32:38 bde Exp $
* $Id: if_mib.c,v 1.6 1998/12/04 22:54:52 archie Exp $
*/
#include <sys/param.h>
@ -61,6 +61,7 @@
* services stuff).
*/
SYSCTL_DECL(_net_link_generic);
SYSCTL_NODE(_net_link_generic, IFMIB_SYSTEM, system, CTLFLAG_RW, 0,
"Variables global to all interfaces");
SYSCTL_INT(_net_link_generic_system, IFMIB_IFCOUNT, ifcount, CTLFLAG_RD,

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)icmp_var.h 8.1 (Berkeley) 6/10/93
* $Id: icmp_var.h,v 1.11 1998/12/04 03:49:18 dillon Exp $
* $Id: icmp_var.h,v 1.12 1998/12/04 04:21:25 dillon Exp $
*/
#ifndef _NETINET_ICMP_VAR_H_
@ -78,6 +78,7 @@ struct icmpstat {
}
#ifdef KERNEL
SYSCTL_DECL(_net_inet_icmp);
#ifdef ICMP_BANDLIM
extern int badport_bandlim __P((int));
#endif

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)if_ether.c 8.1 (Berkeley) 6/10/93
* $Id: if_ether.c,v 1.51 1999/01/18 01:54:36 fenner Exp $
* $Id: if_ether.c,v 1.52 1999/01/19 23:17:03 fenner Exp $
*/
/*
@ -45,6 +45,7 @@
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/queue.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
@ -64,6 +65,7 @@
#define SIN(s) ((struct sockaddr_in *)s)
#define SDL(s) ((struct sockaddr_dl *)s)
SYSCTL_DECL(_net_link_ether);
SYSCTL_NODE(_net_link_ether, PF_INET, inet, CTLFLAG_RW, 0, "");
/* timer values */

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* @(#)igmp_var.h 8.1 (Berkeley) 7/19/93
* $Id: igmp_var.h,v 1.11 1997/02/22 09:41:27 peter Exp $
* $Id: igmp_var.h,v 1.12 1997/09/07 05:26:37 bde Exp $
*/
#ifndef _NETINET_IGMP_VAR_H_
@ -104,6 +104,8 @@ void igmp_slowtimo __P((void));
{ "stats", CTLTYPE_STRUCT }, \
}
SYSCTL_DECL(_net_inet_igmp);
#endif

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)in_proto.c 8.2 (Berkeley) 2/9/95
* $Id: in_proto.c,v 1.46 1998/03/21 11:33:57 peter Exp $
* $Id: in_proto.c,v 1.47 1998/08/23 03:07:14 wollman Exp $
*/
#include "opt_ipdivert.h"
@ -42,6 +42,7 @@
#include <sys/socket.h>
#include <sys/domain.h>
#include <sys/protosw.h>
#include <sys/queue.h>
#include <sys/sysctl.h>
#include <net/if.h>

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)in_var.h 8.2 (Berkeley) 1/9/95
* $Id: in_var.h,v 1.28 1998/05/19 14:04:24 dg Exp $
* $Id: in_var.h,v 1.29 1998/06/07 17:12:14 dfr Exp $
*/
#ifndef _NETINET_IN_VAR_H_
@ -157,6 +157,12 @@ struct in_multi {
};
#ifdef KERNEL
#ifdef SYSCTL_DECL
SYSCTL_DECL(_net_inet_ip);
SYSCTL_DECL(_net_inet_raw);
#endif
extern LIST_HEAD(in_multihead, in_multi) in_multihead;
/*

View File

@ -12,7 +12,7 @@
*
* This software is provided ``AS IS'' without any warranties of any kind.
*
* $Id: ip_fw.c,v 1.102 1998/12/22 20:38:06 luigi Exp $
* $Id: ip_fw.c,v 1.103 1998/12/31 07:43:29 luigi Exp $
*/
/*
@ -76,6 +76,7 @@ LIST_HEAD (ip_fw_head, ip_fw_chain) ip_fw_chain;
MALLOC_DEFINE(M_IPFW, "IpFw/IpAcct", "IpFw/IpAcct chain's");
#ifdef SYSCTL_NODE
SYSCTL_DECL(_net_inet_ip);
SYSCTL_NODE(_net_inet_ip, OID_AUTO, fw, CTLFLAG_RW, 0, "Firewall");
SYSCTL_INT(_net_inet_ip_fw, OID_AUTO, debug, CTLFLAG_RW, &fw_debug, 0, "");
SYSCTL_INT(_net_inet_ip_fw, OID_AUTO,one_pass,CTLFLAG_RW, &fw_one_pass, 0, "");

View File

@ -84,6 +84,7 @@ extern int lkmenodev __P((void));
int xxxinit __P((struct lkm_table *, int, int));
#ifdef SYSCTL_INT
SYSCTL_DECL(_net_inet);
SYSCTL_NODE(_net_inet, OID_AUTO, ipf, CTLFLAG_RW, 0, "IPF");
SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_flags, CTLFLAG_RW, &fr_flags, 0, "");
SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_pass, CTLFLAG_RW, &fr_pass, 0, "");

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_var.h 8.4 (Berkeley) 5/24/95
* $Id: tcp_var.h,v 1.48 1998/08/24 07:47:39 dfr Exp $
* $Id: tcp_var.h,v 1.49 1999/01/20 17:32:00 fenner Exp $
*/
#ifndef _NETINET_TCP_VAR_H_
@ -322,7 +322,12 @@ struct xtcpcb {
{ "pcblist", CTLTYPE_STRUCT }, \
}
#ifdef KERNEL
#ifdef SYSCTL_DECL
SYSCTL_DECL(_net_inet_tcp);
#endif
extern struct inpcbhead tcb; /* head of queue of active tcpcb's */
extern struct inpcbinfo tcbinfo;
extern struct tcpstat tcpstat; /* tcp statistics */

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)udp_var.h 8.1 (Berkeley) 6/10/93
* $Id: udp_var.h,v 1.15 1998/05/15 20:11:36 wollman Exp $
* $Id: udp_var.h,v 1.16 1998/11/17 10:53:37 dfr Exp $
*/
#ifndef _NETINET_UDP_VAR_H_
@ -100,6 +100,8 @@ struct udpstat {
}
#ifdef KERNEL
SYSCTL_DECL(_net_inet_udp);
extern struct pr_usrreqs udp_usrreqs;
void udp_ctlinput __P((int, struct sockaddr *, void *));

View File

@ -33,7 +33,7 @@
*
* @(#)ipx_proto.c
*
* $Id: ipx_proto.c,v 1.12 1997/12/15 20:31:14 eivind Exp $
* $Id: ipx_proto.c,v 1.13 1998/02/09 06:10:24 eivind Exp $
*/
#include "opt_ipx.h"
@ -43,6 +43,7 @@
#include <sys/protosw.h>
#include <sys/domain.h>
#include <sys/kernel.h>
#include <sys/queue.h>
#include <sys/sysctl.h>
#include <net/radix.h>

View File

@ -33,7 +33,7 @@
*
* @(#)ipx_var.h
*
* $Id: ipx_var.h,v 1.10 1998/06/07 17:12:20 dfr Exp $
* $Id: ipx_var.h,v 1.11 1998/08/23 03:07:15 wollman Exp $
*/
#ifndef _NETIPX_IPX_VAR_H_
@ -58,6 +58,11 @@ struct ipxstat {
#ifdef KERNEL
#ifdef SYSCTL_DECL
SYSCTL_DECL(_net_ipx);
SYSCTL_DECL(_net_ipx_ipx);
#endif
extern int ipxcksum;
extern long ipx_pexseq;
extern struct ipxstat ipxstat;

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_serv.c 8.8 (Berkeley) 7/31/95
* $Id: nfs_serv.c,v 1.71 1998/12/08 23:11:24 eivind Exp $
* $Id: nfs_serv.c,v 1.72 1998/12/09 15:12:53 eivind Exp $
*/
/*
@ -99,6 +99,8 @@ extern struct nfsstats nfsstats;
int nfsrvw_procrastinate = NFS_GATHERDELAY * 1000;
int nfsrvw_procrastinate_v3 = 0;
SYSCTL_DECL(_vfs_nfs);
static int nfs_async;
SYSCTL_INT(_vfs_nfs, OID_AUTO, async, CTLFLAG_RW, &nfs_async, 0, "");

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_syscalls.c 8.5 (Berkeley) 3/30/95
* $Id: nfs_syscalls.c,v 1.44 1998/12/07 21:58:44 archie Exp $
* $Id: nfs_syscalls.c,v 1.45 1999/01/27 22:42:27 dillon Exp $
*/
#include <sys/param.h>
@ -109,6 +109,8 @@ static int nfssvc_addsock __P((struct file *, struct sockaddr *,
struct proc *));
static int nfssvc_nfsd __P((struct nfsd_srvargs *,caddr_t,struct proc *));
SYSCTL_DECL(_vfs_nfs);
static int nfs_privport = 0;
SYSCTL_INT(_vfs_nfs, NFS_NFSPRIVPORT, nfs_privport, CTLFLAG_RW, &nfs_privport, 0, "");
SYSCTL_INT(_vfs_nfs, OID_AUTO, gatherdelay, CTLFLAG_RW, &nfsrvw_procrastinate, 0, "");

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_vfsops.c 8.12 (Berkeley) 5/20/95
* $Id: nfs_vfsops.c,v 1.80 1999/01/28 00:57:51 dillon Exp $
* $Id: nfs_vfsops.c,v 1.81 1999/01/28 17:32:01 dillon Exp $
*/
#include <sys/param.h>
@ -133,7 +133,6 @@ static struct vfsops nfs_vfsops = {
nfs_vptofh,
nfs_init,
nfs_uninit,
&sysctl___vfs_nfs
};
VFS_SET(nfs_vfsops, nfs, VFCF_NETWORK);

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_vnops.c 8.16 (Berkeley) 5/27/95
* $Id: nfs_vnops.c,v 1.121 1999/02/13 08:01:59 dillon Exp $
* $Id: nfs_vnops.c,v 1.122 1999/02/13 09:47:30 dillon Exp $
*/
@ -248,6 +248,8 @@ struct nfsmount *nfs_iodmount[NFS_MAXASYNCDAEMON];
int nfs_numasync = 0;
#define DIRHDSIZ (sizeof (struct dirent) - (MAXNAMLEN + 1))
SYSCTL_DECL(_vfs_nfs);
static int nfsaccess_cache_timeout = 2;
SYSCTL_INT(_vfs_nfs, OID_AUTO, access_cache_timeout, CTLFLAG_RW,
&nfsaccess_cache_timeout, 0, "NFS ACCESS cache timeout");

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_syscalls.c 8.5 (Berkeley) 3/30/95
* $Id: nfs_syscalls.c,v 1.44 1998/12/07 21:58:44 archie Exp $
* $Id: nfs_syscalls.c,v 1.45 1999/01/27 22:42:27 dillon Exp $
*/
#include <sys/param.h>
@ -109,6 +109,8 @@ static int nfssvc_addsock __P((struct file *, struct sockaddr *,
struct proc *));
static int nfssvc_nfsd __P((struct nfsd_srvargs *,caddr_t,struct proc *));
SYSCTL_DECL(_vfs_nfs);
static int nfs_privport = 0;
SYSCTL_INT(_vfs_nfs, NFS_NFSPRIVPORT, nfs_privport, CTLFLAG_RW, &nfs_privport, 0, "");
SYSCTL_INT(_vfs_nfs, OID_AUTO, gatherdelay, CTLFLAG_RW, &nfsrvw_procrastinate, 0, "");

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_vfsops.c 8.12 (Berkeley) 5/20/95
* $Id: nfs_vfsops.c,v 1.80 1999/01/28 00:57:51 dillon Exp $
* $Id: nfs_vfsops.c,v 1.81 1999/01/28 17:32:01 dillon Exp $
*/
#include <sys/param.h>
@ -133,7 +133,6 @@ static struct vfsops nfs_vfsops = {
nfs_vptofh,
nfs_init,
nfs_uninit,
&sysctl___vfs_nfs
};
VFS_SET(nfs_vfsops, nfs, VFCF_NETWORK);

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_vnops.c 8.16 (Berkeley) 5/27/95
* $Id: nfs_vnops.c,v 1.121 1999/02/13 08:01:59 dillon Exp $
* $Id: nfs_vnops.c,v 1.122 1999/02/13 09:47:30 dillon Exp $
*/
@ -248,6 +248,8 @@ struct nfsmount *nfs_iodmount[NFS_MAXASYNCDAEMON];
int nfs_numasync = 0;
#define DIRHDSIZ (sizeof (struct dirent) - (MAXNAMLEN + 1))
SYSCTL_DECL(_vfs_nfs);
static int nfsaccess_cache_timeout = 2;
SYSCTL_INT(_vfs_nfs, OID_AUTO, access_cache_timeout, CTLFLAG_RW,
&nfsaccess_cache_timeout, 0, "NFS ACCESS cache timeout");

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_serv.c 8.8 (Berkeley) 7/31/95
* $Id: nfs_serv.c,v 1.71 1998/12/08 23:11:24 eivind Exp $
* $Id: nfs_serv.c,v 1.72 1998/12/09 15:12:53 eivind Exp $
*/
/*
@ -99,6 +99,8 @@ extern struct nfsstats nfsstats;
int nfsrvw_procrastinate = NFS_GATHERDELAY * 1000;
int nfsrvw_procrastinate_v3 = 0;
SYSCTL_DECL(_vfs_nfs);
static int nfs_async;
SYSCTL_INT(_vfs_nfs, OID_AUTO, async, CTLFLAG_RW, &nfs_async, 0, "");

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_syscalls.c 8.5 (Berkeley) 3/30/95
* $Id: nfs_syscalls.c,v 1.44 1998/12/07 21:58:44 archie Exp $
* $Id: nfs_syscalls.c,v 1.45 1999/01/27 22:42:27 dillon Exp $
*/
#include <sys/param.h>
@ -109,6 +109,8 @@ static int nfssvc_addsock __P((struct file *, struct sockaddr *,
struct proc *));
static int nfssvc_nfsd __P((struct nfsd_srvargs *,caddr_t,struct proc *));
SYSCTL_DECL(_vfs_nfs);
static int nfs_privport = 0;
SYSCTL_INT(_vfs_nfs, NFS_NFSPRIVPORT, nfs_privport, CTLFLAG_RW, &nfs_privport, 0, "");
SYSCTL_INT(_vfs_nfs, OID_AUTO, gatherdelay, CTLFLAG_RW, &nfsrvw_procrastinate, 0, "");

View File

@ -33,6 +33,7 @@
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/queue.h>
#include <sys/sysctl.h>
#include <posix4/posix4.h>
@ -45,12 +46,16 @@ static int facility[CTL_P1003_1B_MAXID - 1];
#if 1
SYSCTL_DECL(_p1003_1b);
#define P1B_SYSCTL(num, name) \
SYSCTL_INT(_p1003_1b, num, \
name, CTLFLAG_RD, facility + num - 1, 0, "");
#else
SYSCTL_DECL(_kern_p1003_1b);
#define P1B_SYSCTL(num, name) \
SYSCTL_INT(_kern_p1003_1b, OID_AUTO, \
name, CTLFLAG_RD, facility + num - 1, 0, "");
@ -58,7 +63,6 @@ SYSCTL_NODE(_kern, OID_AUTO, p1003_1b, CTLFLAG_RW, 0, "P1003.1B");
#endif
P1B_SYSCTL(CTL_P1003_1B_ASYNCHRONOUS_IO, asynchronous_io);
P1B_SYSCTL(CTL_P1003_1B_MAPPED_FILES, mapped_files);
P1B_SYSCTL(CTL_P1003_1B_MEMLOCK, memlock);

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)mount.h 8.21 (Berkeley) 5/20/95
* $Id: mount.h,v 1.72 1998/11/10 09:04:09 peter Exp $
* $Id: mount.h,v 1.73 1998/11/15 15:12:58 bde Exp $
*/
#ifndef _SYS_MOUNT_H_
@ -310,7 +310,6 @@ struct vfsops {
int (*vfs_vptofh) __P((struct vnode *vp, struct fid *fhp));
int (*vfs_init) __P((struct vfsconf *));
int (*vfs_uninit) __P((struct vfsconf *));
struct sysctl_oid *vfs_oid;
};
#define VFS_MOUNT(MP, PATH, DATA, NDP, P) \

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)sysctl.h 8.1 (Berkeley) 6/2/93
* $Id: sysctl.h,v 1.68 1998/12/27 18:03:29 dfr Exp $
* $Id: sysctl.h,v 1.70 1999/01/10 07:45:27 phk Exp $
*/
#ifndef _SYS_SYSCTL_H_
@ -110,11 +110,15 @@ struct sysctl_req {
int (*newfunc)(struct sysctl_req *, void *, size_t);
};
SLIST_HEAD(sysctl_oid_list, sysctl_oid);
/*
* This describes one "oid" in the MIB tree. Potentially more nodes can
* be hidden behind it, expanded by the handler.
*/
struct sysctl_oid {
struct sysctl_oid_list *oid_parent;
SLIST_ENTRY(sysctl_oid) oid_link;
int oid_number;
int oid_kind;
void *oid_arg1;
@ -133,18 +137,29 @@ int sysctl_handle_intptr SYSCTL_HANDLER_ARGS;
int sysctl_handle_string SYSCTL_HANDLER_ARGS;
int sysctl_handle_opaque SYSCTL_HANDLER_ARGS;
/*
* These functions are used to add/remove an oid from the mib.
*/
void sysctl_register_oid(struct sysctl_oid *oidp);
void sysctl_unregister_oid(struct sysctl_oid *oidp);
/* Declare an oid to allow child oids to be added to it. */
#define SYSCTL_DECL(name) \
extern struct sysctl_oid_list sysctl_##name##_children
/* This constructs a "raw" MIB oid. */
#define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \
static struct sysctl_oid sysctl__##parent##_##name = { \
nbr, kind, a1, a2, #name, handler, fmt }; \
DATA_SET(sysctl_##parent, sysctl__##parent##_##name)
static struct sysctl_oid sysctl__##parent##_##name = { \
&sysctl_##parent##_children, { 0 }, \
nbr, kind, a1, a2, #name, handler, fmt }; \
DATA_SET(sysctl_set, sysctl__##parent##_##name);
/* This constructs a node from which other oids can hang. */
#define SYSCTL_NODE(parent, nbr, name, access, handler, descr) \
extern struct linker_set sysctl_##parent##_##name; \
SYSCTL_OID(parent, nbr, name, CTLTYPE_NODE|access, \
(void*)&sysctl_##parent##_##name, 0, handler, "N", descr); \
DATA_SET(sysctl_##parent##_##name, sysctl__##parent##_##name)
#define SYSCTL_NODE(parent, nbr, name, access, handler, descr) \
struct sysctl_oid_list sysctl_##parent##_##name##_children; \
SYSCTL_OID(parent, nbr, name, CTLTYPE_NODE|access, \
(void*)&sysctl_##parent##_##name##_children, 0, handler, \
"N", descr);
/* Oid for a string. len can be 0 to indicate '\0' termination. */
#define SYSCTL_STRING(parent, nbr, name, access, arg, len, descr) \
@ -452,14 +467,29 @@ int sysctl_handle_opaque SYSCTL_HANDLER_ARGS;
#ifdef KERNEL
/*
* Declare some common oids.
*/
extern struct sysctl_oid_list sysctl__children;
SYSCTL_DECL(_kern);
SYSCTL_DECL(_sysctl);
SYSCTL_DECL(_vm);
SYSCTL_DECL(_vfs);
SYSCTL_DECL(_net);
SYSCTL_DECL(_debug);
SYSCTL_DECL(_hw);
SYSCTL_DECL(_machdep);
SYSCTL_DECL(_user);
extern char machine[];
extern char osrelease[];
extern char ostype[];
void sysctl_register_set(struct linker_set *lsp);
void sysctl_unregister_set(struct linker_set *lsp);
int kernel_sysctl(struct proc *p, int *name, u_int namelen, void *old,
size_t *oldlenp, void *new, size_t newlen,
size_t *retval);
void sysctl_order_all(void);
int userland_sysctl(struct proc *p, int *name, u_int namelen, void *old,
size_t *oldlenp, int inkernel, void *new, size_t newlen,
size_t *retval);