Move hw.machine and hw.machine_arch sysctls to base so rump can use them

This allows uname(3) and uname(1) to work on rump kernels.
This commit is contained in:
justin 2015-07-07 12:38:02 +00:00
parent eec608f983
commit 034bfbdba3
3 changed files with 20 additions and 18 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: init_sysctl.c,v 1.207 2015/05/20 11:17:24 pooka Exp $ */
/* $NetBSD: init_sysctl.c,v 1.208 2015/07/07 12:38:02 justin 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.207 2015/05/20 11:17:24 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.208 2015/07/07 12:38:02 justin Exp $");
#include "opt_sysv.h"
#include "opt_compat_netbsd.h"
@ -613,12 +613,6 @@ SYSCTL_SETUP(sysctl_hw_setup, "sysctl hw subtree setup")
u_quad_t q;
const char *model = cpu_getmodel();
sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_STRING, "machine",
SYSCTL_DESCR("Machine class"),
NULL, 0, machine, 0,
CTL_HW, HW_MACHINE, CTL_EOL);
sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_STRING, "model",
@ -657,12 +651,6 @@ SYSCTL_SETUP(sysctl_hw_setup, "sysctl hw subtree setup")
SYSCTL_DESCR("Software page size"),
NULL, PAGE_SIZE, NULL, 0,
CTL_HW, HW_PAGESIZE, CTL_EOL);
sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_STRING, "machine_arch",
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|CTLFLAG_IMMEDIATE,
CTLTYPE_INT, "alignbytes",

View File

@ -1,4 +1,4 @@
/* $NetBSD: init_sysctl_base.c,v 1.3 2014/02/25 18:30:11 pooka Exp $ */
/* $NetBSD: init_sysctl_base.c,v 1.4 2015/07/07 12:38:02 justin Exp $ */
/*-
* Copyright (c) 2003, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@ -30,8 +30,9 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: init_sysctl_base.c,v 1.3 2014/02/25 18:30:11 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: init_sysctl_base.c,v 1.4 2015/07/07 12:38:02 justin Exp $");
#include <sys/cpu.h>
#include <sys/param.h>
#include <sys/sysctl.h>
#include <sys/kernel.h>
@ -179,6 +180,18 @@ SYSCTL_SETUP(sysctl_kernbase_setup, "sysctl kern subtree base setup")
SYSCTL_DESCR("Raw partition of a disk"),
NULL, RAW_PART, NULL, 0,
CTL_KERN, KERN_RAWPARTITION, CTL_EOL);
sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_STRING, "machine",
SYSCTL_DESCR("Machine class"),
NULL, 0, machine, 0,
CTL_HW, HW_MACHINE, CTL_EOL);
sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_STRING, "machine_arch",
SYSCTL_DESCR("Machine CPU class"),
NULL, 0, machine_arch, 0,
CTL_HW, HW_MACHINE_ARCH, CTL_EOL);
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: rump.c,v 1.321 2015/06/08 12:16:47 pooka Exp $ */
/* $NetBSD: rump.c,v 1.322 2015/07/07 12:38:02 justin Exp $ */
/*
* Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved.
@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.321 2015/06/08 12:16:47 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.322 2015/07/07 12:38:02 justin Exp $");
#include <sys/systm.h>
#define ELFSIZE ARCH_ELFSIZE
@ -89,6 +89,7 @@ __KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.321 2015/06/08 12:16:47 pooka Exp $");
#include "rump_dev_private.h"
char machine[] = MACHINE;
char machine_arch[] = MACHINE_ARCH;
struct proc *initproc;