r4806 - trunk/varnish-cache/bin/varnishd
phk at varnish-cache.org
phk at varnish-cache.org
Mon May 17 22:09:45 CEST 2010
Author: phk
Date: 2010-05-17 22:09:45 +0200 (Mon, 17 May 2010)
New Revision: 4806
Modified:
trunk/varnish-cache/bin/varnishd/mgt.h
trunk/varnish-cache/bin/varnishd/mgt_shmem.c
Log:
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.
Modified: trunk/varnish-cache/bin/varnishd/mgt.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt.h 2010-05-17 15:48:05 UTC (rev 4805)
+++ trunk/varnish-cache/bin/varnishd/mgt.h 2010-05-17 20:09:45 UTC (rev 4806)
@@ -71,6 +71,7 @@
/* 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);
Modified: trunk/varnish-cache/bin/varnishd/mgt_shmem.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_shmem.c 2010-05-17 15:48:05 UTC (rev 4805)
+++ trunk/varnish-cache/bin/varnishd/mgt_shmem.c 2010-05-17 20:09:45 UTC (rev 4806)
@@ -64,7 +64,7 @@
/*--------------------------------------------------------------------*/
-static void *
+void *
mgt_SHM_Alloc(unsigned size, const char *type, const char *ident)
{
struct shmalloc *sha, *sha2;
@@ -221,8 +221,6 @@
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 @@
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();
More information about the varnish-commit
mailing list