From 7f8e46d66acbcb20e98280a1f7a759d7f654a4c5 Mon Sep 17 00:00:00 2001 From: apb Date: Sun, 3 Aug 2014 09:15:21 +0000 Subject: [PATCH] BUILDINFO part 2: expose sysctl kern.buildinfo --- share/man/man7/sysctl.7 | 8 ++++++-- sys/kern/init_sysctl.c | 23 +++++++++++++++-------- sys/sys/systm.h | 3 ++- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/share/man/man7/sysctl.7 b/share/man/man7/sysctl.7 index 65da2492636e..316a86972134 100644 --- a/share/man/man7/sysctl.7 +++ b/share/man/man7/sysctl.7 @@ -1,4 +1,4 @@ -.\" $NetBSD: sysctl.7,v 1.84 2014/07/17 13:42:02 njoly Exp $ +.\" $NetBSD: sysctl.7,v 1.85 2014/08/03 09:15:21 apb Exp $ .\" .\" Copyright (c) 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)sysctl.3 8.4 (Berkeley) 5/9/95 .\" -.Dd July 17, 2014 +.Dd August 3, 2014 .Dt SYSCTL 7 .Os .Sh NAME @@ -280,6 +280,7 @@ privilege may change the value. .It kern.argmax integer no .It kern.boothowto integer no .It kern.boottime struct timeval no +.It kern.buildinfo string no .\".It kern.bufq node not applicable .It kern.ccpu integer no .It kern.clockrate struct clockinfo no @@ -398,6 +399,9 @@ A .Vt struct timeval structure is returned. This structure contains the time that the system was booted. +.It Li kern.buildinfo +When the kernel is built, the build environment may optionally provide +arbitrary information to be stored in this variable. .\" .It Li kern.bufq .\" XXX: Undocumented. .It Li kern.ccpu ( KERN_CCPU ) diff --git a/sys/kern/init_sysctl.c b/sys/kern/init_sysctl.c index fc3224571d44..81f66b0f4866 100644 --- a/sys/kern/init_sysctl.c +++ b/sys/kern/init_sysctl.c @@ -1,4 +1,4 @@ -/* $NetBSD: init_sysctl.c,v 1.203 2014/05/08 08:21:53 hannken Exp $ */ +/* $NetBSD: init_sysctl.c,v 1.204 2014/08/03 09:15:21 apb Exp $ */ /*- * Copyright (c) 2003, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.203 2014/05/08 08:21:53 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.204 2014/08/03 09:15:21 apb Exp $"); #include "opt_sysv.h" #include "opt_compat_netbsd.h" @@ -610,6 +610,19 @@ SYSCTL_SETUP(sysctl_kern_setup, "sysctl kern subtree setup") "it doesn't"), NULL, 1, NULL, 0, CTL_KERN, CTL_CREATE, CTL_EOL); + sysctl_createv(clog, 0, NULL, NULL, + CTLFLAG_PERMANENT, + CTLTYPE_STRING, "configname", + SYSCTL_DESCR("Name of config file"), + NULL, 0, __UNCONST(kernel_ident), 0, + CTL_KERN, CTL_CREATE, CTL_EOL); + sysctl_createv(clog, 0, NULL, NULL, + CTLFLAG_PERMANENT, + CTLTYPE_STRING, "buildinfo", + SYSCTL_DESCR("Information from build environment"), + NULL, 0, __UNCONST(buildinfo), 0, + CTL_KERN, CTL_CREATE, CTL_EOL); + /* kern.posix. */ sysctl_createv(clog, 0, NULL, &rnode, CTLFLAG_PERMANENT, @@ -623,12 +636,6 @@ SYSCTL_SETUP(sysctl_kern_setup, "sysctl kern subtree setup") SYSCTL_DESCR("Maximal number of semaphores"), NULL, 0, &ksem_max, 0, CTL_CREATE, CTL_EOL); - sysctl_createv(clog, 0, NULL, NULL, - CTLFLAG_PERMANENT, - CTLTYPE_STRING, "configname", - SYSCTL_DESCR("Name of config file"), - NULL, 0, __UNCONST(kernel_ident), 0, - CTL_KERN, CTL_CREATE, CTL_EOL); } SYSCTL_SETUP(sysctl_hw_setup, "sysctl hw subtree setup") diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 5038e0ad5430..5219e43a2b3b 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -1,4 +1,4 @@ -/* $NetBSD: systm.h,v 1.264 2014/07/17 14:55:32 riastradh Exp $ */ +/* $NetBSD: systm.h,v 1.265 2014/08/03 09:15:21 apb Exp $ */ /*- * Copyright (c) 1982, 1988, 1991, 1993 @@ -73,6 +73,7 @@ extern const char osrelease[]; /* short system version */ extern const char ostype[]; /* system type */ extern const char kernel_ident[];/* kernel configuration ID */ extern const char version[]; /* system version */ +extern const char buildinfo[]; /* infomation from build environment */ extern int autonicetime; /* time (in seconds) before autoniceval */ extern int autoniceval; /* proc priority after autonicetime */