--------------------- PatchSet 6449 Date: 2005/02/25 10:48:44 Author: hno Branch: lfs-2_5 Tag: (none) Log: Initial stab at getting Squid-2.5 ready to handle large files Members: configure.in:1.42.2.59->1.42.2.59.2.1 src/HttpHdrContRange.c:1.5->1.5.74.1 src/HttpHdrRange.c:1.7->1.7.74.1 src/HttpHeader.c:1.10.6.19->1.10.6.19.2.1 src/HttpHeaderTools.c:1.7.12.3->1.7.12.3.8.1 src/HttpReply.c:1.10.6.4->1.10.6.4.6.1 src/MemPool.c:1.6.6.1->1.6.6.1.34.1 src/authenticate.c:1.23.2.13->1.23.2.13.8.1 src/cache_cf.c:1.38.6.18->1.38.6.18.2.1 src/cf.data.pre:1.49.2.69->1.49.2.69.2.1 src/client.c:1.8.6.5->1.8.6.5.10.1 src/client_db.c:1.6.54.4->1.6.54.4.8.1 src/client_side.c:1.47.2.56->1.47.2.56.2.1 src/dns_internal.c:1.15.6.5->1.15.6.5.8.1 src/enums.h:1.29.2.14->1.29.2.14.6.1 src/ftp.c:1.18.6.18->1.18.6.18.2.1 src/globals.h:1.14.6.4->1.14.6.4.6.1 src/htcp.c:1.9.2.5->1.9.2.5.2.1 src/http.c:1.17.6.26->1.17.6.26.2.1 src/mime.c:1.11.6.4->1.11.6.4.6.1 src/net_db.c:1.11.22.3->1.11.22.3.2.1 src/peer_digest.c:1.10.6.1->1.10.6.1.16.1 src/protos.h:1.41.6.22->1.41.6.22.2.1 src/squid.h:1.13.6.7->1.13.6.7.8.1 src/ssl.c:1.13.6.7->1.13.6.7.8.1 src/stmem.c:1.7->1.7.66.1 src/store.c:1.16.6.7->1.16.6.7.6.1 src/store_client.c:1.9.6.2->1.9.6.2.16.1 src/store_dir.c:1.19.6.2->1.19.6.2.16.1 src/store_log.c:1.7->1.7.74.1 src/store_swapout.c:1.11.2.1->1.11.2.1.30.1 src/structs.h:1.48.2.33->1.48.2.33.2.1 src/tools.c:1.19.6.10->1.19.6.10.2.1 src/typedefs.h:1.25.6.6->1.25.6.6.8.1 src/fs/aufs/store_io_aufs.c:1.13.2.11->1.13.2.11.8.1 src/fs/ufs/store_io_ufs.c:1.7.6.3->1.7.6.3.8.1 Index: squid/configure.in =================================================================== RCS file: /cvsroot/squid-sf//squid/configure.in,v retrieving revision 1.42.2.59 retrieving revision 1.42.2.59.2.1 diff -u -r1.42.2.59 -r1.42.2.59.2.1 --- squid/configure.in 24 Feb 2005 03:17:00 -0000 1.42.2.59 +++ squid/configure.in 25 Feb 2005 10:48:44 -0000 1.42.2.59.2.1 @@ -3,7 +3,7 @@ dnl dnl Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9) dnl -dnl $Id: configure.in,v 1.42.2.59 2005/02/24 03:17:00 squidadm Exp $ +dnl $Id: configure.in,v 1.42.2.59.2.1 2005/02/25 10:48:44 hno Exp $ dnl dnl dnl @@ -11,7 +11,7 @@ AC_CONFIG_AUX_DIR(cfgaux) AM_INIT_AUTOMAKE(squid, 2.5.STABLE9-CVS) AM_CONFIG_HEADER(include/autoconf.h) -AC_REVISION($Revision: 1.42.2.59 $)dnl +AC_REVISION($Revision: 1.42.2.59.2.1 $)dnl AC_PREFIX_DEFAULT(/usr/local/squid) AM_MAINTAINER_MODE @@ -747,6 +747,16 @@ fi ]) +dnl Enable Large file support +AC_ARG_ENABLE(large-files, +[ --enable-large-files Enable support for large files (>2GB). Still + experimental.], +[ if test "$enableval" = "yes" ; then + echo "Large file support enabled" + CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64" + fi +]) + AM_CONDITIONAL(MAKE_LEAKFINDER, false) dnl Enable Leak Finding Functions AC_ARG_ENABLE(leakfinder, Index: squid/src/HttpHdrContRange.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/HttpHdrContRange.c,v retrieving revision 1.5 retrieving revision 1.5.74.1 diff -u -r1.5 -r1.5.74.1 --- squid/src/HttpHdrContRange.c 24 Oct 2001 09:42:11 -0000 1.5 +++ squid/src/HttpHdrContRange.c 25 Feb 2005 10:48:45 -0000 1.5.74.1 @@ -1,6 +1,6 @@ /* - * $Id: HttpHdrContRange.c,v 1.5 2001/10/24 09:42:11 squidadm Exp $ + * $Id: HttpHdrContRange.c,v 1.5.74.1 2005/02/25 10:48:45 hno Exp $ * * DEBUG: section 68 HTTP Content-Range Header * AUTHOR: Alex Rousskov @@ -81,7 +81,7 @@ p++; /* do we have last-pos ? */ if (p - field < flen) { - ssize_t last_pos; + off_t last_pos; if (!httpHeaderParseSize(p, &last_pos)) return 0; spec->length = size_diff(last_pos + 1, spec->offset); @@ -101,8 +101,8 @@ if (!known_spec(spec->offset) || !known_spec(spec->length)) packerPrintf(p, "*"); else - packerPrintf(p, "bytes %ld-%ld", - (long int) spec->offset, (long int) spec->offset + spec->length - 1); + packerPrintf(p, "bytes %"PRINTF_OFF_T"-%"PRINTF_OFF_T"", + spec->offset, spec->offset + spec->length - 1); } /* @@ -152,9 +152,9 @@ range->elength = range_spec_unknown; else if (!httpHeaderParseSize(p, &range->elength)) return 0; - debug(68, 8) ("parsed content-range field: %ld-%ld / %ld\n", - (long int) range->spec.offset, (long int) range->spec.offset + range->spec.length - 1, - (long int) range->elength); + debug(68, 8) ("parsed content-range field: %"PRINTF_OFF_T"-%"PRINTF_OFF_T" / %"PRINTF_OFF_T"\n", + range->spec.offset, range->spec.offset + range->spec.length - 1, + range->elength); return 1; } @@ -187,7 +187,7 @@ } void -httpHdrContRangeSet(HttpHdrContRange * cr, HttpHdrRangeSpec spec, ssize_t ent_len) +httpHdrContRangeSet(HttpHdrContRange * cr, HttpHdrRangeSpec spec, off_t ent_len) { assert(cr && ent_len >= 0); cr->spec = spec; Index: squid/src/HttpHdrRange.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/HttpHdrRange.c,v retrieving revision 1.7 retrieving revision 1.7.74.1 diff -u -r1.7 -r1.7.74.1 --- squid/src/HttpHdrRange.c 24 Oct 2001 09:42:11 -0000 1.7 +++ squid/src/HttpHdrRange.c 25 Feb 2005 10:48:45 -0000 1.7.74.1 @@ -1,6 +1,6 @@ /* - * $Id: HttpHdrRange.c,v 1.7 2001/10/24 09:42:11 squidadm Exp $ + * $Id: HttpHdrRange.c,v 1.7.74.1 2005/02/25 10:48:45 hno Exp $ * * DEBUG: section 64 HTTP Range Header * AUTHOR: Alex Rousskov @@ -55,7 +55,7 @@ /* local constants */ -#define range_spec_unknown ((ssize_t)-1) +#define range_spec_unknown ((off_t)-1) /* local routines */ #define known_spec(s) ((s) != range_spec_unknown) @@ -102,7 +102,7 @@ p++; /* do we have last-pos ? */ if (p - field < flen) { - ssize_t last_pos; + off_t last_pos; if (!httpHeaderParseSize(p, &last_pos)) return NULL; spec.length = size_diff(last_pos + 1, spec.offset); @@ -136,12 +136,12 @@ httpHdrRangeSpecPackInto(const HttpHdrRangeSpec * spec, Packer * p) { if (!known_spec(spec->offset)) /* suffix */ - packerPrintf(p, "-%ld", (long int) spec->length); + packerPrintf(p, "-%"PRINTF_OFF_T, spec->length); else if (!known_spec(spec->length)) /* trailer */ - packerPrintf(p, "%ld-", (long int) spec->offset); + packerPrintf(p, "%"PRINTF_OFF_T"-", spec->offset); else /* range */ - packerPrintf(p, "%ld-%ld", - (long int) spec->offset, (long int) spec->offset + spec->length - 1); + packerPrintf(p, "%"PRINTF_OFF_T"-%"PRINTF_OFF_T, + spec->offset, spec->offset + spec->length - 1); } /* fills "absent" positions in range specification based on response body size @@ -151,8 +151,8 @@ static int httpHdrRangeSpecCanonize(HttpHdrRangeSpec * spec, size_t clen) { - debug(64, 5) ("httpHdrRangeSpecCanonize: have: [%ld, %ld) len: %ld\n", - (long int) spec->offset, (long int) spec->offset + spec->length, (long int) spec->length); + debug(64, 5) ("httpHdrRangeSpecCanonize: have: [%"PRINTF_OFF_T", %"PRINTF_OFF_T") len: %"PRINTF_OFF_T"\n", + spec->offset, spec->offset + spec->length, spec->length); if (!known_spec(spec->offset)) /* suffix */ spec->offset = size_diff(clen, spec->length); else if (!known_spec(spec->length)) /* trailer */ @@ -162,8 +162,8 @@ assert(known_spec(spec->offset)); spec->length = size_min(size_diff(clen, spec->offset), spec->length); /* check range validity */ - debug(64, 5) ("httpHdrRangeSpecCanonize: done: [%ld, %ld) len: %ld\n", - (long int) spec->offset, (long int) spec->offset + (long int) spec->length, (long int) spec->length); + debug(64, 5) ("httpHdrRangeSpecCanonize: done: [%"PRINTF_OFF_T", %"PRINTF_OFF_T") len: %"PRINTF_OFF_T"\n", + spec->offset, spec->offset + spec->length, spec->length); return spec->length > 0; } @@ -303,7 +303,7 @@ * - there is at least one range spec */ int -httpHdrRangeCanonize(HttpHdrRange * range, ssize_t clen) +httpHdrRangeCanonize(HttpHdrRange * range, off_t clen) { int i; HttpHdrRangeSpec *spec; @@ -415,10 +415,10 @@ * Returns lowest known offset in range spec(s), or range_spec_unknown * this is used for size limiting */ -ssize_t +off_t httpHdrRangeFirstOffset(const HttpHdrRange * range) { - ssize_t offset = range_spec_unknown; + off_t offset = range_spec_unknown; HttpHdrRangePos pos = HttpHdrRangeInitPos; const HttpHdrRangeSpec *spec; assert(range); @@ -435,11 +435,11 @@ * ranges are combined into one, for example FTP REST. * Use 0 for size if unknown */ -ssize_t -httpHdrRangeLowestOffset(const HttpHdrRange * range, ssize_t size) +off_t +httpHdrRangeLowestOffset(const HttpHdrRange * range, off_t size) { - ssize_t offset = range_spec_unknown; - ssize_t current; + off_t offset = range_spec_unknown; + off_t current; HttpHdrRangePos pos = HttpHdrRangeInitPos; const HttpHdrRangeSpec *spec; assert(range); Index: squid/src/HttpHeader.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/HttpHeader.c,v retrieving revision 1.10.6.19 retrieving revision 1.10.6.19.2.1 diff -u -r1.10.6.19 -r1.10.6.19.2.1 --- squid/src/HttpHeader.c 20 Feb 2005 19:42:01 -0000 1.10.6.19 +++ squid/src/HttpHeader.c 25 Feb 2005 10:48:45 -0000 1.10.6.19.2.1 @@ -1,6 +1,6 @@ /* - * $Id: HttpHeader.c,v 1.10.6.19 2005/02/20 19:42:01 squidadm Exp $ + * $Id: HttpHeader.c,v 1.10.6.19.2.1 2005/02/25 10:48:45 hno Exp $ * * DEBUG: section 55 HTTP Header * AUTHOR: Alex Rousskov @@ -807,6 +807,17 @@ } void +httpHeaderPutSize(HttpHeader * hdr, http_hdr_type id, off_t number) +{ + char size[64]; + assert_eid(id); + assert(Headers[id].type == ftSize); /* must be of an appropriate type */ + assert(number >= 0); + snprintf(size, sizeof(size), "%"PRINTF_OFF_T, number); + httpHeaderAddEntry(hdr, httpHeaderEntryCreate(id, NULL, size)); +} + +void httpHeaderPutTime(HttpHeader * hdr, http_hdr_type id, time_t htime) { assert_eid(id); @@ -912,6 +923,21 @@ return value; } +off_t +httpHeaderGetSize(const HttpHeader * hdr, http_hdr_type id) +{ + HttpHeaderEntry *e; + off_t value = -1; + int ok; + assert_eid(id); + assert(Headers[id].type == ftInt); /* must be of an appropriate type */ + if ((e = httpHeaderFindEntry(hdr, id))) { + ok = httpHeaderParseSize(strBuf(e->value), &value); + httpHeaderNoteParsedEntry(e->id, e->value, !ok); + } + return value; +} + time_t httpHeaderGetTime(const HttpHeader * hdr, http_hdr_type id) { Index: squid/src/HttpHeaderTools.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/HttpHeaderTools.c,v retrieving revision 1.7.12.3 retrieving revision 1.7.12.3.8.1 diff -u -r1.7.12.3 -r1.7.12.3.8.1 --- squid/src/HttpHeaderTools.c 26 Sep 2004 02:14:22 -0000 1.7.12.3 +++ squid/src/HttpHeaderTools.c 25 Feb 2005 10:48:45 -0000 1.7.12.3.8.1 @@ -1,6 +1,6 @@ /* - * $Id: HttpHeaderTools.c,v 1.7.12.3 2004/09/26 02:14:22 squidadm Exp $ + * $Id: HttpHeaderTools.c,v 1.7.12.3.8.1 2005/02/25 10:48:45 hno Exp $ * * DEBUG: section 66 HTTP Header Tools * AUTHOR: Alex Rousskov @@ -138,7 +138,7 @@ /* wrapper arrounf PutContRange */ void -httpHeaderAddContRange(HttpHeader * hdr, HttpHdrRangeSpec spec, ssize_t ent_len) +httpHeaderAddContRange(HttpHeader * hdr, HttpHdrRangeSpec spec, off_t ent_len) { HttpHdrContRange *cr = httpHdrContRangeCreate(); assert(hdr && ent_len >= 0); @@ -316,11 +316,18 @@ return 1; } -int -httpHeaderParseSize(const char *start, ssize_t * value) +off_t +httpHeaderParseSize(const char *start, off_t * value) { - int v; - const int res = httpHeaderParseInt(start, &v); + off_t v; + char *end; + int res; +#if SIZEOF_OFF_T > SIZEOF_LONG + v = strtoll(start, &end, 10); +#else + v = strtol(start, &end, 10); +#endif + res = start != end; assert(value); *value = res ? v : 0; return res; Index: squid/src/HttpReply.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/HttpReply.c,v retrieving revision 1.10.6.4 retrieving revision 1.10.6.4.6.1 diff -u -r1.10.6.4 -r1.10.6.4.6.1 --- squid/src/HttpReply.c 22 Jan 2005 03:15:02 -0000 1.10.6.4 +++ squid/src/HttpReply.c 25 Feb 2005 10:48:45 -0000 1.10.6.4.6.1 @@ -1,6 +1,6 @@ /* - * $Id: HttpReply.c,v 1.10.6.4 2005/01/22 03:15:02 squidadm Exp $ + * $Id: HttpReply.c,v 1.10.6.4.6.1 2005/02/25 10:48:45 hno Exp $ * * DEBUG: section 58 HTTP Reply (Response) * AUTHOR: Alex Rousskov @@ -135,7 +135,7 @@ * returns true on success. */ int -httpReplyParse(HttpReply * rep, const char *buf, ssize_t end) +httpReplyParse(HttpReply * rep, const char *buf, off_t end) { /* * this extra buffer/copy will be eliminated when headers become @@ -194,9 +194,10 @@ packerClean(&p); } +#if UNUSED_CODE MemBuf httpPackedReply(http_version_t ver, http_status status, const char *ctype, - int clen, time_t lmt, time_t expires) + off_t clen, time_t lmt, time_t expires) { HttpReply *rep = httpReplyCreate(); MemBuf mb; @@ -205,6 +206,7 @@ httpReplyDestroy(rep); return mb; } +#endif MemBuf httpPacked304Reply(const HttpReply * rep) @@ -230,7 +232,7 @@ void httpReplySetHeaders(HttpReply * reply, http_version_t ver, http_status status, const char *reason, - const char *ctype, int clen, time_t lmt, time_t expires) + const char *ctype, off_t clen, time_t lmt, time_t expires) { HttpHeader *hdr; assert(reply); @@ -245,7 +247,7 @@ } else reply->content_type = StringNull; if (clen >= 0) - httpHeaderPutInt(hdr, HDR_CONTENT_LENGTH, clen); + httpHeaderPutSize(hdr, HDR_CONTENT_LENGTH, clen); if (expires >= 0) httpHeaderPutTime(hdr, HDR_EXPIRES, expires); if (lmt > 0) /* this used to be lmt != 0 @?@ */ @@ -267,7 +269,7 @@ hdr = &reply->header; httpHeaderPutStr(hdr, HDR_SERVER, full_appname_string); httpHeaderPutTime(hdr, HDR_DATE, squid_curtime); - httpHeaderPutInt(hdr, HDR_CONTENT_LENGTH, 0); + httpHeaderPutSize(hdr, HDR_CONTENT_LENGTH, 0); httpHeaderPutStr(hdr, HDR_LOCATION, loc); reply->date = squid_curtime; reply->content_length = 0; @@ -342,7 +344,7 @@ { const HttpHeader *hdr = &rep->header; const char *str; - rep->content_length = httpHeaderGetInt(hdr, HDR_CONTENT_LENGTH); + rep->content_length = httpHeaderGetSize(hdr, HDR_CONTENT_LENGTH); rep->date = httpHeaderGetTime(hdr, HDR_DATE); rep->last_modified = httpHeaderGetTime(hdr, HDR_LAST_MODIFIED); str = httpHeaderGetStr(hdr, HDR_CONTENT_TYPE); @@ -449,7 +451,7 @@ /* * Returns the body size of a HTTP response */ -int +off_t httpReplyBodySize(method_t method, const HttpReply * reply) { if (reply->sline.version.major < 1) Index: squid/src/MemPool.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/MemPool.c,v retrieving revision 1.6.6.1 retrieving revision 1.6.6.1.34.1 diff -u -r1.6.6.1 -r1.6.6.1.34.1 --- squid/src/MemPool.c 11 Mar 2002 05:06:56 -0000 1.6.6.1 +++ squid/src/MemPool.c 25 Feb 2005 10:48:45 -0000 1.6.6.1.34.1 @@ -1,6 +1,6 @@ /* - * $Id: MemPool.c,v 1.6.6.1 2002/03/11 05:06:56 squidadm Exp $ + * $Id: MemPool.c,v 1.6.6.1.34.1 2005/02/25 10:48:45 hno Exp $ * * DEBUG: section 63 Low Level Memory Pool Management * AUTHOR: Alex Rousskov @@ -58,9 +58,9 @@ static Stack Pools; /* local prototypes */ -static void memShrink(ssize_t new_limit); +static void memShrink(off_t new_limit); static void memPoolDescribe(const MemPool * pool); -static void memPoolShrink(MemPool * pool, ssize_t new_limit); +static void memPoolShrink(MemPool * pool, off_t new_limit); static double @@ -135,9 +135,9 @@ static void -memShrink(ssize_t new_limit) +memShrink(off_t new_limit) { - ssize_t start_limit = TheMeter.idle.level; + off_t start_limit = TheMeter.idle.level; int i; assert(start_limit >= 0 && new_limit >= 0); debug(63, 1) ("memShrink: started with %ld KB goal: %ld KB\n", @@ -145,7 +145,7 @@ /* first phase: cut proportionally to the pool idle size */ for (i = 0; i < Pools.count && TheMeter.idle.level > new_limit; ++i) { MemPool *pool = Pools.items[i]; - const ssize_t target_pool_size = (size_t) ((double) pool->meter.idle.level * new_limit) / start_limit; + const off_t target_pool_size = (size_t) ((double) pool->meter.idle.level * new_limit) / start_limit; memPoolShrink(pool, target_pool_size); } debug(63, 1) ("memShrink: 1st phase done with %ld KB left\n", (long int) toKB(TheMeter.idle.level)); @@ -276,7 +276,7 @@ } static void -memPoolShrink(MemPool * pool, ssize_t new_limit) +memPoolShrink(MemPool * pool, off_t new_limit) { assert(pool); assert(new_limit >= 0); @@ -304,11 +304,11 @@ return pool->meter.inuse.level; } -size_t +off_t memPoolInUseSize(const MemPool * pool) { assert(pool); - return pool->obj_size * pool->meter.inuse.level; + return ((off_t)pool->obj_size) * pool->meter.inuse.level; } /* to-do: make debug level a parameter? */ @@ -321,7 +321,7 @@ (long int) toKB(memPoolInUseSize(pool))); } -size_t +int memTotalAllocated(void) { return TheMeter.alloc.level; Index: squid/src/authenticate.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/authenticate.c,v retrieving revision 1.23.2.13 retrieving revision 1.23.2.13.8.1 diff -u -r1.23.2.13 -r1.23.2.13.8.1 --- squid/src/authenticate.c 11 Jan 2005 03:17:25 -0000 1.23.2.13 +++ squid/src/authenticate.c 25 Feb 2005 10:48:45 -0000 1.23.2.13.8.1 @@ -1,6 +1,6 @@ /* - * $Id: authenticate.c,v 1.23.2.13 2005/01/11 03:17:25 squidadm Exp $ + * $Id: authenticate.c,v 1.23.2.13.8.1 2005/02/25 10:48:45 hno Exp $ * * DEBUG: section 29 Authenticator * AUTHOR: Duane Wessels @@ -352,7 +352,7 @@ authenticateAuthUserClearIp(auth_user_request->auth_user); } -size_t +int authenticateAuthUserRequestIPCount(auth_user_request_t * auth_user_request) { assert(auth_user_request); Index: squid/src/cache_cf.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/cache_cf.c,v retrieving revision 1.38.6.18 retrieving revision 1.38.6.18.2.1 diff -u -r1.38.6.18 -r1.38.6.18.2.1 --- squid/src/cache_cf.c 21 Feb 2005 03:13:32 -0000 1.38.6.18 +++ squid/src/cache_cf.c 25 Feb 2005 10:48:46 -0000 1.38.6.18.2.1 @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.c,v 1.38.6.18 2005/02/21 03:13:32 squidadm Exp $ + * $Id: cache_cf.c,v 1.38.6.18.2.1 2005/02/25 10:48:46 hno Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -78,7 +78,7 @@ static void default_all(void); static void defaults_if_none(void); static int parse_line(char *); -static void parseBytesLine(size_t * bptr, const char *units); +static void parseBytesLine(off_t * bptr, const char *units); static size_t parseBytesUnits(const char *unit); static void free_all(void); void requirePathnameExists(const char *name, const char *path); @@ -210,10 +210,37 @@ GetInteger(void) { char *token = strtok(NULL, w_space); + char *end; int i; + double d; + if (token == NULL) + self_destruct(); + i = strtol(token, &end, 0); + d = strtod(token, NULL); + if (d > INT_MAX || end == token) + self_destruct(); + return i; +} + +static off_t +GetOffT(void) +{ + char *token = strtok(NULL, w_space); + char *end; + off_t i; if (token == NULL) self_destruct(); - if (sscanf(token, "%d", &i) != 1) +#if SIZEOF_OFF_T > SIZEOF_LONG + i = strtoll(token, &end, 0); +#else + i = strtol(token, &end, 0); + { + double d = strtod(token, NULL); + if (d > INT_MAX) + end = token; + } +#endif + if (end == token) self_destruct(); return i; } @@ -222,7 +249,7 @@ update_maxobjsize(void) { int i; - ssize_t ms = -1; + off_t ms = -1; for (i = 0; i < Config.cacheSwap.n_configured; i++) { if (Config.cacheSwap.swapDirs[i].max_objsize > ms) @@ -492,18 +519,18 @@ } static void -parseBytesLine(size_t * bptr, const char *units) +parseBytesLine(off_t * bptr, const char *units) { char *token; double d; - size_t m; - size_t u; + off_t m; + off_t u; if ((u = parseBytesUnits(units)) == 0) self_destruct(); if ((token = strtok(NULL, w_space)) == NULL) self_destruct(); if (strcmp(token, "none") == 0 || strcmp(token, "-1") == 0) { - *bptr = (size_t) - 1; + *bptr = (off_t) - 1; return; } d = atof(token); @@ -1323,7 +1350,7 @@ static void parse_cachedir_option_maxsize(SwapDir * sd, const char *option, const char *value, int reconfiguring) { - ssize_t size; + off_t size; if (!value) self_destruct(); @@ -2073,34 +2100,36 @@ *var = 0; } +#if UNUSED_CODE static void -dump_size_t(StoreEntry * entry, const char *name, size_t var) +dump_size_t(StoreEntry * entry, const char *name, off_t var) { - storeAppendPrintf(entry, "%s %d\n", name, (int) var); + storeAppendPrintf(entry, "%s %"PRINTF_OFF_T"\n", name, var); } +#endif static void -dump_b_size_t(StoreEntry * entry, const char *name, size_t var) +dump_b_size_t(StoreEntry * entry, const char *name, off_t var) { - storeAppendPrintf(entry, "%s %d %s\n", name, (int) var, B_BYTES_STR); + storeAppendPrintf(entry, "%s %"PRINTF_OFF_T" %s\n", name, var, B_BYTES_STR); } static void -dump_kb_size_t(StoreEntry * entry, const char *name, size_t var) +dump_kb_size_t(StoreEntry * entry, const char *name, off_t var) { - storeAppendPrintf(entry, "%s %d %s\n", name, (int) var, B_KBYTES_STR); + storeAppendPrintf(entry, "%s %"PRINTF_OFF_T" %s\n", name, var, B_KBYTES_STR); } +#if UNUSED_CODE static void parse_size_t(size_t * var) { - int i; - i = GetInteger(); - *var = (size_t) i; + *var = GetInteger(); } +#endif static void -parse_b_size_t(size_t * var) +parse_b_size_t(off_t * var) { parseBytesLine(var, B_BYTES_STR); } @@ -2113,7 +2142,7 @@ body_size *bs; CBDATA_INIT_TYPE(body_size); bs = cbdataAlloc(body_size); - parse_size_t(&bs->maxsize); + bs->maxsize = GetOffT(); aclParseAccessLine(&bs->access_list); dlinkAddTail(bs, &bs->node, bodylist); @@ -2128,7 +2157,7 @@ acl_list *l; acl_access *head = bs->access_list; while (head != NULL) { - storeAppendPrintf(entry, "%s %ld %s", name, (long int) bs->maxsize, + storeAppendPrintf(entry, "%s %"PRINTF_OFF_T" %s", name, bs->maxsize, head->allow ? "Allow" : "Deny"); for (l = head->acl_list; l != NULL; l = l->next) { storeAppendPrintf(entry, " %s%s", @@ -2165,13 +2194,13 @@ static void -parse_kb_size_t(size_t * var) +parse_kb_size_t(off_t * var) { parseBytesLine(var, B_KBYTES_STR); } static void -free_size_t(size_t * var) +free_size_t(off_t * var) { *var = 0; } Index: squid/src/cf.data.pre =================================================================== RCS file: /cvsroot/squid-sf//squid/src/cf.data.pre,v retrieving revision 1.49.2.69 retrieving revision 1.49.2.69.2.1 diff -u -r1.49.2.69 -r1.49.2.69.2.1 --- squid/src/cf.data.pre 23 Feb 2005 03:15:06 -0000 1.49.2.69 +++ squid/src/cf.data.pre 25 Feb 2005 10:48:47 -0000 1.49.2.69.2.1 @@ -1,6 +1,6 @@ # -# $Id: cf.data.pre,v 1.49.2.69 2005/02/23 03:15:06 squidadm Exp $ +# $Id: cf.data.pre,v 1.49.2.69.2.1 2005/02/25 10:48:47 hno Exp $ # # # SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -1046,7 +1046,7 @@ DOC_END NAME: ftp_list_width -TYPE: size_t +TYPE: int DEFAULT: 32 LOC: Config.Ftp.list_width DOC_START Index: squid/src/client.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/client.c,v retrieving revision 1.8.6.5 retrieving revision 1.8.6.5.10.1 diff -u -r1.8.6.5 -r1.8.6.5.10.1 --- squid/src/client.c 19 Feb 2004 03:08:38 -0000 1.8.6.5 +++ squid/src/client.c 25 Feb 2005 10:48:48 -0000 1.8.6.5.10.1 @@ -1,6 +1,6 @@ /* - * $Id: client.c,v 1.8.6.5 2004/02/19 03:08:38 squidadm Exp $ + * $Id: client.c,v 1.8.6.5.10.1 2005/02/25 10:48:48 hno Exp $ * * DEBUG: section 0 WWW Client * AUTHOR: Harvest Derived @@ -47,8 +47,8 @@ static SIGHDLR catch; static SIGHDLR pipe_handler; static void set_our_signal(void); -static ssize_t myread(int fd, void *buf, size_t len); -static ssize_t mywrite(int fd, void *buf, size_t len); +static off_t myread(int fd, void *buf, size_t len); +static off_t mywrite(int fd, void *buf, size_t len); static int put_fd; static char *put_file = NULL; static struct stat sb; @@ -489,14 +489,14 @@ } -static ssize_t +static off_t myread(int fd, void *buf, size_t len) { alarm(io_timeout); return read(fd, buf, len); } -static ssize_t +static off_t mywrite(int fd, void *buf, size_t len) { alarm(io_timeout); Index: squid/src/client_db.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_db.c,v retrieving revision 1.6.54.4 retrieving revision 1.6.54.4.8.1 diff -u -r1.6.54.4 -r1.6.54.4.8.1 --- squid/src/client_db.c 12 Oct 2004 02:13:35 -0000 1.6.54.4 +++ squid/src/client_db.c 25 Feb 2005 10:48:48 -0000 1.6.54.4.8.1 @@ -1,6 +1,6 @@ /* - * $Id: client_db.c,v 1.6.54.4 2004/10/12 02:13:35 squidadm Exp $ + * $Id: client_db.c,v 1.6.54.4.8.1 2005/02/25 10:48:48 hno Exp $ * * DEBUG: section 0 Client Database * AUTHOR: Duane Wessels @@ -77,7 +77,7 @@ } void -clientdbUpdate(struct in_addr addr, log_type ltype, protocol_t p, size_t size) +clientdbUpdate(struct in_addr addr, log_type ltype, protocol_t p, off_t size) { char *key; ClientInfo *c; Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.47.2.56 retrieving revision 1.47.2.56.2.1 diff -u -r1.47.2.56 -r1.47.2.56.2.1 --- squid/src/client_side.c 20 Feb 2005 19:42:02 -0000 1.47.2.56 +++ squid/src/client_side.c 25 Feb 2005 10:48:48 -0000 1.47.2.56.2.1 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.47.2.56 2005/02/20 19:42:02 squidadm Exp $ + * $Id: client_side.c,v 1.47.2.56.2.1 2005/02/25 10:48:48 hno Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -125,8 +125,8 @@ static int clientCheckContentLength(request_t * r); static DEFER httpAcceptDefer; static log_type clientProcessRequest2(clientHttpRequest * http); -static int clientReplyBodyTooLarge(clientHttpRequest *, ssize_t clen); -static int clientRequestBodyTooLarge(int clen); +static int clientReplyBodyTooLarge(clientHttpRequest *, off_t clen); +static int clientRequestBodyTooLarge(off_t clen); static void clientProcessBody(ConnStateData * conn); static void clientEatRequestBody(clientHttpRequest *); static BODY_HANDLER clientReadBody; @@ -1224,10 +1224,10 @@ * warning: assumes that HTTP headers for individual ranges at the * time of the actuall assembly will be exactly the same as * the headers when clientMRangeCLen() is called */ -static int +static off_t clientMRangeCLen(clientHttpRequest * http) { - int clen = 0; + off_t clen = 0; HttpHdrRangePos pos = HttpHdrRangeInitPos; const HttpHdrRangeSpec *spec; MemBuf mb; @@ -1246,8 +1246,8 @@ /* account for range content */ clen += spec->length; - debug(33, 6) ("clientMRangeCLen: (clen += %ld + %ld) == %d\n", - (long int) mb.size, (long int) spec->length, clen); + debug(33, 6) ("clientMRangeCLen: (clen += %ld + %"PRINTF_OFF_T") == %"PRINTF_OFF_T"\n", + (long int)mb.size, spec->length, clen); } /* account for the terminating boundary */ memBufReset(&mb); @@ -1295,9 +1295,9 @@ http->request->range = NULL; } else { const int spec_count = http->request->range->specs.count; - int actual_clen = -1; + off_t actual_clen = -1; - debug(33, 3) ("clientBuildRangeHeader: range spec count: %d virgin clen: %d\n", + debug(33, 3) ("clientBuildRangeHeader: range spec count: %d virgin clen: %"PRINTF_OFF_T"\n", spec_count, rep->content_length); assert(spec_count > 0); /* ETags should not be returned with Partial Content replies? */ @@ -1329,8 +1329,8 @@ /* replace Content-Length header */ assert(actual_clen >= 0); httpHeaderDelById(hdr, HDR_CONTENT_LENGTH); - httpHeaderPutInt(hdr, HDR_CONTENT_LENGTH, actual_clen); - debug(33, 3) ("clientBuildRangeHeader: actual content length: %d\n", actual_clen); + httpHeaderPutSize(hdr, HDR_CONTENT_LENGTH, actual_clen); + debug(33, 3) ("clientBuildRangeHeader: actual content length: %"PRINTF_OFF_T"\n", actual_clen); } } @@ -1729,10 +1729,10 @@ clientPackRange(clientHttpRequest * http, HttpHdrRangeIter * i, const char **buf, - ssize_t * size, + off_t * size, MemBuf * mb) { - const ssize_t copy_sz = i->debt_size <= *size ? i->debt_size : *size; + const off_t copy_sz = i->debt_size <= *size ? i->debt_size : *size; off_t body_off = http->out.offset - i->prefix_size; assert(*size > 0); assert(i->spec); @@ -1777,7 +1777,7 @@ * increments iterator "i" * used by clientPackMoreRanges */ static int -clientCanPackMoreRanges(const clientHttpRequest * http, HttpHdrRangeIter * i, ssize_t size) +clientCanPackMoreRanges(const clientHttpRequest * http, HttpHdrRangeIter * i, off_t size) { /* first update "i" if needed */ if (!i->debt_size) { @@ -1792,7 +1792,7 @@ /* extracts "ranges" from buf and appends them to mb, updating all offsets and such */ /* returns true if we need more data */ static int -clientPackMoreRanges(clientHttpRequest * http, const char *buf, ssize_t size, MemBuf * mb) +clientPackMoreRanges(clientHttpRequest * http, const char *buf, off_t size, MemBuf * mb) { HttpHdrRangeIter *i = &http->range_iter; /* offset in range specs does not count the prefix of an http msg */ @@ -1876,7 +1876,7 @@ } static int -clientReplyBodyTooLarge(clientHttpRequest * http, ssize_t clen) +clientReplyBodyTooLarge(clientHttpRequest * http, off_t clen) { if (0 == http->maxBodySize) return 0; /* disabled */ @@ -1888,7 +1888,7 @@ } static int -clientRequestBodyTooLarge(int clen) +clientRequestBodyTooLarge(off_t clen) { if (0 == Config.maxRequestBodySize) return 0; /* disabled */ @@ -1939,9 +1939,9 @@ int fd = conn->fd; HttpReply *rep = NULL; const char *body_buf = buf; - ssize_t body_size = size; + off_t body_size = size; MemBuf mb; - ssize_t check_size = 0; + off_t check_size = 0; debug(33, 5) ("clientSendMoreData: %s, %d bytes\n", http->uri, (int) size); assert(size <= CLIENT_SOCK_SZ); assert(http->request != NULL); @@ -2191,7 +2191,7 @@ if (isTcpHit(http->log_type)) kb_incr(&statCounter.client_http.hit_kbytes_out, size); } -#if SIZEOF_SIZE_T == 4 +#if SIZEOF_OFF_T == 4 if (http->out.size > 0x7FFF0000) { debug(33, 1) ("WARNING: closing FD %d to prevent counter overflow\n", fd); debug(33, 1) ("\tclient %s\n", inet_ntoa(http->conn->peer.sin_addr)); @@ -3124,7 +3124,7 @@ /* * cache the Content-length value in request_t. */ - request->content_length = httpHeaderGetInt(&request->header, + request->content_length = httpHeaderGetSize(&request->header, HDR_CONTENT_LENGTH); request->flags.internal = http->flags.internal; safe_free(prefix); Index: squid/src/dns_internal.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/dns_internal.c,v retrieving revision 1.15.6.5 retrieving revision 1.15.6.5.8.1 diff -u -r1.15.6.5 -r1.15.6.5.8.1 --- squid/src/dns_internal.c 30 Jul 2004 02:12:59 -0000 1.15.6.5 +++ squid/src/dns_internal.c 25 Feb 2005 10:48:49 -0000 1.15.6.5.8.1 @@ -1,6 +1,6 @@ /* - * $Id: dns_internal.c,v 1.15.6.5 2004/07/30 02:12:59 squidadm Exp $ + * $Id: dns_internal.c,v 1.15.6.5.8.1 2005/02/25 10:48:49 hno Exp $ * * DEBUG: section 78 DNS lookups; interacts with lib/rfc1035.c * AUTHOR: Duane Wessels @@ -518,7 +518,7 @@ idnsRead(int fd, void *data) { int *N = &incoming_sockets_accepted; - ssize_t len; + off_t len; struct sockaddr_in from; socklen_t from_len; int max = INCOMING_DNS_MAX; Index: squid/src/enums.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/enums.h,v retrieving revision 1.29.2.14 retrieving revision 1.29.2.14.6.1 diff -u -r1.29.2.14 -r1.29.2.14.6.1 --- squid/src/enums.h 18 Jan 2005 03:16:49 -0000 1.29.2.14 +++ squid/src/enums.h 25 Feb 2005 10:48:49 -0000 1.29.2.14.6.1 @@ -1,6 +1,6 @@ /* - * $Id: enums.h,v 1.29.2.14 2005/01/18 03:16:49 squidadm Exp $ + * $Id: enums.h,v 1.29.2.14.6.1 2005/02/25 10:48:49 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -274,7 +274,8 @@ ftPCc, ftPContRange, ftPRange, - ftDate_1123_or_ETag + ftDate_1123_or_ETag, + ftSize } field_type; /* possible owners of http header */ Index: squid/src/ftp.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/ftp.c,v retrieving revision 1.18.6.18 retrieving revision 1.18.6.18.2.1 diff -u -r1.18.6.18 -r1.18.6.18.2.1 --- squid/src/ftp.c 22 Feb 2005 03:23:03 -0000 1.18.6.18 +++ squid/src/ftp.c 25 Feb 2005 10:48:49 -0000 1.18.6.18.2.1 @@ -1,6 +1,6 @@ /* - * $Id: ftp.c,v 1.18.6.18 2005/02/22 03:23:03 squidadm Exp $ + * $Id: ftp.c,v 1.18.6.18.2.1 2005/02/25 10:48:49 hno Exp $ * * DEBUG: section 9 File Transfer Protocol (FTP) * AUTHOR: Harvest Derived @@ -93,14 +93,14 @@ int login_att; ftp_state_t state; time_t mdtm; - int size; + off_t size; wordlist *pathcomps; char *filepath; - int restart_offset; - int restarted_offset; + off_t restart_offset; + off_t restarted_offset; int rest_att; char *proxy_host; - size_t list_width; + int list_width; wordlist *cwd_message; char *old_request; char *old_reply; @@ -110,7 +110,7 @@ int fd; char *buf; size_t size; - off_t offset; + size_t offset; FREE *freefunc; wordlist *message; char *last_command; @@ -121,7 +121,7 @@ int fd; char *buf; size_t size; - off_t offset; + size_t offset; FREE *freefunc; char *host; u_short port; @@ -132,7 +132,7 @@ typedef struct { char type; - int size; + off_t size; char *date; char *name; char *showname; @@ -537,7 +537,7 @@ month, day, year); if ((t = strstr(buf, tbuf))) { p->type = *tokens[0]; - p->size = atoi(size); + p->size = strtoll(size, NULL, 10); p->date = xstrdup(tbuf); if (flags.skip_whitespace) { t += strlen(tbuf); @@ -607,7 +607,7 @@ p->size = atoi(ct + 1); break; case 'm': - t = (time_t) strtol(ct + 1, &tmp, 0); + t = (time_t) strtoll(ct + 1, &tmp, 0); if (*tmp || (tmp == ct + 1)) break; /* not a valid integer */ p->date = xstrdup(ctime(&t)); @@ -774,7 +774,7 @@ snprintf(icon, 2048, "\"%-6s\"", mimeGetIconURL(parts->name), "[FILE]"); - snprintf(size, 2048, " %6dk", parts->size); + snprintf(size, 2048, " %6"PRINTF_OFF_T"k", parts->size); break; } if (parts->type != 'd') { @@ -818,7 +818,7 @@ size_t linelen; size_t usable; StoreEntry *e = ftpState->entry; - int len = ftpState->data.offset; + size_t len = ftpState->data.offset; /* * We need a NULL-terminated buffer for scanning, ick */ @@ -828,13 +828,13 @@ while (*end != '\r' && *end != '\n' && end > sbuf) end--; usable = end - sbuf; - debug(9, 3) ("ftpParseListing: usable = %d\n", (int) usable); + debug(9, 3) ("ftpParseListing: usable = %d\n", (int)usable); if (usable == 0) { debug(9, 3) ("ftpParseListing: didn't find end for %s\n", storeUrl(e)); xfree(sbuf); return; } - debug(9, 3) ("ftpParseListing: %d bytes to play with\n", len); + debug(9, 3) ("ftpParseListing: %d bytes to play with\n", (int)len); line = memAllocate(MEM_4K_BUF); end++; storeBuffer(e); @@ -1224,8 +1224,8 @@ wordlist *head = NULL; wordlist *list; wordlist **tail = &head; - off_t offset; - size_t linelen; + int offset; + int linelen; int code = -1; debug(9, 5) ("ftpParseControlReply\n"); /* @@ -1698,7 +1698,7 @@ debug(9, 3) ("This is ftpReadSize\n"); if (code == 213) { ftpUnhack(ftpState); - ftpState->size = atoi(ftpState->ctrl.last_reply); + ftpState->size = (size_t)strtoll(ftpState->ctrl.last_reply, NULL, 10); if (ftpState->size == 0) { debug(9, 2) ("ftpReadSize: SIZE reported %s on %s\n", ftpState->ctrl.last_reply, @@ -2036,7 +2036,7 @@ snprintf(cbuf, 1024, "STOR %s\r\n", ftpState->filepath); ftpWriteCommand(cbuf, ftpState); ftpState->state = SENT_STOR; - } else if (httpHeaderGetInt(&ftpState->request->header, HDR_CONTENT_LENGTH) > 0) { + } else if (httpHeaderGetSize(&ftpState->request->header, HDR_CONTENT_LENGTH) > 0) { /* File upload without a filename. use STOU to generate one */ snprintf(cbuf, 1024, "STOU\r\n"); ftpWriteCommand(cbuf, ftpState); @@ -2086,7 +2086,7 @@ static void ftpSendRest(FtpStateData * ftpState) { - snprintf(cbuf, 1024, "REST %d\r\n", ftpState->restart_offset); + snprintf(cbuf, 1024, "REST %"PRINTF_OFF_T"\r\n", ftpState->restart_offset); ftpWriteCommand(cbuf, ftpState); ftpState->state = SENT_REST; } Index: squid/src/globals.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/globals.h,v retrieving revision 1.14.6.4 retrieving revision 1.14.6.4.6.1 diff -u -r1.14.6.4 -r1.14.6.4.6.1 --- squid/src/globals.h 22 Jan 2005 03:15:06 -0000 1.14.6.4 +++ squid/src/globals.h 25 Feb 2005 10:48:49 -0000 1.14.6.4.6.1 @@ -1,6 +1,6 @@ /* - * $Id: globals.h,v 1.14.6.4 2005/01/22 03:15:06 squidadm Exp $ + * $Id: globals.h,v 1.14.6.4.6.1 2005/02/25 10:48:49 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -154,7 +154,7 @@ extern int store_swap_low; /* 0 */ extern int store_swap_high; /* 0 */ extern int store_pages_max; /* 0 */ -extern ssize_t store_maxobjsize; /* -1 */ +extern off_t store_maxobjsize; /* -1 */ extern RemovalPolicy *mem_policy; extern hash_table *proxy_auth_username_cache; /* NULL */ extern int incoming_sockets_accepted; Index: squid/src/htcp.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/htcp.c,v retrieving revision 1.9.2.5 retrieving revision 1.9.2.5.2.1 diff -u -r1.9.2.5 -r1.9.2.5.2.1 --- squid/src/htcp.c 20 Feb 2005 19:42:04 -0000 1.9.2.5 +++ squid/src/htcp.c 25 Feb 2005 10:48:49 -0000 1.9.2.5.2.1 @@ -1,6 +1,6 @@ /* - * $Id: htcp.c,v 1.9.2.5 2005/02/20 19:42:04 squidadm Exp $ + * $Id: htcp.c,v 1.9.2.5.2.1 2005/02/25 10:48:49 hno Exp $ * * DEBUG: section 31 Hypertext Caching Protocol * AUTHOR: Duane Wesssels @@ -159,17 +159,17 @@ static MemPool *htcpDetailPool = NULL; -static char *htcpBuildPacket(htcpStuff * stuff, ssize_t * len); +static char *htcpBuildPacket(htcpStuff * stuff, off_t * len); static htcpSpecifier *htcpUnpackSpecifier(char *buf, int sz); static htcpDetail *htcpUnpackDetail(char *buf, int sz); static int htcpUnpackCountstr(char *buf, int sz, char **str); -static ssize_t htcpBuildAuth(char *buf, size_t buflen); -static ssize_t htcpBuildCountstr(char *buf, size_t buflen, const char *s); -static ssize_t htcpBuildData(char *buf, size_t buflen, htcpStuff * stuff); -static ssize_t htcpBuildDetail(char *buf, size_t buflen, htcpStuff * stuff); -static ssize_t htcpBuildOpData(char *buf, size_t buflen, htcpStuff * stuff); -static ssize_t htcpBuildSpecifier(char *buf, size_t buflen, htcpStuff * stuff); -static ssize_t htcpBuildTstOpData(char *buf, size_t buflen, htcpStuff * stuff); +static off_t htcpBuildAuth(char *buf, size_t buflen); +static off_t htcpBuildCountstr(char *buf, size_t buflen, const char *s); +static off_t htcpBuildData(char *buf, size_t buflen, htcpStuff * stuff); +static off_t htcpBuildDetail(char *buf, size_t buflen, htcpStuff * stuff); +static off_t htcpBuildOpData(char *buf, size_t buflen, htcpStuff * stuff); +static off_t htcpBuildSpecifier(char *buf, size_t buflen, htcpStuff * stuff); +static off_t htcpBuildTstOpData(char *buf, size_t buflen, htcpStuff * stuff); static void htcpFreeSpecifier(htcpSpecifier * s); static void htcpFreeDetail(htcpDetail * s); static void htcpHandle(char *buf, int sz, struct sockaddr_in *from); @@ -209,7 +209,7 @@ * STUFF FOR SENDING HTCP MESSAGES */ -static ssize_t +static off_t htcpBuildAuth(char *buf, size_t buflen) { htcpAuthHeader auth; @@ -222,7 +222,7 @@ return copy_sz; } -static ssize_t +static off_t htcpBuildCountstr(char *buf, size_t buflen, const char *s) { u_short length; @@ -247,11 +247,11 @@ return off; } -static ssize_t +static off_t htcpBuildSpecifier(char *buf, size_t buflen, htcpStuff * stuff) { - ssize_t off = 0; - ssize_t s; + off_t off = 0; + off_t s; s = htcpBuildCountstr(buf + off, buflen - off, stuff->S.method); if (s < 0) return s; @@ -272,11 +272,11 @@ return off; } -static ssize_t +static off_t htcpBuildDetail(char *buf, size_t buflen, htcpStuff * stuff) { - ssize_t off = 0; - ssize_t s; + off_t off = 0; + off_t s; s = htcpBuildCountstr(buf + off, buflen - off, stuff->D.resp_hdrs); if (s < 0) return s; @@ -292,7 +292,7 @@ return off; } -static ssize_t +static off_t htcpBuildTstOpData(char *buf, size_t buflen, htcpStuff * stuff) { switch (stuff->rr) { @@ -312,10 +312,10 @@ return 0; } -static ssize_t +static off_t htcpBuildOpData(char *buf, size_t buflen, htcpStuff * stuff) { - ssize_t off = 0; + off_t off = 0; debug(31, 3) ("htcpBuildOpData: opcode %s\n", htcpOpcodeStr[stuff->op]); switch (stuff->op) { @@ -329,11 +329,11 @@ return off; } -static ssize_t +static off_t htcpBuildData(char *buf, size_t buflen, htcpStuff * stuff) { - ssize_t off = 0; - ssize_t op_data_sz; + off_t off = 0; + off_t op_data_sz; size_t hdr_sz = sizeof(htcpDataHeader); htcpDataHeader hdr; if (buflen < hdr_sz) @@ -359,11 +359,11 @@ } static char * -htcpBuildPacket(htcpStuff * stuff, ssize_t * len) +htcpBuildPacket(htcpStuff * stuff, off_t * len) { size_t buflen = 8192; - ssize_t s; - ssize_t off = 0; + off_t s; + off_t off = 0; size_t hdr_sz = sizeof(htcpHeader); htcpHeader hdr; char *buf = xcalloc(buflen, 1); @@ -544,7 +544,7 @@ HttpHeader hdr; MemBuf mb; Packer p; - ssize_t pktlen; + off_t pktlen; char *host; int rtt = 0; int hops = 0; @@ -897,7 +897,7 @@ { cache_key *save_key; char *pkt; - ssize_t pktlen; + off_t pktlen; char vbuf[32]; htcpStuff stuff; HttpHeader hdr; Index: squid/src/http.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/http.c,v retrieving revision 1.17.6.26 retrieving revision 1.17.6.26.2.1 diff -u -r1.17.6.26 -r1.17.6.26.2.1 --- squid/src/http.c 11 Feb 2005 23:48:47 -0000 1.17.6.26 +++ squid/src/http.c 25 Feb 2005 10:48:50 -0000 1.17.6.26.2.1 @@ -1,6 +1,6 @@ /* - * $Id: http.c,v 1.17.6.26 2005/02/11 23:48:47 squidadm Exp $ + * $Id: http.c,v 1.17.6.26.2.1 2005/02/25 10:48:50 hno Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -528,9 +528,9 @@ /* return 1 if we got the last of the data on a persistent connection */ MemObject *mem = httpState->entry->mem_obj; HttpReply *reply = mem->reply; - int clen; + off_t clen; debug(11, 3) ("httpPconnTransferDone: FD %d\n", httpState->fd); - debug(11, 5) ("httpPconnTransferDone: content_length=%d\n", + debug(11, 5) ("httpPconnTransferDone: content_length=%"PRINTF_OFF_T"\n", reply->content_length); /* If we haven't seen the end of reply headers, we are not done */ if (httpState->reply_hdr_state < 2) Index: squid/src/mime.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/mime.c,v retrieving revision 1.11.6.4 retrieving revision 1.11.6.4.6.1 diff -u -r1.11.6.4 -r1.11.6.4.6.1 --- squid/src/mime.c 22 Jan 2005 03:15:06 -0000 1.11.6.4 +++ squid/src/mime.c 25 Feb 2005 10:48:50 -0000 1.11.6.4.6.1 @@ -1,6 +1,6 @@ /* - * $Id: mime.c,v 1.11.6.4 2005/01/22 03:15:06 squidadm Exp $ + * $Id: mime.c,v 1.11.6.4.6.1 2005/02/25 10:48:50 hno Exp $ * * DEBUG: section 25 MIME Parsing * AUTHOR: Harvest Derived @@ -442,7 +442,7 @@ httpReplyReset(reply = e->mem_obj->reply); httpBuildVersion(&version, 1, 0); httpReplySetHeaders(reply, version, HTTP_OK, NULL, - type, (int) sb.st_size, sb.st_mtime, -1); + type, sb.st_size, sb.st_mtime, -1); reply->cache_control = httpHdrCcCreate(); httpHdrCcSetMaxAge(reply->cache_control, 86400); httpHeaderPutCc(&reply->header, reply->cache_control); Index: squid/src/net_db.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/net_db.c,v retrieving revision 1.11.22.3 retrieving revision 1.11.22.3.2.1 diff -u -r1.11.22.3 -r1.11.22.3.2.1 --- squid/src/net_db.c 14 Feb 2005 03:15:34 -0000 1.11.22.3 +++ squid/src/net_db.c 25 Feb 2005 10:48:50 -0000 1.11.22.3.2.1 @@ -1,6 +1,6 @@ /* - * $Id: net_db.c,v 1.11.22.3 2005/02/14 03:15:34 squidadm Exp $ + * $Id: net_db.c,v 1.11.22.3.2.1 2005/02/25 10:48:50 hno Exp $ * * DEBUG: section 38 Network Measurement Database * AUTHOR: Duane Wessels @@ -527,7 +527,7 @@ } static void -netdbExchangeHandleReply(void *data, char *buf, ssize_t size) +netdbExchangeHandleReply(void *data, char *buf, off_t size) { netdbExchangeState *ex = data; int rec_sz = 0; Index: squid/src/peer_digest.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/peer_digest.c,v retrieving revision 1.10.6.1 retrieving revision 1.10.6.1.16.1 diff -u -r1.10.6.1 -r1.10.6.1.16.1 --- squid/src/peer_digest.c 17 Jul 2003 02:13:28 -0000 1.10.6.1 +++ squid/src/peer_digest.c 25 Feb 2005 10:48:51 -0000 1.10.6.1.16.1 @@ -1,6 +1,6 @@ /* - * $Id: peer_digest.c,v 1.10.6.1 2003/07/17 02:13:28 squidadm Exp $ + * $Id: peer_digest.c,v 1.10.6.1.16.1 2005/02/25 10:48:51 hno Exp $ * * DEBUG: section 72 Peer Digest Routines * AUTHOR: Alex Rousskov @@ -453,7 +453,7 @@ if (size >= StoreDigestCBlockSize) { PeerDigest *pd = fetch->pd; HttpReply *rep = fetch->entry->mem_obj->reply; - const int seen = fetch->offset + size; + const off_t seen = fetch->offset + size; assert(pd && rep); if (peerDigestSetCBlock(pd, buf)) { @@ -498,7 +498,7 @@ fetch->offset += size; fetch->mask_offset += size; if (fetch->mask_offset >= pd->cd->mask_size) { - debug(72, 2) ("peerDigestSwapInMask: Done! Got %d, expected %d\n", + debug(72, 2) ("peerDigestSwapInMask: Done! Got %"PRINTF_OFF_T", expected %d\n", fetch->mask_offset, pd->cd->mask_size); assert(fetch->mask_offset == pd->cd->mask_size); assert(peerDigestFetchedEnough(fetch, NULL, 0, "peerDigestSwapInMask")); @@ -540,8 +540,8 @@ else host = strBuf(pd->host); } - debug(72, 6) ("%s: peer %s, offset: %d size: %d.\n", - step_name, host, fcb_valid ? fetch->offset : -1, size); + debug(72, 6) ("%s: peer %s, offset: %"PRINTF_OFF_T" size: %d.\n", + step_name, host, fcb_valid ? fetch->offset : (off_t)-1, size); /* continue checking (with pd and host known and valid) */ if (!reason) { Index: squid/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/protos.h,v retrieving revision 1.41.6.22 retrieving revision 1.41.6.22.2.1 diff -u -r1.41.6.22 -r1.41.6.22.2.1 --- squid/src/protos.h 21 Feb 2005 03:13:32 -0000 1.41.6.22 +++ squid/src/protos.h 25 Feb 2005 10:48:51 -0000 1.41.6.22.2.1 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.41.6.22 2005/02/21 03:13:32 squidadm Exp $ + * $Id: protos.h,v 1.41.6.22.2.1 2005/02/25 10:48:51 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -125,7 +125,7 @@ extern int cbdataLocked(const void *p); extern void clientdbInit(void); -extern void clientdbUpdate(struct in_addr, log_type, protocol_t, size_t); +extern void clientdbUpdate(struct in_addr, log_type, protocol_t, off_t); extern int clientdbCutoffDenied(struct in_addr); extern void clientdbDump(StoreEntry *); extern void clientdbFreeMemory(void); @@ -371,13 +371,13 @@ /* iterate through specs */ extern HttpHdrRangeSpec *httpHdrRangeGetSpec(const HttpHdrRange * range, HttpHdrRangePos * pos); /* adjust specs after the length is known */ -extern int httpHdrRangeCanonize(HttpHdrRange *, ssize_t); +extern int httpHdrRangeCanonize(HttpHdrRange *, off_t); /* other */ extern String httpHdrRangeBoundaryStr(clientHttpRequest * http); extern int httpHdrRangeIsComplex(const HttpHdrRange * range); extern int httpHdrRangeWillBeComplex(const HttpHdrRange * range); -extern ssize_t httpHdrRangeFirstOffset(const HttpHdrRange * range); -extern ssize_t httpHdrRangeLowestOffset(const HttpHdrRange * range, ssize_t); +extern off_t httpHdrRangeFirstOffset(const HttpHdrRange * range); +extern off_t httpHdrRangeLowestOffset(const HttpHdrRange * range, off_t); extern int httpHdrRangeOffsetLimit(HttpHdrRange *); @@ -390,7 +390,7 @@ extern HttpHdrContRange *httpHdrContRangeDup(const HttpHdrContRange * crange); extern void httpHdrContRangePackInto(const HttpHdrContRange * crange, Packer * p); /* inits with given spec */ -extern void httpHdrContRangeSet(HttpHdrContRange *, HttpHdrRangeSpec, ssize_t); +extern void httpHdrContRangeSet(HttpHdrContRange *, HttpHdrRangeSpec, off_t); /* Http Header Tools */ extern HttpHeaderFieldInfo *httpHeaderBuildFieldsInfo(const HttpHeaderFieldAttrs * attrs, int count); @@ -401,14 +401,14 @@ extern void httpHeaderMaskInit(HttpHeaderMask * mask, int value); extern void httpHeaderCalcMask(HttpHeaderMask * mask, const int *enums, int count); extern int httpHeaderHasConnDir(const HttpHeader * hdr, const char *directive); -extern void httpHeaderAddContRange(HttpHeader *, HttpHdrRangeSpec, ssize_t); +extern void httpHeaderAddContRange(HttpHeader *, HttpHdrRangeSpec, off_t); extern void strListAdd(String * str, const char *item, char del); extern int strListIsMember(const String * str, const char *item, char del); extern int strListIsSubstr(const String * list, const char *s, char del); extern int strListGetItem(const String * str, char del, const char **item, int *ilen, const char **pos); extern const char *getStringPrefix(const char *str, const char *end); extern int httpHeaderParseInt(const char *start, int *val); -extern int httpHeaderParseSize(const char *start, ssize_t * sz); +extern off_t httpHeaderParseSize(const char *start, off_t * sz); extern int httpHeaderReset(HttpHeader * hdr); #if STDC_HEADERS extern void @@ -433,6 +433,7 @@ /* field manipulation */ extern int httpHeaderHas(const HttpHeader * hdr, http_hdr_type type); extern void httpHeaderPutInt(HttpHeader * hdr, http_hdr_type type, int number); +extern void httpHeaderPutSize(HttpHeader * hdr, http_hdr_type type, off_t number); extern void httpHeaderPutTime(HttpHeader * hdr, http_hdr_type type, time_t htime); extern void httpHeaderPutStr(HttpHeader * hdr, http_hdr_type type, const char *str); extern void httpHeaderPutAuth(HttpHeader * hdr, const char *auth_scheme, const char *realm); @@ -441,6 +442,7 @@ extern void httpHeaderPutRange(HttpHeader * hdr, const HttpHdrRange * range); extern void httpHeaderPutExt(HttpHeader * hdr, const char *name, const char *value); extern int httpHeaderGetInt(const HttpHeader * hdr, http_hdr_type id); +extern off_t httpHeaderGetSize(const HttpHeader * hdr, http_hdr_type id); extern time_t httpHeaderGetTime(const HttpHeader * hdr, http_hdr_type id); extern TimeOrTag httpHeaderGetTimeOrTag(const HttpHeader * hdr, http_hdr_type id); extern HttpHdrCc *httpHeaderGetCc(const HttpHeader * hdr); @@ -482,7 +484,7 @@ /* absorb: copy the contents of a new reply to the old one, destroy new one */ extern void httpReplyAbsorb(HttpReply * rep, HttpReply * new_rep); /* parse returns -1,0,+1 on error,need-more-data,success */ -extern int httpReplyParse(HttpReply * rep, const char *buf, ssize_t); +extern int httpReplyParse(HttpReply * rep, const char *buf, off_t); extern void httpReplyPackInto(const HttpReply * rep, Packer * p); /* ez-routines */ /* mem-pack: returns a ready to use mem buffer with a packed reply */ @@ -491,10 +493,10 @@ extern void httpReplySwapOut(const HttpReply * rep, StoreEntry * e); /* set commonly used info with one call */ extern void httpReplySetHeaders(HttpReply * rep, http_version_t ver, http_status status, - const char *reason, const char *ctype, int clen, time_t lmt, time_t expires); + const char *reason, const char *ctype, off_t clen, time_t lmt, time_t expires); /* do everything in one call: init, set, pack, clean, return MemBuf */ extern MemBuf httpPackedReply(http_version_t ver, http_status status, const char *ctype, - int clen, time_t lmt, time_t expires); + off_t clen, time_t lmt, time_t expires); /* construct 304 reply and pack it into MemBuf, return MemBuf */ extern MemBuf httpPacked304Reply(const HttpReply * rep); /* update when 304 reply is received for a cached object */ @@ -505,7 +507,7 @@ extern time_t httpReplyExpires(const HttpReply * rep); extern int httpReplyHasCc(const HttpReply * rep, http_hdr_cc_type type); extern void httpRedirectReply(HttpReply *, http_status, const char *); -extern int httpReplyBodySize(method_t, const HttpReply *); +extern off_t httpReplyBodySize(method_t, const HttpReply *); /* Http Request */ extern request_t *requestCreate(method_t, protocol_t, const char *urlpath); @@ -756,7 +758,7 @@ extern int authenticateAuthUserInuse(auth_user_t * auth_user); extern void authenticateAuthUserRequestRemoveIp(auth_user_request_t *, struct in_addr); extern void authenticateAuthUserRequestClearIp(auth_user_request_t *); -extern size_t authenticateAuthUserRequestIPCount(auth_user_request_t *); +extern int authenticateAuthUserRequestIPCount(auth_user_request_t *); extern int authenticateDirection(auth_user_request_t *); extern FREE authenticateFreeProxyAuthUser; extern void authenticateFreeProxyAuthUserACLResults(void *data); @@ -788,7 +790,7 @@ extern void start_announce(void *unused); -extern void sslStart(clientHttpRequest *, size_t *, int *); +extern void sslStart(clientHttpRequest *, off_t *, int *); extern void waisStart(FwdState *); /* ident.c */ @@ -851,7 +853,7 @@ extern void memFree32K(void *); extern void memFree64K(void *); extern int memInUse(mem_type); -extern size_t memTotalAllocated(void); +extern int memTotalAllocated(void); extern void memDataInit(mem_type, const char *, size_t, int); extern void memCheckInit(void); @@ -862,7 +864,7 @@ extern void memPoolFree(MemPool * pool, void *obj); extern int memPoolWasUsed(const MemPool * pool); extern int memPoolInUseCount(const MemPool * pool); -extern size_t memPoolInUseSize(const MemPool * pool); +extern off_t memPoolInUseSize(const MemPool * pool); extern int memPoolUsedCount(const MemPool * pool); extern void memPoolReport(const MemPool * pool, StoreEntry * e); @@ -1007,7 +1009,7 @@ extern void storeDirInit(void); extern void storeDirOpenSwapLogs(void); extern void storeDirSwapLog(const StoreEntry *, int op); -extern void storeDirUpdateSwapSize(SwapDir *, size_t size, int sign); +extern void storeDirUpdateSwapSize(SwapDir *, off_t size, int sign); extern void storeDirSync(void); extern void storeDirCallback(void); extern void storeDirLRUDelete(StoreEntry *); @@ -1152,7 +1154,7 @@ extern void dlinkNodeDelete(dlink_node * m); extern dlink_node *dlinkNodeNew(void); -extern void kb_incr(kb_t *, size_t); +extern void kb_incr(kb_t *, off_t); extern double gb_to_double(const gb_t *); extern const char *gb_to_str(const gb_t *); extern void gb_flush(gb_t *); /* internal, do not use this */ Index: squid/src/squid.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/squid.h,v retrieving revision 1.13.6.7 retrieving revision 1.13.6.7.8.1 diff -u -r1.13.6.7 -r1.13.6.7.8.1 --- squid/src/squid.h 10 Aug 2004 02:13:32 -0000 1.13.6.7 +++ squid/src/squid.h 25 Feb 2005 10:48:51 -0000 1.13.6.7.8.1 @@ -1,6 +1,6 @@ /* - * $Id: squid.h,v 1.13.6.7 2004/08/10 02:13:32 squidadm Exp $ + * $Id: squid.h,v 1.13.6.7.8.1 2005/02/25 10:48:51 hno Exp $ * * AUTHOR: Duane Wessels * @@ -449,6 +449,17 @@ #endif /* + * printf format shortcuts for size_t, depending on size + */ +#if SIZEOF_OFF_T > SIZEOF_LONG +#define PRINTF_OFF_T "llu" +#elif SIZEOF_OFF_T > SIZEOF_INT +#define PRINTF_OFF_T "lu" +#else +#define PRINTF_OFF_T "u" +#endif + +/* * Hey dummy, don't be tempted to move this to lib/config.h.in * again. O_NONBLOCK will not be defined there because you didn't * #include yet. Index: squid/src/ssl.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/ssl.c,v retrieving revision 1.13.6.7 retrieving revision 1.13.6.7.8.1 diff -u -r1.13.6.7 -r1.13.6.7.8.1 --- squid/src/ssl.c 28 Sep 2004 02:14:08 -0000 1.13.6.7 +++ squid/src/ssl.c 25 Feb 2005 10:48:51 -0000 1.13.6.7.8.1 @@ -1,6 +1,6 @@ /* - * $Id: ssl.c,v 1.13.6.7 2004/09/28 02:14:08 squidadm Exp $ + * $Id: ssl.c,v 1.13.6.7.8.1 2005/02/25 10:48:51 hno Exp $ * * DEBUG: section 26 Secure Sockets Layer Proxy * AUTHOR: Duane Wessels @@ -46,7 +46,7 @@ int len; char *buf; } client, server; - size_t *size_ptr; /* pointer to size in an ConnStateData for logging */ + off_t *size_ptr; /* pointer to size in an ConnStateData for logging */ int *status_ptr; /* pointer to status for logging */ #if DELAY_POOLS delay_id delay_id; @@ -289,6 +289,12 @@ fd_bytes(fd, len, FD_WRITE); kb_incr(&statCounter.server.all.kbytes_out, len); kb_incr(&statCounter.server.other.kbytes_out, len); + /* increment total object size */ + if (sslState->size_ptr) +#if SIZEOF_OFF_T == 4 + if (*sslState->size_ptr < 0x7FFF0000) +#endif + *sslState->size_ptr += len; assert(len <= sslState->client.len); sslState->client.len -= len; if (sslState->client.len > 0) { @@ -331,7 +337,7 @@ sslState->server.len -= len; /* increment total object size */ if (sslState->size_ptr) -#if SIZEOF_SIZE_T == 4 +#if SIZEOF_OFF_T == 4 if (*sslState->size_ptr < 0x7FFF0000) #endif *sslState->size_ptr += len; @@ -461,7 +467,7 @@ CBDATA_TYPE(SslStateData); void -sslStart(clientHttpRequest * http, size_t * size_ptr, int *status_ptr) +sslStart(clientHttpRequest * http, off_t * size_ptr, int *status_ptr) { /* Create state structure. */ SslStateData *sslState = NULL; Index: squid/src/stmem.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/stmem.c,v retrieving revision 1.7 retrieving revision 1.7.66.1 diff -u -r1.7 -r1.7.66.1 --- squid/src/stmem.c 24 Oct 2001 09:42:13 -0000 1.7 +++ squid/src/stmem.c 25 Feb 2005 10:48:51 -0000 1.7.66.1 @@ -1,6 +1,6 @@ /* - * $Id: stmem.c,v 1.7 2001/10/24 09:42:13 squidadm Exp $ + * $Id: stmem.c,v 1.7.66.1 2005/02/25 10:48:51 hno Exp $ * * DEBUG: section 19 Store Memory Primitives * AUTHOR: Harvest Derived @@ -133,7 +133,7 @@ char *ptr_to_buf = NULL; int bytes_from_this_packet = 0; int bytes_into_this_packet = 0; - debug(19, 6) ("memCopy: offset %ld: size %d\n", (long int) offset, (int) size); + debug(19, 6) ("memCopy: offset %"PRINTF_OFF_T": size %d\n", offset, (int) size); if (p == NULL) return 0; assert(size > 0); Index: squid/src/store.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store.c,v retrieving revision 1.16.6.7 retrieving revision 1.16.6.7.6.1 diff -u -r1.16.6.7 -r1.16.6.7.6.1 --- squid/src/store.c 22 Jan 2005 03:15:07 -0000 1.16.6.7 +++ squid/src/store.c 25 Feb 2005 10:48:51 -0000 1.16.6.7.6.1 @@ -1,6 +1,6 @@ /* - * $Id: store.c,v 1.16.6.7 2005/01/22 03:15:07 squidadm Exp $ + * $Id: store.c,v 1.16.6.7.6.1 2005/02/25 10:48:51 hno Exp $ * * DEBUG: section 20 Storage Manager * AUTHOR: Harvest Derived @@ -939,8 +939,8 @@ static int storeEntryValidLength(const StoreEntry * e) { - int diff; - int clen; + off_t diff; + off_t clen; const HttpReply *reply; assert(e->mem_obj != NULL); reply = e->mem_obj->reply; @@ -950,7 +950,7 @@ debug(20, 5) ("storeEntryValidLength: hdr_sz = %d\n", reply->hdr_sz); clen = httpReplyBodySize(e->mem_obj->method, reply); - debug(20, 5) ("storeEntryValidLength: content_length = %d\n", + debug(20, 5) ("storeEntryValidLength: content_length = %"PRINTF_OFF_T"\n", clen); if (clen < 0) { debug(20, 5) ("storeEntryValidLength: Unspecified content length: %s\n", @@ -960,7 +960,7 @@ diff = reply->hdr_sz + clen - objectLen(e); if (diff == 0) return 1; - debug(20, 2) ("storeEntryValidLength: %d bytes too %s; '%s'\n", + debug(20, 2) ("storeEntryValidLength: %"PRINTF_OFF_T" bytes too %s; '%s'\n", diff < 0 ? -diff : diff, diff < 0 ? "big" : "small", storeKeyText(e->hash.key)); Index: squid/src/store_client.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_client.c,v retrieving revision 1.9.6.2 retrieving revision 1.9.6.2.16.1 diff -u -r1.9.6.2 -r1.9.6.2.16.1 --- squid/src/store_client.c 7 Aug 2003 02:13:44 -0000 1.9.6.2 +++ squid/src/store_client.c 25 Feb 2005 10:48:51 -0000 1.9.6.2.16.1 @@ -1,6 +1,6 @@ /* - * $Id: store_client.c,v 1.9.6.2 2003/08/07 02:13:44 squidadm Exp $ + * $Id: store_client.c,v 1.9.6.2.16.1 2005/02/25 10:48:51 hno Exp $ * * DEBUG: section 20 Storage Manager Client-Side Interface * AUTHOR: Duane Wessels @@ -153,7 +153,7 @@ } static void -storeClientCallback(store_client * sc, ssize_t sz) +storeClientCallback(store_client * sc, off_t sz) { STCB *callback = sc->callback; char *buf = sc->copy_buf; @@ -220,7 +220,7 @@ static int storeClientNoMoreToSend(StoreEntry * e, store_client * sc) { - ssize_t len; + off_t len; if (e->store_status == STORE_PENDING) return 0; if ((len = objectLen(e)) < 0) Index: squid/src/store_dir.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_dir.c,v retrieving revision 1.19.6.2 retrieving revision 1.19.6.2.16.1 diff -u -r1.19.6.2 -r1.19.6.2.16.1 --- squid/src/store_dir.c 18 Jul 2003 02:13:40 -0000 1.19.6.2 +++ squid/src/store_dir.c 25 Feb 2005 10:48:51 -0000 1.19.6.2.16.1 @@ -1,6 +1,6 @@ /* - * $Id: store_dir.c,v 1.19.6.2 2003/07/18 02:13:40 squidadm Exp $ + * $Id: store_dir.c,v 1.19.6.2.16.1 2005/02/25 10:48:51 hno Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -45,7 +45,7 @@ #include #endif -static int storeDirValidSwapDirSize(int, ssize_t); +static int storeDirValidSwapDirSize(int, off_t); static STDIRSELECT storeDirSelectSwapDirRoundRobin; static STDIRSELECT storeDirSelectSwapDirLeastLoad; @@ -106,7 +106,7 @@ * ie any-sized-object swapdirs. This is a good thing. */ static int -storeDirValidSwapDirSize(int swapdir, ssize_t objsize) +storeDirValidSwapDirSize(int swapdir, off_t objsize) { /* * If the swapdir's max_obj_size is -1, then it definitely can @@ -144,7 +144,7 @@ int i; int load; SwapDir *sd; - ssize_t objsize = (ssize_t) objectLen(e); + off_t objsize = (off_t) objectLen(e); for (i = 0; i <= Config.cacheSwap.n_configured; i++) { if (++dirn >= Config.cacheSwap.n_configured) dirn = 0; @@ -181,9 +181,9 @@ static int storeDirSelectSwapDirLeastLoad(const StoreEntry * e) { - ssize_t objsize; - ssize_t most_free = 0, cur_free; - ssize_t least_objsize = -1; + off_t objsize; + off_t most_free = 0, cur_free; + off_t least_objsize = -1; int least_load = INT_MAX; int load; int dirn = -1; @@ -191,7 +191,7 @@ SwapDir *SD; /* Calculate the object size */ - objsize = (ssize_t) objectLen(e); + objsize = (off_t) objectLen(e); if (objsize != -1) objsize += e->mem_obj->swap_hdr_sz; for (i = 0; i < Config.cacheSwap.n_configured; i++) { @@ -270,7 +270,7 @@ } void -storeDirUpdateSwapSize(SwapDir * SD, size_t size, int sign) +storeDirUpdateSwapSize(SwapDir * SD, off_t size, int sign) { int blks = (size + SD->fs.blksize - 1) / SD->fs.blksize; int k = (blks * SD->fs.blksize >> 10) * sign; Index: squid/src/store_log.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_log.c,v retrieving revision 1.7 retrieving revision 1.7.74.1 diff -u -r1.7 -r1.7.74.1 --- squid/src/store_log.c 18 Oct 2001 20:52:11 -0000 1.7 +++ squid/src/store_log.c 25 Feb 2005 10:48:51 -0000 1.7.74.1 @@ -1,6 +1,6 @@ /* - * $Id: store_log.c,v 1.7 2001/10/18 20:52:11 squidadm Exp $ + * $Id: store_log.c,v 1.7.74.1 2005/02/25 10:48:51 hno Exp $ * * DEBUG: section 20 Storage Manager Logging Functions * AUTHOR: Duane Wessels @@ -69,7 +69,7 @@ * Because if we print it before the swap file number, it'll break * the existing log format. */ - logfilePrintf(storelog, "%9d.%03d %-7s %02d %08X %s %4d %9d %9d %9d %s %d/%d %s %s\n", + logfilePrintf(storelog, "%9d.%03d %-7s %02d %08X %s %4d %9d %9d %9d %s %"PRINTF_OFF_T"/%"PRINTF_OFF_T" %s %s\n", (int) current_time.tv_sec, (int) current_time.tv_usec / 1000, storeLogTags[tag], @@ -82,7 +82,7 @@ (int) reply->expires, strLen(reply->content_type) ? strBuf(reply->content_type) : "unknown", reply->content_length, - (int) (mem->inmem_hi - mem->reply->hdr_sz), + mem->inmem_hi - mem->reply->hdr_sz, RequestMethodStr[mem->method], mem->log_url); } else { Index: squid/src/store_swapout.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_swapout.c,v retrieving revision 1.11.2.1 retrieving revision 1.11.2.1.30.1 diff -u -r1.11.2.1 -r1.11.2.1.30.1 --- squid/src/store_swapout.c 13 Apr 2002 23:11:15 -0000 1.11.2.1 +++ squid/src/store_swapout.c 25 Feb 2005 10:48:52 -0000 1.11.2.1.30.1 @@ -1,6 +1,6 @@ /* - * $Id: store_swapout.c,v 1.11.2.1 2002/04/13 23:11:15 squidadm Exp $ + * $Id: store_swapout.c,v 1.11.2.1.30.1 2005/02/25 10:48:52 hno Exp $ * * DEBUG: section 20 Storage Manager Swapout Functions * AUTHOR: Duane Wessels @@ -102,8 +102,8 @@ off_t lowest_offset; off_t new_mem_lo; off_t on_disk = 0; - ssize_t swapout_size; - ssize_t swap_buf_len; + off_t swapout_size; + off_t swap_buf_len; if (mem == NULL) return; /* should we swap something out to disk? */ @@ -136,7 +136,7 @@ * Grab the swapout_size and check to see whether we're going to defer * the swapout based upon size */ - swapout_size = (ssize_t) (mem->inmem_hi - mem->swapout.queue_offset); + swapout_size = (off_t) (mem->inmem_hi - mem->swapout.queue_offset); if ((e->store_status != STORE_OK) && (swapout_size < store_maxobjsize)) { /* * NOTE: the store_maxobjsize here is the max of optional @@ -260,7 +260,7 @@ /* the storeWrite() call might generate an error */ if (e->swap_status != SWAPOUT_WRITING) break; - swapout_size = (ssize_t) (mem->inmem_hi - mem->swapout.queue_offset); + swapout_size = (off_t) (mem->inmem_hi - mem->swapout.queue_offset); if (e->store_status == STORE_PENDING) if (swapout_size < SM_PAGE_SIZE) break; Index: squid/src/structs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/structs.h,v retrieving revision 1.48.2.33 retrieving revision 1.48.2.33.2.1 diff -u -r1.48.2.33 -r1.48.2.33.2.1 --- squid/src/structs.h 23 Feb 2005 03:15:09 -0000 1.48.2.33 +++ squid/src/structs.h 25 Feb 2005 10:48:52 -0000 1.48.2.33.2.1 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.48.2.33 2005/02/23 03:15:09 squidadm Exp $ + * $Id: structs.h,v 1.48.2.33.2.1 2005/02/25 10:48:52 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -57,7 +57,7 @@ }; struct _acl_user_ip_data { - size_t max; + int max; struct { unsigned int strict:1; } flags; @@ -122,10 +122,10 @@ dlink_list proxy_match_cache; /* what ip addresses has this user been seen at?, plus a list length cache */ dlink_list ip_list; - size_t ipcount; + int ipcount; long expiretime; /* how many references are outstanding to this instance */ - size_t references; + int references; /* the auth scheme has it's own private data area */ void *scheme_data; /* the auth_user_request structures that link to this. Yes it could be a splaytree @@ -143,7 +143,7 @@ /* any scheme specific request related data */ void *scheme_data; /* how many 'processes' are working on this data */ - size_t references; + int references; /* We only attempt authentication once per http request. This * is to allow multiple auth acl references from different _access areas * when using connection based authentication @@ -228,7 +228,7 @@ struct _body_size { dlink_node node; acl_access *access_list; - size_t maxsize; + off_t maxsize; }; struct _http_version_t { @@ -385,20 +385,20 @@ struct _SquidConfig { struct { - size_t maxSize; + off_t maxSize; int highWaterMark; int lowWaterMark; } Swap; - size_t memMaxSize; + off_t memMaxSize; struct { char *relayHost; u_short relayPort; peer *peer; } Wais; struct { - size_t min; + off_t min; int pct; - size_t max; + off_t max; } quickAbort; RemovalPolicySettings *replPolicy; RemovalPolicySettings *memPolicy; @@ -428,9 +428,9 @@ time_t idns_query; #endif } Timeout; - size_t maxRequestHeaderSize; - size_t maxRequestBodySize; - size_t maxReplyHeaderSize; + off_t maxRequestHeaderSize; + off_t maxRequestBodySize; + off_t maxReplyHeaderSize; dlink_list ReplyBodySize; struct { u_short icp; @@ -507,7 +507,7 @@ u_short port; } Accel; char *appendDomain; - size_t appendDomainLen; + int appendDomainLen; char *debugOptions; char *pidFilename; char *mimeTablePathname; @@ -531,8 +531,8 @@ #endif struct in_addr client_netmask; } Addrs; - size_t tcpRcvBufsz; - size_t udpMaxHitObjsz; + off_t tcpRcvBufsz; + off_t udpMaxHitObjsz; wordlist *hierarchy_stoplist; wordlist *mcast_group_list; wordlist *dns_testname_list; @@ -552,10 +552,10 @@ cachemgr_passwd *passwd_list; struct { int objectsPerBucket; - size_t avgObjectSize; - size_t maxObjectSize; - size_t minObjectSize; - size_t maxInMemObjSize; + off_t avgObjectSize; + off_t maxObjectSize; + off_t minObjectSize; + off_t maxInMemObjSize; } Store; struct { int high; @@ -637,7 +637,7 @@ int n_configured; } authConfig; struct { - size_t list_width; + int list_width; int list_wrap; char *anon_user; int passive; @@ -660,7 +660,7 @@ int onerror; } retry; struct { - size_t limit; + off_t limit; } MemPools; #if DELAY_POOLS delayConfig Delay; @@ -675,7 +675,7 @@ } comm_incoming; int max_open_disk_fds; int uri_whitespace; - size_t rangeOffsetLimit; + off_t rangeOffsetLimit; #if MULTICAST_MISS_STREAM struct { struct in_addr addr; @@ -692,7 +692,7 @@ int bits_per_entry; time_t rebuild_period; time_t rewrite_period; - size_t swapout_chunk_size; + off_t swapout_chunk_size; int rebuild_chunk_percentage; } digest; #endif @@ -705,7 +705,7 @@ struct { int high_rptm; int high_pf; - size_t high_memory; + off_t high_memory; } warnings; char *store_dir_select_algorithm; int sleep_after_fork; /* microseconds */ @@ -885,8 +885,8 @@ /* http byte-range-spec */ struct _HttpHdrRangeSpec { - ssize_t offset; - ssize_t length; + off_t offset; + off_t length; }; /* There may be more than one byte range specified in the request. @@ -900,7 +900,7 @@ /* http content-range header field */ struct _HttpHdrContRange { HttpHdrRangeSpec spec; - ssize_t elength; /* entity length, not content length */ + off_t elength; /* entity length, not content length */ }; /* some fields can hold either time or etag specs (e.g. If-Range) */ @@ -914,8 +914,8 @@ struct _HttpHdrRangeIter { HttpHdrRangePos pos; const HttpHdrRangeSpec *spec; /* current spec at pos */ - ssize_t debt_size; /* bytes left to send from the current spec */ - ssize_t prefix_size; /* the size of the incoming HTTP msg prefix */ + off_t debt_size; /* bytes left to send from the current spec */ + off_t prefix_size; /* the size of the incoming HTTP msg prefix */ String boundary; /* boundary for multipart responses */ }; @@ -962,7 +962,7 @@ int hdr_sz; /* sums _stored_ status-line, headers, and */ /* public, readable; never update these or their .hdr equivalents directly */ - int content_length; + off_t content_length; time_t date; time_t last_modified; time_t expires; @@ -1053,7 +1053,7 @@ } icp; struct { struct in_addr caddr; - size_t size; + off_t size; log_type code; int msec; const char *rfc931; @@ -1078,10 +1078,10 @@ char *log_uri; struct { off_t offset; - size_t size; + off_t size; } out; HttpHdrRangeIter range_iter; /* data for iterating thru range specs */ - size_t req_sz; /* raw request size on input, not current request size */ + off_t req_sz; /* raw request size on input, not current request size */ StoreEntry *entry; StoreEntry *old_entry; log_type log_type; @@ -1105,7 +1105,7 @@ char *location; } redirect; dlink_node active; - size_t maxBodySize; + off_t maxBodySize; }; struct _ConnStateData { @@ -1116,7 +1116,7 @@ size_t size; } in; struct { - size_t size_left; /* How much body left to process */ + off_t size_left; /* How much body left to process */ request_t *request; /* Parameters passed to clientReadBody */ char *buf; size_t bufsize; @@ -1186,8 +1186,8 @@ store_client *sc; store_client *old_sc; request_t *request; - int offset; - int mask_offset; + off_t offset; + off_t mask_offset; time_t start_time; time_t resp_time; time_t expires; @@ -1522,7 +1522,7 @@ char *log_url; RemovalPolicyNode repl; int id; - ssize_t object_sz; + off_t object_sz; size_t swap_hdr_sz; #if URL_CHECKSUM_DEBUG unsigned int chksum; @@ -1539,7 +1539,7 @@ time_t lastref; time_t expires; time_t lastmod; - size_t swap_file_sz; + off_t swap_file_sz; u_short refcount; u_short flags; /* END OF ON-DISK STORE_META_STD */ @@ -1559,7 +1559,7 @@ int max_size; char *path; int index; /* This entry's index into the swapDirs array */ - ssize_t max_objsize; + off_t max_objsize; RemovalPolicy *repl; int removals; int scanned; @@ -1639,7 +1639,7 @@ sfileno swap_filen; StoreEntry *e; /* Need this so the FS layers can play god */ mode_t mode; - size_t st_size; /* do stat(2) after read open */ + off_t st_size; /* do stat(2) after read open */ off_t offset; /* current on-disk offset pointer */ STFNCB *file_callback; /* called on delayed sfileno assignments */ STIOCB *callback; @@ -1676,7 +1676,7 @@ struct in_addr my_addr; unsigned short my_port; HttpHeader header; - int content_length; + off_t content_length; HierarchyLogEntry hier; err_type err_type; char *peer_login; /* Configured peer login:password */ @@ -1910,7 +1910,7 @@ time_t lastref; time_t expires; time_t lastmod; - size_t swap_file_sz; + off_t swap_file_sz; u_short refcount; u_short flags; unsigned char key[MD5_DIGEST_CHARS]; @@ -1918,8 +1918,8 @@ /* object to track per-action memory usage (e.g. #idle objects) */ struct _MemMeter { - ssize_t level; /* current level (count or volume) */ - ssize_t hwater_level; /* high water mark */ + off_t level; /* current level (count or volume) */ + off_t hwater_level; /* high water mark */ time_t hwater_stamp; /* timestamp of last high water mark change */ }; @@ -1962,7 +1962,7 @@ struct _CacheDigest { /* public, read-only */ char *mask; /* bit mask */ - size_t mask_size; /* mask size in bytes */ + int mask_size; /* mask size in bytes */ int capacity; /* expected maximum for .count, not a hard limit */ int bits_per_entry; /* number of bits allocated for each entry from capacity */ int count; /* number of digested entries */ @@ -2183,7 +2183,7 @@ char path[MAXPATHLEN]; char *buf; size_t bufsz; - off_t offset; + ssize_t offset; struct { unsigned int fatal:1; } flags; Index: squid/src/tools.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/tools.c,v retrieving revision 1.19.6.10 retrieving revision 1.19.6.10.2.1 diff -u -r1.19.6.10 -r1.19.6.10.2.1 --- squid/src/tools.c 14 Feb 2005 03:15:35 -0000 1.19.6.10 +++ squid/src/tools.c 25 Feb 2005 10:48:52 -0000 1.19.6.10.2.1 @@ -1,6 +1,6 @@ /* - * $Id: tools.c,v 1.19.6.10 2005/02/14 03:15:35 squidadm Exp $ + * $Id: tools.c,v 1.19.6.10.2.1 2005/02/25 10:48:52 hno Exp $ * * DEBUG: section 21 Misc Functions * AUTHOR: Harvest Derived @@ -839,7 +839,7 @@ } void -kb_incr(kb_t * k, size_t v) +kb_incr(kb_t * k, off_t v) { k->bytes += v; k->kb += (k->bytes >> 10); Index: squid/src/typedefs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/typedefs.h,v retrieving revision 1.25.6.6 retrieving revision 1.25.6.6.8.1 diff -u -r1.25.6.6 -r1.25.6.6.8.1 --- squid/src/typedefs.h 6 Oct 2004 02:15:18 -0000 1.25.6.6 +++ squid/src/typedefs.h 25 Feb 2005 10:48:52 -0000 1.25.6.6.8.1 @@ -1,6 +1,6 @@ /* - * $Id: typedefs.h,v 1.25.6.6 2004/10/06 02:15:18 squidadm Exp $ + * $Id: typedefs.h,v 1.25.6.6.8.1 2005/02/25 10:48:52 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -42,8 +42,8 @@ typedef signed int sdirno; typedef struct { - size_t bytes; - size_t kb; + off_t bytes; + off_t kb; } kb_t; typedef struct { @@ -336,13 +336,13 @@ typedef int Ctx; /* in case we want to change it later */ -typedef ssize_t mb_size_t; +typedef off_t mb_size_t; /* iteration for HttpHdrRange */ typedef int HttpHdrRangePos; /*iteration for headers; use HttpHeaderPos as opaque type, do not interpret */ -typedef ssize_t HttpHeaderPos; +typedef int HttpHeaderPos; /* big mask for http headers */ typedef char HttpHeaderMask[8]; Index: squid/src/fs/aufs/store_io_aufs.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/fs/aufs/store_io_aufs.c,v retrieving revision 1.13.2.11 retrieving revision 1.13.2.11.8.1 diff -u -r1.13.2.11 -r1.13.2.11.8.1 --- squid/src/fs/aufs/store_io_aufs.c 9 Jun 2004 14:05:58 -0000 1.13.2.11 +++ squid/src/fs/aufs/store_io_aufs.c 25 Feb 2005 10:48:53 -0000 1.13.2.11.8.1 @@ -320,7 +320,7 @@ squidaiostate_t *aiostate = (squidaiostate_t *) sio->fsstate; STRCB *callback = sio->read.callback; void *their_data = sio->read.callback_data; - ssize_t rlen; + off_t rlen; int inreaddone = aiostate->flags.inreaddone; /* Protect from callback loops */ debug(79, 3) ("storeAufsReadDone: dirno %d, fileno %08X, FD %d, len %d\n", sio->swap_dirn, sio->swap_filen, fd, len); @@ -330,7 +330,7 @@ debug(79, 3) ("storeAufsReadDone: got failure (%d)\n", errflag); rlen = -1; } else { - rlen = (ssize_t) len; + rlen = (off_t) len; sio->offset += len; } #if ASYNC_READ Index: squid/src/fs/ufs/store_io_ufs.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/fs/ufs/store_io_ufs.c,v retrieving revision 1.7.6.3 retrieving revision 1.7.6.3.8.1 diff -u -r1.7.6.3 -r1.7.6.3.8.1 --- squid/src/fs/ufs/store_io_ufs.c 18 Jul 2004 02:13:13 -0000 1.7.6.3 +++ squid/src/fs/ufs/store_io_ufs.c 25 Feb 2005 10:48:53 -0000 1.7.6.3.8.1 @@ -204,7 +204,7 @@ ufsstate_t *ufsstate = (ufsstate_t *) sio->fsstate; STRCB *callback = sio->read.callback; void *their_data = sio->read.callback_data; - ssize_t rlen; + off_t rlen; debug(79, 3) ("storeUfsReadDone: dirno %d, fileno %08X, FD %d, len %d\n", sio->swap_dirn, sio->swap_filen, fd, len); @@ -213,7 +213,7 @@ debug(79, 3) ("storeUfsReadDone: got failure (%d)\n", errflag); rlen = -1; } else { - rlen = (ssize_t) len; + rlen = (off_t) len; sio->offset += len; } assert(callback);