From d98ed85ef9ad8d3491cebee4adc103b7fef155b6 Mon Sep 17 00:00:00 2001 From: Jean-Frederic Clere Date: Thu, 3 Aug 2006 15:51:21 +0000 Subject: [PATCH] Add a parameter for the filename. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/httpd-proxy-scoreboard@428433 13f79535-47bb-0310-9956-ffa450edef68 --- support/proxymonitor.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/support/proxymonitor.c b/support/proxymonitor.c index ffb9157a26b..c262c7d6497 100644 --- a/support/proxymonitor.c +++ b/support/proxymonitor.c @@ -62,6 +62,7 @@ static const char *shortname = "proxymonitor"; static const health_worker_method *worker_storage; char *basedir = NULL; +char *filename = NULL; /* XXX: hack to use a part of the mod_sharedmem and mod_proxy_health_checker */ static apr_status_t init_healthck(apr_pool_t *pool, int *num) @@ -75,7 +76,7 @@ static apr_status_t init_healthck(apr_pool_t *pool, int *num) checkstorage = sharedmem_getstorage(); worker_storage->set_slotmem_storage_method(checkstorage); - rv = worker_storage->attach_slotmem("proxy/checker", num, pool); + rv = worker_storage->attach_slotmem(filename, num, pool); if (rv != APR_SUCCESS) { apr_file_printf(errfile, "Can't attach to httpd memory error: %d\n", rv); @@ -132,9 +133,11 @@ static void usage(void) { apr_file_printf(errfile, "%s -- program for monitoring proxies of httpd." NL - "Usage: %s [-n] [-pPATH] [-dINTERVAL] [-rN]" NL + "Usage: %s [-nFILENAME] [-pPATH] [-dINTERVAL] [-rN]" NL NL "Options:" NL + " -n Specify FILENAME to use to locate shared slotmem." NL + NL " -d Repeat checking every INTERVAL seconds." NL NL " -r Repeat checking N times." NL @@ -241,7 +244,7 @@ int main(int argc, const char * const argv[]) apr_getopt_init(&o, pool, argc, argv); while (1) { - status = apr_getopt(o, "p:d:r:", &opt, &arg); + status = apr_getopt(o, "n:p:d:r:", &opt, &arg); if (status == APR_EOF) { break; } @@ -266,6 +269,12 @@ int main(int argc, const char * const argv[]) } basedir = apr_pstrdup(pool, arg); break; + case 'n': + if (filename) { + usage(); + } + filename = apr_pstrdup(pool, arg); + break; default: usage(); } /* switch */ @@ -273,6 +282,8 @@ int main(int argc, const char * const argv[]) } /* while */ if (basedir == NULL) usage(); + if (filename == NULL) + usage(); instance_socket = NULL; -- 2.47.2