Add a "-d" option which causes the system to generate a crash dump.

This commit is contained in:
John Polstra 1999-11-21 21:52:40 +00:00
parent ddc83e8523
commit 85c981cc3f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=53523
2 changed files with 17 additions and 4 deletions

View File

@ -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

View File

@ -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 @@ main(argc, argv)
void
usage()
{
(void)fprintf(stderr, "usage: %s [-npq]\n", dohalt ? "halt" : "reboot");
(void)fprintf(stderr, "usage: %s [-dnpq]\n",
dohalt ? "halt" : "reboot");
exit(1);
}