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

Function sysctl_move_oid

freebsd/kern/kern_sysctl.c:896–917  ·  view source on GitHub ↗

* Reparent an existing oid. */

Source from the content-addressed store, hash-verified

894 * Reparent an existing oid.
895 */
896int
897sysctl_move_oid(struct sysctl_oid *oid, struct sysctl_oid_list *parent)
898{
899 struct sysctl_oid *oidp;
900
901 SYSCTL_WLOCK();
902 if (oid->oid_parent == parent) {
903 SYSCTL_WUNLOCK();
904 return (0);
905 }
906 oidp = sysctl_find_oidname(oid->oid_name, parent);
907 if (oidp != NULL) {
908 SYSCTL_WUNLOCK();
909 return (EEXIST);
910 }
911 sysctl_unregister_oid(oid);
912 oid->oid_parent = parent;
913 oid->oid_number = OID_AUTO;
914 sysctl_register_oid(oid);
915 SYSCTL_WUNLOCK();
916 return (0);
917}
918
919/*
920 * Register the kernel's oids on startup.

Callers

nothing calls this directly

Calls 3

sysctl_find_oidnameFunction · 0.85
sysctl_unregister_oidFunction · 0.85
sysctl_register_oidFunction · 0.85

Tested by

no test coverage detected