A couple of minor tweaks to the sysctl stuff.

This commit is contained in:
Poul-Henning Kamp 1995-12-06 13:27:39 +00:00
parent 44036f9429
commit 65d0bc1387
6 changed files with 60 additions and 24 deletions

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)kern_clock.c 8.5 (Berkeley) 1/21/94 * @(#)kern_clock.c 8.5 (Berkeley) 1/21/94
* $Id: kern_clock.c,v 1.20 1995/12/02 17:10:31 bde Exp $ * $Id: kern_clock.c,v 1.21 1995/12/04 16:48:20 phk Exp $
*/ */
/* Portions of this software are covered by the following: */ /* Portions of this software are covered by the following: */
@ -985,7 +985,7 @@ sysctl_kern_clockrate SYSCTL_HANDLER_ARGS
} }
SYSCTL_PROC(_kern, KERN_CLOCKRATE, clockrate, CTLTYPE_STRUCT|CTLFLAG_RD, SYSCTL_PROC(_kern, KERN_CLOCKRATE, clockrate, CTLTYPE_STRUCT|CTLFLAG_RD,
0, 0, sysctl_kern_clockrate, "S,clkinfo",""); 0, 0, sysctl_kern_clockrate, "S,clockinfo","");
/*#ifdef PPS_SYNC*/ /*#ifdef PPS_SYNC*/
#if 0 #if 0

View File

@ -37,7 +37,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94 * @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94
* $Id: kern_sysctl.c,v 1.53 1995/12/04 16:48:30 phk Exp $ * $Id: kern_sysctl.c,v 1.54 1995/12/05 21:51:33 bde Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -161,6 +161,34 @@ long hostid;
/* Some trouble here, if sizeof (int) != sizeof (long) */ /* Some trouble here, if sizeof (int) != sizeof (long) */
SYSCTL_INT(_kern, KERN_HOSTID, hostid, CTLFLAG_RW, &hostid, 0, ""); SYSCTL_INT(_kern, KERN_HOSTID, hostid, CTLFLAG_RW, &hostid, 0, "");
/*
* This is really cheating. These actually live in the libc, something
* which I'm not quite sure is a good idea anyway, but in order for
* getnext and friends to actually work, we define dummies here.
*/
SYSCTL_STRING(_user, USER_CS_PATH, cs_path, CTLFLAG_RW, "", 0, "");
SYSCTL_INT(_user, USER_BC_BASE_MAX, bc_base_max, CTLFLAG_RW, 0, 0, "");
SYSCTL_INT(_user, USER_BC_DIM_MAX, bc_dim_max, CTLFLAG_RW, 0, 0, "");
SYSCTL_INT(_user, USER_BC_SCALE_MAX, bc_scale_max, CTLFLAG_RW, 0, 0, "");
SYSCTL_INT(_user, USER_BC_STRING_MAX, bc_string_max, CTLFLAG_RW, 0, 0, "");
SYSCTL_INT(_user, USER_COLL_WEIGHTS_MAX, coll_weights_max, CTLFLAG_RW, 0, 0, "");
SYSCTL_INT(_user, USER_EXPR_NEST_MAX, expr_nest_max, CTLFLAG_RW, 0, 0, "");
SYSCTL_INT(_user, USER_LINE_MAX, line_max, CTLFLAG_RW, 0, 0, "");
SYSCTL_INT(_user, USER_RE_DUP_MAX, re_dup_max, CTLFLAG_RW, 0, 0, "");
SYSCTL_INT(_user, USER_POSIX2_VERSION, posix2_version, CTLFLAG_RW, 0, 0, "");
SYSCTL_INT(_user, USER_POSIX2_C_BIND, posix2_c_bind, CTLFLAG_RW, 0, 0, "");
SYSCTL_INT(_user, USER_POSIX2_C_DEV, posix2_c_dev, CTLFLAG_RW, 0, 0, "");
SYSCTL_INT(_user, USER_POSIX2_CHAR_TERM, posix2_char_term, CTLFLAG_RW, 0, 0, "");
SYSCTL_INT(_user, USER_POSIX2_FORT_DEV, posix2_fort_dev, CTLFLAG_RW, 0, 0, "");
SYSCTL_INT(_user, USER_POSIX2_FORT_RUN, posix2_fort_run, CTLFLAG_RW, 0, 0, "");
SYSCTL_INT(_user, USER_POSIX2_LOCALEDEF, posix2_localedef, CTLFLAG_RW, 0, 0, "");
SYSCTL_INT(_user, USER_POSIX2_SW_DEV, posix2_sw_dev, CTLFLAG_RW, 0, 0, "");
SYSCTL_INT(_user, USER_POSIX2_UPE, posix2_upe, CTLFLAG_RW, 0, 0, "");
SYSCTL_INT(_user, USER_STREAM_MAX, stream_max, CTLFLAG_RW, 0, 0, "");
SYSCTL_INT(_user, USER_TZNAME_MAX, tzname_max, CTLFLAG_RW, 0, 0, "");
/* /*
* End of MIB definitions. * End of MIB definitions.
*/ */
@ -230,11 +258,19 @@ SYSINIT(sysctl, SI_SUB_KMEM, SI_ORDER_ANY, sysctl_order, &sysctl_);
/* /*
* "Staff-functions" * "Staff-functions"
* *
* 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.
* This interface is under work and consideration, and should probably
* be killed with a big axe by the first person who can find the time.
* (be aware though, that the proper interface isn't as obvious as it
* may seem, there are various conflicting requirements.
*
* {0,0} printf the entire MIB-tree. * {0,0} printf the entire MIB-tree.
* {0,1,...} return the name of the "..." OID. * {0,1,...} return the name of the "..." OID.
* {0,2,...} return the next OID. * {0,2,...} return the next OID.
* {0,3} return the OID of the name in "new" * {0,3} return the OID of the name in "new"
* {0,4,...} return the format info for the "..." OID. * {0,4,...} return the kind & format info for the "..." OID.
*/ */
static void static void
@ -426,9 +462,7 @@ sysctl_sysctl_next SYSCTL_HANDLER_ARGS
i = sysctl_sysctl_next_ls (lsp, name, namelen, newoid, &j, 1, &oid); i = sysctl_sysctl_next_ls (lsp, name, namelen, newoid, &j, 1, &oid);
if (i) if (i)
return ENOENT; return ENOENT;
error = SYSCTL_OUT(req, &oid->oid_kind, sizeof oid->oid_kind); error = SYSCTL_OUT(req, newoid, j * sizeof (int));
if (!error)
error =SYSCTL_OUT(req, newoid, j * sizeof (int));
return (error); return (error);
} }
@ -522,9 +556,7 @@ sysctl_sysctl_name2oid SYSCTL_HANDLER_ARGS
if (error) if (error)
return (error); return (error);
error = SYSCTL_OUT(req, &op->oid_kind, sizeof op->oid_kind); error = SYSCTL_OUT(req, oid, len * sizeof *oid);
if (!error)
error = SYSCTL_OUT(req, oid, len * sizeof *oid);
return (error); return (error);
} }
@ -534,7 +566,7 @@ SYSCTL_PROC(_sysctl, 3, name2oid, CTLFLAG_RW, 0, 0,
static int static int
sysctl_sysctl_oidfmt SYSCTL_HANDLER_ARGS sysctl_sysctl_oidfmt SYSCTL_HANDLER_ARGS
{ {
int *name = (int *) arg1; int *name = (int *) arg1, error;
u_int namelen = arg2; u_int namelen = arg2;
int indx, j; int indx, j;
struct sysctl_oid **oidpp; struct sysctl_oid **oidpp;
@ -551,7 +583,7 @@ sysctl_sysctl_oidfmt SYSCTL_HANDLER_ARGS
if ((*oidpp)->oid_handler) if ((*oidpp)->oid_handler)
goto found; goto found;
if (indx == namelen) if (indx == namelen)
return ENOENT; goto found;
lsp = (struct linker_set*)(*oidpp)->oid_arg1; lsp = (struct linker_set*)(*oidpp)->oid_arg1;
j = lsp->ls_length; j = lsp->ls_length;
oidpp = (struct sysctl_oid **)lsp->ls_items; oidpp = (struct sysctl_oid **)lsp->ls_items;
@ -568,8 +600,12 @@ sysctl_sysctl_oidfmt SYSCTL_HANDLER_ARGS
found: found:
if (!(*oidpp)->oid_fmt) if (!(*oidpp)->oid_fmt)
return ENOENT; return ENOENT;
return (SYSCTL_OUT(req, (*oidpp)->oid_fmt, error = SYSCTL_OUT(req,
strlen((*oidpp)->oid_fmt)+1)); &(*oidpp)->oid_kind, sizeof((*oidpp)->oid_kind));
if (!error)
error = SYSCTL_OUT(req, (*oidpp)->oid_fmt,
strlen((*oidpp)->oid_fmt)+1);
return (error);
} }

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)kern_clock.c 8.5 (Berkeley) 1/21/94 * @(#)kern_clock.c 8.5 (Berkeley) 1/21/94
* $Id: kern_clock.c,v 1.20 1995/12/02 17:10:31 bde Exp $ * $Id: kern_clock.c,v 1.21 1995/12/04 16:48:20 phk Exp $
*/ */
/* Portions of this software are covered by the following: */ /* Portions of this software are covered by the following: */
@ -985,7 +985,7 @@ sysctl_kern_clockrate SYSCTL_HANDLER_ARGS
} }
SYSCTL_PROC(_kern, KERN_CLOCKRATE, clockrate, CTLTYPE_STRUCT|CTLFLAG_RD, SYSCTL_PROC(_kern, KERN_CLOCKRATE, clockrate, CTLTYPE_STRUCT|CTLFLAG_RD,
0, 0, sysctl_kern_clockrate, "S,clkinfo",""); 0, 0, sysctl_kern_clockrate, "S,clockinfo","");
/*#ifdef PPS_SYNC*/ /*#ifdef PPS_SYNC*/
#if 0 #if 0

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)kern_clock.c 8.5 (Berkeley) 1/21/94 * @(#)kern_clock.c 8.5 (Berkeley) 1/21/94
* $Id: kern_clock.c,v 1.20 1995/12/02 17:10:31 bde Exp $ * $Id: kern_clock.c,v 1.21 1995/12/04 16:48:20 phk Exp $
*/ */
/* Portions of this software are covered by the following: */ /* Portions of this software are covered by the following: */
@ -985,7 +985,7 @@ sysctl_kern_clockrate SYSCTL_HANDLER_ARGS
} }
SYSCTL_PROC(_kern, KERN_CLOCKRATE, clockrate, CTLTYPE_STRUCT|CTLFLAG_RD, SYSCTL_PROC(_kern, KERN_CLOCKRATE, clockrate, CTLTYPE_STRUCT|CTLFLAG_RD,
0, 0, sysctl_kern_clockrate, "S,clkinfo",""); 0, 0, sysctl_kern_clockrate, "S,clockinfo","");
/*#ifdef PPS_SYNC*/ /*#ifdef PPS_SYNC*/
#if 0 #if 0

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)vfs_subr.c 8.13 (Berkeley) 4/18/94 * @(#)vfs_subr.c 8.13 (Berkeley) 4/18/94
* $Id: vfs_subr.c,v 1.44 1995/11/29 11:28:00 phk Exp $ * $Id: vfs_subr.c,v 1.45 1995/12/02 18:58:56 bde Exp $
*/ */
/* /*
@ -1326,8 +1326,8 @@ sysctl_vnode SYSCTL_HANDLER_ARGS
return (0); return (0);
} }
SYSCTL_NODE(_kern, KERN_VNODE, vnode, CTLTYPE_OPAQUE|CTLFLAG_RD, SYSCTL_PROC(_kern, KERN_VNODE, vnode, CTLTYPE_OPAQUE|CTLFLAG_RD,
sysctl_vnode, ""); 0, 0, sysctl_vnode, "S,vnode", "");
/* /*

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)vfs_subr.c 8.13 (Berkeley) 4/18/94 * @(#)vfs_subr.c 8.13 (Berkeley) 4/18/94
* $Id: vfs_subr.c,v 1.44 1995/11/29 11:28:00 phk Exp $ * $Id: vfs_subr.c,v 1.45 1995/12/02 18:58:56 bde Exp $
*/ */
/* /*
@ -1326,8 +1326,8 @@ sysctl_vnode SYSCTL_HANDLER_ARGS
return (0); return (0);
} }
SYSCTL_NODE(_kern, KERN_VNODE, vnode, CTLTYPE_OPAQUE|CTLFLAG_RD, SYSCTL_PROC(_kern, KERN_VNODE, vnode, CTLTYPE_OPAQUE|CTLFLAG_RD,
sysctl_vnode, ""); 0, 0, sysctl_vnode, "S,vnode", "");
/* /*