r3975 - in trunk/varnish-cache: include lib/libvarnishapi
phk at projects.linpro.no
phk at projects.linpro.no
Sun Mar 22 14:28:38 CET 2009
Author: phk
Date: 2009-03-22 14:28:38 +0100 (Sun, 22 Mar 2009)
New Revision: 3975
Modified:
trunk/varnish-cache/include/varnishapi.h
trunk/varnish-cache/lib/libvarnishapi/shmlog.c
Log:
Introduce VSL_Close() function so the same process can check
multiple varnish's shmem sequentially.
Eventually, we may want to have a descriptor so one process can
check multiple varnish's shmem at the same time.
Modified: trunk/varnish-cache/include/varnishapi.h
===================================================================
--- trunk/varnish-cache/include/varnishapi.h 2009-03-22 08:48:45 UTC (rev 3974)
+++ trunk/varnish-cache/include/varnishapi.h 2009-03-22 13:28:38 UTC (rev 3975)
@@ -57,6 +57,7 @@
int VSL_Dispatch(struct VSL_data *vd, vsl_handler *func, void *priv);
int VSL_NextLog(struct VSL_data *lh, unsigned char **pp);
int VSL_Arg(struct VSL_data *vd, int arg, const char *opt);
+void VSL_Close(void);
struct varnish_stats *VSL_OpenStats(const char *varnish_name);
const char *VSL_Name(void);
extern const char *VSL_tags[256];
Modified: trunk/varnish-cache/lib/libvarnishapi/shmlog.c
===================================================================
--- trunk/varnish-cache/lib/libvarnishapi/shmlog.c 2009-03-22 08:48:45 UTC (rev 3974)
+++ trunk/varnish-cache/lib/libvarnishapi/shmlog.c 2009-03-22 13:28:38 UTC (rev 3975)
@@ -560,6 +560,18 @@
return (&vsl_lh->stats);
}
+void
+VSL_Close(void)
+{
+ if (vsl_lh == NULL)
+ return;
+ assert(0 == munmap(vsl_lh, vsl_lh->size + sizeof *vsl_lh));
+ vsl_lh = NULL;
+ assert(vsl_fd >= 0);
+ assert(0 == close(vsl_fd));
+ vsl_fd = -1;
+}
+
const char *
VSL_Name(void)
{
More information about the varnish-commit
mailing list