On Tue, 18 Jun 2002, Roger Ripley wrote:

> I have a problem with Dosemu hanging after 30 minutes 
> of keyboard inactivity.  If a key is pressed after the 
> 30 minutes have expired, CPU usage will go up to 100% 
> and after 10 minutes the application may start responding 
> again, and receive the keystrokes that were buffered in 
> the interim.  It occurs in multiple applications, 

Hmm this looks suspiciously like an integer overflow:

2^31 microseconds = 35 mins 47 secs.

There is only one time out test in the keyboard code, to see if ESC
times out (after 0.25 sec).

The patch below avoids the problem - really, stretches it from 35mins
to ~600000 years. That should be enough for now.

This is untested. Please test it. I'd like to sleep now instead of
waiting 35 mins.

Bart

--- dosemu-1.1.3.2/src/plugin/term/keyb_slang.c Sun May 26 16:57:56 2002
+++ dosemu-1.1.3.3/src/plugin/term/keyb_slang.c Wed Jun 19 01:35:32 2002
@@ -873,9 +873,8 @@
 static int sltermio_input_pending(void)
 {
        struct timeval scr_tv;
-       hitimer_t t_start;
+       hitimer_t t_start, t_dif;
        fd_set fds;
-       long t_dif;
        
 #if 0
 #define        THE_TIMEOUT 750000L
@@ -890,13 +889,13 @@
        t_start = GETusTIME(0);
        errno = 0;
        while ((int)select(keyb_state.kbd_fd + 1, &fds, NULL, NULL, &scr_tv) < (int)1) 
{
-               t_dif = (long)(GETusTIME(0) - t_start);
+               t_dif = GETusTIME(0) - t_start;
                
                if ((t_dif >= THE_TIMEOUT) || (errno != EINTR))
                        return 0;
                errno = 0;
                scr_tv.tv_sec = 0L;
-               scr_tv.tv_usec = THE_TIMEOUT - t_dif;
+               scr_tv.tv_usec = THE_TIMEOUT - (long)t_dif;
        }
        return 1;
 }


-
To unsubscribe from this list: send the line "unsubscribe linux-msdos" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to