summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_shutdown.c
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2012-11-01 17:01:05 +0000
committeralfred <alfred@FreeBSD.org>2012-11-01 17:01:05 +0000
commit4a74d2e51a5c00dd3b2ee1ac5829aace6d13d817 (patch)
treee8b52ec5f3f944661c5f829b80fa86f03ac121a8 /sys/kern/kern_shutdown.c
parent768e7f7830fb52401cfc9229634414aaab2d31ab (diff)
downloadFreeBSD-src-4a74d2e51a5c00dd3b2ee1ac5829aace6d13d817.zip
FreeBSD-src-4a74d2e51a5c00dd3b2ee1ac5829aace6d13d817.tar.gz
Provide a device name in the sysctl tree for programs to query the
state of crashdump target devices. This will be used to add a "-l" (ell) flag to dumpon(8) to list the currently configured dumpdev. Reviewed by: phk
Diffstat (limited to 'sys/kern/kern_shutdown.c')
-rw-r--r--sys/kern/kern_shutdown.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c
index d676136..d6c8b2d 100644
--- a/sys/kern/kern_shutdown.c
+++ b/sys/kern/kern_shutdown.c
@@ -712,18 +712,28 @@ kthread_shutdown(void *arg, int howto)
printf("done\n");
}
+static char dumpdevname[sizeof(((struct cdev*)NULL)->si_name)];
+SYSCTL_STRING(_kern_shutdown, OID_AUTO, dumpdevname, CTLFLAG_RD,
+ dumpdevname, 0, "Device for kernel dumps");
+
/* Registration of dumpers */
int
-set_dumper(struct dumperinfo *di)
+set_dumper(struct dumperinfo *di, const char *devname)
{
if (di == NULL) {
bzero(&dumper, sizeof dumper);
+ dumpdevname[0] = '\0';
return (0);
}
if (dumper.dumper != NULL)
return (EBUSY);
dumper = *di;
+ strlcpy(dumpdevname, devname, sizeof(dumpdevname));
+ if (strlen(dumpdevname) != strlen(devname)) {
+ printf("set_dumper: device name truncated from '%s' -> '%s'\n",
+ devname, dumpdevname);
+ }
return (0);
}
OpenPOWER on IntegriCloud