Date: Thu, 01 Jan 1998 12:50:31 -0500 From: Ken Key <key@cs.utk.edu> To: Mike Smith <mike@smith.net.au> Cc: Ken Key <key@cs.utk.edu>, freebsd-mobile@freebsd.org Subject: Re: More on APM suspened/calltodo patch. Message-ID: <199801011750.MAA09248@duncan.cs.utk.edu> In-Reply-To: Your message of Wed, 31 Dec 1997 14:03:48 %2B1030. <199712310333.OAA00537@word.smith.net.au>
next in thread | previous in thread | raw e-mail | index | archive | help
> The "right" thing to do here appears to me to wait until I can actually
> get a working -current kernel for my laptop, verify that the new
> technique actually works (what tests did you do?), and then push your
> older version back into 2.2.
OK, sounds good to me. To test if the APM suspend/timeout code was working,
I just ran the following test program and suspended the machine, waited a
few minutes, resumed, and then watched to see if the select() timeout fired
immediately or waited the amount of time.
=================================>8 cut here 8<===========================
/*
* timer_test.c testing interaction between timer operation on select and APM.
*/
#include <sys/types.h>
#include <sys/time.h>
#include <unistd.h>
int
main(int argc, char *argv[])
{
int cc;
struct timeval timeout;
time_t timenow;
char *str_p;
/* Test timeout of 45 seconds */
timeout.tv_sec = 45;
timeout.tv_usec = 0;
do {
timenow = time(NULL);
str_p = ctime(&timenow);
str_p[strlen(str_p)-1] = ' ';
printf("Time entering select: %s (timeout=%d)\n",
str_p, timeout.tv_sec);
cc = select(0, NULL, NULL, NULL, &timeout);
timenow = time(NULL);
str_p = ctime(&timenow);
str_p[strlen(str_p)-1] = ' ';
printf("Time exiting select: %s (cc= %d)\n\n",
str_p, cc);
} while(1);
}
=================================>8 cut here 8<===========================
--
Ken Key (key@cs.utk.edu)
Univ. of Tennessee, Knoxville
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199801011750.MAA09248>
