Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Jun 1999 22:43:32 -0400 (EDT)
From:      "Chris D. Faulhaber" <jedgar@fxp.org>
To:        Stefan `Sec` Zehl <sec@42.org>
Cc:        Dag-Erling Smorgrav <des@flood.ping.uio.no>, freebsd-stable@FreeBSD.ORG
Subject:   Re: / not properly unmounted ?
Message-ID:  <Pine.BSF.4.10.9906162237000.301-200000@earth.fxp>
In-Reply-To: <19990616142937.A24601@matrix.42.org>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On Wed, 16 Jun 1999, Stefan `Sec` Zehl wrote:

> On Wed, Jun 16, 1999 at 02:24:44PM +0200, Dag-Erling Smorgrav wrote:
> > Stefan `Sec` Zehl <sec@42.org> writes:
> > > WARNING: / was not properly dismounted
> > >  and a subsquent fsck happens which has no (visible) effect.
> > > 
> > > I do use 'halt -p' to turn off my box.
> > 
> > Either don't use 'halt -p', or disable write caching on your disk
> > drives - or hack the kernel to pause for five seconds or something
> > before switching off the power.
> 

Okay...sounds like fun...

I added a sysctl variable (machdep.powerdown_delay) to allow the disk
cache to flush by itself before APM powering the system off.  After
applying the attached patch (tested on 3.2-STABLE) and installing a new
kernel, just use 'sysctl -w machdep.powerdown_delay=5' for a 5 second
delay.

I don't know if this is appropriate for actual inclusion into the
kernel...if so, I can see about merging it into -CURRENT and/or changing
to a more appropriate sysctl level (i.e. kern, hw).

-----
Chris D. Faulhaber <jedgar@fxp.org> | All the true gurus I've met never
System/Network Administrator,       | claimed they were one and always
Reality Check Information, Inc.     | pointed to someone better.


[-- Attachment #2 --]
--- /sys/i386/apm/apm.c.orig	Thu Dec 10 18:36:14 1998
+++ /sys/i386/apm/apm.c	Wed Jun 16 22:34:43 1999
@@ -39,6 +39,7 @@
 #include <vm/pmap.h>
 #include <sys/syslog.h>
 #include <i386/apm/apm_setup.h>
+#include <sys/sysctl.h>
 
 #ifdef VM86
 #include <machine/psl.h>
@@ -118,6 +119,9 @@
 
 static int apm_errno;
 
+static int powerdown_delay = 0;
+SYSCTL_INT(_machdep, OID_AUTO, powerdown_delay, CTLFLAG_RW, &powerdown_delay, 0, "");
+
 static int
 apm_int(u_long *eax, u_long *ebx, u_long *ecx, u_long *edx)
 {
@@ -254,6 +258,7 @@
 	/* Not halting powering off, or not active */
 	if (!(howto & RB_POWEROFF) || !apm_softc.active)
 		return;
+	DELAY(1000000 * powerdown_delay);
 	eax = (APM_BIOS << 8) | APM_SETPWSTATE;
 	ebx = PMDV_ALLDEV;
 	ecx = PMST_OFF;

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.10.9906162237000.301-200000>