Commit c6284349 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Expose mgt_SHM_Alloc()

Fix an safely-off-by-some-bytes error which made it harder to find the
end of the alloc-arena in the shmlog file.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4806 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 0031a2fb
......@@ -71,6 +71,7 @@ void MCF_DumpMdoc(void);
/* mgt_shmem.c */
void mgt_SHM_Init(const char *fn, const char *arg);
void mgt_SHM_Pid(void);
void *mgt_SHM_Alloc(unsigned size, const char *type, const char *ident);
/* mgt_vcc.c */
void mgt_vcc_init(void);
......
......@@ -64,7 +64,7 @@ static int vsl_fd = -1;
/*--------------------------------------------------------------------*/
static void *
void *
mgt_SHM_Alloc(unsigned size, const char *type, const char *ident)
{
struct shmalloc *sha, *sha2;
......@@ -221,8 +221,6 @@ mgt_SHM_Init(const char *fn, const char *l_arg)
if (av[0] != NULL)
ARGV_ERR("\t-l ...: %s", av[0]);
printf("<%s> <%s> <%s>\n", av[1], av[2], av[3]);
ap = av + 1;
/* Size of SHMLOG */
......@@ -296,7 +294,8 @@ mgt_SHM_Init(const char *fn, const char *l_arg)
memset(&loghead->head, 0, sizeof loghead->head);
loghead->head.magic = SHMALLOC_MAGIC;
loghead->head.len = size - sizeof *loghead;
loghead->head.len =
(uint8_t*)(loghead) + size - (uint8_t*)&loghead->head;
bprintf(loghead->head.type, "%s", "Free");
MEMORY_BARRIER();
......
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