r1588 - in trunk/varnish-cache: include lib/libvarnishapi

des at projects.linpro.no des at projects.linpro.no
Thu Jun 28 12:25:47 CEST 2007


Author: des
Date: 2007-06-28 12:25:47 +0200 (Thu, 28 Jun 2007)
New Revision: 1588

Modified:
   trunk/varnish-cache/include/varnishapi.h
   trunk/varnish-cache/lib/libvarnishapi/shmlog.c
Log:
Expose the instance name associated with the currently open VSL file.

This is a bletcherous hack - the entire API needs cleaning up.


Modified: trunk/varnish-cache/include/varnishapi.h
===================================================================
--- trunk/varnish-cache/include/varnishapi.h	2007-06-28 09:35:56 UTC (rev 1587)
+++ trunk/varnish-cache/include/varnishapi.h	2007-06-28 10:25:47 UTC (rev 1588)
@@ -56,6 +56,7 @@
 int VSL_NextLog(struct VSL_data *lh, unsigned char **pp);
 int VSL_Arg(struct VSL_data *vd, int arg, const char *opt);
 struct varnish_stats *VSL_OpenStats(const char *varnish_name);
+const char *VSL_Name(void);
 extern const char *VSL_tags[256];
 
 /* instance.c */

Modified: trunk/varnish-cache/lib/libvarnishapi/shmlog.c
===================================================================
--- trunk/varnish-cache/lib/libvarnishapi/shmlog.c	2007-06-28 09:35:56 UTC (rev 1587)
+++ trunk/varnish-cache/lib/libvarnishapi/shmlog.c	2007-06-28 10:25:47 UTC (rev 1588)
@@ -90,6 +90,7 @@
 
 static int vsl_fd;
 static struct shmloghead *vsl_lh;
+static char vsl_name[PATH_MAX];
 
 static int vsl_nextlog(struct VSL_data *vd, unsigned char **pp);
 
@@ -108,13 +109,13 @@
 {
 	int i;
 	struct shmloghead slh;
-	char name[PATH_MAX], dirname[PATH_MAX], logname[PATH_MAX];
+	char dirname[PATH_MAX], logname[PATH_MAX];
 
 	if (vsl_lh != NULL)
 		return (0);
 
-	if (varnish_instance(varnish_name, name,
-	    sizeof name, dirname, sizeof dirname) != 0) {
+	if (varnish_instance(varnish_name, vsl_name,
+	    sizeof vsl_name, dirname, sizeof dirname) != 0) {
 		fprintf(stderr, "Invalid instance name: %s\n",
 		    strerror(errno));
 		return (1);
@@ -495,3 +496,9 @@
 	return (&vsl_lh->stats);
 }
 
+const char *
+VSL_Name(void)
+{
+
+	return (vsl_name);
+}




More information about the varnish-commit mailing list