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

Function proc0_init

freebsd/kern/init_main.c:442–625  ·  view source on GitHub ↗

* The two following SYSINIT's are proc0 specific glue code. I am not * convinced that they can not be safely combined, but their order of * operation has been maintained as the same as the original init_main.c * for right now. */ ARGSUSED*/

Source from the content-addressed store, hash-verified

440 */
441/* ARGSUSED*/
442static void
443proc0_init(void *dummy __unused)
444{
445 struct proc *p;
446 struct thread *td;
447 struct ucred *newcred;
448 struct uidinfo tmpuinfo;
449 struct loginclass tmplc = {
450 .lc_name = "",
451 };
452 vm_paddr_t pageablemem;
453 int i;
454
455 GIANT_REQUIRED;
456 p = &proc0;
457 td = &thread0;
458
459 /*
460 * Initialize magic number and osrel.
461 */
462 p->p_magic = P_MAGIC;
463 p->p_osrel = osreldate;
464
465 /*
466 * Initialize thread and process structures.
467 */
468 procinit(); /* set up proc zone */
469 threadinit(); /* set up UMA zones */
470
471 /*
472 * Initialise scheduler resources.
473 * Add scheduler specific parts to proc, thread as needed.
474 */
475 schedinit(); /* scheduler gets its house in order */
476
477 /*
478 * Create process 0 (the swapper).
479 */
480 LIST_INSERT_HEAD(&allproc, p, p_list);
481 LIST_INSERT_HEAD(PIDHASH(0), p, p_hash);
482 mtx_init(&pgrp0.pg_mtx, "process group", NULL, MTX_DEF | MTX_DUPOK);
483 p->p_pgrp = &pgrp0;
484 LIST_INSERT_HEAD(PGRPHASH(0), &pgrp0, pg_hash);
485 LIST_INIT(&pgrp0.pg_members);
486 LIST_INSERT_HEAD(&pgrp0.pg_members, p, p_pglist);
487
488 pgrp0.pg_session = &session0;
489 mtx_init(&session0.s_mtx, "session", NULL, MTX_DEF);
490 refcount_init(&session0.s_count, 1);
491 session0.s_leader = p;
492
493 p->p_sysent = &null_sysvec;
494 p->p_flag = P_SYSTEM | P_INMEM | P_KPROC;
495 p->p_flag2 = 0;
496 p->p_state = PRS_NORMAL;
497 p->p_klist = knlist_alloc(&p->p_mtx);
498 STAILQ_INIT(&p->p_ktr);
499 p->p_nice = NZERO;

Callers

nothing calls this directly

Calls 15

threadinitFunction · 0.85
mtx_initFunction · 0.85
refcount_initFunction · 0.85
knlist_allocFunction · 0.85
tidhash_addFunction · 0.85
cpuset_thread0Function · 0.85
prison0_initFunction · 0.85
strncpyFunction · 0.85
loginclass_findFunction · 0.85
proc_set_cred_initFunction · 0.85
audit_cred_kproc0Function · 0.85
mac_cred_create_swapperFunction · 0.85

Tested by

no test coverage detected