exit+ttynew minor fixes
[unix-history] / usr / src / sys / kern / kern_clock.c
index aac9754..5b29708 100644 (file)
@@ -1,4 +1,4 @@
-/*     %H%     3.16    kern_clock.c    */
+/*     %H%     3.19    kern_clock.c    */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -13,7 +13,9 @@
 #include "../h/vm.h"
 #include "../h/buf.h"
 #include "../h/text.h"
 #include "../h/vm.h"
 #include "../h/buf.h"
 #include "../h/text.h"
-#include "../h/limit.h"
+#include "../h/vlimit.h"
+#include "../h/mtpr.h"
+#include "../h/clock.h"
 
 #define        SCHMAG  9/10
 
 
 #define        SCHMAG  9/10
 
@@ -126,6 +128,11 @@ out:
                }
                if (s > u.u_vm.vm_maxrss)
                        u.u_vm.vm_maxrss = s;
                }
                if (s > u.u_vm.vm_maxrss)
                        u.u_vm.vm_maxrss = s;
+               if ((u.u_vm.vm_utime+u.u_vm.vm_stime+1)/HZ > u.u_limit[LIM_CPU]) {
+                       psignal(u.u_procp, SIGXCPU);
+                       if (u.u_limit[LIM_CPU] < INFINITY - 5)
+                               u.u_limit[LIM_CPU] += 5;
+               }
        }
        if (USERMODE(ps)) {
                u.u_vm.vm_utime++;
        }
        if (USERMODE(ps)) {
                u.u_vm.vm_utime++;
@@ -157,15 +164,25 @@ out:
                runrun++;
        }
        if (lbolt >= HZ) {
                runrun++;
        }
        if (lbolt >= HZ) {
+               extern int hangcnt;
+
                if (BASEPRI(ps))
                        return;
                lbolt -= HZ;
                ++time;
                (void) spl1();
                if (BASEPRI(ps))
                        return;
                lbolt -= HZ;
                ++time;
                (void) spl1();
+               /*
+                * machdep.c:unhang uses hangcnt to make sure uba
+                * doesn't forget to interrupt (this has been observed).
+                * This prevents an accumulation of < 5 second uba failures
+                * from summing to a uba reset.
+                */
+               if (hangcnt)
+                       hangcnt--;
                runrun++;
                wakeup((caddr_t)&lbolt);
                for(pp = &proc[0]; pp < &proc[NPROC]; pp++)
                runrun++;
                wakeup((caddr_t)&lbolt);
                for(pp = &proc[0]; pp < &proc[NPROC]; pp++)
-               if (pp->p_stat && pp->p_stat<SZOMB) {
+               if (pp->p_stat && pp->p_stat!=SZOMB) {
                        if(pp->p_time != 127)
                                pp->p_time++;
                        if(pp->p_clktim)
                        if(pp->p_time != 127)
                                pp->p_time++;
                        if(pp->p_clktim)
@@ -237,8 +254,6 @@ out:
                        (void) setpri(pp);
                        pp->p_pri = pp->p_usrpri;
 #endif
                        (void) setpri(pp);
                        pp->p_pri = pp->p_usrpri;
 #endif
-                       if ((u.u_vm.vm_utime+u.u_vm.vm_stime)/HZ > u.u_limit[LIM_CPU])
-                               psignal(pp, SIGXCPU);
                }
        }
        if (!BASEPRI(ps))
                }
        }
        if (!BASEPRI(ps))