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

Function sysctl_unregister_oid

freebsd/kern/kern_sysctl.c:555–585  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

553}
554
555void
556sysctl_unregister_oid(struct sysctl_oid *oidp)
557{
558 struct sysctl_oid *p;
559 int error;
560
561 SYSCTL_ASSERT_WLOCKED();
562 if (oidp->oid_number == OID_AUTO) {
563 error = EINVAL;
564 } else {
565 error = ENOENT;
566 SLIST_FOREACH(p, oidp->oid_parent, oid_link) {
567 if (p == oidp) {
568 SLIST_REMOVE(oidp->oid_parent, oidp,
569 sysctl_oid, oid_link);
570 error = 0;
571 break;
572 }
573 }
574 }
575
576 /*
577 * This can happen when a module fails to register and is
578 * being unloaded afterwards. It should not be a panic()
579 * for normal use.
580 */
581 if (error) {
582 printf("%s: failed(%d) to unregister sysctl(%s)\n",
583 __func__, error, oidp->oid_name);
584 }
585}
586
587/* Initialize a new context to keep track of dynamically added sysctls. */
588int

Callers 4

vfs_registerFunction · 0.85
sysctl_remove_oid_lockedFunction · 0.85
sysctl_move_oidFunction · 0.85

Calls 1

printfFunction · 0.70

Tested by

no test coverage detected