Generate documentation of the varnishd -n option

with greetings from the rabbit-hole opened by #4105
parent 725c9d56
......@@ -79,6 +79,19 @@ static const char opt_spec[] = "?a:b:CdE:f:Fh:i:I:j:l:M:n:P:p:r:S:s:T:t:VW:x:";
/*--------------------------------------------------------------------*/
// Basic options documentation with compile time dependencies
static void
mgt_DumpOptions(void)
{
printf(".. _opt_n:\n\n");
printf("-n workdir\n\n");
printf(" Runtime directory for the shared memory, "
"compiled VCLs etc.\n\n");
printf(" In performance critical applications, this directory "
"should be on a RAM backed filesystem.\n\n");
VIN_DumpDefaults();
}
static void
usage(void)
{
......@@ -121,6 +134,7 @@ usage(void)
printf(FMT, "-x cli", "CLI command documentation");
printf(FMT, "-x builtin", "Builtin VCL program");
printf(FMT, "-x optstring", "List of getopt options");
printf(FMT, "-x options", "Dynamic options documentation");
printf("\nOperations options:\n");
......@@ -359,6 +373,8 @@ mgt_x_arg(const char *x_arg)
mgt_DumpBuiltin();
else if (!strcmp(x_arg, "optstring"))
(void)printf("%s\n", opt_spec);
else if (!strcmp(x_arg, "options"))
mgt_DumpOptions();
else
ARGV_ERR("Invalid -x argument\n");
}
......
......@@ -85,6 +85,11 @@ include/params.rst: $(top_builddir)/bin/varnishd/varnishd
mv -f ${@}_ ${@}
BUILT_SOURCES += include/params.rst
include/options.rst: $(top_builddir)/bin/varnishd/varnishd
$(top_builddir)/bin/varnishd/varnishd -x options > ${@}_
mv -f ${@}_ ${@}
BUILT_SOURCES += include/options.rst
include/counters.rst:
ln -s $(abs_top_builddir)/lib/libvsc/counters.rst $@
BUILT_SOURCES += include/counters.rst
......
......@@ -142,19 +142,7 @@ Basic options
could later be accessed remotely, starting `varnishd` requires
local privileges.
.. _opt_n:
-n workdir
Runtime directory for the shared memory, compiled VCLs etc.
In performance critical applications, this directory should be
on a RAM backed filesystem.
Relative paths will be appended to `/var/run/` (NB: Binary packages
of Varnish may have adjusted this to the platform.)
The default value is `/var/run/varnishd` (NB: as above.)
.. include:: ../include/options.rst
Documentation options
---------------------
......
......@@ -33,6 +33,7 @@
#ifndef VIN_H_INCLUDED
#define VIN_H_INCLUDED
/* This function lives in both libvarnish and libvarnishapi */
/* These functions live in both libvarnish and libvarnishapi */
char *VIN_n_Arg(const char *n_arg);
void VIN_DumpDefaults(void);
#endif
......@@ -42,6 +42,7 @@
#include "vin.h"
#include "vsb.h"
#define VARNISH_DEFAULT_REL_NAME "varnishd"
char *
VIN_n_Arg(const char *n_arg)
{
......@@ -52,7 +53,7 @@ VIN_n_Arg(const char *n_arg)
AN(vsb);
if (n_arg == NULL || n_arg[0] == '\0') {
VSB_cat(vsb, VARNISH_STATE_DIR);
VSB_cat(vsb, "/varnishd");
VSB_cat(vsb, "/" VARNISH_DEFAULT_REL_NAME);
} else if (n_arg[0] == '/') {
VSB_cat(vsb, n_arg);
} else {
......@@ -66,3 +67,13 @@ VIN_n_Arg(const char *n_arg)
VSB_destroy(&vsb);
return (retval);
}
void
VIN_DumpDefaults(void)
{
printf(" Relative paths will be appended to ``%s``.\n\n",
VARNISH_STATE_DIR);
printf(" The default value is ``%s``.\n\n",
VARNISH_STATE_DIR "/" VARNISH_DEFAULT_REL_NAME);
printf(" Note: These defaults may be distribution specific.\n\n");
}
......@@ -78,7 +78,8 @@ varnishadm.1: $(top_builddir)/doc/sphinx/reference/varnishadm.rst
varnishd.1: \
$(top_builddir)/doc/sphinx/reference/varnishd.rst \
$(top_builddir)/doc/sphinx/include/params.rst
$(top_builddir)/doc/sphinx/include/params.rst \
$(top_builddir)/doc/sphinx/include/options.rst
$(BUILD_MAN) $(top_builddir)/doc/sphinx/reference/varnishd.rst $@
varnishncsa.1: \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment