Implement sysctl `machdep.booted_kernel'.
This commit is contained in:
parent
ef0ba32b7d
commit
fa65ea182c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cpu.h,v 1.33 1999/08/10 21:08:09 thorpej Exp $ */
|
||||
/* $NetBSD: cpu.h,v 1.34 1999/10/04 19:11:43 pk Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -50,10 +50,12 @@
|
|||
/*
|
||||
* CTL_MACHDEP definitions.
|
||||
*/
|
||||
#define CPU_MAXID 1 /* no valid machdep ids */
|
||||
#define CPU_BOOTED_KERNEL 1 /* string: booted kernel name */
|
||||
#define CPU_MAXID 2 /* number of valid machdep ids */
|
||||
|
||||
#define CTL_MACHDEP_NAMES { \
|
||||
{ 0, 0 }, \
|
||||
#define CTL_MACHDEP_NAMES { \
|
||||
{ 0, 0 }, \
|
||||
{ "booted_kernel", CTLTYPE_STRING }, \
|
||||
}
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.154 1999/09/17 20:04:53 thorpej Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.155 1999/10/04 19:11:42 pk Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -407,12 +407,18 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
|
|||
size_t newlen;
|
||||
struct proc *p;
|
||||
{
|
||||
char *cp;
|
||||
|
||||
/* all sysctl names are this level are terminal */
|
||||
if (namelen != 1)
|
||||
return (ENOTDIR); /* overloaded */
|
||||
|
||||
switch (name[0]) {
|
||||
case CPU_BOOTED_KERNEL:
|
||||
cp = prom_getbootfile();
|
||||
if (cp == NULL || cp[0] == '\0')
|
||||
return (ENOENT);
|
||||
return (sysctl_rdstring(oldp, oldlenp, newp, cp));
|
||||
default:
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue