add a "machdep.booted_kernel" sysctl, which is the name of the booted

kernel as supplied by the SRM console's BOOTED_FILE variable.
This commit is contained in:
cgd 1996-12-07 01:54:49 +00:00
parent 5b9f69465f
commit 1a8f25c523
2 changed files with 15 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.60 1996/12/03 19:52:58 cgd Exp $ */
/* $NetBSD: machdep.c,v 1.61 1996/12/07 01:54:49 cgd Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@ -160,6 +160,7 @@ caddr_t le_iomem; /* XXX iomem for LANCE DMA */
int ncpus;
char boot_flags[64];
char booted_kernel[64];
/* for cpu_sysctl() */
char root_device[17];
@ -514,11 +515,17 @@ unknown_cputype:
/*
* Look at arguments passed to us and compute boothowto.
* Also, get kernel name so it can be used in user-land.
*/
prom_getenv(PROM_E_BOOTED_OSFLAGS, boot_flags, sizeof(boot_flags));
#if 0
printf("boot flags = \"%s\"\n", boot_flags);
#endif
prom_getenv(PROM_E_BOOTED_FILE, booted_kernel,
sizeof(booted_kernel));
#if 0
printf("booted kernel = \"%s\"\n", booted_kernel);
#endif
boothowto = RB_SINGLE;
#ifdef KADB
@ -1335,6 +1342,9 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
return (sysctl_int(oldp, oldlenp, newp, newlen,
&alpha_unaligned_sigbus));
case CPU_BOOTED_KERNEL:
return (sysctl_rdstring(oldp, oldlenp, newp, booted_kernel));
default:
return (EOPNOTSUPP);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.13 1996/11/13 21:13:18 cgd Exp $ */
/* $NetBSD: cpu.h,v 1.14 1996/12/07 01:54:50 cgd Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -109,7 +109,8 @@ u_int64_t want_resched; /* resched() was called */
#define CPU_UNALIGNED_PRINT 3 /* int: print unaligned accesses */
#define CPU_UNALIGNED_FIX 4 /* int: fix unaligned accesses */
#define CPU_UNALIGNED_SIGBUS 5 /* int: SIGBUS unaligned accesses */
#define CPU_MAXID 6 /* 5 valid machdep IDs */
#define CPU_BOOTED_KERNEL 6 /* string: booted kernel name */
#define CPU_MAXID 7 /* 6 valid machdep IDs */
#define CTL_MACHDEP_NAMES { \
{ 0, 0 }, \
@ -118,6 +119,7 @@ u_int64_t want_resched; /* resched() was called */
{ "unaligned_print", CTLTYPE_INT }, \
{ "unaligned_fix", CTLTYPE_INT }, \
{ "unaligned_sigbus", CTLTYPE_INT }, \
{ "booted_kernel", CTLTYPE_STRING }, \
}
#ifdef _KERNEL