Lines Matching defs:oid

179 sysctl_root_handler_locked(struct sysctl_oid *oid, void *arg1, intmax_t arg2,
184 if (oid->oid_kind & CTLFLAG_DYN)
185 atomic_add_int(&oid->oid_running, 1);
196 if ((oid->oid_kind & CTLFLAG_NEEDGIANT) ||
197 (!(oid->oid_kind & CTLFLAG_MPSAFE)))
199 error = oid->oid_handler(oid, arg1, arg2, req);
200 if ((oid->oid_kind & CTLFLAG_NEEDGIANT) ||
201 (!(oid->oid_kind & CTLFLAG_MPSAFE)))
211 if (oid->oid_kind & CTLFLAG_DYN) {
212 if (atomic_fetchadd_int(&oid->oid_running, -1) == 1 &&
213 (oid->oid_kind & CTLFLAG_DYING) != 0)
214 wakeup(&oid->oid_running);
360 * Locate the path to a given oid. Returns the length of the resulting path,
361 * or -1 if the oid was not found. nodes must have room for CTL_MAXNAME
372 * Do a depth-first search of the oid tree, looking for 'needle'. Start
454 * First check if another oid with the same name already
569 ("enabling already enabled sysctl oid"));
823 "remove oid %s with child %s\n",
921 /* Register this oid */
928 * Rename an existing oid.
945 * Reparent an existing oid.
948 sysctl_move_oid(struct sysctl_oid *oid, struct sysctl_oid_list *parent)
953 if (oid->oid_parent == parent) {
957 oidp = sysctl_find_oidname(oid->oid_name, parent);
962 sysctl_unregister_oid(oid);
963 oid->oid_parent = parent;
964 oid->oid_number = OID_AUTO;
965 sysctl_register_oid(oid);
995 int oid[CTL_MAXNAME];
999 error = name2oid(name, oid, &nlen, &oidp);
1018 int oid[CTL_MAXNAME];
1031 error = name2oid(name, oid, &nlen, &oidp);
1187 struct sysctl_oid *oid, key;
1212 oid = RB_FIND(sysctl_oid_list, lsp, &key);
1213 if (oid) {
1217 error = SYSCTL_OUT(req, oid->oid_name,
1218 strlen(oid->oid_name));
1225 if ((oid->oid_kind & CTLTYPE) == CTLTYPE_NODE &&
1226 !oid->oid_handler)
1227 lsp2 = SYSCTL_CHILDREN(oid);
1269 * looking for the next oid in its children.
1284 /* Report oid as a node to iterate */
1295 * that means we have reached the next oid in the sequence and
1305 * We have reached the next oid.
1333 * Returns true and fills in next oid data in @next and @len if oid is found.
1346 * Start the search at the requested oid. But if not found, then scan
1376 * We maintain the invariant that current node oid
1377 * is >= the oid provided in @name.
1379 * current node oid is strictly > than the requested
1380 * oid.
1433 name2oid(const char *name, int *oid, int *len, struct sysctl_oid **oidpp)
1446 *oid++ = oidp->oid_number;
1473 int error, oid[CTL_MAXNAME], len = 0;
1497 error = name2oid(p, oid, &len, &op);
1506 error = SYSCTL_OUT(req, oid, len * sizeof *oid);
1521 struct sysctl_oid *oid;
1530 error = sysctl_find_oid(arg1, arg2, &oid, NULL, req);
1534 if (oid->oid_fmt == NULL) {
1538 error = SYSCTL_OUT(req, &oid->oid_kind, sizeof(oid->oid_kind));
1541 error = SYSCTL_OUT(req, oid->oid_fmt, strlen(oid->oid_fmt) + 1);
1553 struct sysctl_oid *oid;
1562 error = sysctl_find_oid(arg1, arg2, &oid, NULL, req);
1566 if (oid->oid_descr == NULL) {
1570 error = SYSCTL_OUT(req, oid->oid_descr, strlen(oid->oid_descr) + 1);
1582 struct sysctl_oid *oid;
1591 error = sysctl_find_oid(arg1, arg2, &oid, NULL, req);
1595 if (oid->oid_label == NULL) {
1599 error = SYSCTL_OUT(req, oid->oid_label, strlen(oid->oid_label) + 1);
2157 int oid[CTL_MAXNAME];
2161 oid[0] = CTL_SYSCTL;
2162 oid[1] = CTL_SYSCTL_NAME2OID;
2163 oidlen = sizeof(oid);
2165 error = kernel_sysctl(td, oid, 2, oid, &oidlen,
2170 error = kernel_sysctl(td, oid, plen / sizeof(int), old, oldlenp,
2265 struct sysctl_oid *oid;
2274 oid = RB_FIND(sysctl_oid_list, lsp, &key);
2275 if (oid == NULL)
2279 if ((oid->oid_kind & CTLTYPE) == CTLTYPE_NODE) {
2280 if (oid->oid_handler != NULL || indx == namelen) {
2281 *noid = oid;
2284 KASSERT((oid->oid_kind & CTLFLAG_DYING) == 0,
2285 ("%s found DYING node %p", __func__, oid));
2288 lsp = SYSCTL_CHILDREN(oid);
2290 if ((oid->oid_kind & CTLFLAG_DORMANT) != 0)
2292 *noid = oid;
2295 KASSERT((oid->oid_kind & CTLFLAG_DYING) == 0,
2296 ("%s found DYING node %p", __func__, oid));
2313 struct sysctl_oid *oid;
2319 error = sysctl_find_oid(arg1, arg2, &oid, &indx, req);
2323 if ((oid->oid_kind & CTLTYPE) == CTLTYPE_NODE) {
2329 if (oid->oid_handler == NULL) {
2336 if (req->newptr && !(oid->oid_kind & CTLFLAG_WR)) {
2349 if ((req->oldptr && !(oid->oid_kind & CTLFLAG_CAPRD)) ||
2350 (req->newptr && !(oid->oid_kind & CTLFLAG_CAPWR))) {
2358 if (req->newptr && (oid->oid_kind & CTLFLAG_SECURE)) {
2359 lvl = (oid->oid_kind & CTLMASK_SECURE) >> CTLSHIFT_SECURE;
2366 if (req->newptr && !(oid->oid_kind & CTLFLAG_ANYBODY)) {
2369 if (oid->oid_kind & CTLFLAG_PRISON)
2372 else if ((oid->oid_kind & CTLFLAG_VNET) &&
2383 if (!oid->oid_handler) {
2388 if ((oid->oid_kind & CTLTYPE) == CTLTYPE_NODE) {
2392 arg1 = oid->oid_arg1;
2393 arg2 = oid->oid_arg2;
2396 error = mac_system_check_sysctl(req->td->td_ucred, oid, arg1, arg2,
2402 if ((oid->oid_kind & CTLFLAG_VNET) && arg1 != NULL)
2405 error = sysctl_root_handler_locked(oid, arg1, arg2, req, &tracker);
2453 int oid[CTL_MAXNAME];
2468 oid[0] = CTL_SYSCTL;
2469 oid[1] = CTL_SYSCTL_NAME2OID;
2470 oidlen = sizeof(oid);
2471 error = kernel_sysctl(td, oid, 2, oid, &oidlen, (void *)name, namelen,
2475 error = userland_sysctl(td, oid, *retval / sizeof(int), old, oldlenp,
2875 db_show_oid_name(int *oid, size_t nlen)
2883 memcpy(qoid + 2, oid, nlen * sizeof(int));
2887 db_error("sysctl name oid");
2913 db_show_oid(struct sysctl_oid *oidp, int *oid, size_t nlen, int flags)
2928 db_show_oid_name(oid, nlen);
2934 db_show_oid_name(oid, nlen);
2946 error = db_sysctl(oidp, oid, nlen,
2953 error = db_sysctl(oidp, oid, nlen,
2966 db_show_sysctl_all(int *oid, size_t len, int flags)
2976 memcpy(&qoid[2], oid, nlen * sizeof(int));
2999 if (memcmp(&oid[0], &next[0], len * sizeof(int)) != 0)
3023 int oid[CTL_MAXNAME];
3026 error = name2oid(name, oid, &nlen, &oidp);
3032 db_show_sysctl_all(oid, nlen, flags);
3034 error = db_show_oid(oidp, oid, nlen, flags);
3121 db_printf("unknown oid: '%s'\n", db_tok_string);