| 1177 | } |
| 1178 | |
| 1179 | int |
| 1180 | sys_kldfind(struct thread *td, struct kldfind_args *uap) |
| 1181 | { |
| 1182 | char *pathname; |
| 1183 | const char *filename; |
| 1184 | linker_file_t lf; |
| 1185 | int error; |
| 1186 | |
| 1187 | #ifdef MAC |
| 1188 | error = mac_kld_check_stat(td->td_ucred); |
| 1189 | if (error) |
| 1190 | return (error); |
| 1191 | #endif |
| 1192 | |
| 1193 | td->td_retval[0] = -1; |
| 1194 | |
| 1195 | pathname = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); |
| 1196 | if ((error = copyinstr(uap->file, pathname, MAXPATHLEN, NULL)) != 0) |
| 1197 | goto out; |
| 1198 | |
| 1199 | filename = linker_basename(pathname); |
| 1200 | sx_xlock(&kld_sx); |
| 1201 | lf = linker_find_file_by_name(filename); |
| 1202 | if (lf) |
| 1203 | td->td_retval[0] = lf->id; |
| 1204 | else |
| 1205 | error = ENOENT; |
| 1206 | sx_xunlock(&kld_sx); |
| 1207 | out: |
| 1208 | free(pathname, M_TEMP); |
| 1209 | return (error); |
| 1210 | } |
| 1211 | |
| 1212 | int |
| 1213 | sys_kldnext(struct thread *td, struct kldnext_args *uap) |
nothing calls this directly
no test coverage detected