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

Function sys_kldnext

freebsd/kern/kern_linker.c:1212–1247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1210}
1211
1212int
1213sys_kldnext(struct thread *td, struct kldnext_args *uap)
1214{
1215 linker_file_t lf;
1216 int error = 0;
1217
1218#ifdef MAC
1219 error = mac_kld_check_stat(td->td_ucred);
1220 if (error)
1221 return (error);
1222#endif
1223
1224 sx_xlock(&kld_sx);
1225 if (uap->fileid == 0)
1226 lf = TAILQ_FIRST(&linker_files);
1227 else {
1228 lf = linker_find_file_by_id(uap->fileid);
1229 if (lf == NULL) {
1230 error = ENOENT;
1231 goto out;
1232 }
1233 lf = TAILQ_NEXT(lf, link);
1234 }
1235
1236 /* Skip partially loaded files. */
1237 while (lf != NULL && !(lf->flags & LINKER_FILE_LINKED))
1238 lf = TAILQ_NEXT(lf, link);
1239
1240 if (lf)
1241 td->td_retval[0] = lf->id;
1242 else
1243 td->td_retval[0] = 0;
1244out:
1245 sx_xunlock(&kld_sx);
1246 return (error);
1247}
1248
1249int
1250sys_kldstat(struct thread *td, struct kldstat_args *uap)

Callers

nothing calls this directly

Calls 2

mac_kld_check_statFunction · 0.85
linker_find_file_by_idFunction · 0.85

Tested by

no test coverage detected