mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-11-07 04:36:52 -10:00
Complete the native configuration trinity: sysctl(8) for live kernel state, sysrc(8) for rc.conf(5), and sysconf(8) for the remaining base configuration -- loader.conf(5), sysctl.conf(5), and the make.conf(5) family -- atop libbsdconf(3). libbsdconf resurrects figpar as a unified reader/writer. Callbacks own semantics; statements may span multiple lines via backslash continuation; non-seekable input is spooled; writes are atomic (mkstemp, fsync, rename) with mode/owner preservation. Format descriptors name each target, its files, and quoting rules without private parsers. Multi-file targets follow boot sourcing order; loader chases loader_conf_files as the boot loader does. sysconf(8) is the operator-facing tool: name / name=value on a required target, sysrc-style list edits, make append and list-strike where they belong, jail/altroot, and a capsicum sandbox for read-only use. Sysctl writes validate against the running kernel first -- unknown and read-only OIDs, CTLFLAG_TUN (pointing at the loader target), and CTLTYPE range checks -- so a typo or overflow does not land in sysctl.conf. Make and src treat WITH_/WITHOUT_ as presence knobs (as bsd.mkopt.mk / src.conf(5) do) and warn on the WITH_*=no form that does not disable the option, so a bad assignment is caught before an /usr/src build surfaces it. The rc target passes through to sysrc(8). Defaults querying (-d/-D/-A) mirrors sysrc for dumps and descriptions on targets that have a defaults file; named reads already see defaults, and -A only widens dump scope. Manuals are split pkg(8)-style (bsdconf/put/format; sysconf plus per-target pages). ATF coverage exercises the frontend. Co-authored-by: Faraz Vahedi <[email protected]> Reviewed by: fuz, kfv Differential Revision: https://reviews.freebsd.org/D58066
38 lines
1.5 KiB
C
38 lines
1.5 KiB
C
/*
|
|
* Copyright (c) 2013-2026 Devin Teske <[email protected]>
|
|
* Copyright (c) 2021-2026 Faraz Vahedi <[email protected]>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#ifndef _BSDCONF_FORMATS_H_
|
|
#define _BSDCONF_FORMATS_H_
|
|
|
|
#include "bsdconf.h"
|
|
|
|
/*
|
|
* The built-in format descriptors, one translation unit per format.
|
|
* This header is deliberately not installed.
|
|
*
|
|
* Every format is a self-contained bsdconf_format_<keyword>.c defining a
|
|
* single descriptor; the registry in bsdconf_format.c does nothing but
|
|
* collect them into the table indexed by enum bsdconf_format. Adding a
|
|
* format to the library therefore touches no existing parsing or writing
|
|
* code: drop in the new file, declare its descriptor here, append one
|
|
* enum constant in bsdconf.h and one pointer to the registry table, and
|
|
* list the file in the Makefile.
|
|
*
|
|
* A candidate format whose syntax the existing processing/put flags cannot
|
|
* express (for example, brace-grouped statement blocks) is handled by
|
|
* teaching the shared engine (bsdconf.c and bsdconf_put.c) a new flag that
|
|
* the new descriptor is first to set, so the capability composes with
|
|
* every other format rather than living in a private parser.
|
|
*/
|
|
extern const struct bsdconf_format_def bsdconf_format_generic_def;
|
|
extern const struct bsdconf_format_def bsdconf_format_loader_def;
|
|
extern const struct bsdconf_format_def bsdconf_format_make_def;
|
|
extern const struct bsdconf_format_def bsdconf_format_src_def;
|
|
extern const struct bsdconf_format_def bsdconf_format_sysctl_def;
|
|
|
|
#endif /* !_BSDCONF_FORMATS_H_ */
|