MCPcopy Create free account
hub / github.com/F-Stack/f-stack / proc0_post

Function proc0_post

freebsd/kern/init_main.c:629–663  ·  view source on GitHub ↗

ARGSUSED*/

Source from the content-addressed store, hash-verified

627
628/* ARGSUSED*/
629static void
630proc0_post(void *dummy __unused)
631{
632 struct proc *p;
633 struct rusage ru;
634 struct thread *td;
635
636 /*
637 * Now we can look at the time, having had a chance to verify the
638 * time from the filesystem. Pretend that proc0 started now.
639 */
640 sx_slock(&allproc_lock);
641 FOREACH_PROC_IN_SYSTEM(p) {
642 PROC_LOCK(p);
643 if (p->p_state == PRS_NEW) {
644 PROC_UNLOCK(p);
645 continue;
646 }
647 microuptime(&p->p_stats->p_start);
648 PROC_STATLOCK(p);
649 rufetch(p, &ru); /* Clears thread stats */
650 p->p_rux.rux_runtime = 0;
651 p->p_rux.rux_uticks = 0;
652 p->p_rux.rux_sticks = 0;
653 p->p_rux.rux_iticks = 0;
654 PROC_STATUNLOCK(p);
655 FOREACH_THREAD_IN_PROC(p, td) {
656 td->td_runtime = 0;
657 }
658 PROC_UNLOCK(p);
659 }
660 sx_sunlock(&allproc_lock);
661 PCPU_SET(switchtime, cpu_ticks());
662 PCPU_SET(switchticks, ticks);
663}
664SYSINIT(p0post, SI_SUB_INTRINSIC_POST, SI_ORDER_FIRST, proc0_post, NULL);
665
666/*

Callers

nothing calls this directly

Calls 2

microuptimeFunction · 0.85
rufetchFunction · 0.85

Tested by

no test coverage detected