Subject: bin/1486: can't force crashdump with reboot(8)
To: None <gnats-bugs@gnats.netbsd.org>
From: John Kohl <jtk@kolvir.arlington.ma.us>
List: netbsd-bugs
Date: 09/20/1995 18:53:55
>Number:         1486
>Category:       bin
>Synopsis:       can't force crashdump with reboot(8)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 20 19:20:01 1995
>Last-Modified:
>Originator:     John Kohl
>Organization:
NetBSD Kernel Hackers `R` Us
>Release:        NetBSD-current, 20 Sep 1995
>Environment:
	
System: NetBSD pattern 1.0A NetBSD 1.0A (PATTERN) #118: Tue Sep 19 21:58:28 EDT 1995 jtk@pattern:/u1/NetBSD-current/src/sys/arch/i386/compile/PATTERN i386


>Description:
reboot doesn't have a flag to force a crash dump.

>How-To-Repeat:
	try to force a crash dump from user level.  Yes, this is
probably not useful to most people, but when debugging crash dumps it
was useful :)

>Fix:

===================================================================
RCS file: RCS/reboot.8,v
retrieving revision 1.1
diff -c -r1.1 sbin/reboot/reboot.8
*** sbin/reboot/reboot.8	1995/09/20 22:47:15	1.1
--- sbin/reboot/reboot.8	1995/09/20 22:50:02
***************
*** 43,51 ****
  stopping and restarting the system
  .Sh SYNOPSIS
  .Nm halt
! .Op Fl nq
  .Nm reboot
! .Op Fl nq
  .Sh DESCRIPTION
  The
  .Nm halt
--- 43,51 ----
  stopping and restarting the system
  .Sh SYNOPSIS
  .Nm halt
! .Op Fl nqd
  .Nm reboot
! .Op Fl nqd
  .Sh DESCRIPTION
  The
  .Nm halt
***************
*** 72,77 ****
--- 72,84 ----
  the system is halted or restarted quickly and ungracefully, and only
  the flushing of the file system cache is performed.
  This option should probably not be used.
+ .It Fl d
+ If the
+ .Fl d
+ option is specified,
+ the system will force a crash dump before rebooting.
+ This option is useful for debugging system dump procedures or
+ capturing the state of a corrupted or misbehaving system.
  .El
  .Pp
  Normally, the
===================================================================
RCS file: RCS/reboot.c,v
retrieving revision 1.1
diff -c -r1.1 sbin/reboot/reboot.c
*** sbin/reboot/reboot.c	1995/09/06 03:33:36	1.1
--- sbin/reboot/reboot.c	1995/09/20 22:49:34
***************
*** 78,84 ****
  	} else
  		howto = 0;
  	lflag = nflag = qflag = 0;
! 	while ((ch = getopt(argc, argv, "lnq")) != EOF)
  		switch(ch) {
  		case 'l':		/* Undocumented; used by shutdown. */
  			lflag = 1;
--- 78,84 ----
  	} else
  		howto = 0;
  	lflag = nflag = qflag = 0;
! 	while ((ch = getopt(argc, argv, "lnqd")) != EOF)
  		switch(ch) {
  		case 'l':		/* Undocumented; used by shutdown. */
  			lflag = 1;
***************
*** 90,95 ****
--- 90,98 ----
  		case 'q':
  			qflag = 1;
  			break;
+ 		case 'd':
+ 			howto |= RB_DUMP;
+ 			break;
  		case '?':
  		default:
  			usage();
***************
*** 176,182 ****
  void
  usage()
  {
! 	(void)fprintf(stderr, "usage: %s [-nq]\n", dohalt ? "halt" : "reboot");
  	exit(1);
  }
  
--- 179,185 ----
  void
  usage()
  {
! 	(void)fprintf(stderr, "usage: %s [-nqd]\n", dohalt ? "halt" : "reboot");
  	exit(1);
  }
  

>Audit-Trail:
>Unformatted: