diff --git a/include/proto/dumpstats.h b/include/proto/dumpstats.h index 6cca84fd65..ed2bf1e066 100644 --- a/include/proto/dumpstats.h +++ b/include/proto/dumpstats.h @@ -3,7 +3,7 @@ This file contains definitions of some primitives to dedicated to statistics output. - Copyright (C) 2000-2007 Willy Tarreau - w@1wt.eu + Copyright (C) 2000-2008 Willy Tarreau - w@1wt.eu This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -39,7 +39,6 @@ #define STATS_TYPE_BE 1 #define STATS_TYPE_SV 2 -int stats_parse_global(const char **args, char *err, int errlen); int stats_dump_raw(struct session *s, struct uri_auth *uri); int stats_dump_http(struct session *s, struct uri_auth *uri); int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri); diff --git a/src/cfgparse.c b/src/cfgparse.c index b202923ed8..af29a47986 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -295,13 +295,6 @@ int cfg_parse_global(const char *file, int linenum, char **args, int inv) else if (!strcmp(args[0], "quiet")) { global.mode |= MODE_QUIET; } - else if (!strcmp(args[0], "stats")) { - memcpy(trash, "error near 'stats'", 19); - if (stats_parse_global((const char **)args + 1, trash, sizeof(trash)) < 0) { - Alert("parsing [%s:%d] : %s\n", file, linenum, trash); - return -1; - } - } else if (!strcmp(args[0], "tune.maxpollevents")) { if (global.tune.maxpollevents != 0) { Alert("parsing [%s:%d] : '%s' already specified. Continuing.\n", file, linenum, args[0]); diff --git a/src/dumpstats.c b/src/dumpstats.c index 354d274551..655cb4dfe2 100644 --- a/src/dumpstats.c +++ b/src/dumpstats.c @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -55,8 +56,10 @@ * zero included. The trailing '\n' must not be written. The function must be * called with pointing to the first word after "stats". */ -int stats_parse_global(const char **args, char *err, int errlen) +static int stats_parse_global(char **args, int section_type, struct proxy *curpx, + struct proxy *defpx, char *err, int errlen) { + args++; if (!strcmp(args[0], "socket")) { struct sockaddr_un su; int cur_arg; @@ -1067,6 +1070,17 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri) } } +static struct cfg_kw_list cfg_kws = {{ },{ + { CFG_GLOBAL, "stats", stats_parse_global }, + { 0, NULL, NULL }, +}}; + +__attribute__((constructor)) +static void __dumpstats_module_init(void) +{ + cfg_register_keywords(&cfg_kws); +} + /* * Local variables: * c-indent-level: 8