From: phk Date: Mon, 18 Feb 2008 11:45:58 +0000 (+0000) Subject: Make a parameter "diag_bitflag" which can control deeper diagnostics for X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=acfc796230915a7abd114061b74f8f3d8321a486;p=varnish Make a parameter "diag_bitflag" which can control deeper diagnostics for us, instead of the #ifdef DIAGNOSTICS which is always not there when you need it or there when you don't want it. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2508 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/heritage.h b/varnish-cache/bin/varnishd/heritage.h index f25e59e3..5cd3ecf5 100644 --- a/varnish-cache/bin/varnishd/heritage.h +++ b/varnish-cache/bin/varnishd/heritage.h @@ -141,6 +141,9 @@ struct params { /* CLI buffer size */ unsigned cli_buffer; + + /* Control diagnostic code */ + unsigned diag_bitmap; }; extern volatile struct params *params; diff --git a/varnish-cache/bin/varnishd/mgt_param.c b/varnish-cache/bin/varnishd/mgt_param.c index b7ea5382..b96ae091 100644 --- a/varnish-cache/bin/varnishd/mgt_param.c +++ b/varnish-cache/bin/varnishd/mgt_param.c @@ -400,6 +400,22 @@ tweak_cc_command(struct cli *cli, const struct parspec *par, const char *arg) /*--------------------------------------------------------------------*/ +static void +tweak_diag_bitmap(struct cli *cli, const struct parspec *par, const char *arg) +{ + unsigned u; + + (void)par; + if (arg != NULL) { + u = strtoul(arg, NULL, 0); + master.diag_bitmap = u; + } else { + cli_out(cli, "0x%x", master.diag_bitmap); + } +} + +/*--------------------------------------------------------------------*/ + /* * Make sure to end all lines with either a space or newline of the * formatting will go haywire. @@ -620,6 +636,12 @@ static const struct parspec parspec[] = { "NB: Must be specified with -p to have effect.\n", 0, "8192", "bytes" }, + { "diag_bitmap", tweak_diag_bitmap, 0, 0, 0, + "Bitmap controlling DIAGNOSTICS code:\n" + " 0x00000001 - CNT_Session states.\n" + "Use 0x notation and do the bitor in your head :-)\n", + 0, + "0", "bitmap" }, { NULL, NULL, NULL } };