diff --git a/contrib/mandoc/mandocdb.c b/contrib/mandoc/mandocdb.c --- a/contrib/mandoc/mandocdb.c +++ b/contrib/mandoc/mandocdb.c @@ -279,7 +279,7 @@ { NULL, 0, 0 }, /* Sm */ { NULL, 0, 0 }, /* Sx */ { NULL, TYPE_Sy, 0 }, /* Sy */ - { NULL, TYPE_Tn, 0 }, /* Tn */ + { NULL, 0, 0 }, /* Tn */ { NULL, 0, NODE_NOSRC }, /* Ux */ { NULL, 0, 0 }, /* Xc */ { NULL, 0, 0 }, /* Xo */ @@ -1698,6 +1698,21 @@ { char *cp; + /* + * Special case ".It Va" when found inside "LOADER TUNABLES" + * or "SYSCTL VARIABLES" sections. + */ + if (n->tok == MDOC_Va && n->parent != NULL && n->parent->tok == MDOC_It && + (n->sec == SEC_LOADER || n->sec == SEC_SYSCTL)) { + cp = NULL; + deroff(&cp, n); + if (cp != NULL) { + putkey(mpage, cp, TYPE_tun); + free(cp); + } + return 0; + } + if (n->type != ROFFT_ELEM && n->type != ROFFT_BODY) return 0; diff --git a/contrib/mandoc/mansearch.h b/contrib/mandoc/mansearch.h --- a/contrib/mandoc/mansearch.h +++ b/contrib/mandoc/mansearch.h @@ -43,7 +43,7 @@ #define TYPE_Cd 0x0000000000002000ULL #define TYPE_Va 0x0000000000004000ULL #define TYPE_Ft 0x0000000000008000ULL -#define TYPE_Tn 0x0000000000010000ULL +#define TYPE_tun 0x0000000000010000ULL #define TYPE_Er 0x0000000000020000ULL #define TYPE_Ev 0x0000000000040000ULL #define TYPE_Sy 0x0000000000080000ULL diff --git a/contrib/mandoc/mansearch.c b/contrib/mandoc/mansearch.c --- a/contrib/mandoc/mansearch.c +++ b/contrib/mandoc/mansearch.c @@ -55,7 +55,7 @@ const char *const mansearch_keynames[KEY_MAX] = { "arch", "sec", "Xr", "Ar", "Fa", "Fl", "Dv", "Fn", "Ic", "Pa", "Cm", "Li", "Em", "Cd", "Va", "Ft", - "Tn", "Er", "Ev", "Sy", "Sh", "In", "Ss", "Ox", + "_tun", "Er", "Ev", "Sy", "Sh", "In", "Ss", "Ox", "An", "Mt", "St", "Bx", "At", "Nx", "Fx", "Lk", "Ms", "Bsx", "Dx", "Rs", "Vt", "Lb", "Nm", "Nd" }; diff --git a/contrib/mandoc/mdoc_validate.c b/contrib/mandoc/mdoc_validate.c --- a/contrib/mandoc/mdoc_validate.c +++ b/contrib/mandoc/mdoc_validate.c @@ -265,6 +265,8 @@ "LIBRARY", "SYNOPSIS", "DESCRIPTION", + "LOADER TUNABLES", + "SYSCTL VARIABLES", "CONTEXT", "IMPLEMENTATION NOTES", "RETURN VALUES", diff --git a/contrib/mandoc/roff.h b/contrib/mandoc/roff.h --- a/contrib/mandoc/roff.h +++ b/contrib/mandoc/roff.h @@ -36,6 +36,8 @@ SEC_LIBRARY, SEC_SYNOPSIS, SEC_DESCRIPTION, + SEC_LOADER, + SEC_SYSCTL, SEC_CONTEXT, SEC_IMPLEMENTATION, /* IMPLEMENTATION NOTES */ SEC_RETURN_VALUES, diff --git a/share/man/man4/ixl.4 b/share/man/man4/ixl.4 --- a/share/man/man4/ixl.4 +++ b/share/man/man4/ixl.4 @@ -210,7 +210,7 @@ Enabled by default; disable to mimic the TX behavior found in .Xr ixgbe 4 . .El -.Sh SYSCTL PROCEDURES +.Sh SYSCTL VARIABLES .Bl -tag -width indent .It Va dev.ixl.#.fc Sets the 802.3x flow control mode that the adapter will advertise on the link. diff --git a/share/man/man5/style.mdoc.5 b/share/man/man5/style.mdoc.5 --- a/share/man/man5/style.mdoc.5 +++ b/share/man/man5/style.mdoc.5 @@ -197,17 +197,47 @@ .Pq Qo Qc macro is usually not necessary. .El -.Ss Variables -.Bl -dash -width "" -.It -Use +.Ss Loader tunables and sysctl variables +Loader tunables and sysctl variables should be documented in +.Qq LOADER TUNABLES +and +.Qq SYSCTL VARIABLES +sections, respectively. +Both sections should provide them inside an +.Sy \&Bl +list block using the .Sy \&Va -instead of -.Sy \&Dv -for -.Xr sysctl 8 -variables like -.Va kdb.enter.panic . +macro. +Note that +.Xr makewhatis 8 +only special cases them if found after the +.Sy \&It +macro, and for +.Xr man 1 +to be able to do tunable/sysctl search, the following format should be used: +.Bd -literal -offset indent +\&.Sh LOADER TUNABLES +Tunables can be set at the +\&.Xr loader 8 +prompt before booting the kernel or stored in +\&.Xr loader.conf 5 . +\&.Bl -tag -width indent +\&.It Va some.loader.tunable +Tunable description. +\&.El +\&.Sh SYSCTL VARIABLES +The following variables are available as both +\&.Xr sysctl 8 +variables and +\&.Xr loader 8 +tunables: +\&.Bl -tag -width indent +\&.It Va some.sysctl.variable +Variable description. +\&.El +.Ed +.Ss Other variables +.Bl -dash -width "" .It Use the angle brackets .Sy \&Aq diff --git a/usr.bin/man/man.sh b/usr.bin/man/man.sh --- a/usr.bin/man/man.sh +++ b/usr.bin/man/man.sh @@ -532,7 +532,16 @@ done unset IFS - # Nothing? Well, we are done then. + # Nothing? Try looking for loader/sysctl tunable. + if [ -z "$found_page" ]; then + path=$(apropos -w _tun="$1" 2>/dev/null) + if [ $? = 0 ]; then + found_page=yes + man_find_and_display $path + fi + fi + + # Still nothing? Well, we are done then. if [ -z "$found_page" ]; then echo "No manual entry for $1" >&2 ret=1