- lck_mtx_lock(domain_proto_mtx);
- for (dp = domains; dp; dp = dp->dom_next)
- for (pr = dp->dom_protosw; pr; pr = pr->pr_next)
- if (pr->pr_fasttimo)
- (*pr->pr_fasttimo)();
- lck_mtx_unlock(domain_proto_mtx);
- timeout(pffasttimo, NULL, hz/PR_FASTHZ);
+ microuptime(&tv);
+ uptime = tv.tv_sec;
+}
+
+/*
+ * An alternative way to obtain the coarse-grained uptime (in seconds)
+ * for networking code which do not require high-precision timestamp,
+ * as this is significantly cheaper than microuptime().
+ */
+u_int64_t
+net_uptime(void)
+{
+ /* If we get here before pfslowtimo() fires for the first time */
+ if (uptime == 0)
+ net_update_uptime();
+
+ return (uptime);