libzpool: tunable-based option interface for zdb/ztest

Removes the old dlsym() based option setter and adds a new
function handle_tunable_option() that can set, get and list all the
tunables in the system. And then wire it up to zdb and ztest.

Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Closes #17537
This commit is contained in:
Rob Norris
2025-07-12 11:33:19 +10:00
committed by Brian Behlendorf
parent cb9742e532
commit fce18e04d5
7 changed files with 133 additions and 102 deletions
+9 -4
View File
@@ -474,10 +474,15 @@ as it runs.
Exercise extreme caution when using this option in shared or uncontrolled
environments.
.It Fl o , -option Ns = Ns Ar var Ns = Ns Ar value Ns …
Set the given global libzpool variable to the provided value.
The value must be an unsigned 32-bit integer.
Currently only little-endian systems are supported to avoid accidentally setting
the high 32 bits of 64-bit variables.
Set the given tunable to the provided value.
.It Fl o , -option Ns = Ns Ar var Ns …
Show the value of the given tunable.
.It Fl o , -option Ns = Ns show
Show all tunables and their values.
.It Fl o , -option Ns = Ns info Ns = Ns Ar value Ns …
Show info about a tunable, including their name, type and description.
.It Fl o , -option Ns = Ns info
Show info about all tunables.
.It Fl P , -parseable
Print numbers in an unscaled form more amenable to parsing, e.g.\&
.Sy 1000000