]> err.no Git - varnish/commitdiff
Expose the instance name associated with the currently open VSL file.
authordes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Thu, 28 Jun 2007 10:25:47 +0000 (10:25 +0000)
committerdes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Thu, 28 Jun 2007 10:25:47 +0000 (10:25 +0000)
This is a bletcherous hack - the entire API needs cleaning up.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1588 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/include/varnishapi.h
varnish-cache/lib/libvarnishapi/shmlog.c

index 519cfef76bb895a3c543af88fa3b0b8ccab5e3d1..4460d4ea6c431c07c08e5792419e891e0428c3d3 100644 (file)
@@ -56,6 +56,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);
 struct varnish_stats *VSL_OpenStats(const char *varnish_name);
+const char *VSL_Name(void);
 extern const char *VSL_tags[256];
 
 /* instance.c */
index 3c2d097639c2442160a3b56058aec2a1e2aefed4..2bc9afe05f285b5fd81cf99332ba6331485d1287 100644 (file)
@@ -90,6 +90,7 @@ struct VSL_data {
 
 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 @@ vsl_shmem_map(const char *varnish_name)
 {
        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 @@ VSL_OpenStats(const char *varnish_name)
        return (&vsl_lh->stats);
 }
 
+const char *
+VSL_Name(void)
+{
+
+       return (vsl_name);
+}