kern_sysctl.c (316128) | kern_sysctl.c (324748) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Mike Karels at Berkeley Software Design, Inc. 7 * 8 * Quite extensively rewritten by Poul-Henning Kamp of the FreeBSD --- 22 unchanged lines hidden (view full) --- 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * 35 * @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94 36 */ 37 38#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1982, 1986, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Mike Karels at Berkeley Software Design, Inc. 7 * 8 * Quite extensively rewritten by Poul-Henning Kamp of the FreeBSD --- 22 unchanged lines hidden (view full) --- 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * 35 * @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94 36 */ 37 38#include <sys/cdefs.h> |
39__FBSDID("$FreeBSD: stable/11/sys/kern/kern_sysctl.c 316128 2017-03-29 08:00:13Z ngie $"); | 39__FBSDID("$FreeBSD: stable/11/sys/kern/kern_sysctl.c 324748 2017-10-19 07:54:04Z avg $"); |
40 41#include "opt_capsicum.h" 42#include "opt_compat.h" 43#include "opt_ktrace.h" 44 45#include <sys/param.h> 46#include <sys/fail.h> 47#include <sys/systm.h> --- 372 unchanged lines hidden (view full) --- 420 /* only fetch value once */ 421 oidp->oid_kind |= CTLFLAG_NOFETCH; 422 /* try to fetch value from kernel environment */ 423 sysctl_load_tunable_by_oid_locked(oidp); 424 } 425} 426 427void | 40 41#include "opt_capsicum.h" 42#include "opt_compat.h" 43#include "opt_ktrace.h" 44 45#include <sys/param.h> 46#include <sys/fail.h> 47#include <sys/systm.h> --- 372 unchanged lines hidden (view full) --- 420 /* only fetch value once */ 421 oidp->oid_kind |= CTLFLAG_NOFETCH; 422 /* try to fetch value from kernel environment */ 423 sysctl_load_tunable_by_oid_locked(oidp); 424 } 425} 426 427void |
428sysctl_register_disabled_oid(struct sysctl_oid *oidp) 429{ 430 431 /* 432 * Mark the leaf as dormant if it's not to be immediately enabled. 433 * We do not disable nodes as they can be shared between modules 434 * and it is always safe to access a node. 435 */ 436 KASSERT((oidp->oid_kind & CTLFLAG_DORMANT) == 0, 437 ("internal flag is set in oid_kind")); 438 if ((oidp->oid_kind & CTLTYPE) != CTLTYPE_NODE) 439 oidp->oid_kind |= CTLFLAG_DORMANT; 440 sysctl_register_oid(oidp); 441} 442 443void 444sysctl_enable_oid(struct sysctl_oid *oidp) 445{ 446 447 SYSCTL_ASSERT_WLOCKED(); 448 if ((oidp->oid_kind & CTLTYPE) == CTLTYPE_NODE) { 449 KASSERT((oidp->oid_kind & CTLFLAG_DORMANT) == 0, 450 ("sysctl node is marked as dormant")); 451 return; 452 } 453 KASSERT((oidp->oid_kind & CTLFLAG_DORMANT) != 0, 454 ("enabling already enabled sysctl oid")); 455 oidp->oid_kind &= ~CTLFLAG_DORMANT; 456} 457 458void |
|
428sysctl_unregister_oid(struct sysctl_oid *oidp) 429{ 430 struct sysctl_oid *p; 431 int error; 432 433 SYSCTL_ASSERT_WLOCKED(); 434 error = ENOENT; 435 if (oidp->oid_number == OID_AUTO) { --- 524 unchanged lines hidden (view full) --- 960 struct sysctl_oid *oidp; 961 962 SYSCTL_ASSERT_LOCKED(); 963 *len = level; 964 SLIST_FOREACH(oidp, lsp, oid_link) { 965 *next = oidp->oid_number; 966 *oidpp = oidp; 967 | 459sysctl_unregister_oid(struct sysctl_oid *oidp) 460{ 461 struct sysctl_oid *p; 462 int error; 463 464 SYSCTL_ASSERT_WLOCKED(); 465 error = ENOENT; 466 if (oidp->oid_number == OID_AUTO) { --- 524 unchanged lines hidden (view full) --- 991 struct sysctl_oid *oidp; 992 993 SYSCTL_ASSERT_LOCKED(); 994 *len = level; 995 SLIST_FOREACH(oidp, lsp, oid_link) { 996 *next = oidp->oid_number; 997 *oidpp = oidp; 998 |
968 if (oidp->oid_kind & CTLFLAG_SKIP) | 999 if ((oidp->oid_kind & (CTLFLAG_SKIP | CTLFLAG_DORMANT)) != 0) |
969 continue; 970 971 if (!namelen) { 972 if ((oidp->oid_kind & CTLTYPE) != CTLTYPE_NODE) 973 return (0); 974 if (oidp->oid_handler) 975 /* We really should call the handler here...*/ 976 return (0); --- 779 unchanged lines hidden (view full) --- 1756 if (nindx != NULL) 1757 *nindx = indx; 1758 KASSERT((oid->oid_kind & CTLFLAG_DYING) == 0, 1759 ("%s found DYING node %p", __func__, oid)); 1760 return (0); 1761 } 1762 lsp = SYSCTL_CHILDREN(oid); 1763 } else if (indx == namelen) { | 1000 continue; 1001 1002 if (!namelen) { 1003 if ((oidp->oid_kind & CTLTYPE) != CTLTYPE_NODE) 1004 return (0); 1005 if (oidp->oid_handler) 1006 /* We really should call the handler here...*/ 1007 return (0); --- 779 unchanged lines hidden (view full) --- 1787 if (nindx != NULL) 1788 *nindx = indx; 1789 KASSERT((oid->oid_kind & CTLFLAG_DYING) == 0, 1790 ("%s found DYING node %p", __func__, oid)); 1791 return (0); 1792 } 1793 lsp = SYSCTL_CHILDREN(oid); 1794 } else if (indx == namelen) { |
1795 if ((oid->oid_kind & CTLFLAG_DORMANT) != 0) 1796 return (ENOENT); |
|
1764 *noid = oid; 1765 if (nindx != NULL) 1766 *nindx = indx; 1767 KASSERT((oid->oid_kind & CTLFLAG_DYING) == 0, 1768 ("%s found DYING node %p", __func__, oid)); 1769 return (0); 1770 } else { 1771 return (ENOTDIR); --- 260 unchanged lines hidden --- | 1797 *noid = oid; 1798 if (nindx != NULL) 1799 *nindx = indx; 1800 KASSERT((oid->oid_kind & CTLFLAG_DYING) == 0, 1801 ("%s found DYING node %p", __func__, oid)); 1802 return (0); 1803 } else { 1804 return (ENOTDIR); --- 260 unchanged lines hidden --- |