Commit dc4969c0 authored by Dag Erling Smørgrav's avatar Dag Erling Smørgrav

Expose the instance name associated with the currently open VSL file.

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


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@1588 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 63a05fef
...@@ -56,6 +56,7 @@ int VSL_Dispatch(struct VSL_data *vd, vsl_handler *func, void *priv); ...@@ -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_NextLog(struct VSL_data *lh, unsigned char **pp);
int VSL_Arg(struct VSL_data *vd, int arg, const char *opt); int VSL_Arg(struct VSL_data *vd, int arg, const char *opt);
struct varnish_stats *VSL_OpenStats(const char *varnish_name); struct varnish_stats *VSL_OpenStats(const char *varnish_name);
const char *VSL_Name(void);
extern const char *VSL_tags[256]; extern const char *VSL_tags[256];
/* instance.c */ /* instance.c */
......
...@@ -90,6 +90,7 @@ struct VSL_data { ...@@ -90,6 +90,7 @@ struct VSL_data {
static int vsl_fd; static int vsl_fd;
static struct shmloghead *vsl_lh; static struct shmloghead *vsl_lh;
static char vsl_name[PATH_MAX];
static int vsl_nextlog(struct VSL_data *vd, unsigned char **pp); static int vsl_nextlog(struct VSL_data *vd, unsigned char **pp);
...@@ -108,13 +109,13 @@ vsl_shmem_map(const char *varnish_name) ...@@ -108,13 +109,13 @@ vsl_shmem_map(const char *varnish_name)
{ {
int i; int i;
struct shmloghead slh; struct shmloghead slh;
char name[PATH_MAX], dirname[PATH_MAX], logname[PATH_MAX]; char dirname[PATH_MAX], logname[PATH_MAX];
if (vsl_lh != NULL) if (vsl_lh != NULL)
return (0); return (0);
if (varnish_instance(varnish_name, name, if (varnish_instance(varnish_name, vsl_name,
sizeof name, dirname, sizeof dirname) != 0) { sizeof vsl_name, dirname, sizeof dirname) != 0) {
fprintf(stderr, "Invalid instance name: %s\n", fprintf(stderr, "Invalid instance name: %s\n",
strerror(errno)); strerror(errno));
return (1); return (1);
...@@ -495,3 +496,9 @@ VSL_OpenStats(const char *varnish_name) ...@@ -495,3 +496,9 @@ VSL_OpenStats(const char *varnish_name)
return (&vsl_lh->stats); return (&vsl_lh->stats);
} }
const char *
VSL_Name(void)
{
return (vsl_name);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment