summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjmallett <jmallett@FreeBSD.org>2003-06-09 09:38:20 +0000
committerjmallett <jmallett@FreeBSD.org>2003-06-09 09:38:20 +0000
commitf315e03eafe4decb20f007ba50f2c0bbd07209aa (patch)
tree63448f4636bc01d8e3847824509199f59c05b3b2 /sys
parent0e96b35689d627ad5cfe6b881520841fae6da5c6 (diff)
downloadFreeBSD-src-f315e03eafe4decb20f007ba50f2c0bbd07209aa.zip
FreeBSD-src-f315e03eafe4decb20f007ba50f2c0bbd07209aa.tar.gz
Make kernel identification (`ident' in the config(8) driver) available to
userland, and the kernel. In the kernel by way of the 'ident[]' variable akin to all the other stuff generated by newvers.sh. In userland it is available to sysctl consumers via KERN_IDENT or 'kern.ident'. It is exported by uname(1) by the -i flag. Reviewed by: hackers@
Diffstat (limited to 'sys')
-rw-r--r--sys/conf/newvers.sh2
-rw-r--r--sys/sys/sysctl.h5
2 files changed, 6 insertions, 1 deletions
diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh
index ce2d31d..d27e926 100644
--- a/sys/conf/newvers.sh
+++ b/sys/conf/newvers.sh
@@ -86,6 +86,7 @@ fi
touch version
v=`cat version` u=${USER-root} d=`pwd` h=`hostname` t=`date`
+i=`make -V KERN_IDENT`
cat << EOF > vers.c
$COPYRIGHT
char sccspad[32 - 4 /* sizeof(sccs) */] = { '\\0' };
@@ -94,6 +95,7 @@ char version[] = "${VERSION} #${v}: ${t}\\n ${u}@${h}:${d}\\n";
char ostype[] = "${TYPE}";
char osrelease[] = "${RELEASE}";
int osreldate = ${RELDATE};
+char ident[] = "${i}";
EOF
echo `expr ${v} + 1` > version
diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h
index 8762e72..7cbc2c2 100644
--- a/sys/sys/sysctl.h
+++ b/sys/sys/sysctl.h
@@ -354,7 +354,8 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);
#define KERN_USRSTACK 33 /* int: address of USRSTACK */
#define KERN_LOGSIGEXIT 34 /* int: do we log sigexit procs? */
#define KERN_IOV_MAX 35 /* int: value of UIO_MAXIOV */
-#define KERN_MAXID 36 /* number of valid kern ids */
+#define KERN_IDENT 36 /* string: kernel ident */
+#define KERN_MAXID 37 /* number of valid kern ids */
#define CTL_KERN_NAMES { \
{ 0, 0 }, \
@@ -392,6 +393,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);
{ "usrstack", CTLTYPE_INT }, \
{ "logsigexit", CTLTYPE_INT }, \
{ "iov_max", CTLTYPE_INT }, \
+ { "ident", CTLTYPE_STRING }, \
}
/*
@@ -581,6 +583,7 @@ SYSCTL_DECL(_compat);
extern char machine[];
extern char osrelease[];
extern char ostype[];
+extern char ident[];
/* Dynamic oid handling */
struct sysctl_oid *sysctl_add_oid(struct sysctl_ctx_list *clist,
OpenPOWER on IntegriCloud