svn commit: r246246 - in head/sys: conf kern sys
Andriy Gapon
avg at FreeBSD.org
Sat Feb 2 11:58:36 UTC 2013
Author: avg
Date: Sat Feb 2 11:58:35 2013
New Revision: 246246
URL: http://svnweb.freebsd.org/changeset/base/246246
Log:
print compiler version in the kernel banner
And provide kernel compiler version as a sysctl as well.
This is useful while we have gcc and clang cohabitation.
This could be even more useful when we have support
for external toolchains.
In cooperation with: mjg
MFC after: 13 days
Modified:
head/sys/conf/newvers.sh
head/sys/kern/init_main.c
head/sys/kern/kern_mib.c
head/sys/sys/systm.h
Modified: head/sys/conf/newvers.sh
==============================================================================
--- head/sys/conf/newvers.sh Sat Feb 2 11:54:00 2013 (r246245)
+++ head/sys/conf/newvers.sh Sat Feb 2 11:58:35 2013 (r246246)
@@ -86,6 +86,7 @@ fi
touch version
v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} t=`date`
i=`${MAKE:-make} -V KERN_IDENT`
+compiler_v=$($(${MAKE:-make} -V CC) -v 2>&1 | grep 'version')
for dir in /bin /usr/bin /usr/local/bin; do
if [ -x "${dir}/svnversion" ] && [ -z ${svnversion} ] ; then
@@ -159,6 +160,7 @@ $COPYRIGHT
char sccs[sizeof(SCCSSTR) > 128 ? sizeof(SCCSSTR) : 128] = SCCSSTR;
char version[sizeof(VERSTR) > 256 ? sizeof(VERSTR) : 256] = VERSTR;
+char compiler_version[] = "${compiler_v}";
char ostype[] = "${TYPE}";
char osrelease[sizeof(RELSTR) > 32 ? sizeof(RELSTR) : 32] = RELSTR;
int osreldate = ${RELDATE};
Modified: head/sys/kern/init_main.c
==============================================================================
--- head/sys/kern/init_main.c Sat Feb 2 11:54:00 2013 (r246245)
+++ head/sys/kern/init_main.c Sat Feb 2 11:58:35 2013 (r246246)
@@ -325,6 +325,7 @@ print_version(void *data __unused)
while (len > 0 && version[len - 1] == '\n')
len--;
printf("%.*s %s\n", len, version, machine);
+ printf("%s\n", compiler_version);
}
SYSINIT(announce, SI_SUB_COPYRIGHT, SI_ORDER_FIRST, print_caddr_t,
Modified: head/sys/kern/kern_mib.c
==============================================================================
--- head/sys/kern/kern_mib.c Sat Feb 2 11:54:00 2013 (r246245)
+++ head/sys/kern/kern_mib.c Sat Feb 2 11:58:35 2013 (r246246)
@@ -99,6 +99,9 @@ SYSCTL_INT(_kern, KERN_OSREV, osrevision
SYSCTL_STRING(_kern, KERN_VERSION, version, CTLFLAG_RD|CTLFLAG_MPSAFE,
version, 0, "Kernel version");
+SYSCTL_STRING(_kern, KERN_VERSION, compiler_version, CTLFLAG_RD|CTLFLAG_MPSAFE,
+ compiler_version, 0, "Version of compiler used to compile kernel");
+
SYSCTL_STRING(_kern, KERN_OSTYPE, ostype, CTLFLAG_RD|CTLFLAG_MPSAFE|
CTLFLAG_CAPRD, ostype, 0, "Operating system type");
Modified: head/sys/sys/systm.h
==============================================================================
--- head/sys/sys/systm.h Sat Feb 2 11:54:00 2013 (r246245)
+++ head/sys/sys/systm.h Sat Feb 2 11:58:35 2013 (r246246)
@@ -49,6 +49,7 @@ extern int cold; /* nonzero if we are d
extern int rebooting; /* kern_reboot() has been called. */
extern const char *panicstr; /* panic message */
extern char version[]; /* system version */
+extern char compiler_version[]; /* system version */
extern char copyright[]; /* system copyright */
extern int kstack_pages; /* number of kernel stack pages */
More information about the svn-src-all
mailing list