move clock sysctls from init_sysctl.c to kern_clock.c
This commit is contained in:
parent
6d5d1af88e
commit
da6e50ee29
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: init_sysctl.c,v 1.204 2014/08/03 09:15:21 apb Exp $ */
|
||||
/* $NetBSD: init_sysctl.c,v 1.205 2015/04/22 16:42:24 pooka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003, 2007, 2008, 2009 The NetBSD Foundation, Inc.
|
||||
@ -30,7 +30,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.204 2014/08/03 09:15:21 apb Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.205 2015/04/22 16:42:24 pooka Exp $");
|
||||
|
||||
#include "opt_sysv.h"
|
||||
#include "opt_compat_netbsd.h"
|
||||
@ -105,7 +105,6 @@ static int sysctl_kern_maxvnodes(SYSCTLFN_PROTO);
|
||||
static int sysctl_kern_rtc_offset(SYSCTLFN_PROTO);
|
||||
static int sysctl_kern_maxproc(SYSCTLFN_PROTO);
|
||||
static int sysctl_kern_hostid(SYSCTLFN_PROTO);
|
||||
static int sysctl_kern_clockrate(SYSCTLFN_PROTO);
|
||||
static int sysctl_msgbuf(SYSCTLFN_PROTO);
|
||||
static int sysctl_kern_defcorename(SYSCTLFN_PROTO);
|
||||
static int sysctl_kern_cptime(SYSCTLFN_PROTO);
|
||||
@ -174,19 +173,6 @@ SYSCTL_SETUP(sysctl_kern_setup, "sysctl kern subtree setup")
|
||||
SYSCTL_DESCR("System host ID number"),
|
||||
sysctl_kern_hostid, 0, NULL, 0,
|
||||
CTL_KERN, KERN_HOSTID, CTL_EOL);
|
||||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT,
|
||||
CTLTYPE_STRUCT, "clockrate",
|
||||
SYSCTL_DESCR("Kernel clock rates"),
|
||||
sysctl_kern_clockrate, 0, NULL,
|
||||
sizeof(struct clockinfo),
|
||||
CTL_KERN, KERN_CLOCKRATE, CTL_EOL);
|
||||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT,
|
||||
CTLTYPE_INT, "hardclock_ticks",
|
||||
SYSCTL_DESCR("Number of hardclock ticks"),
|
||||
NULL, 0, &hardclock_ticks, sizeof(hardclock_ticks),
|
||||
CTL_KERN, KERN_HARDCLOCK_TICKS, CTL_EOL);
|
||||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT,
|
||||
CTLTYPE_STRUCT, "vnode",
|
||||
@ -955,27 +941,6 @@ sysctl_kern_hostid(SYSCTLFN_ARGS)
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* sysctl helper routine for kern.clockrate. Assembles a struct on
|
||||
* the fly to be returned to the caller.
|
||||
*/
|
||||
static int
|
||||
sysctl_kern_clockrate(SYSCTLFN_ARGS)
|
||||
{
|
||||
struct clockinfo clkinfo;
|
||||
struct sysctlnode node;
|
||||
|
||||
clkinfo.tick = tick;
|
||||
clkinfo.tickadj = tickadj;
|
||||
clkinfo.hz = hz;
|
||||
clkinfo.profhz = profhz;
|
||||
clkinfo.stathz = stathz ? stathz : hz;
|
||||
|
||||
node = *rnode;
|
||||
node.sysctl_data = &clkinfo;
|
||||
return (sysctl_lookup(SYSCTLFN_CALL(&node)));
|
||||
}
|
||||
|
||||
/*
|
||||
* sysctl helper routine for kern.msgbufsize and kern.msgbuf. For the
|
||||
* former it merely checks the message buffer is set up. For the latter,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kern_clock.c,v 1.131 2012/12/02 01:05:16 chs Exp $ */
|
||||
/* $NetBSD: kern_clock.c,v 1.132 2015/04/22 16:42:24 pooka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000, 2004, 2006, 2007, 2008 The NetBSD Foundation, Inc.
|
||||
@ -69,7 +69,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_clock.c,v 1.131 2012/12/02 01:05:16 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_clock.c,v 1.132 2015/04/22 16:42:24 pooka Exp $");
|
||||
|
||||
#include "opt_dtrace.h"
|
||||
#include "opt_ntp.h"
|
||||
@ -101,6 +101,8 @@ __KERNEL_RCSID(0, "$NetBSD: kern_clock.c,v 1.131 2012/12/02 01:05:16 chs Exp $")
|
||||
cyclic_clock_func_t cyclic_clock_func[MAXCPUS];
|
||||
#endif
|
||||
|
||||
static int sysctl_kern_clockrate(SYSCTLFN_PROTO);
|
||||
|
||||
/*
|
||||
* Clock handling routines.
|
||||
*
|
||||
@ -161,6 +163,7 @@ get_intr_timecount(struct timecounter *tc)
|
||||
void
|
||||
initclocks(void)
|
||||
{
|
||||
static struct sysctllog *clog;
|
||||
int i;
|
||||
|
||||
/*
|
||||
@ -190,6 +193,19 @@ initclocks(void)
|
||||
panic("hardscheddiv");
|
||||
}
|
||||
|
||||
sysctl_createv(&clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT,
|
||||
CTLTYPE_STRUCT, "clockrate",
|
||||
SYSCTL_DESCR("Kernel clock rates"),
|
||||
sysctl_kern_clockrate, 0, NULL,
|
||||
sizeof(struct clockinfo),
|
||||
CTL_KERN, KERN_CLOCKRATE, CTL_EOL);
|
||||
sysctl_createv(&clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT,
|
||||
CTLTYPE_INT, "hardclock_ticks",
|
||||
SYSCTL_DESCR("Number of hardclock ticks"),
|
||||
NULL, 0, &hardclock_ticks, sizeof(hardclock_ticks),
|
||||
CTL_KERN, KERN_HARDCLOCK_TICKS, CTL_EOL);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -449,3 +465,24 @@ statclock(struct clockframe *frame)
|
||||
mutex_spin_exit(&p->p_stmutex);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* sysctl helper routine for kern.clockrate. Assembles a struct on
|
||||
* the fly to be returned to the caller.
|
||||
*/
|
||||
static int
|
||||
sysctl_kern_clockrate(SYSCTLFN_ARGS)
|
||||
{
|
||||
struct clockinfo clkinfo;
|
||||
struct sysctlnode node;
|
||||
|
||||
clkinfo.tick = tick;
|
||||
clkinfo.tickadj = tickadj;
|
||||
clkinfo.hz = hz;
|
||||
clkinfo.profhz = profhz;
|
||||
clkinfo.stathz = stathz ? stathz : hz;
|
||||
|
||||
node = *rnode;
|
||||
node.sysctl_data = &clkinfo;
|
||||
return (sysctl_lookup(SYSCTLFN_CALL(&node)));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user