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

Function sys_kldfirstmod

freebsd/kern/kern_linker.c:1330–1357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1328#endif /* DDB */
1329
1330int
1331sys_kldfirstmod(struct thread *td, struct kldfirstmod_args *uap)
1332{
1333 linker_file_t lf;
1334 module_t mp;
1335 int error = 0;
1336
1337#ifdef MAC
1338 error = mac_kld_check_stat(td->td_ucred);
1339 if (error)
1340 return (error);
1341#endif
1342
1343 sx_xlock(&kld_sx);
1344 lf = linker_find_file_by_id(uap->fileid);
1345 if (lf) {
1346 MOD_SLOCK;
1347 mp = TAILQ_FIRST(&lf->modules);
1348 if (mp != NULL)
1349 td->td_retval[0] = module_getid(mp);
1350 else
1351 td->td_retval[0] = 0;
1352 MOD_SUNLOCK;
1353 } else
1354 error = ENOENT;
1355 sx_xunlock(&kld_sx);
1356 return (error);
1357}
1358
1359int
1360sys_kldsym(struct thread *td, struct kldsym_args *uap)

Callers

nothing calls this directly

Calls 3

mac_kld_check_statFunction · 0.85
linker_find_file_by_idFunction · 0.85
module_getidFunction · 0.85

Tested by

no test coverage detected