fix soaccept
[unix-history] / usr / src / sys / kern / kern_clock.c
index 513ccb6..a4e4384 100644 (file)
@@ -1,4 +1,4 @@
-/*     kern_clock.c    4.25    81/08/31        */
+/*     kern_clock.c    4.30    81/12/19        */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -17,6 +17,7 @@
 #include "../h/mtpr.h"
 #include "../h/clock.h"
 #include "../h/cpu.h"
 #include "../h/mtpr.h"
 #include "../h/clock.h"
 #include "../h/cpu.h"
+#include "../h/protosw.h"
 
 #include "bk.h"
 #include "dh.h"
 
 #include "bk.h"
 #include "dh.h"
  * interrupts compressed into one (due to excessive interrupt load),
  * but that hardclock interrupts should never be lost.
  */
  * interrupts compressed into one (due to excessive interrupt load),
  * but that hardclock interrupts should never be lost.
  */
+#ifdef KPROF
+int    kcounts[20000];
+#endif
+
+/*
+ * Protoslow is like lbolt, but for slow protocol timeouts, counting
+ * up to (hz/PR_SLOWHZ), then causing a pfslowtimo().
+ * Protofast is like lbolt, but for fast protocol timeouts, counting
+ * up to (hz/PR_FASTHZ), then causing a pffasttimo().
+ */
+int    protoslow;
+int    protofast;
 
 /*ARGSUSED*/
 hardclock(pc, ps)
 
 /*ARGSUSED*/
 hardclock(pc, ps)
@@ -97,6 +110,11 @@ hardclock(pc, ps)
                else
                        cpstate = CP_USER;
        } else {
                else
                        cpstate = CP_USER;
        } else {
+#ifdef KPROF
+       int k = ((int)pc & 0x7fffffff) / 8;
+       if (k < 20000)
+               kcounts[k]++;
+#endif
                cpstate = CP_SYS;
                if (noproc)
                        cpstate = CP_IDLE;
                cpstate = CP_SYS;
                if (noproc)
                        cpstate = CP_IDLE;
@@ -125,6 +143,12 @@ hardclock(pc, ps)
         * Time moves on.
         */
        ++lbolt;
         * Time moves on.
         */
        ++lbolt;
+
+       /*
+        * Time moves on for protocols.
+        */
+       --protoslow; --protofast;
+
 #if VAX780
        /*
         * On 780's, impelement a fast UBA watcher,
 #if VAX780
        /*
         * On 780's, impelement a fast UBA watcher,
@@ -236,6 +260,18 @@ softclock(pc, ps)
                aston();
        }
 
                aston();
        }
 
+       /*
+        * Run network slow and fast timeouts.
+        */
+       if (protofast <= 0) {
+               protofast = hz / PR_FASTHZ;
+               pffasttimo();
+       }
+       if (protoslow <= 0) {
+               protoslow = hz / PR_SLOWHZ;
+               pfslowtimo();
+       }
+
        /*
         * Lightning bolt every second:
         *      sleep timeouts
        /*
         * Lightning bolt every second:
         *      sleep timeouts