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

Function procinit

freebsd/kern/kern_proc.c:176–201  ·  view source on GitHub ↗

* Initialize global process hashing structures. */

Source from the content-addressed store, hash-verified

174 * Initialize global process hashing structures.
175 */
176void
177procinit(void)
178{
179 u_long i;
180
181 sx_init(&allproc_lock, "allproc");
182 sx_init(&proctree_lock, "proctree");
183 mtx_init(&ppeers_lock, "p_peers", NULL, MTX_DEF);
184 mtx_init(&procid_lock, "procid", NULL, MTX_DEF);
185 LIST_INIT(&allproc);
186 pidhashtbl = hashinit(maxproc / 4, M_PROC, &pidhash);
187 pidhashlock = (pidhash + 1) / 64;
188 if (pidhashlock > 0)
189 pidhashlock--;
190 pidhashtbl_lock = malloc(sizeof(*pidhashtbl_lock) * (pidhashlock + 1),
191 M_PROC, M_WAITOK | M_ZERO);
192 for (i = 0; i < pidhashlock + 1; i++)
193 sx_init_flags(&pidhashtbl_lock[i], "pidhash", SX_DUPOK);
194 pgrphashtbl = hashinit(maxproc / 4, M_PROC, &pgrphash);
195 proc_zone = uma_zcreate("PROC", sched_sizeof_proc(),
196 proc_ctor, proc_dtor, proc_init, proc_fini,
197 UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
198 pgrp_zone = uma_zcreate("PGRP", sizeof(struct pgrp), NULL, NULL,
199 pgrp_init, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
200 uihashinit();
201}
202
203/*
204 * Prepare a proc for use.

Callers 1

proc0_initFunction · 0.70

Calls 7

mtx_initFunction · 0.85
mallocFunction · 0.85
uma_zcreateFunction · 0.85
uihashinitFunction · 0.85
hashinitFunction · 0.70
sx_init_flagsFunction · 0.70
sched_sizeof_procFunction · 0.70

Tested by

no test coverage detected