| 1210 | } |
| 1211 | |
| 1212 | int |
| 1213 | sys_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; |
| 1244 | out: |
| 1245 | sx_xunlock(&kld_sx); |
| 1246 | return (error); |
| 1247 | } |
| 1248 | |
| 1249 | int |
| 1250 | sys_kldstat(struct thread *td, struct kldstat_args *uap) |
nothing calls this directly
no test coverage detected