diff options
author | nate <nate@FreeBSD.org> | 1997-12-23 16:32:35 +0000 |
---|---|---|
committer | nate <nate@FreeBSD.org> | 1997-12-23 16:32:35 +0000 |
commit | b24853a7102a1c4494d9c7a93687004535ec8c4c (patch) | |
tree | 399425419e34c9e8a58a8bdab127e8329283c2f6 /sys/i386/apm | |
parent | 643a53fdee71927a5d220dec08f7d22d939efbd9 (diff) | |
download | FreeBSD-src-b24853a7102a1c4494d9c7a93687004535ec8c4c.zip FreeBSD-src-b24853a7102a1c4494d9c7a93687004535ec8c4c.tar.gz |
This patch causes the "calltodo" timer list to be decremented by the amount
of time that the laptop was suspending. Thus, select() calls that might have
suspended rather than firing at 1hr + "time suspended" since the timer was
posted.
Adding:
options APM_FIXUP_CALLTODO
to the kernel config enables the patch.
[
This patch was slightly modified to use a consistant indent style and
I removed some unused local variables. After this has been tested a
few weeks we'll make the options the default, so for now I'm now
documenting it in LINT. Mike can later if he wants.
]
Reviewed by: Mike Smith <msmith@freebsd.org>
Submitted by: Ken Key <key@cs.utk.edu>
Diffstat (limited to 'sys/i386/apm')
-rw-r--r-- | sys/i386/apm/apm.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/sys/i386/apm/apm.c b/sys/i386/apm/apm.c index 372efdf..59067c3 100644 --- a/sys/i386/apm/apm.c +++ b/sys/i386/apm/apm.c @@ -15,7 +15,7 @@ * * Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD) * - * $Id: apm.c,v 1.65 1997/11/12 04:12:43 jdp Exp $ + * $Id: apm.c,v 1.66 1997/12/04 02:40:00 imp Exp $ */ #include <sys/param.h> @@ -365,8 +365,22 @@ apm_default_resume(void *arg) tmp_time = time; /* because 'time' is volatile */ timevaladd(&tmp_time, &diff_time); time = tmp_time; +#ifdef APM_FIXUP_CALLTODO + /* Calculate the delta time suspended */ + timevalsub(&resume_time, &suspend_time); + /* Fixup the calltodo list with the delta time. */ + adjust_timeout_calltodo(&resume_time); +#endif /* APM_FIXUP_CALLTODOK */ splx(pl); - second = resume_time.tv_sec - suspend_time.tv_sec; +#ifndef APM_FIXUP_CALLTODO + second = resume_time.tv_sec - suspend_time.tv_sec; +#else /* APM_FIXUP_CALLTODO */ + /* + * We've already calculated resume_time to be the delta between + * the suspend and the resume. + */ + second = resume_time.tv_sec; +#endif /* APM_FIXUP_CALLTODO */ hour = second / 3600; second %= 3600; minute = second / 60; |