diff options
author | jkh <jkh@FreeBSD.org> | 1994-11-15 20:30:56 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1994-11-15 20:30:56 +0000 |
commit | d7fefcee590c8f50187cf87cb6b53f66f1e4e6d9 (patch) | |
tree | aa9fc0d208806902928367287c51bb12aee70172 | |
parent | 3affdfe7d7730ae3503731962f0f02d2c9769d22 (diff) | |
download | FreeBSD-src-d7fefcee590c8f50187cf87cb6b53f66f1e4e6d9.zip FreeBSD-src-d7fefcee590c8f50187cf87cb6b53f66f1e4e6d9.tar.gz |
From: Michael Reifenberger <root@rz-wb.fh-sw.de>
I added a bootfile entry to /kern so every program could examine the
Path and name of the kernel.
Submitted by: mr
-rw-r--r-- | sys/miscfs/kernfs/kernfs_vnops.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/sys/miscfs/kernfs/kernfs_vnops.c b/sys/miscfs/kernfs/kernfs_vnops.c index a4b6d4d..b38fc5e 100644 --- a/sys/miscfs/kernfs/kernfs_vnops.c +++ b/sys/miscfs/kernfs/kernfs_vnops.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)kernfs_vnops.c 8.6 (Berkeley) 2/10/94 - * $Id: kernfs_vnops.c,v 1.5 1994/09/21 03:47:00 wollman Exp $ + * $Id: kernfs_vnops.c,v 1.6 1994/10/02 17:48:09 phk Exp $ */ /* @@ -73,6 +73,7 @@ struct kern_target { #define KTT_INT 17 #define KTT_STRING 31 #define KTT_HOSTNAME 47 +#define KTT_BOOTFILE 49 #define KTT_AVENRUN 53 int kt_tag; int kt_rw; @@ -85,6 +86,7 @@ struct kern_target { { "boottime", &boottime.tv_sec, KTT_INT, VREAD, VREG }, { "copyright", copyright, KTT_STRING, VREAD, VREG }, { "hostname", 0, KTT_HOSTNAME, VREAD|VWRITE, VREG }, + { "bootfile", 0, KTT_BOOTFILE, VREAD, VREG }, { "hz", &hz, KTT_INT, VREAD, VREG }, { "loadavg", 0, KTT_AVENRUN, VREAD, VREG }, { "pagesize", &cnt.v_page_size, KTT_INT, VREAD, VREG }, @@ -145,6 +147,19 @@ kernfs_xread(kt, buf, len, lenp) break; } + case KTT_BOOTFILE: { + char *cp = kernelname; + int xlen = strlen(cp) + 1; + + if (xlen >= (len-2)) + return (EINVAL); + + bcopy(cp, buf, xlen); + buf[xlen] = '\n'; + buf[xlen+1] = '\0'; + break; + } + case KTT_AVENRUN: sprintf(buf, "%ld %ld %ld %ld\n", averunnable.ldavg[0], |