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

Function linker_preload_finish

freebsd/kern/kern_linker.c:1710–1732  ·  view source on GitHub ↗

* Handle preload files that failed to load any modules. */

Source from the content-addressed store, hash-verified

1708 * Handle preload files that failed to load any modules.
1709 */
1710static void
1711linker_preload_finish(void *arg)
1712{
1713 linker_file_t lf, nlf;
1714
1715 sx_xlock(&kld_sx);
1716 TAILQ_FOREACH_SAFE(lf, &linker_files, link, nlf) {
1717 /*
1718 * If all of the modules in this file failed to load, unload
1719 * the file and return an error of ENOEXEC. (Parity with
1720 * linker_load_file.)
1721 */
1722 if ((lf->flags & LINKER_FILE_MODULES) != 0 &&
1723 TAILQ_EMPTY(&lf->modules)) {
1724 linker_file_unload(lf, LINKER_UNLOAD_FORCE);
1725 continue;
1726 }
1727
1728 lf->flags &= ~LINKER_FILE_MODULES;
1729 lf->userrefs++; /* so we can (try to) kldunload it */
1730 }
1731 sx_xunlock(&kld_sx);
1732}
1733
1734/*
1735 * Attempt to run after all DECLARE_MODULE SYSINITs. Unfortunately they can be

Callers

nothing calls this directly

Calls 1

linker_file_unloadFunction · 0.85

Tested by

no test coverage detected