savecore(8) increments /var/crash/bounds on each boot

Ed Maste emaste at phaedrus.sandvine.ca
Mon Jun 13 20:50:56 GMT 2005


On Mon, Jun 13, 2005 at 01:03:50PM -0700, Doug White wrote:

> On Mon, 13 Jun 2005, Ed Maste wrote:
> 
> > I notice that as of sbin/savecore/savecore.c 1.72 and in 5.4-RELEASE
> > savecore increments the number in /var/crash/bounds on each boot,
> > regardless of whether it rebooted due to panic or was a clean shutdown.
> >
> > Is this the desired behaviour or an unintentional side effect?
> > We've been monitoring the value in bounds to detect panics, which
> > of course doesn't work anymore.
> 
> Its certainly not the historical behavior :-)
> 
> Think you could submit a patch with the fix?

The attached patch does the trick.  In -vv mode the bounds used to
be included with the first/last dump header output -- I just replaced
it with -1.

Problem originally discovered by Adrian Dewhurst.

--
Ed Maste, Sandvine Inc.
-------------- next part --------------
--- savecore.c.orig	2005-06-13 16:19:41.000000000 -0400
+++ savecore.c	2005-06-13 16:16:39.000000000 -0400
@@ -236,7 +236,6 @@
 	int bounds, status;
 	u_int sectorsize;
 
-	bounds = getbounds();
 	dmpcnt = 0;
 	mediasize = 0;
 	status = STATUS_UNKNOWN;
@@ -337,10 +336,10 @@
 
 	if (verbose >= 2) {
 		printf("First dump headers:\n");
-		printheader(stdout, &kdhf, device, bounds, -1);
+		printheader(stdout, &kdhf, device, -1, -1);
 
 		printf("\nLast dump headers:\n");
-		printheader(stdout, &kdhl, device, bounds, -1);
+		printheader(stdout, &kdhl, device, -1, -1);
 		printf("\n");
 	}
 
@@ -373,6 +372,8 @@
 		goto closefd;
 	}
 
+	bounds = getbounds();
+
 	sprintf(buf, "info.%d", bounds);
 
 	/*


More information about the freebsd-current mailing list