| 1289 | } |
| 1290 | |
| 1291 | int |
| 1292 | ctl_byname(tsd_t *tsd, const char *name, void *oldp, size_t *oldlenp, |
| 1293 | void *newp, size_t newlen) { |
| 1294 | int ret; |
| 1295 | size_t depth; |
| 1296 | ctl_node_t const *nodes[CTL_MAX_DEPTH]; |
| 1297 | size_t mib[CTL_MAX_DEPTH]; |
| 1298 | const ctl_named_node_t *node; |
| 1299 | |
| 1300 | if (!ctl_initialized && ctl_init(tsd)) { |
| 1301 | ret = EAGAIN; |
| 1302 | goto label_return; |
| 1303 | } |
| 1304 | |
| 1305 | depth = CTL_MAX_DEPTH; |
| 1306 | ret = ctl_lookup(tsd_tsdn(tsd), name, nodes, mib, &depth); |
| 1307 | if (ret != 0) { |
| 1308 | goto label_return; |
| 1309 | } |
| 1310 | |
| 1311 | node = ctl_named_node(nodes[depth-1]); |
| 1312 | if (node != NULL && node->ctl) { |
| 1313 | ret = node->ctl(tsd, mib, depth, oldp, oldlenp, newp, newlen); |
| 1314 | } else { |
| 1315 | /* The name refers to a partial path through the ctl tree. */ |
| 1316 | ret = ENOENT; |
| 1317 | } |
| 1318 | |
| 1319 | label_return: |
| 1320 | return(ret); |
| 1321 | } |
| 1322 | |
| 1323 | int |
| 1324 | ctl_nametomib(tsd_t *tsd, const char *name, size_t *mibp, size_t *miblenp) { |
no test coverage detected