Commit 10c61fb1 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Move vin stuff into vin.h and vsm stuff into vsm.h



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4928 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 84a760b1
......@@ -634,7 +634,7 @@ void SES_Charge(struct sess *sp);
/* cache_shmlog.c */
void VSL_Init(void);
#ifdef VSM_HEAD_MAGIC
#ifdef VSL_ENDMARKER
void VSL(enum shmlogtag tag, int id, const char *fmt, ...);
void WSLR(struct worker *w, enum shmlogtag tag, int id, txt t);
void WSL(struct worker *w, enum shmlogtag tag, int id, const char *fmt, ...);
......
......@@ -44,6 +44,7 @@ SVNID("$Id$")
#include <execinfo.h>
#endif
#include "cache.h"
#include "vsm.h"
#include "shmlog.h"
#include "cache_backend.h"
#include "vcl.h"
......
......@@ -36,6 +36,7 @@ SVNID("$Id$")
#include <unistd.h>
#include <stdarg.h>
#include "vsm.h"
#include "shmlog.h"
#include "cache.h"
#include "vmb.h"
......
......@@ -71,7 +71,7 @@ void MCF_DumpMdoc(void);
#endif
/* mgt_shmem.c */
void mgt_SHM_Init(const char *fn, const char *arg);
void mgt_SHM_Init(const char *arg);
void mgt_SHM_Pid(void);
/* mgt_vcc.c */
......
......@@ -59,7 +59,7 @@ SVNID("$Id$")
#endif
#include "mgt.h"
#include "shmlog.h"
#include "vsm.h"
#include "heritage.h"
#include "cli.h"
#include "cli_priv.h"
......
......@@ -41,6 +41,7 @@ SVNID("$Id$")
#include <sys/mman.h>
#include <sys/stat.h>
#include "vsm.h"
#include "shmlog.h"
#include "mgt.h"
#include "heritage.h"
......@@ -194,7 +195,7 @@ vsl_buildnew(const char *fn, unsigned size, int fill)
}
void
mgt_SHM_Init(const char *fn, const char *l_arg)
mgt_SHM_Init(const char *l_arg)
{
int i, fill;
struct params *pp;
......@@ -259,13 +260,13 @@ mgt_SHM_Init(const char *fn, const char *l_arg)
size += ps - 1;
size &= ~(ps - 1);
i = open(fn, O_RDWR, 0644);
i = open(VSM_FILENAME, O_RDWR, 0644);
if (i >= 0) {
vsl_n_check(i);
(void)close(i);
}
(void)close(i);
vsl_buildnew(fn, size, fill);
vsl_buildnew(VSM_FILENAME, size, fill);
loghead = (void *)mmap(NULL, size,
PROT_READ|PROT_WRITE,
......
......@@ -66,7 +66,7 @@ SVNID("$Id$")
#include "cli_priv.h"
#include "cli_common.h"
#include "shmlog.h"
#include "vin.h"
#include "heritage.h"
#include "mgt.h"
#include "hash_slinger.h"
......@@ -623,7 +623,7 @@ main(int argc, char * const *argv)
HSH_config(h_arg);
mgt_SHM_Init(VSM_FILENAME, l_arg);
mgt_SHM_Init(l_arg);
vsb_finish(vident);
AZ(vsb_overflowed(vident));
......
# $Id$
pkginclude_HEADERS = \
vsm.h \
shmlog.h \
shmlog_tags.h \
stat_field.h \
......
......@@ -36,49 +36,8 @@
#ifndef SHMLOG_H_INCLUDED
#define SHMLOG_H_INCLUDED
#define VSM_FILENAME "_.vsm"
#include <time.h>
#include <sys/types.h>
#include "stats.h"
/*
* This structure describes each allocation from the shmlog
*/
struct vsm_chunk {
#define VSM_CHUNK_MAGIC 0x43907b6e /* From /dev/random */
unsigned magic;
unsigned len;
char class[8];
char type[8];
char ident[16];
};
#define VSM_NEXT(sha) ((void*)((uintptr_t)(sha) + (sha)->len))
#define VSM_PTR(sha) ((void*)((uintptr_t)((sha) + 1)))
struct vsm_head {
#define VSM_HEAD_MAGIC 4185512502U /* From /dev/random */
unsigned magic;
unsigned hdrsize;
time_t starttime;
pid_t master_pid;
pid_t child_pid;
unsigned shm_size;
/* Panic message buffer */
char panicstr[64 * 1024];
unsigned alloc_seq;
/* Must be last element */
struct vsm_chunk head;
};
#define VSM_CLASS_LOG "Log"
#define VSM_CLASS_STAT "Stat"
......@@ -118,12 +77,4 @@ enum shmlogtag {
SLT_Reserved = 255
};
/* This function lives in both libvarnish and libvarnishapi */
int vin_n_arg(const char *n_arg, char **name, char **dir, char **vsl);
char *vin_L_arg(unsigned L_arg);
#define VIN_L_LOW 1024
#define VIN_L_HIGH 65000
#define VIN_L_OK(a) (a >= VIN_L_LOW && a <= VIN_L_HIGH)
#define VIN_L_MSG "-L argument must be [1024...65000]"
#endif
/*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2009 Linpro AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id$
*
*/
#ifndef VIN_H_INCLUDED
#define VIN_H_INCLUDED
/* This function lives in both libvarnish and libvarnishapi */
int vin_n_arg(const char *n_arg, char **name, char **dir, char **vsl);
char *vin_L_arg(unsigned L_arg);
#define VIN_L_LOW 1024
#define VIN_L_HIGH 65000
#define VIN_L_OK(a) (a >= VIN_L_LOW && a <= VIN_L_HIGH)
#define VIN_L_MSG "-L argument must be [1024...65000]"
#endif
/*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2009 Linpro AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id$
*
* Define the layout of the shared memory log segment.
*
* NB: THIS IS NOT A PUBLIC API TO VARNISH!
*/
#ifndef VSM_H_INCLUDED
#define VSM_H_INCLUDED
#define VSM_FILENAME "_.vsm"
#include <time.h>
#include <sys/types.h>
/*
* This structure describes each allocation from the shmlog
*/
struct vsm_chunk {
#define VSM_CHUNK_MAGIC 0x43907b6e /* From /dev/random */
unsigned magic;
unsigned len;
char class[8];
char type[8];
char ident[16];
};
#define VSM_NEXT(sha) ((void*)((uintptr_t)(sha) + (sha)->len))
#define VSM_PTR(sha) ((void*)((uintptr_t)((sha) + 1)))
struct vsm_head {
#define VSM_HEAD_MAGIC 4185512502U /* From /dev/random */
unsigned magic;
unsigned hdrsize;
time_t starttime;
pid_t master_pid;
pid_t child_pid;
unsigned shm_size;
/* Panic message buffer */
char panicstr[64 * 1024];
unsigned alloc_seq;
/* Must be last element */
struct vsm_chunk head;
};
#endif
......@@ -40,7 +40,8 @@ SVNID("$Id$")
#include <unistd.h>
#include "libvarnish.h"
#include "shmlog.h"
#include "vsm.h"
#include "vin.h"
int
vin_n_arg(const char *n_arg, char **name, char **dir, char **vsl)
......
......@@ -44,7 +44,8 @@ SVNID("$Id$")
#include <unistd.h>
#include "vas.h"
#include "shmlog.h"
#include "vin.h"
#include "vsm.h"
#include "vre.h"
#include "vbm.h"
#include "vqueue.h"
......
......@@ -45,7 +45,7 @@ SVNID("$Id$")
#include "vas.h"
#include "argv.h"
#include "shmlog.h"
#include "vin.h"
#include "vre.h"
#include "vbm.h"
#include "vqueue.h"
......
......@@ -41,6 +41,7 @@ SVNID("$Id$")
#include <unistd.h>
#include "vas.h"
#include "vsm.h"
#include "shmlog.h"
#include "vre.h"
#include "vbm.h"
......
......@@ -37,6 +37,7 @@ SVNID("$Id$")
#include <string.h>
#include "vas.h"
#include "vsm.h"
#include "shmlog.h"
#include "vre.h"
#include "vqueue.h"
......
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