A major sweep over the sysctl stuff.
Move a lot of variables home to their own code (In good time before xmas :-) Introduce the string descrition of format. Add a couple more functions to poke into these marvels, while I try to decide what the correct interface should look like. Next is adding vars on the fly, and sysctl looking at them too. Removed a tine bit of defunct and #ifdefed notused code in swapgeneric.
This commit is contained in:
parent
3810ebe310
commit
27e3e437a7
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
|
||||
* $Id: machdep.c,v 1.152 1995/11/20 12:41:24 phk Exp $
|
||||
* $Id: machdep.c,v 1.153 1995/11/29 19:57:01 wollman Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
@ -142,7 +142,10 @@ SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL)
|
||||
static void identifycpu(void);
|
||||
|
||||
char machine[] = "i386";
|
||||
SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD, machine, 0, "");
|
||||
|
||||
char cpu_model[128];
|
||||
SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD, cpu_model, 0, "");
|
||||
|
||||
struct kern_devconf kdc_cpu0 = {
|
||||
0, 0, 0, /* filled in by dev_attach */
|
||||
@ -174,10 +177,30 @@ int msgbufmapped = 0; /* set when safe to use msgbuf */
|
||||
int _udatasel, _ucodesel;
|
||||
|
||||
|
||||
/*
|
||||
* Machine-dependent startup code
|
||||
*/
|
||||
int boothowto = 0, bootverbose = 0, Maxmem = 0, badpages = 0, physmem = 0;
|
||||
int physmem = 0;
|
||||
|
||||
static int
|
||||
sysctl_hw_physmem SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
int error = sysctl_handle_int(oidp, 0, ctob(physmem), req);
|
||||
return (error);
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_hw, HW_PHYSMEM, physmem, CTLTYPE_INT|CTLFLAG_RD,
|
||||
0, 0, sysctl_hw_physmem, "I", "");
|
||||
|
||||
static int
|
||||
sysctl_hw_usermem SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
int error = sysctl_handle_int(oidp, 0,
|
||||
ctob(physmem - cnt.v_wire_count), req);
|
||||
return (error);
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_hw, HW_USERMEM, usermem, CTLTYPE_INT|CTLFLAG_RD,
|
||||
0, 0, sysctl_hw_usermem, "I", "");
|
||||
|
||||
int boothowto = 0, bootverbose = 0, Maxmem = 0, badpages = 0;
|
||||
long dumplo;
|
||||
extern int bootdev;
|
||||
int biosmem;
|
||||
@ -1037,8 +1060,8 @@ sysctl_machdep_adjkerntz SYSCTL_HANDLER_ARGS
|
||||
return (error);
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_machdep, CPU_ADJKERNTZ, adjkerntz,
|
||||
CTLTYPE_INT|CTLFLAG_RW, &adjkerntz, 0, sysctl_machdep_adjkerntz, "");
|
||||
SYSCTL_PROC(_machdep, CPU_ADJKERNTZ, adjkerntz, CTLTYPE_INT|CTLFLAG_RW,
|
||||
&adjkerntz, 0, sysctl_machdep_adjkerntz, "I", "");
|
||||
|
||||
static int
|
||||
sysctl_machdep_consdev SYSCTL_HANDLER_ARGS
|
||||
@ -1048,8 +1071,8 @@ sysctl_machdep_consdev SYSCTL_HANDLER_ARGS
|
||||
return (sysctl_handle_opaque(oidp, &consdev, sizeof consdev, req));
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_machdep, CPU_CONSDEV, consdev,
|
||||
CTLTYPE_OPAQUE|CTLFLAG_RD, 0, 0, sysctl_machdep_consdev, "");
|
||||
SYSCTL_PROC(_machdep, CPU_CONSDEV, consdev, CTLTYPE_OPAQUE|CTLFLAG_RD,
|
||||
0, 0, sysctl_machdep_consdev, "T,dev_t", "");
|
||||
|
||||
SYSCTL_INT(_machdep, CPU_DISRTCSET, disable_rtc_set,
|
||||
CTLFLAG_RW, &disable_rtc_set, 0, "");
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
|
||||
* $Id: machdep.c,v 1.152 1995/11/20 12:41:24 phk Exp $
|
||||
* $Id: machdep.c,v 1.153 1995/11/29 19:57:01 wollman Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
@ -142,7 +142,10 @@ SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL)
|
||||
static void identifycpu(void);
|
||||
|
||||
char machine[] = "i386";
|
||||
SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD, machine, 0, "");
|
||||
|
||||
char cpu_model[128];
|
||||
SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD, cpu_model, 0, "");
|
||||
|
||||
struct kern_devconf kdc_cpu0 = {
|
||||
0, 0, 0, /* filled in by dev_attach */
|
||||
@ -174,10 +177,30 @@ int msgbufmapped = 0; /* set when safe to use msgbuf */
|
||||
int _udatasel, _ucodesel;
|
||||
|
||||
|
||||
/*
|
||||
* Machine-dependent startup code
|
||||
*/
|
||||
int boothowto = 0, bootverbose = 0, Maxmem = 0, badpages = 0, physmem = 0;
|
||||
int physmem = 0;
|
||||
|
||||
static int
|
||||
sysctl_hw_physmem SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
int error = sysctl_handle_int(oidp, 0, ctob(physmem), req);
|
||||
return (error);
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_hw, HW_PHYSMEM, physmem, CTLTYPE_INT|CTLFLAG_RD,
|
||||
0, 0, sysctl_hw_physmem, "I", "");
|
||||
|
||||
static int
|
||||
sysctl_hw_usermem SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
int error = sysctl_handle_int(oidp, 0,
|
||||
ctob(physmem - cnt.v_wire_count), req);
|
||||
return (error);
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_hw, HW_USERMEM, usermem, CTLTYPE_INT|CTLFLAG_RD,
|
||||
0, 0, sysctl_hw_usermem, "I", "");
|
||||
|
||||
int boothowto = 0, bootverbose = 0, Maxmem = 0, badpages = 0;
|
||||
long dumplo;
|
||||
extern int bootdev;
|
||||
int biosmem;
|
||||
@ -1037,8 +1060,8 @@ sysctl_machdep_adjkerntz SYSCTL_HANDLER_ARGS
|
||||
return (error);
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_machdep, CPU_ADJKERNTZ, adjkerntz,
|
||||
CTLTYPE_INT|CTLFLAG_RW, &adjkerntz, 0, sysctl_machdep_adjkerntz, "");
|
||||
SYSCTL_PROC(_machdep, CPU_ADJKERNTZ, adjkerntz, CTLTYPE_INT|CTLFLAG_RW,
|
||||
&adjkerntz, 0, sysctl_machdep_adjkerntz, "I", "");
|
||||
|
||||
static int
|
||||
sysctl_machdep_consdev SYSCTL_HANDLER_ARGS
|
||||
@ -1048,8 +1071,8 @@ sysctl_machdep_consdev SYSCTL_HANDLER_ARGS
|
||||
return (sysctl_handle_opaque(oidp, &consdev, sizeof consdev, req));
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_machdep, CPU_CONSDEV, consdev,
|
||||
CTLTYPE_OPAQUE|CTLFLAG_RD, 0, 0, sysctl_machdep_consdev, "");
|
||||
SYSCTL_PROC(_machdep, CPU_CONSDEV, consdev, CTLTYPE_OPAQUE|CTLFLAG_RD,
|
||||
0, 0, sysctl_machdep_consdev, "T,dev_t", "");
|
||||
|
||||
SYSCTL_INT(_machdep, CPU_DISRTCSET, disable_rtc_set,
|
||||
CTLFLAG_RW, &disable_rtc_set, 0, "");
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)swapgeneric.c 5.5 (Berkeley) 5/9/91
|
||||
* $Id: swapgeneric.c,v 1.12 1995/10/03 14:49:38 wpaul Exp $
|
||||
* $Id: swapgeneric.c,v 1.13 1995/10/31 17:03:26 joerg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -43,6 +43,8 @@
|
||||
#include <sys/systm.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/disklabel.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/devconf.h>
|
||||
|
||||
#include <i386/i386/cons.h>
|
||||
@ -64,6 +66,24 @@
|
||||
dev_t rootdev = NODEV;
|
||||
dev_t dumpdev = NODEV;
|
||||
|
||||
static int
|
||||
sysctl_kern_dumpdev SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
int error;
|
||||
dev_t ndumpdev;
|
||||
|
||||
ndumpdev = dumpdev;
|
||||
error = sysctl_handle_opaque(oidp, &ndumpdev, sizeof ndumpdev, req);
|
||||
if (!error && ndumpdev != dumpdev) {
|
||||
error = setdumpdev(ndumpdev);
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_kern, KERN_DUMPDEV, dumpdev, CTLTYPE_OPAQUE|CTLFLAG_RW,
|
||||
0, sizeof dumpdev, sysctl_kern_dumpdev, "");
|
||||
|
||||
|
||||
#ifdef notused
|
||||
int nswap;
|
||||
struct swdevt swdevt[] = {
|
||||
@ -123,7 +143,7 @@ void setconf(void)
|
||||
int unit, swaponroot = 0;
|
||||
|
||||
if (rootdev != NODEV)
|
||||
goto doswap;
|
||||
return;
|
||||
if (boothowto & RB_ASKNAME) {
|
||||
char name[128];
|
||||
retry:
|
||||
@ -178,14 +198,6 @@ void setconf(void)
|
||||
found:
|
||||
gc->gc_root = makedev(major(gc->gc_root), unit * MAXPARTITIONS);
|
||||
rootdev = gc->gc_root;
|
||||
doswap:
|
||||
#ifdef notused
|
||||
swdevt[0].sw_dev = dumpdev =
|
||||
makedev(major(rootdev), minor(rootdev)+1);
|
||||
/* swap size and dumplo set during autoconfigure */
|
||||
if (swaponroot)
|
||||
rootdev = dumpdev;
|
||||
#endif
|
||||
}
|
||||
|
||||
void gets(cp)
|
||||
|
@ -39,7 +39,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)init_main.c 8.9 (Berkeley) 1/21/94
|
||||
* $Id: init_main.c,v 1.32 1995/11/28 07:29:59 bde Exp $
|
||||
* $Id: init_main.c,v 1.33 1995/12/02 17:10:29 bde Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -47,6 +47,7 @@
|
||||
#include <sys/errno.h>
|
||||
#include <sys/exec.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/sysctl.h>
|
||||
#ifdef GPROF
|
||||
#include <sys/gmon.h>
|
||||
#endif
|
||||
@ -96,7 +97,11 @@ extern struct user *proc0paddr;
|
||||
|
||||
struct vnode *rootvp;
|
||||
int boothowto;
|
||||
|
||||
struct timeval boottime;
|
||||
SYSCTL_STRUCT(_kern, KERN_BOOTTIME, boottime,
|
||||
CTLFLAG_RW, &boottime, timeval, "");
|
||||
|
||||
struct timeval runtime;
|
||||
|
||||
/*
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)kern_clock.c 8.5 (Berkeley) 1/21/94
|
||||
* $Id: kern_clock.c,v 1.19 1995/11/12 19:51:48 phk Exp $
|
||||
* $Id: kern_clock.c,v 1.20 1995/12/02 17:10:31 bde Exp $
|
||||
*/
|
||||
|
||||
/* Portions of this software are covered by the following: */
|
||||
@ -984,8 +984,8 @@ sysctl_kern_clockrate SYSCTL_HANDLER_ARGS
|
||||
return (sysctl_handle_opaque(oidp, &clkinfo, sizeof clkinfo, req));
|
||||
}
|
||||
|
||||
SYSCTL_OID(_kern, KERN_CLOCKRATE, clockrate,
|
||||
CTLTYPE_STRUCT|CTLFLAG_RD, 0, 0, sysctl_kern_clockrate, "");
|
||||
SYSCTL_PROC(_kern, KERN_CLOCKRATE, clockrate, CTLTYPE_STRUCT|CTLFLAG_RD,
|
||||
0, 0, sysctl_kern_clockrate, "S,clkinfo","");
|
||||
|
||||
/*#ifdef PPS_SYNC*/
|
||||
#if 0
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94
|
||||
* $Id: kern_descrip.c,v 1.16 1995/11/29 14:40:32 julian Exp $
|
||||
* $Id: kern_descrip.c,v 1.17 1995/12/02 18:58:46 bde Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -1022,8 +1022,17 @@ sysctl_kern_file SYSCTL_HANDLER_ARGS
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_kern, KERN_FILE, file, CTLTYPE_OPAQUE|CTLFLAG_RD,
|
||||
0, 0, sysctl_kern_file, "S,file", "");
|
||||
|
||||
SYSCTL_INT(_kern, KERN_MAXFILESPERPROC, maxfilesperproc,
|
||||
CTLFLAG_RD, &maxfilesperproc, 0, "");
|
||||
|
||||
SYSCTL_INT(_kern, KERN_MAXFILES, maxfiles, CTLFLAG_RW, &maxfiles, 0, "");
|
||||
|
||||
#ifdef JREMOD
|
||||
struct cdevsw fildesc_cdevsw =
|
||||
static struct cdevsw fildesc_cdevsw =
|
||||
{ fdopen, noclose, noread, nowrite, /*22*/
|
||||
noioc, nostop, nullreset, nodevtotty,/*fd(!=Fd)*/
|
||||
noselect, nommap, nostrat };
|
||||
@ -1058,13 +1067,3 @@ SYSINIT(fildescdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,
|
||||
fildesc_drvinit,NULL)
|
||||
|
||||
#endif /* JREMOD */
|
||||
|
||||
|
||||
SYSCTL_PROC(_kern, KERN_FILE, file, CTLTYPE_OPAQUE|CTLFLAG_RD,
|
||||
0, 0, sysctl_kern_file, "");
|
||||
|
||||
SYSCTL_INT(_kern, KERN_MAXFILESPERPROC, maxfilesperproc,
|
||||
CTLFLAG_RD, &maxfilesperproc, 0, "");
|
||||
|
||||
SYSCTL_INT(_kern, KERN_MAXFILES, maxfiles, CTLFLAG_RW, &maxfiles, 0, "");
|
||||
|
||||
|
@ -159,7 +159,7 @@ ntp_sysctl SYSCTL_HANDLER_ARGS
|
||||
SYSCTL_NODE(_kern, KERN_NTP_PLL, ntp_pll, CTLFLAG_RW, 0,
|
||||
"NTP kernel PLL related stuff");
|
||||
SYSCTL_PROC(_kern_ntp_pll, NTP_PLL_GETTIME, gettime, CTLTYPE_OPAQUE|CTLFLAG_RD,
|
||||
0, sizeof(struct ntptimeval) , ntp_sysctl, "");
|
||||
0, sizeof(struct ntptimeval) , ntp_sysctl, "S,ntptimeval", "");
|
||||
|
||||
/*
|
||||
* ntp_adjtime() - NTP daemon application interface
|
||||
|
@ -5,6 +5,9 @@
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Mike Karels at Berkeley Software Design, Inc.
|
||||
*
|
||||
* Quite extensively rewritten by Poul-Henning Kamp of the FreeBSD
|
||||
* project, to make these variables more userfriendly.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
@ -34,11 +37,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94
|
||||
* $Id: kern_sysctl.c,v 1.51 1995/11/16 18:59:49 phk Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* sysctl system call.
|
||||
* $Id: kern_sysctl.c,v 1.52 1995/11/20 12:42:03 phk Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -49,6 +48,7 @@
|
||||
#include <sys/unistd.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/malloc.h>
|
||||
|
||||
/*
|
||||
* Locking and stats
|
||||
@ -63,7 +63,9 @@ static int sysctl_root SYSCTL_HANDLER_ARGS;
|
||||
|
||||
extern struct linker_set sysctl_;
|
||||
|
||||
/* BEGIN_MIB */
|
||||
/*
|
||||
* MIB definitions. XXX Very few of these, if any, belong here.
|
||||
*/
|
||||
SYSCTL_NODE(, 0, sysctl, CTLFLAG_RW, 0,
|
||||
"Sysctl internal magic");
|
||||
SYSCTL_NODE(, CTL_KERN, kern, CTLFLAG_RW, 0,
|
||||
@ -94,8 +96,6 @@ SYSCTL_STRING(_kern, KERN_OSTYPE, ostype, CTLFLAG_RD, ostype, 0, "");
|
||||
extern int osreldate;
|
||||
SYSCTL_INT(_kern, KERN_OSRELDATE, osreldate, CTLFLAG_RD, &osreldate, 0, "");
|
||||
|
||||
SYSCTL_INT(_kern, KERN_MAXVNODES, maxvnodes, CTLFLAG_RD, &desiredvnodes, 0, "");
|
||||
|
||||
SYSCTL_INT(_kern, KERN_MAXPROC, maxproc, CTLFLAG_RD, &maxproc, 0, "");
|
||||
|
||||
SYSCTL_INT(_kern, KERN_MAXPROCPERUID, maxprocperuid,
|
||||
@ -120,37 +120,12 @@ char kernelname[MAXPATHLEN] = "/kernel"; /* XXX bloat */
|
||||
SYSCTL_STRING(_kern, KERN_BOOTFILE, bootfile,
|
||||
CTLFLAG_RW, kernelname, sizeof kernelname, "");
|
||||
|
||||
SYSCTL_STRUCT(_kern, KERN_BOOTTIME, boottime,
|
||||
CTLFLAG_RW, &boottime, timeval, "");
|
||||
|
||||
SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD, machine, 0, "");
|
||||
|
||||
SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD, cpu_model, 0, "");
|
||||
|
||||
SYSCTL_INT(_hw, HW_NCPU, ncpu, CTLFLAG_RD, 0, 1, "");
|
||||
|
||||
SYSCTL_INT(_hw, HW_BYTEORDER, byteorder, CTLFLAG_RD, 0, BYTE_ORDER, "");
|
||||
|
||||
SYSCTL_INT(_hw, HW_PAGESIZE, pagesize, CTLFLAG_RD, 0, PAGE_SIZE, "");
|
||||
|
||||
/* END_MIB */
|
||||
|
||||
extern int vfs_update_wakeup;
|
||||
extern int vfs_update_interval;
|
||||
static int
|
||||
sysctl_kern_updateinterval SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
int error = sysctl_handle_int(oidp,
|
||||
oidp->oid_arg1, oidp->oid_arg2, req);
|
||||
if (!error)
|
||||
wakeup(&vfs_update_wakeup);
|
||||
return error;
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_kern, KERN_UPDATEINTERVAL, update, CTLTYPE_INT|CTLFLAG_RW,
|
||||
&vfs_update_interval, 0, sysctl_kern_updateinterval, "");
|
||||
|
||||
|
||||
char hostname[MAXHOSTNAMELEN];
|
||||
|
||||
SYSCTL_STRING(_kern, KERN_HOSTNAME, hostname, CTLFLAG_RW,
|
||||
@ -174,47 +149,25 @@ sysctl_kern_securelvl SYSCTL_HANDLER_ARGS
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_kern, KERN_SECURELVL, securelevel, CTLTYPE_INT|CTLFLAG_RW,
|
||||
0, 0, sysctl_kern_securelvl, "");
|
||||
0, 0, sysctl_kern_securelvl, "I", "");
|
||||
|
||||
static int
|
||||
sysctl_kern_dumpdev SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
int error;
|
||||
dev_t ndumpdev;
|
||||
char domainname[MAXHOSTNAMELEN];
|
||||
SYSCTL_STRING(_kern, KERN_DOMAINNAME, domainname, CTLFLAG_RW,
|
||||
&domainname, sizeof(domainname), "");
|
||||
|
||||
ndumpdev = dumpdev;
|
||||
error = sysctl_handle_opaque(oidp, &ndumpdev, sizeof ndumpdev, req);
|
||||
if (!error && ndumpdev != dumpdev) {
|
||||
error = setdumpdev(ndumpdev);
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
long hostid;
|
||||
/* Some trouble here, if sizeof (int) != sizeof (long) */
|
||||
SYSCTL_INT(_kern, KERN_HOSTID, hostid, CTLFLAG_RW, &hostid, 0, "");
|
||||
|
||||
SYSCTL_PROC(_kern, KERN_DUMPDEV, dumpdev, CTLTYPE_OPAQUE|CTLFLAG_RW,
|
||||
0, sizeof dumpdev, sysctl_kern_dumpdev, "");
|
||||
/*
|
||||
* End of MIB definitions.
|
||||
*/
|
||||
|
||||
static int
|
||||
sysctl_hw_physmem SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
int error = sysctl_handle_int(oidp, 0, ctob(physmem), req);
|
||||
return (error);
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_hw, HW_PHYSMEM, physmem, CTLTYPE_INT|CTLFLAG_RD,
|
||||
0, 0, sysctl_hw_physmem, "");
|
||||
|
||||
static int
|
||||
sysctl_hw_usermem SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
int error = sysctl_handle_int(oidp, 0,
|
||||
ctob(physmem - cnt.v_wire_count), req);
|
||||
return (error);
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_hw, HW_USERMEM, usermem, CTLTYPE_INT|CTLFLAG_RD,
|
||||
0, 0, sysctl_hw_usermem, "");
|
||||
|
||||
/* END_MIB */
|
||||
/*
|
||||
* Initialization of the MIB tree.
|
||||
*
|
||||
* Order by number in each linker_set.
|
||||
*/
|
||||
|
||||
static int
|
||||
sysctl_order_cmp(const void *a, const void *b)
|
||||
@ -233,10 +186,26 @@ sysctl_order_cmp(const void *a, const void *b)
|
||||
static void
|
||||
sysctl_order(void *arg)
|
||||
{
|
||||
int j;
|
||||
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 && (*oidpp)->oid_number > k)
|
||||
k = (*oidpp)->oid_number;
|
||||
|
||||
/* 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++) {
|
||||
@ -256,6 +225,16 @@ sysctl_order(void *arg)
|
||||
|
||||
SYSINIT(sysctl, SI_SUB_KMEM, SI_ORDER_ANY, sysctl_order, &sysctl_);
|
||||
|
||||
/*
|
||||
* "Staff-functions"
|
||||
*
|
||||
* {0,0} printf the entire MIB-tree.
|
||||
* {0,1,...} return the name of the "..." OID.
|
||||
* {0,2,...} return the next OID.
|
||||
* {0,3} return the OID of the name in "new"
|
||||
* {0,4,...} return the format info for the "..." OID.
|
||||
*/
|
||||
|
||||
static void
|
||||
sysctl_sysctl_debug_dump_node(struct linker_set *l, int i)
|
||||
{
|
||||
@ -306,7 +285,6 @@ sysctl_sysctl_debug_dump_node(struct linker_set *l, int i)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
sysctl_sysctl_debug SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
@ -315,15 +293,289 @@ sysctl_sysctl_debug SYSCTL_HANDLER_ARGS
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_sysctl, 0, debug, CTLTYPE_STRING|CTLFLAG_RD,
|
||||
0, 0, sysctl_sysctl_debug, "");
|
||||
0, 0, sysctl_sysctl_debug, "-", "");
|
||||
|
||||
char domainname[MAXHOSTNAMELEN];
|
||||
SYSCTL_STRING(_kern, KERN_DOMAINNAME, domainname, CTLFLAG_RW,
|
||||
&domainname, sizeof(domainname), "");
|
||||
static int
|
||||
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_;
|
||||
char buf[10];
|
||||
|
||||
long hostid;
|
||||
/* Some trouble here, if sizeof (int) != sizeof (long) */
|
||||
SYSCTL_INT(_kern, KERN_HOSTID, hostid, CTLFLAG_RW, &hostid, 0, "");
|
||||
while (namelen) {
|
||||
if (!lsp) {
|
||||
sprintf(buf,"%d",*name);
|
||||
if (req->oldidx)
|
||||
error = SYSCTL_OUT(req, ".", 1);
|
||||
if (!error)
|
||||
error = SYSCTL_OUT(req, buf, strlen(buf));
|
||||
if (error)
|
||||
return (error);
|
||||
namelen--;
|
||||
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))
|
||||
continue;
|
||||
|
||||
if (req->oldidx)
|
||||
error = SYSCTL_OUT(req, ".", 1);
|
||||
if (!error)
|
||||
error = SYSCTL_OUT(req, (*oidpp)->oid_name,
|
||||
strlen((*oidpp)->oid_name));
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
namelen--;
|
||||
name++;
|
||||
|
||||
if (((*oidpp)->oid_kind & CTLTYPE) != CTLTYPE_NODE)
|
||||
break;
|
||||
|
||||
if ((*oidpp)->oid_handler)
|
||||
break;
|
||||
|
||||
lsp = (struct linker_set*)(*oidpp)->oid_arg1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return (SYSCTL_OUT(req, "", 1));
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
int i, j;
|
||||
struct sysctl_oid **oidpp;
|
||||
|
||||
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;
|
||||
|
||||
if (!namelen) {
|
||||
if (((*oidpp)->oid_kind & CTLTYPE) != CTLTYPE_NODE)
|
||||
return 0;
|
||||
if ((*oidpp)->oid_handler)
|
||||
/* 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 ((*oidpp)->oid_number < *name)
|
||||
continue;
|
||||
|
||||
if ((*oidpp)->oid_number > *name) {
|
||||
if (((*oidpp)->oid_kind & CTLTYPE) != CTLTYPE_NODE)
|
||||
return 0;
|
||||
if ((*oidpp)->oid_handler)
|
||||
return 0;
|
||||
lsp = (struct linker_set*)(*oidpp)->oid_arg1;
|
||||
if (!sysctl_sysctl_next_ls (lsp, name+1, namelen-1,
|
||||
next+1, len, level+1, oidp))
|
||||
return (0);
|
||||
namelen = 1;
|
||||
*len = level;
|
||||
continue;
|
||||
}
|
||||
if (((*oidpp)->oid_kind & CTLTYPE) != CTLTYPE_NODE)
|
||||
continue;
|
||||
|
||||
if ((*oidpp)->oid_handler)
|
||||
continue;
|
||||
|
||||
lsp = (struct linker_set*)(*oidpp)->oid_arg1;
|
||||
if (!sysctl_sysctl_next_ls (lsp, name+1, namelen-1, next+1,
|
||||
len, level+1, oidp))
|
||||
return (0);
|
||||
namelen = 1;
|
||||
*len = level;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
sysctl_sysctl_next SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
int *name = (int *) arg1;
|
||||
u_int namelen = arg2;
|
||||
int i, j, error;
|
||||
struct sysctl_oid *oid;
|
||||
struct linker_set *lsp = &sysctl_;
|
||||
int newoid[CTL_MAXNAME];
|
||||
|
||||
i = sysctl_sysctl_next_ls (lsp, name, namelen, newoid, &j, 1, &oid);
|
||||
if (i)
|
||||
return ENOENT;
|
||||
error = SYSCTL_OUT(req, &oid->oid_kind, sizeof oid->oid_kind);
|
||||
if (!error)
|
||||
error =SYSCTL_OUT(req, newoid, j * sizeof (int));
|
||||
return (error);
|
||||
}
|
||||
|
||||
SYSCTL_NODE(_sysctl, 2, next, CTLFLAG_RD, sysctl_sysctl_next, "");
|
||||
|
||||
static int
|
||||
name2oid (char *name, int *oid, int *len, struct sysctl_oid **oidp)
|
||||
{
|
||||
int i, j;
|
||||
struct sysctl_oid **oidpp;
|
||||
struct linker_set *lsp = &sysctl_;
|
||||
char *p;
|
||||
|
||||
if (!*name)
|
||||
return ENOENT;
|
||||
|
||||
p = name + strlen(name) - 1 ;
|
||||
if (*p == '.')
|
||||
*p = '\0';
|
||||
|
||||
*len = 0;
|
||||
|
||||
for (p = name; *p && *p != '.'; p++)
|
||||
;
|
||||
i = *p;
|
||||
if (i == '.')
|
||||
*p = '\0';
|
||||
|
||||
j = lsp->ls_length;
|
||||
oidpp = (struct sysctl_oid **) lsp->ls_items;
|
||||
|
||||
while (j-- && *len < CTL_MAXNAME) {
|
||||
if (!*oidpp)
|
||||
continue;
|
||||
if (strcmp(name, (*oidpp)->oid_name)) {
|
||||
oidpp++;
|
||||
continue;
|
||||
}
|
||||
*oid++ = (*oidpp)->oid_number;
|
||||
(*len)++;
|
||||
|
||||
if (!i) {
|
||||
if (oidp)
|
||||
*oidp = *oidpp;
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (((*oidpp)->oid_kind & CTLTYPE) != CTLTYPE_NODE)
|
||||
break;
|
||||
|
||||
if ((*oidpp)->oid_handler)
|
||||
break;
|
||||
|
||||
lsp = (struct linker_set*)(*oidpp)->oid_arg1;
|
||||
j = lsp->ls_length;
|
||||
oidpp = (struct sysctl_oid **)lsp->ls_items;
|
||||
name = p+1;
|
||||
for (p = name; *p && *p != '.'; p++)
|
||||
;
|
||||
i = *p;
|
||||
if (i == '.')
|
||||
*p = '\0';
|
||||
}
|
||||
return ENOENT;
|
||||
}
|
||||
|
||||
static int
|
||||
sysctl_sysctl_name2oid SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
char *p;
|
||||
int error, oid[CTL_MAXNAME], len;
|
||||
struct sysctl_oid *op = 0;
|
||||
|
||||
if (!req->newlen)
|
||||
return ENOENT;
|
||||
|
||||
p = malloc(req->newlen+1, M_SYSCTL, M_WAITOK);
|
||||
|
||||
error = SYSCTL_IN(req, p, req->newlen);
|
||||
if (error) {
|
||||
free(p, M_SYSCTL);
|
||||
return (error);
|
||||
}
|
||||
|
||||
p [req->newlen] = '\0';
|
||||
|
||||
error = name2oid(p, oid, &len, &op);
|
||||
|
||||
free(p, M_SYSCTL);
|
||||
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
error = SYSCTL_OUT(req, &op->oid_kind, sizeof op->oid_kind);
|
||||
if (!error)
|
||||
error = SYSCTL_OUT(req, oid, len * sizeof *oid);
|
||||
return (error);
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_sysctl, 3, name2oid, CTLFLAG_RW, 0, 0,
|
||||
sysctl_sysctl_name2oid, "I", "");
|
||||
|
||||
static int
|
||||
sysctl_sysctl_oidfmt SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
int *name = (int *) arg1;
|
||||
u_int namelen = arg2;
|
||||
int indx, j;
|
||||
struct sysctl_oid **oidpp;
|
||||
struct linker_set *lsp = &sysctl_;
|
||||
|
||||
j = lsp->ls_length;
|
||||
oidpp = (struct sysctl_oid **) lsp->ls_items;
|
||||
|
||||
indx = 0;
|
||||
while (j-- && indx < CTL_MAXNAME) {
|
||||
if (*oidpp && ((*oidpp)->oid_number == name[indx])) {
|
||||
indx++;
|
||||
if (((*oidpp)->oid_kind & CTLTYPE) == CTLTYPE_NODE) {
|
||||
if ((*oidpp)->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;
|
||||
} else {
|
||||
if (indx != namelen)
|
||||
return EISDIR;
|
||||
goto found;
|
||||
}
|
||||
} else {
|
||||
oidpp++;
|
||||
}
|
||||
}
|
||||
return ENOENT;
|
||||
found:
|
||||
if (!(*oidpp)->oid_fmt)
|
||||
return ENOENT;
|
||||
return (SYSCTL_OUT(req, (*oidpp)->oid_fmt,
|
||||
strlen((*oidpp)->oid_fmt)+1));
|
||||
}
|
||||
|
||||
|
||||
SYSCTL_NODE(_sysctl, 4, oidfmt, CTLFLAG_RD, sysctl_sysctl_oidfmt, "");
|
||||
|
||||
/*
|
||||
* Default "handler" functions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Handle an integer, signed or unsigned.
|
||||
@ -481,7 +733,7 @@ int
|
||||
sysctl_root SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
int *name = (int *) arg1;
|
||||
int namelen = arg2;
|
||||
u_int namelen = arg2;
|
||||
int indx, i, j;
|
||||
struct sysctl_oid **oidpp;
|
||||
struct linker_set *lsp = &sysctl_;
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)kern_clock.c 8.5 (Berkeley) 1/21/94
|
||||
* $Id: kern_clock.c,v 1.19 1995/11/12 19:51:48 phk Exp $
|
||||
* $Id: kern_clock.c,v 1.20 1995/12/02 17:10:31 bde Exp $
|
||||
*/
|
||||
|
||||
/* Portions of this software are covered by the following: */
|
||||
@ -984,8 +984,8 @@ sysctl_kern_clockrate SYSCTL_HANDLER_ARGS
|
||||
return (sysctl_handle_opaque(oidp, &clkinfo, sizeof clkinfo, req));
|
||||
}
|
||||
|
||||
SYSCTL_OID(_kern, KERN_CLOCKRATE, clockrate,
|
||||
CTLTYPE_STRUCT|CTLFLAG_RD, 0, 0, sysctl_kern_clockrate, "");
|
||||
SYSCTL_PROC(_kern, KERN_CLOCKRATE, clockrate, CTLTYPE_STRUCT|CTLFLAG_RD,
|
||||
0, 0, sysctl_kern_clockrate, "S,clkinfo","");
|
||||
|
||||
/*#ifdef PPS_SYNC*/
|
||||
#if 0
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)kern_clock.c 8.5 (Berkeley) 1/21/94
|
||||
* $Id: kern_clock.c,v 1.19 1995/11/12 19:51:48 phk Exp $
|
||||
* $Id: kern_clock.c,v 1.20 1995/12/02 17:10:31 bde Exp $
|
||||
*/
|
||||
|
||||
/* Portions of this software are covered by the following: */
|
||||
@ -984,8 +984,8 @@ sysctl_kern_clockrate SYSCTL_HANDLER_ARGS
|
||||
return (sysctl_handle_opaque(oidp, &clkinfo, sizeof clkinfo, req));
|
||||
}
|
||||
|
||||
SYSCTL_OID(_kern, KERN_CLOCKRATE, clockrate,
|
||||
CTLTYPE_STRUCT|CTLFLAG_RD, 0, 0, sysctl_kern_clockrate, "");
|
||||
SYSCTL_PROC(_kern, KERN_CLOCKRATE, clockrate, CTLTYPE_STRUCT|CTLFLAG_RD,
|
||||
0, 0, sysctl_kern_clockrate, "S,clkinfo","");
|
||||
|
||||
/*#ifdef PPS_SYNC*/
|
||||
#if 0
|
||||
|
@ -18,7 +18,7 @@
|
||||
* 5. Modifications may be freely made to this file if the above conditions
|
||||
* are met.
|
||||
*
|
||||
* $Id: vfs_bio.c,v 1.72 1995/12/02 17:10:47 bde Exp $
|
||||
* $Id: vfs_bio.c,v 1.73 1995/12/02 18:58:44 bde Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -37,6 +37,7 @@
|
||||
#include <sys/systm.h>
|
||||
#include <sys/sysproto.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <vm/vm.h>
|
||||
@ -1355,6 +1356,20 @@ vfs_update()
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
sysctl_kern_updateinterval SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
int error = sysctl_handle_int(oidp,
|
||||
oidp->oid_arg1, oidp->oid_arg2, req);
|
||||
if (!error)
|
||||
wakeup(&vfs_update_wakeup);
|
||||
return error;
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_kern, KERN_UPDATEINTERVAL, update, CTLTYPE_INT|CTLFLAG_RW,
|
||||
&vfs_update_interval, 0, sysctl_kern_updateinterval, "I", "");
|
||||
|
||||
|
||||
/*
|
||||
* This routine is called in lieu of iodone in the case of
|
||||
* incomplete I/O. This keeps the busy status for pages
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)vfs_init.c 8.3 (Berkeley) 1/4/94
|
||||
* $Id: vfs_init.c,v 1.16 1995/12/02 18:58:43 bde Exp $
|
||||
* $Id: vfs_init.c,v 1.17 1995/12/03 18:00:35 bde Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -302,7 +302,7 @@ sysctl_fs_vfsconf SYSCTL_HANDLER_ARGS
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_fs, FS_VFSCONF, vfsconf, CTLTYPE_OPAQUE|CTLFLAG_RD,
|
||||
0, 0, sysctl_fs_vfsconf, "");
|
||||
0, 0, sysctl_fs_vfsconf, "S,vfsconf", "");
|
||||
|
||||
/*
|
||||
* This goop is here to support a loadable NFS module... grumble...
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)sysctl.h 8.1 (Berkeley) 6/2/93
|
||||
* $Id: sysctl.h,v 1.35 1995/11/20 12:42:39 phk Exp $
|
||||
* $Id: sysctl.h,v 1.36 1995/12/02 20:40:20 phk Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_SYSCTL_H_
|
||||
@ -108,8 +108,9 @@ struct sysctl_oid {
|
||||
int oid_kind;
|
||||
void *oid_arg1;
|
||||
int oid_arg2;
|
||||
char *oid_name;
|
||||
const char *oid_name;
|
||||
int (*oid_handler) SYSCTL_HANDLER_ARGS;
|
||||
const char *oid_fmt;
|
||||
};
|
||||
|
||||
#define SYSCTL_IN(r, p, l) (r->newfunc)(r, p, l)
|
||||
@ -120,42 +121,43 @@ int sysctl_handle_string SYSCTL_HANDLER_ARGS;
|
||||
int sysctl_handle_opaque SYSCTL_HANDLER_ARGS;
|
||||
|
||||
/* This is the "raw" function for a mib-oid */
|
||||
#define SYSCTL_OID(parent, number, name, kind, arg1, arg2, handler, descr) \
|
||||
#define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \
|
||||
static const struct sysctl_oid sysctl__##parent##_##name = { \
|
||||
number, kind, arg1, arg2, #name, handler }; \
|
||||
nbr, kind, a1, a2, #name, handler, fmt }; \
|
||||
TEXT_SET(sysctl_##parent, sysctl__##parent##_##name);
|
||||
|
||||
/* This makes a node from which other oids can hang */
|
||||
#define SYSCTL_NODE(parent, number, name, access, handler, descr) \
|
||||
#define SYSCTL_NODE(parent, nbr, name, access, handler, descr) \
|
||||
extern struct linker_set sysctl_##parent##_##name; \
|
||||
SYSCTL_OID(parent, number, name, CTLTYPE_NODE|access, \
|
||||
(void*)&sysctl_##parent##_##name, 0, handler, descr); \
|
||||
SYSCTL_OID(parent, nbr, name, CTLTYPE_NODE|access, \
|
||||
(void*)&sysctl_##parent##_##name, 0, handler, "N", descr); \
|
||||
TEXT_SET(sysctl_##parent##_##name, sysctl__##parent##_##name);
|
||||
|
||||
/* This is a string len can be 0 to indicate '\0' termination */
|
||||
#define SYSCTL_STRING(parent, number, name, access, arg, len, descr) \
|
||||
SYSCTL_OID(parent, number, name, CTLTYPE_STRING|access, \
|
||||
arg, len, sysctl_handle_string, descr);
|
||||
#define SYSCTL_STRING(parent, nbr, name, access, arg, len, descr) \
|
||||
SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING|access, \
|
||||
arg, len, sysctl_handle_string, "A", descr);
|
||||
|
||||
/* This is a integer, if ptr is NULL, val is returned */
|
||||
#define SYSCTL_INT(parent, number, name, access, ptr, val, descr) \
|
||||
SYSCTL_OID(parent, number, name, CTLTYPE_INT|access, \
|
||||
ptr, val, sysctl_handle_int, descr);
|
||||
#define SYSCTL_INT(parent, nbr, name, access, ptr, val, descr) \
|
||||
SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|access, \
|
||||
ptr, val, sysctl_handle_int, "I", descr);
|
||||
|
||||
/* This is anything, specified by a pointer and a lenth */
|
||||
#define SYSCTL_OPAQUE(parent, number, name, access, ptr, len, descr) \
|
||||
SYSCTL_OID(parent, number, name, CTLTYPE_OPAQUE|access, \
|
||||
ptr, len, sysctl_handle_opaque, descr);
|
||||
#define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, descr) \
|
||||
SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|access, \
|
||||
ptr, len, sysctl_handle_opaque, "O", descr);
|
||||
|
||||
/* This is a struct, specified by a pointer and type */
|
||||
#define SYSCTL_STRUCT(parent, number, name, access, ptr, type, descr) \
|
||||
SYSCTL_OID(parent, number, name, CTLTYPE_OPAQUE|access, \
|
||||
ptr, sizeof(struct type), sysctl_handle_opaque, descr);
|
||||
#define SYSCTL_STRUCT(parent, nbr, name, access, ptr, type, descr) \
|
||||
SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|access, \
|
||||
ptr, sizeof(struct type), sysctl_handle_opaque, \
|
||||
"S," #type, descr);
|
||||
|
||||
/* Needs a proc. Specify by pointer and arg */
|
||||
#define SYSCTL_PROC(parent, number, name, access, ptr, arg, handler, descr) \
|
||||
SYSCTL_OID(parent, number, name, access, \
|
||||
ptr, arg, handler, descr);
|
||||
#define SYSCTL_PROC(parent, nbr, name, access, ptr, arg, handler, fmt, descr) \
|
||||
SYSCTL_OID(parent, nbr, name, access, \
|
||||
ptr, arg, handler, fmt, descr);
|
||||
#endif /* KERNEL */
|
||||
|
||||
/*
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)vm_meter.c 8.4 (Berkeley) 1/4/94
|
||||
* $Id: vm_meter.c,v 1.8 1995/07/29 11:44:25 bde Exp $
|
||||
* $Id: vm_meter.c,v 1.9 1995/11/14 09:29:34 phk Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -41,7 +41,9 @@
|
||||
#include <vm/vm.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
struct loadavg averunnable; /* load average, of runnable procs */
|
||||
struct loadavg averunnable =
|
||||
{ {0, 0, 0}, FSCALE }; /* load average, of runnable procs */
|
||||
|
||||
struct vmmeter cnt;
|
||||
|
||||
int maxslp = MAXSLP;
|
||||
@ -107,16 +109,7 @@ SYSCTL_INT(_vm, VM_V_CACHE_MAX, v_cache_max,
|
||||
SYSCTL_INT(_vm, VM_V_PAGEOUT_FREE_MIN, v_pageout_free_min,
|
||||
CTLFLAG_RW, &cnt.v_pageout_free_min, 0, "");
|
||||
|
||||
static int
|
||||
vm_loadavg SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
averunnable.fscale = FSCALE;
|
||||
return (sysctl_handle_opaque(oidp,
|
||||
oidp->oid_arg1, oidp->oid_arg2, req));
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_vm, VM_LOADAVG, loadavg, CTLTYPE_OPAQUE|CTLFLAG_RD,
|
||||
&averunnable, sizeof(averunnable), vm_loadavg, "");
|
||||
SYSCTL_STRUCT(_vm, VM_LOADAVG, loadavg, CTLFLAG_RD, &averunnable, loadavg, "");
|
||||
|
||||
static int
|
||||
vmtotal SYSCTL_HANDLER_ARGS
|
||||
@ -212,4 +205,4 @@ vmtotal SYSCTL_HANDLER_ARGS
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_vm, VM_METER, vmmeter, CTLTYPE_OPAQUE|CTLFLAG_RD,
|
||||
0, sizeof(struct vmtotal), vmtotal, "");
|
||||
0, sizeof(struct vmtotal), vmtotal, "S,vmtotal", "");
|
||||
|
Loading…
Reference in New Issue
Block a user