Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Move a bunch of sysctl nodes from init_sysctl (kitc...
details: https://anonhg.NetBSD.org/src/rev/cce25bb535d4
branches: trunk
changeset: 340185:cce25bb535d4
user: pooka <pooka%NetBSD.org@localhost>
date: Tue Aug 25 14:52:31 2015 +0000
description:
Move a bunch of sysctl nodes from init_sysctl (kitchen sink sysctl file)
to init_sysctl_base (only base kernel defs). Main motivation was to
fix sysconf(_SC_NPROCESSORS) for Rumprun. As reported by neeraj on irc,
it returned -1 before this fix, so we were doing imaginary computing.
diffstat:
sys/kern/init_sysctl.c | 61 ++------------------------------------------
sys/kern/init_sysctl_base.c | 59 ++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 60 insertions(+), 60 deletions(-)
diffs (192 lines):
diff -r 55804b8dd3e1 -r cce25bb535d4 sys/kern/init_sysctl.c
--- a/sys/kern/init_sysctl.c Tue Aug 25 14:47:39 2015 +0000
+++ b/sys/kern/init_sysctl.c Tue Aug 25 14:52:31 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: init_sysctl.c,v 1.208 2015/07/07 12:38:02 justin Exp $ */
+/* $NetBSD: init_sysctl.c,v 1.209 2015/08/25 14:52:31 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.208 2015/07/07 12:38:02 justin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.209 2015/08/25 14:52:31 pooka Exp $");
#include "opt_sysv.h"
#include "opt_compat_netbsd.h"
@@ -607,82 +607,27 @@
CTL_CREATE, CTL_EOL);
}
-SYSCTL_SETUP(sysctl_hw_setup, "sysctl hw subtree setup")
+SYSCTL_SETUP(sysctl_hw_misc_setup, "sysctl hw subtree misc setup")
{
- u_int u;
- u_quad_t q;
- const char *model = cpu_getmodel();
sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
- CTLTYPE_STRING, "model",
- SYSCTL_DESCR("Machine model"),
- NULL, 0, __UNCONST(model), 0,
- CTL_HW, HW_MODEL, CTL_EOL);
- sysctl_createv(clog, 0, NULL, NULL,
- CTLFLAG_PERMANENT,
- CTLTYPE_INT, "ncpu",
- SYSCTL_DESCR("Number of CPUs configured"),
- NULL, 0, &ncpu, 0,
- CTL_HW, HW_NCPU, CTL_EOL);
- sysctl_createv(clog, 0, NULL, NULL,
- CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
- CTLTYPE_INT, "byteorder",
- SYSCTL_DESCR("System byte order"),
- NULL, BYTE_ORDER, NULL, 0,
- CTL_HW, HW_BYTEORDER, CTL_EOL);
- u = ((u_int)physmem > (UINT_MAX / PAGE_SIZE)) ?
- UINT_MAX : physmem * PAGE_SIZE;
- sysctl_createv(clog, 0, NULL, NULL,
- CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
- CTLTYPE_INT, "physmem",
- SYSCTL_DESCR("Bytes of physical memory"),
- NULL, u, NULL, 0,
- CTL_HW, HW_PHYSMEM, CTL_EOL);
- sysctl_createv(clog, 0, NULL, NULL,
- CTLFLAG_PERMANENT,
CTLTYPE_INT, "usermem",
SYSCTL_DESCR("Bytes of non-kernel memory"),
sysctl_hw_usermem, 0, NULL, 0,
CTL_HW, HW_USERMEM, CTL_EOL);
sysctl_createv(clog, 0, NULL, NULL,
- CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
- CTLTYPE_INT, "pagesize",
- SYSCTL_DESCR("Software page size"),
- NULL, PAGE_SIZE, NULL, 0,
- CTL_HW, HW_PAGESIZE, CTL_EOL);
- sysctl_createv(clog, 0, NULL, NULL,
- CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
- CTLTYPE_INT, "alignbytes",
- SYSCTL_DESCR("Alignment constraint for all possible "
- "data types"),
- NULL, ALIGNBYTES, NULL, 0,
- CTL_HW, HW_ALIGNBYTES, CTL_EOL);
- sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE|CTLFLAG_HEX,
CTLTYPE_STRING, "cnmagic",
SYSCTL_DESCR("Console magic key sequence"),
sysctl_hw_cnmagic, 0, NULL, CNS_LEN,
CTL_HW, HW_CNMAGIC, CTL_EOL);
- q = (u_quad_t)physmem * PAGE_SIZE;
- sysctl_createv(clog, 0, NULL, NULL,
- CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
- CTLTYPE_QUAD, "physmem64",
- SYSCTL_DESCR("Bytes of physical memory"),
- NULL, q, NULL, 0,
- CTL_HW, HW_PHYSMEM64, CTL_EOL);
sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_QUAD, "usermem64",
SYSCTL_DESCR("Bytes of non-kernel memory"),
sysctl_hw_usermem, 0, NULL, 0,
CTL_HW, HW_USERMEM64, CTL_EOL);
- sysctl_createv(clog, 0, NULL, NULL,
- CTLFLAG_PERMANENT,
- CTLTYPE_INT, "ncpuonline",
- SYSCTL_DESCR("Number of CPUs online"),
- NULL, 0, &ncpuonline, 0,
- CTL_HW, HW_NCPUONLINE, CTL_EOL);
}
#ifdef DEBUG
diff -r 55804b8dd3e1 -r cce25bb535d4 sys/kern/init_sysctl_base.c
--- a/sys/kern/init_sysctl_base.c Tue Aug 25 14:47:39 2015 +0000
+++ b/sys/kern/init_sysctl_base.c Tue Aug 25 14:52:31 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: init_sysctl_base.c,v 1.6 2015/08/25 14:32:34 pooka Exp $ */
+/* $NetBSD: init_sysctl_base.c,v 1.7 2015/08/25 14:52:31 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_base.c,v 1.6 2015/08/25 14:32:34 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_sysctl_base.c,v 1.7 2015/08/25 14:52:31 pooka Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -185,9 +185,18 @@
SYSCTL_SETUP(sysctl_hwbase_setup, "sysctl hw subtree base setup")
{
+ u_int u;
+ u_quad_t q;
+ const char *model = cpu_getmodel();
sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
+ CTLTYPE_STRING, "model",
+ SYSCTL_DESCR("Machine model"),
+ NULL, 0, __UNCONST(model), 0,
+ CTL_HW, HW_MODEL, CTL_EOL);
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT,
CTLTYPE_STRING, "machine",
SYSCTL_DESCR("Machine class"),
NULL, 0, machine, 0,
@@ -198,6 +207,52 @@
SYSCTL_DESCR("Machine CPU class"),
NULL, 0, machine_arch, 0,
CTL_HW, HW_MACHINE_ARCH, CTL_EOL);
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT,
+ CTLTYPE_INT, "ncpu",
+ SYSCTL_DESCR("Number of CPUs configured"),
+ NULL, 0, &ncpu, 0,
+ CTL_HW, HW_NCPU, CTL_EOL);
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
+ CTLTYPE_INT, "byteorder",
+ SYSCTL_DESCR("System byte order"),
+ NULL, BYTE_ORDER, NULL, 0,
+ CTL_HW, HW_BYTEORDER, CTL_EOL);
+ u = ((u_int)physmem > (UINT_MAX / PAGE_SIZE)) ?
+ UINT_MAX : physmem * PAGE_SIZE;
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
+ CTLTYPE_INT, "physmem",
+ SYSCTL_DESCR("Bytes of physical memory"),
+ NULL, u, NULL, 0,
+ CTL_HW, HW_PHYSMEM, CTL_EOL);
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
+ CTLTYPE_INT, "pagesize",
+ SYSCTL_DESCR("Software page size"),
+ NULL, PAGE_SIZE, NULL, 0,
+ CTL_HW, HW_PAGESIZE, CTL_EOL);
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
+ CTLTYPE_INT, "alignbytes",
+ SYSCTL_DESCR("Alignment constraint for all possible "
+ "data types"),
+ NULL, ALIGNBYTES, NULL, 0,
+ CTL_HW, HW_ALIGNBYTES, CTL_EOL);
+ q = (u_quad_t)physmem * PAGE_SIZE;
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
+ CTLTYPE_QUAD, "physmem64",
+ SYSCTL_DESCR("Bytes of physical memory"),
+ NULL, q, NULL, 0,
+ CTL_HW, HW_PHYSMEM64, CTL_EOL);
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT,
+ CTLTYPE_INT, "ncpuonline",
+ SYSCTL_DESCR("Number of CPUs online"),
+ NULL, 0, &ncpuonline, 0,
+ CTL_HW, HW_NCPUONLINE, CTL_EOL);
}
/*
Home |
Main Index |
Thread Index |
Old Index