diff -N -c -r -X exclude_files squid-1.0.beta6/configure squid-1.0.beta6.henrik/configure *** squid-1.0.beta6/configure Thu May 2 01:46:33 1996 --- squid-1.0.beta6.henrik/configure Mon May 6 22:21:17 1996 *************** *** 1974,1979 **** --- 1974,1980 ---- getdtablesize \ mallinfo \ mallopt \ + memorymap \ regcomp \ regexec \ regfree \ diff -N -c -r -X exclude_files squid-1.0.beta6/configure.in squid-1.0.beta6.henrik/configure.in *** squid-1.0.beta6/configure.in Thu May 2 01:46:34 1996 --- squid-1.0.beta6.henrik/configure.in Mon May 6 22:21:37 1996 *************** *** 172,177 **** --- 172,178 ---- getdtablesize \ mallinfo \ mallopt \ + memorymap \ regcomp \ regexec \ regfree \ diff -N -c -r -X exclude_files squid-1.0.beta6/src/objcache.c squid-1.0.beta6.henrik/src/objcache.c *** squid-1.0.beta6/src/objcache.c Wed Apr 17 01:09:51 1996 --- squid-1.0.beta6.henrik/src/objcache.c Mon May 6 22:05:44 1996 *************** *** 141,146 **** --- 141,151 ---- BIT_RESET(data->entry->flag, DELAY_SENDING); storeComplete(data->entry); + } else if (strncmp(data->request, "stats/memorymap", strlen("stats/general")) == 0) { + BIT_SET(data->entry->flag, DELAY_SENDING); + CacheInfo->stat_get(CacheInfo, "memorymap", data->entry); + BIT_RESET(data->entry->flag, DELAY_SENDING); + storeComplete(data->entry); } else if (strncmp(data->request, "stats/general", strlen("stats/general")) == 0) { BIT_SET(data->entry->flag, DELAY_SENDING); CacheInfo->stat_get(CacheInfo, "general", data->entry); diff -N -c -r -X exclude_files squid-1.0.beta6/src/stat.c squid-1.0.beta6.henrik/src/stat.c *** squid-1.0.beta6/src/stat.c Wed May 1 21:15:34 1996 --- squid-1.0.beta6.henrik/src/stat.c Mon May 6 23:24:29 1996 *************** *** 184,189 **** --- 184,229 ---- } + /* generate memory map */ + void stat_memorymap_get(obj, sentry) + cacheinfo *obj; + StoreEntry *sentry; + { + #if HAVE_MEMORYMAP + int oldOut; + int fd,fd2; + int len; + static char *buf; + char *name; + + oldOut=dup(1); + fflush(stdout); + close(1); + name=tmpnam(NULL); + fd=open(name,O_CREAT|O_RDWR,0666); + unlink(name); + if(fd==1) { + memorymap(1); + fflush(stdout); + fd2=dup(fd); + close(fd); + fd=fd2; + dup(oldOut); + close(oldOut); + } + + buf=xmalloc(4096); + lseek(fd,0,SEEK_SET); + while((len=read(fd,buf,4096))>0) { + storeAppend(sentry, buf, len); + } + close(fd); + safe_free(buf); + #else + storeAppend(sentry,"NOT IMPLEMENTED\n",16); + #endif + } + /* process a requested object into a manager format */ void stat_get(obj, req, sentry) cacheinfo *obj; *************** *** 199,204 **** --- 239,246 ---- stat_general_get(obj, sentry); } else if (strncmp(req, "utilization", strlen("utilization")) == 0) { stat_utilization_get(obj, sentry); + } else if (strncmp(req, "memorymap", strlen("memorymap")) == 0) { + stat_memorymap_get(obj, sentry); } }