]> Zhao Yanbai Git Server - minix.git/commitdiff
Fixed small bug in alarm code.
authorJorrit Herder <jnherder@minix3.org>
Fri, 5 Aug 2005 16:46:27 +0000 (16:46 +0000)
committerJorrit Herder <jnherder@minix3.org>
Fri, 5 Aug 2005 16:46:27 +0000 (16:46 +0000)
Kernel timer count was not reset after expiry.

drivers/tty/tty.c
kernel/system/do_setalarm.c
lib/sysutil/tickdelay.c
servers/pm/main.c

index ec4bad598f0eb13883a3e7c8d86bc583dee09ddc..75b75f6a1c77a4895aee3c94ab3cfac3ec0933cf 100644 (file)
@@ -1,4 +1,3 @@
-#define NEW_REVIVE 1
 /* This file contains the tesminal driver, both for the IBM console and regular
  * ASCII terminals.  It handles only the device-independent part of a TTY, the
  * device dependent parts are in console.c, rs232.c, etc.  This file contains
@@ -870,7 +869,6 @@ tty_t *tp;                  /* TTY to check for events. */
 
   /* Reply if enough bytes are available. */
   if (tp->tty_incum >= tp->tty_min && tp->tty_inleft > 0) {
-#if NEW_REVIVE
        if (tp->tty_inrepcode == REVIVE) {
                notify(tp->tty_incaller);
                tp->tty_inrevived = 1;
@@ -879,11 +877,6 @@ tty_t *tp;                 /* TTY to check for events. */
                        tp->tty_inproc, tp->tty_incum);
                tp->tty_inleft = tp->tty_incum = 0;
        }
-#else
-       tty_reply(tp->tty_inrepcode, tp->tty_incaller, tp->tty_inproc,
-                                                               tp->tty_incum);
-       tp->tty_inleft = tp->tty_incum = 0;
-#endif
   }
   if(tp->tty_select_ops)
        select_retry(tp);
@@ -951,7 +944,6 @@ register tty_t *tp;         /* pointer to terminal to read from */
 
   /* Usually reply to the reader, possibly even if incum == 0 (EOF). */
   if (tp->tty_inleft == 0) {
-#if NEW_REVIVE
        if (tp->tty_inrepcode == REVIVE) {
                notify(tp->tty_incaller);
                tp->tty_inrevived = 1;
@@ -960,11 +952,6 @@ register tty_t *tp;                /* pointer to terminal to read from */
                        tp->tty_inproc, tp->tty_incum);
                tp->tty_inleft = tp->tty_incum = 0;
        }
-#else
-       tty_reply(tp->tty_inrepcode, tp->tty_incaller, tp->tty_inproc,
-                                                               tp->tty_incum);
-       tp->tty_inleft = tp->tty_incum = 0;
-#endif
   }
 }
 
index ac5ec61c133c1acd520be13c956f3cb44a7ecbaa..3e37bbd742ad117f4949fd75a93d2c0769927a98 100644 (file)
@@ -71,7 +71,9 @@ timer_t *tp;
  * alarm. The process number is stored in timer argument 'ta_int'. Notify that
  * process with a notification message from CLOCK.
  */
-  lock_notify(CLOCK, tmr_arg(tp)->ta_int);
+  int proc_nr = tmr_arg(tp)->ta_int;           /* get process number */
+  tmr_inittimer(tp);                           /* reset alarm timer */
+  lock_notify(CLOCK, proc_nr);                 /* notify process */
 }
 
 #endif /* USE_SETALARM */
index 6ec28bdf7dfcec6bb371f00ae8bd3df53495d22a..eb84099ef6bb08541f45dddaea00b73d5abdd2b7 100644 (file)
@@ -1,4 +1,5 @@
 #include "sysutil.h"
+#include <timers.h>
 
 /*===========================================================================*
  *                               tickdelay                                  *
@@ -27,7 +28,7 @@ long ticks;                           /* number of ticks to wait */
     receive(CLOCK,&m_alarm);           /* await synchronous alarm */
 
     /* Check if we must reschedule the current alarm. */
-    if (m.ALRM_TIME_LEFT > 0) {
+    if (m.ALRM_TIME_LEFT > 0 && m.ALRM_TIME_LEFT != TMR_NEVER) {
        m.ALRM_EXP_TIME = m.ALRM_TIME_LEFT - ticks;
        if (m.ALRM_EXP_TIME <= 0) 
                m.ALRM_EXP_TIME = 1;
index c0c516330f5a0c8bac630d6638ff674f532c23ef..8a95710a0f885685f9cd7b7d817536cfe14f6c66 100644 (file)
@@ -253,7 +253,7 @@ PRIVATE void pm_init()
   }
 
   /* Initialize tables to all physical memory and print memory information. */
-  printf("Gathering memory:");
+  printf("Physical memory:");
   mem_init(mem_chunks, &free_clicks);
   total_clicks = minix_clicks + free_clicks;
   printf(" total %u KB,", click_to_round_k(total_clicks));