summary |
tags |
clone url |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
af702c2)
SCCS-vsn: sys/kern/kern_clock.c 4.20
SCCS-vsn: sys/vax/vax/machdep.c 4.32
-/* kern_clock.c 4.19 81/04/13 */
+/* kern_clock.c 4.20 81/04/17 */
#include "../h/param.h"
#include "../h/systm.h"
#include "../h/param.h"
#include "../h/systm.h"
/*
* update callout times
*/
/*
* update callout times
*/
- if (callout[0].c_func == NULL)
- goto out;
- p1 = &callout[0];
- while (p1->c_time<=0 && p1->c_func!=NULL)
- p1++;
- p1->c_time--;
+ for (p1 = calltodo.c_next; p1 && p1->c_time <= 0; p1 = p1->c_next)
+ ;
+ if (p1)
+ p1->c_time--;
register struct callout *p1, *p2;
register struct proc *pp;
register int a, s;
register struct callout *p1, *p2;
register struct proc *pp;
register int a, s;
+ caddr_t arg;
+ int (*func)();
/*
* Perform callouts (but not after panic's!)
*/
/*
* Perform callouts (but not after panic's!)
*/
- if (panicstr == 0 && callout[0].c_time <= 0) {
- p1 = &callout[0];
- while (p1->c_func != 0 && p1->c_time <= 0) {
- (*p1->c_func)(p1->c_arg);
- p1++;
- }
- p2 = &callout[0];
- while (p2->c_func = p1->c_func) {
- p2->c_time = p1->c_time;
- p2->c_arg = p1->c_arg;
- p1++;
- p2++;
+ if (panicstr == 0) {
+ for (;;) {
+ s = spl7();
+ if ((p1 = calltodo.c_next) == 0 || p1->c_time > 0)
+ break;
+ calltodo.c_next = p1->c_next;
+ arg = p1->c_arg;
+ func = p1->c_func;
+ p1->c_next = callfree;
+ callfree = p1;
+ (void) splx(s);
+ (*func)(arg);
/*
* Timeout is called to arrange that
* fun(arg) is called in tim/hz seconds.
/*
* Timeout is called to arrange that
* fun(arg) is called in tim/hz seconds.
- * An entry is sorted into the callout
+ * An entry is linked into the callout
* structure. The time in each structure
* entry is the number of hz's more
* than the previous entry.
* structure. The time in each structure
* entry is the number of hz's more
* than the previous entry.
int (*fun)();
caddr_t arg;
{
int (*fun)();
caddr_t arg;
{
- register struct callout *p1, *p2, *p3;
+ register struct callout *p1, *p2, *pnew;
panic("timeout ttrstr arg");
/* END DEBUGGING CODE */
t = tim;
panic("timeout ttrstr arg");
/* END DEBUGGING CODE */
t = tim;
- while (p1->c_func != 0 && p1->c_time <= t) {
- t -= p1->c_time;
- p1++;
- }
- p1->c_time -= t;
- p2 = p1;
- p3 = callout+(ncallout-2);
- while (p2->c_func != 0) {
- if (p2 >= p3)
- panic("timeout table overflow");
- p2++;
- }
- while (p2 >= p1) {
- (p2+1)->c_time = p2->c_time;
- (p2+1)->c_func = p2->c_func;
- (p2+1)->c_arg = p2->c_arg;
- p2--;
- }
- p1->c_time = t;
- p1->c_func = fun;
- p1->c_arg = arg;
+ pnew = callfree;
+ if (pnew == NULL)
+ panic("timeout table overflow");
+ callfree = pnew->c_next;
+ pnew->c_arg = arg;
+ pnew->c_func = fun;
+ for (p1 = &calltodo; (p2 = p1->c_next) && p2->c_time < t; p1 = p2)
+ t -= p2->c_time;
+ p1->c_next = pnew;
+ pnew->c_next = p2;
+ pnew->c_time = t;
+ if (p2)
+ p2->c_time -= t;
-/* machdep.c 4.31 81/04/13 */
+/* machdep.c 4.32 81/04/17 */
#include "../h/param.h"
#include "../h/systm.h"
#include "../h/param.h"
#include "../h/systm.h"
+ /*
+ * Initialize callouts
+ */
+ callfree = callout;
+ for (i = 1; i < ncallout; i++)
+ callout[i-1].c_next = &callout[i];
+
/*
* Initialize memory allocator and swap
* and user page table maps.
/*
* Initialize memory allocator and swap
* and user page table maps.