Re: git: 4018a762498a - stable/14 - sysctl(9): Booleans: Accept integers to ease knob conversion
- Reply: Lexi Winter : "Re: git: 4018a762498a - stable/14 - sysctl(9): Booleans: Accept integers to ease knob conversion"
- In reply to: Olivier Certner : "git: 4018a762498a - stable/14 - sysctl(9): Booleans: Accept integers to ease knob conversion"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 27 Jul 2026 22:33:12 UTC
On Thu, Jul 23, 2026 at 10:00:29AM +0000, Olivier Certner wrote:
> The branch stable/14 has been updated by olce:
>
> URL: https://cgit.FreeBSD.org/src/commit/?id=4018a762498ab20c6545942faaaefd6371728f48
>
> commit 4018a762498ab20c6545942faaaefd6371728f48
> Author: Olivier Certner <olce@FreeBSD.org>
> AuthorDate: 2026-01-27 09:45:03 +0000
> Commit: Olivier Certner <olce@FreeBSD.org>
> CommitDate: 2026-07-23 09:59:01 +0000
>
> sysctl(9): Booleans: Accept integers to ease knob conversion
>
> In sysctl_handle_bool(), if the output buffer (for the old value) has
> room for exactly 4 bytes (sizeof(int)), then output the current boolean
> value as an integer rather than a 'uint8_t'. Conversely, if 4 bytes
> exactly remain in the input buffer (for the new value), treat them as an
> integer and derive the new boolean value from it.
>
> Doing so allows to convert existing integer syscstl knobs that are
> interpreted as a boolean into true boolean ones while staying
> backwards-compatible.
>
> That brings no drawback as no code currently uses sysctl_handle_bool()
> as part of a series of calls to sysctl_handle_*() functions for
> (de)serialization of some compound structure. If that case ever
> materializes, it can be easily solved, e.g., by creating
> a sysctl_handle_bool_strict() variant.
>
> In the future, we might want to go further and generally be more liberal
> in the external type of integers we accept and output, by tolerating any
> kind of supported integers (8-bit to 64-bit), enabling integer type
> changes of knob's internal representations without breaking the ABI for
> consumers hardcoding the passed integers (instead of relying on sysctl
> knob type information).
>
> Reviewed by: jhb
> MFC after: 2 weeks
> Sponsored by: The FreeBSD Foundation
> Differential Revision: https://reviews.freebsd.org/D54925
>
> (cherry picked from commit 406da392ef8d77b39fe9bfd36bdb440eb3e5ae0a)
This was MFCed without commit 895e1c6567d9561c86f8d20b47e924911bce989e,
which has a Fixes tag referencing this commit. I noticed because a few
regression tests in tests/sys/kern/sigwait.c fail as a result.
The newly added tools/tools/git/git-mfc utility will catch such
mistakes: if you use it as a replacement for git-cherry-pick, it'll
automatically MFC fixup commits; further, if you run
`git mfc --dangling`, it'll detect and report issues like this
automatically, for example:
$ git mfc --dangling -c olce
895e1c6567d9561c86f8d20b47e924911bce989e ("sysctl(9): Booleans: Fix old value length discovery") fixes 406da392ef8d77b39fe9bfd36bdb440eb3e5ae0a ("sysctl(9): Booleans: Accept integers to ease knob conversion")
e8dec0038bd95f6d940afa19b4d101f466280fd6 ("sched_4bsd: Fix conflating priority of differently-niced CPU-bound threads") fixes eebc148f25c3012b943083b48fbfc13494e9c77f ("sched_4bsd: ESTCPULIM(): Allow any value in the timeshare range")
a6587ae0f46dba4e47fa92c831f55288ec181734 ("sched_ule: Fix selecting lowest priority thread early in corner case") fixes 6792f3411f6d99e1698589835adbf6b7b51c7c74 ("sched_ule: Recover previous nice and anti-starvation behaviors")
f93cd891aefd839da869dcdb450d00050d5e701e ("MAC/do: Make it style(9) compliant again") fixes 6c3def74e2deb825e7dac4ffebaaf651f547e392 ("MAC/do: Support multiple users and groups as single rule's targets")