summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorjdp <jdp@FreeBSD.org>1999-11-21 21:52:40 +0000
committerjdp <jdp@FreeBSD.org>1999-11-21 21:52:40 +0000
commitb71520dd661ac0f18e18acc552e6dda161a0640e (patch)
tree212a420c199b214ad357ba2a7e43c0a6aed7ffe3 /sbin
parent91842d93192e4055c56d4ab8c7da02a8b2e2c3b2 (diff)
downloadFreeBSD-src-b71520dd661ac0f18e18acc552e6dda161a0640e.zip
FreeBSD-src-b71520dd661ac0f18e18acc552e6dda161a0640e.tar.gz
Add a "-d" option which causes the system to generate a crash dump.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/reboot/reboot.811
-rw-r--r--sbin/reboot/reboot.c10
2 files changed, 17 insertions, 4 deletions
diff --git a/sbin/reboot/reboot.8 b/sbin/reboot/reboot.8
index 49b6e8c..af8d6857 100644
--- a/sbin/reboot/reboot.8
+++ b/sbin/reboot/reboot.8
@@ -44,11 +44,11 @@ stopping and restarting the system
.Nm halt
.Op Fl nqp
.Nm reboot
-.Op Fl nqp
+.Op Fl dnqp
.Nm fasthalt
.Op Fl nqp
.Nm fastboot
-.Op Fl nqp
+.Op Fl dnqp
.Sh DESCRIPTION
The
.Nm halt
@@ -66,6 +66,11 @@ file.
.Pp
The options are as follows:
.Bl -tag -width indent
+.It Fl d
+The system is requested to create a crash dump. This option is
+supported only when rebooting, and it has no effect unless a dump
+device has previously been specified with
+.Xr dumpon 8 .
.It Fl n
The file system cache is not flushed.
This option should probably not be used.
@@ -101,6 +106,8 @@ specific programs.
.Sh SEE ALSO
.Xr wtmp 5 ,
.Xr boot 8 ,
+.Xr dumpon 8 ,
+.Xr savecore 8 ,
.Xr shutdown 8 ,
.Xr sync 8
.Sh HISTORY
diff --git a/sbin/reboot/reboot.c b/sbin/reboot/reboot.c
index 0bb8482..be3c81b 100644
--- a/sbin/reboot/reboot.c
+++ b/sbin/reboot/reboot.c
@@ -77,8 +77,11 @@ main(argc, argv)
} else
howto = 0;
lflag = nflag = qflag = 0;
- while ((ch = getopt(argc, argv, "lnpq")) != -1)
+ while ((ch = getopt(argc, argv, "dlnpq")) != -1)
switch(ch) {
+ case 'd':
+ howto |= RB_DUMP;
+ break;
case 'l': /* Undocumented; used by shutdown. */
lflag = 1;
break;
@@ -100,6 +103,8 @@ main(argc, argv)
argc -= optind;
argv += optind;
+ if ((howto & (RB_DUMP | RB_HALT)) == (RB_DUMP | RB_HALT))
+ errx(1, "cannot dump (-d) when halting; must reboot instead");
if (geteuid()) {
errno = EPERM;
err(1, NULL);
@@ -181,6 +186,7 @@ restart:
void
usage()
{
- (void)fprintf(stderr, "usage: %s [-npq]\n", dohalt ? "halt" : "reboot");
+ (void)fprintf(stderr, "usage: %s [-dnpq]\n",
+ dohalt ? "halt" : "reboot");
exit(1);
}
OpenPOWER on IntegriCloud