1 /* 2 * Copyright (c) 2013-2026 Devin Teske <dteske@FreeBSD.org> 3 * Copyright (c) 2021-2026 Faraz Vahedi <kfv@FreeBSD.org> 4 * 5 * SPDX-License-Identifier: BSD-2-Clause 6 */ 7 8 #include "bsdconf_formats.h" 9 10 /* 11 * BSDCONF_FORMAT_SYSCTL: sysctl.conf(5) 12 * 13 * Assignments in the format of the sysctl(8) command, whose file parser 14 * trims whitespace around the `=' and strips one pair of quotes around the 15 * value, so values are written unquoted unless quoting is required to 16 * round-trip (embedded whitespace or a comment character). 17 * 18 * Sourced at boot in the order below: the first two by rc.d/sysctl (and 19 * again by rc.d/sysctl_lastload), the module-specific drop-in by 20 * rc.subr(8)'s load_kld when the named kernel module loads. 21 */ 22 static const struct bsdconf_source bsdconf_sysctl_sources[] = { 23 { BSDCONF_SOURCE_FILE, "/etc/sysctl.conf" }, 24 { BSDCONF_SOURCE_FILE, "/etc/sysctl.conf.local" }, 25 { BSDCONF_SOURCE_MODDIR, "/etc/sysctl.kld.d" }, 26 { BSDCONF_SOURCE_FILE, NULL }, 27 }; 28 29 const struct bsdconf_format_def bsdconf_format_sysctl_def = { 30 .keyword = "sysctl", 31 .path = "/etc/sysctl.conf", 32 .sources = bsdconf_sysctl_sources, 33 .processing = BSDCONF_BREAK_ON_EQUALS | BSDCONF_CASE_SENSITIVE | 34 BSDCONF_REQUIRE_EQUALS, 35 .put = BSDCONF_PUT_ALLOW_EMPTY, 36 }; 37