From: Ben Gras Date: Fri, 17 Jun 2005 13:47:29 +0000 (+0000) Subject: Added (fake) readlink(). X-Git-Tag: v3.1.0~734 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=39c90d6c908bca0a99521a9c228d4708e7b7a705;p=minix.git Added (fake) readlink(). Compile fix for fslib (BITS_PER_BLOCK was renamed to FS_BITS_PER_BLOCK). Added extra arg to various timer functions. --- diff --git a/lib/other/fslib.c b/lib/other/fslib.c index a3572c064..2b11a55b0 100755 --- a/lib/other/fslib.c +++ b/lib/other/fslib.c @@ -37,8 +37,8 @@ int block_size; { int nr_blocks; - nr_blocks = (int) (nr_bits / BITS_PER_BLOCK(block_size)); - if (((bit_t) nr_blocks * BITS_PER_BLOCK(block_size)) < nr_bits) ++nr_blocks; + nr_blocks = (int) (nr_bits / FS_BITS_PER_BLOCK(block_size)); + if (((bit_t) nr_blocks * FS_BITS_PER_BLOCK(block_size)) < nr_bits) ++nr_blocks; return(nr_blocks); } diff --git a/lib/posix/readlink.c b/lib/posix/readlink.c index 819c7eee1..be8350d0c 100644 --- a/lib/posix/readlink.c +++ b/lib/posix/readlink.c @@ -2,8 +2,6 @@ readlink.c */ -#define readlink _readlink - #include #include diff --git a/lib/timers/tmrs_clr.c b/lib/timers/tmrs_clr.c index 0a4ff29ef..2113c846c 100644 --- a/lib/timers/tmrs_clr.c +++ b/lib/timers/tmrs_clr.c @@ -3,22 +3,38 @@ /*===========================================================================* * tmrs_clrtimer * *===========================================================================*/ -void tmrs_clrtimer(tmrs, tp) +clock_t tmrs_clrtimer(tmrs, tp, new_head) timer_t **tmrs; /* pointer to timers queue */ timer_t *tp; /* timer to be removed */ +clock_t *new_head; { /* Deactivate a timer and remove it from the timers queue. */ timer_t **atp; struct proc *p; + clock_t old_head = 0; + + if(*tmrs) + old_head = (*tmrs)->tmr_exp_time; + else + old_head = 0; tp->tmr_exp_time = TMR_NEVER; for (atp = tmrs; *atp != NULL; atp = &(*atp)->tmr_next) { if (*atp == tp) { *atp = tp->tmr_next; - return; + break; } } + + if(new_head) { + if(*tmrs) + *new_head = (*tmrs)->tmr_exp_time; + else + *new_head = 0; + } + + return old_head; } diff --git a/lib/timers/tmrs_exp.c b/lib/timers/tmrs_exp.c index d265bf8bd..6ad353cc1 100644 --- a/lib/timers/tmrs_exp.c +++ b/lib/timers/tmrs_exp.c @@ -3,9 +3,10 @@ /*===========================================================================* * tmrs_exptimers * *===========================================================================*/ -void tmrs_exptimers(tmrs, now) +void tmrs_exptimers(tmrs, now, new_head) timer_t **tmrs; /* pointer to timers queue */ clock_t now; /* current time */ +clock_t *new_head; { /* Use the current time to check the timers queue list for expired timers. * Run the watchdog functions for all expired timers and deactivate them. @@ -18,6 +19,13 @@ clock_t now; /* current time */ tp->tmr_exp_time = TMR_NEVER; (*tp->tmr_func)(tp); } + + if(new_head) { + if(*tmrs) + *new_head = (*tmrs)->tmr_exp_time; + else + *new_head = 0; + } } diff --git a/lib/timers/tmrs_set.c b/lib/timers/tmrs_set.c index 3c3d1309e..79785b0be 100644 --- a/lib/timers/tmrs_set.c +++ b/lib/timers/tmrs_set.c @@ -3,11 +3,12 @@ /*===========================================================================* * tmrs_settimer * *===========================================================================*/ -void tmrs_settimer(tmrs, tp, exp_time, watchdog) +clock_t tmrs_settimer(tmrs, tp, exp_time, watchdog, new_head) timer_t **tmrs; /* pointer to timers queue */ timer_t *tp; /* the timer to be added */ clock_t exp_time; /* its expiration time */ tmr_func_t watchdog; /* watchdog function to be run */ +clock_t *new_head; /* new earliest timer, if non NULL */ { /* Activate a timer to run function 'fp' at time 'exp_time'. If the timer is * already in use it is first removed from the timers queue. Then, it is put @@ -15,10 +16,14 @@ tmr_func_t watchdog; /* watchdog function to be run */ * The caller responsible for scheduling a new alarm for the timer if needed. */ timer_t **atp; + clock_t old_head = 0; + + if(*tmrs) + old_head = (*tmrs)->tmr_exp_time; /* Possibly remove an old timer. Then set the timer's variables. */ if (tp->tmr_exp_time != TMR_NEVER) - (void) tmrs_clrtimer(tmrs,tp); + (void) tmrs_clrtimer(tmrs, tp, NULL); tp->tmr_exp_time = exp_time; tp->tmr_func = watchdog; @@ -28,5 +33,8 @@ tmr_func_t watchdog; /* watchdog function to be run */ } tp->tmr_next = *atp; *atp = tp; + if(new_head) + (*new_head) = (*tmrs)->tmr_exp_time; + return old_head; }