diff options
author | Thorsten Lockert <tholo@cvs.openbsd.org> | 1996-06-29 21:02:53 +0000 |
---|---|---|
committer | Thorsten Lockert <tholo@cvs.openbsd.org> | 1996-06-29 21:02:53 +0000 |
commit | 6c0cbd0961931b28647ef3e5f42668a3f66df0f4 (patch) | |
tree | 9666bebbbe7d815c979e4008a0d4dd3352ee4254 | |
parent | ca25e022f078e36e47224e252b65c68d25ad7897 (diff) |
Make uname(1) and uname(3) do sane things for the version field; now will
show only "KERNEL#build".
-rw-r--r-- | lib/libc/gen/uname.c | 10 | ||||
-rw-r--r-- | sys/conf/newvers.sh | 1 | ||||
-rw-r--r-- | sys/sys/sysctl.h | 52 |
3 files changed, 29 insertions, 34 deletions
diff --git a/lib/libc/gen/uname.c b/lib/libc/gen/uname.c index 80a0d6a556d..05221b60056 100644 --- a/lib/libc/gen/uname.c +++ b/lib/libc/gen/uname.c @@ -73,19 +73,11 @@ uname(name) if (sysctl(mib, 2, &name->release, &len, NULL, 0) == -1) rval = -1; - /* The version may have newlines in it, turn them into spaces. */ mib[0] = CTL_KERN; - mib[1] = KERN_VERSION; + mib[1] = KERN_OSVERSION; len = sizeof(name->version); if (sysctl(mib, 2, &name->version, &len, NULL, 0) == -1) rval = -1; - else - for (p = name->version; len--; ++p) - if (*p == '\n' || *p == '\t') - if (len > 1) - *p = ' '; - else - *p = '\0'; mib[0] = CTL_HW; mib[1] = HW_MACHINE; diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index f27e4a2b8f0..24ee587011c 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -49,6 +49,7 @@ osr="1.2" echo "char ostype[] = \"${ost}\";" > vers.c echo "char osrelease[] = \"${osr}\";" >> vers.c +echo "char osversion[] = \"${id}#${v}\";" >> vers.c echo "char sccs[8] = { ' ', ' ', ' ', ' ', '@', '(', '#', ')' };" >> vers.c echo \ "char version[] = \ diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h index 5f296330ac6..224ecd68d31 100644 --- a/sys/sys/sysctl.h +++ b/sys/sys/sysctl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sysctl.h,v 1.5 1996/04/21 22:31:59 deraadt Exp $ */ +/* $OpenBSD: sysctl.h,v 1.6 1996/06/29 21:02:52 tholo Exp $ */ /* $NetBSD: sysctl.h,v 1.16 1996/04/09 20:55:36 cgd Exp $ */ /* @@ -114,36 +114,38 @@ struct ctlname { #define KERN_OSTYPE 1 /* string: system version */ #define KERN_OSRELEASE 2 /* string: system release */ #define KERN_OSREV 3 /* int: system revision */ -#define KERN_VERSION 4 /* string: compile time info */ -#define KERN_MAXVNODES 5 /* int: max vnodes */ -#define KERN_MAXPROC 6 /* int: max processes */ -#define KERN_MAXFILES 7 /* int: max open files */ -#define KERN_ARGMAX 8 /* int: max arguments to exec */ -#define KERN_SECURELVL 9 /* int: system security level */ -#define KERN_HOSTNAME 10 /* string: hostname */ -#define KERN_HOSTID 11 /* int: host identifier */ -#define KERN_CLOCKRATE 12 /* struct: struct clockrate */ -#define KERN_VNODE 13 /* struct: vnode structures */ -#define KERN_PROC 14 /* struct: process entries */ -#define KERN_FILE 15 /* struct: file entries */ -#define KERN_PROF 16 /* node: kernel profiling info */ -#define KERN_POSIX1 17 /* int: POSIX.1 version */ -#define KERN_NGROUPS 18 /* int: # of supplemental group ids */ -#define KERN_JOB_CONTROL 19 /* int: is job control available */ -#define KERN_SAVED_IDS 20 /* int: saved set-user/group-ID */ -#define KERN_BOOTTIME 21 /* struct: time kernel was booted */ -#define KERN_DOMAINNAME 22 /* string: (YP) domainname */ -#define KERN_MAXPARTITIONS 23 /* int: number of partitions/disk */ -#define KERN_RAWPARTITION 24 /* int: raw partition number */ -#define KERN_NTPTIME 25 /* struct: extended-precision time */ -#define KERN_TIMEX 26 /* struct: ntp timekeeping state */ -#define KERN_MAXID 27 /* number of valid kern ids */ +#define KERN_OSVERSION 4 /* string: kernel build version */ +#define KERN_VERSION 5 /* string: compile time info */ +#define KERN_MAXVNODES 6 /* int: max vnodes */ +#define KERN_MAXPROC 7 /* int: max processes */ +#define KERN_MAXFILES 8 /* int: max open files */ +#define KERN_ARGMAX 9 /* int: max arguments to exec */ +#define KERN_SECURELVL 10 /* int: system security level */ +#define KERN_HOSTNAME 11 /* string: hostname */ +#define KERN_HOSTID 12 /* int: host identifier */ +#define KERN_CLOCKRATE 13 /* struct: struct clockrate */ +#define KERN_VNODE 14 /* struct: vnode structures */ +#define KERN_PROC 15 /* struct: process entries */ +#define KERN_FILE 16 /* struct: file entries */ +#define KERN_PROF 17 /* node: kernel profiling info */ +#define KERN_POSIX1 18 /* int: POSIX.1 version */ +#define KERN_NGROUPS 19 /* int: # of supplemental group ids */ +#define KERN_JOB_CONTROL 20 /* int: is job control available */ +#define KERN_SAVED_IDS 21 /* int: saved set-user/group-ID */ +#define KERN_BOOTTIME 22 /* struct: time kernel was booted */ +#define KERN_DOMAINNAME 23 /* string: (YP) domainname */ +#define KERN_MAXPARTITIONS 24 /* int: number of partitions/disk */ +#define KERN_RAWPARTITION 25 /* int: raw partition number */ +#define KERN_NTPTIME 26 /* struct: extended-precision time */ +#define KERN_TIMEX 27 /* struct: ntp timekeeping state */ +#define KERN_MAXID 28 /* number of valid kern ids */ #define CTL_KERN_NAMES { \ { 0, 0 }, \ { "ostype", CTLTYPE_STRING }, \ { "osrelease", CTLTYPE_STRING }, \ { "osrevision", CTLTYPE_INT }, \ + { "osversion", CTLTYPE_STRING }, \ { "version", CTLTYPE_STRING }, \ { "maxvnodes", CTLTYPE_INT }, \ { "maxproc", CTLTYPE_INT }, \ |