diff -ru purge/Makefile purge-fixed/Makefile --- purge/Makefile 2000-09-21 15:05:31.000000000 +0200 +++ purge-fixed/Makefile 2006-10-16 23:26:59.000000000 +0200 @@ -108,10 +108,10 @@ LIBCVER = $(shell /bin/ls /lib/libc.so.? | \ awk -F'.' '{ if (m<$$3) m=$$3;} END { print m} ') ifeq (6,${LIBCVER}) -SOCKLEN = size_t +SOCKLEN = socklen_t endif CXXFLAGS += -DHAS_PSIGNAL -DLIBCVERSION=$(LIBCVER) -pipe # -Wall -pedantic -OPT_NORM = -march=pentium -O2 +OPT_NORM = -O2 # if your g++ balks (e.g. SuSE still uses 2.7.2.3) #CXXFLAGS += -DHAS_PSIGNAL -DLIBCVERSION=$(LIBCVER) -m486 LD = $(CC) diff -ru purge/purge.cc purge-fixed/purge.cc --- purge/purge.cc 2000-09-21 15:05:31.000000000 +0200 +++ purge-fixed/purge.cc 2006-10-16 23:28:02.000000000 +0200 @@ -289,6 +289,13 @@ sprintf( timeb, "%08x %08x %08x %08x %04x %5hu ", temp.timestamp, temp.lastref, temp.expires, temp.lastmod, temp.flags, temp.refcount ); + } else if ( meta && (findings = meta->search( STORE_META_STD_LFS )) ) { + StoreMetaStdLFS temp; + // make data aligned, avoid SIGBUS on RISC machines (ARGH!) + memcpy( &temp, findings->data, sizeof(StoreMetaStd) ); + sprintf( timeb, "%08x %08x %08x %08x %04x %5hu ", + temp.timestamp, temp.lastref, + temp.expires, temp.lastmod, temp.flags, temp.refcount ); } else { sprintf( timeb, "%08x %08x %08x %08x %04x %5hu ", -1, -1, -1, -1, 0, 0 ); } @@ -417,7 +424,7 @@ // the URL as part of the list. First, gobble all meta data. unsigned int offset = addon; SquidMetaList meta; - while ( offset < datastart && *(offset+linebuffer) != STORE_META_END ) { + while ( offset + addon <= datastart ) { unsigned int size = 0; memcpy( &size, linebuffer+offset+sizeof(char), sizeof(unsigned int) ); meta.append( SquidMetaType(*(linebuffer+offset)), diff -ru purge/squid-tlv.cc purge-fixed/squid-tlv.cc --- purge/squid-tlv.cc 2000-09-21 15:05:31.000000000 +0200 +++ purge-fixed/squid-tlv.cc 2006-05-20 14:45:45.000000000 +0200 @@ -49,13 +49,8 @@ SquidTLV::SquidTLV( SquidMetaType _type, size_t _size, void* _data ) :next(0),size(_size) { - if ( size ) { - type = _type; - data = (char*) _data; - } else { - type = STORE_META_END; - data = 0; - } + type = _type; + data = (char*) _data; } SquidMetaList::SquidMetaList() diff -ru purge/squid-tlv.hh purge-fixed/squid-tlv.hh --- purge/squid-tlv.hh 2000-09-21 15:05:31.000000000 +0200 +++ purge-fixed/squid-tlv.hh 2006-05-20 14:51:49.000000000 +0200 @@ -65,7 +65,9 @@ STORE_META_STD, // standard metadata STORE_META_HITMETERING, // reserved for hit metering STORE_META_VALID, - STORE_META_END + STORE_META_VARY_HEADERS, // Stores Vary request headers + STORE_META_STD_LFS, // standard metadata in lfs format + STORE_META_OBJSIZE, // object size, if its known }; // taken from Squid-2.x @@ -79,6 +81,16 @@ u_short flags; }; +struct StoreMetaStdLFS { + time_t timestamp; + time_t lastref; + time_t expires; + time_t lastmod; + uint64_t swap_file_sz; + u_short refcount; + u_short flags; +}; + struct SquidTLV { // create a shallow reference pointing into the "buffer" variable // do not copy --> saves times, saves memory.