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

This commit is contained in:
jdp 1999-11-21 21:52:40 +00:00
parent 91842d9319
commit b71520dd66
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);
}