From: Jorrit Herder Date: Fri, 5 Aug 2005 16:46:27 +0000 (+0000) Subject: Fixed small bug in alarm code. X-Git-Tag: v3.1.0~419 X-Git-Url: http://zhaoyanbai.com/repos/jquery-3.1.1.min.js?a=commitdiff_plain;h=e396496d8ca2631a091ccc66fe1ff7c6233f6caa;p=minix.git Fixed small bug in alarm code. Kernel timer count was not reset after expiry. --- diff --git a/drivers/tty/tty.c b/drivers/tty/tty.c index ec4bad598..75b75f6a1 100644 --- a/drivers/tty/tty.c +++ b/drivers/tty/tty.c @@ -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 } } diff --git a/kernel/system/do_setalarm.c b/kernel/system/do_setalarm.c index ac5ec61c1..3e37bbd74 100644 --- a/kernel/system/do_setalarm.c +++ b/kernel/system/do_setalarm.c @@ -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 */ diff --git a/lib/sysutil/tickdelay.c b/lib/sysutil/tickdelay.c index 6ec28bdf7..eb84099ef 100644 --- a/lib/sysutil/tickdelay.c +++ b/lib/sysutil/tickdelay.c @@ -1,4 +1,5 @@ #include "sysutil.h" +#include /*===========================================================================* * 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; diff --git a/servers/pm/main.c b/servers/pm/main.c index c0c516330..8a95710a0 100644 --- a/servers/pm/main.c +++ b/servers/pm/main.c @@ -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));