diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 3cb211b..50fe46f 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -150,6 +150,7 @@ if [ -n "$p4_cmd" ] ; then esac fi +compiler=`cc --version | head -1` cat << EOF > vers.c $COPYRIGHT @@ -163,6 +164,7 @@ char ostype[] = "${TYPE}"; char osrelease[sizeof(RELSTR) > 32 ? sizeof(RELSTR) : 32] = RELSTR; int osreldate = ${RELDATE}; char kern_ident[] = "${i}"; +char compiler[] = "${compiler}"; EOF echo $((v + 1)) > version diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index c30e1a2..3e5fbf1 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -327,11 +327,19 @@ print_version(void *data __unused) printf("%.*s %s\n", len, version, machine); } +static void +print_compiler(void *data __unused) +{ + + printf("Compiled with %s\n", compiler); +} + SYSINIT(announce, SI_SUB_COPYRIGHT, SI_ORDER_FIRST, print_caddr_t, copyright); SYSINIT(trademark, SI_SUB_COPYRIGHT, SI_ORDER_SECOND, print_caddr_t, trademark); SYSINIT(version, SI_SUB_COPYRIGHT, SI_ORDER_THIRD, print_version, NULL); +SYSINIT(compiler, SI_SUB_COPYRIGHT, SI_ORDER_THIRD, print_compiler, NULL); #ifdef WITNESS static char wit_warn[] = @@ -351,6 +359,9 @@ SYSINIT(diagwarn2, SI_SUB_RUN_SCHEDULER, SI_ORDER_THIRD + 2, print_caddr_t, diag_warn); #endif +SYSCTL_STRING(_kern, OID_AUTO, compiler, CTLFLAG_RD, compiler, 0, + "Compiler used to build this kernel"); + static int null_fetch_syscall_args(struct thread *td __unused, struct syscall_args *sa __unused) diff --git a/sys/sys/systm.h b/sys/sys/systm.h index fec77d2..d7f79eb 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -49,6 +49,7 @@ extern int cold; /* nonzero if we are doing a cold boot */ extern int rebooting; /* kern_reboot() has been called. */ extern const char *panicstr; /* panic message */ extern char version[]; /* system version */ +extern char compiler[]; /* used compiler */ extern char copyright[]; /* system copyright */ extern int kstack_pages; /* number of kernel stack pages */