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

Function linker_file_sysuninit

freebsd/kern/kern_linker.c:241–289  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

239}
240
241static void
242linker_file_sysuninit(linker_file_t lf)
243{
244 struct sysinit **start, **stop, **sipp, **xipp, *save;
245
246 KLD_DPF(FILE, ("linker_file_sysuninit: calling SYSUNINITs for %s\n",
247 lf->filename));
248
249 sx_assert(&kld_sx, SA_XLOCKED);
250
251 if (linker_file_lookup_set(lf, "sysuninit_set", &start, &stop,
252 NULL) != 0)
253 return;
254
255 /*
256 * Perform a reverse bubble sort of the system initialization objects
257 * by their subsystem (primary key) and order (secondary key).
258 *
259 * Since some things care about execution order, this is the operation
260 * which ensures continued function.
261 */
262 for (sipp = start; sipp < stop; sipp++) {
263 for (xipp = sipp + 1; xipp < stop; xipp++) {
264 if ((*sipp)->subsystem > (*xipp)->subsystem ||
265 ((*sipp)->subsystem == (*xipp)->subsystem &&
266 (*sipp)->order >= (*xipp)->order))
267 continue; /* skip */
268 save = *sipp;
269 *sipp = *xipp;
270 *xipp = save;
271 }
272 }
273
274 /*
275 * Traverse the (now) ordered list of system initialization tasks.
276 * Perform each task, and continue on to the next task.
277 */
278 sx_xunlock(&kld_sx);
279 mtx_lock(&Giant);
280 for (sipp = start; sipp < stop; sipp++) {
281 if ((*sipp)->subsystem == SI_SUB_DUMMY)
282 continue; /* skip dummy task(s) */
283
284 /* Call function */
285 (*((*sipp)->func)) ((*sipp)->udata);
286 }
287 mtx_unlock(&Giant);
288 sx_xlock(&kld_sx);
289}
290
291static void
292linker_file_register_sysctls(linker_file_t lf, bool enable)

Callers 1

linker_file_unloadFunction · 0.85

Calls 3

linker_file_lookup_setFunction · 0.85
mtx_lockFunction · 0.70
mtx_unlockFunction · 0.70

Tested by

no test coverage detected