--------------------- PatchSet 10188 Date: 2007/12/02 09:34:13 Author: adri Branch: s27_adri Tag: (none) Log: Bring in my buffer library code. Members: Makefile.am:1.20.36.1->1.20.36.2 configure.in:1.184.2.1.4.1->1.184.2.1.4.2 doc/debug-sections.txt:1.10->1.10.58.1 libbuf/Makefile.in:1.1->1.1.2.1 libbuf/buf.c:1.1->1.1.2.1 libbuf/buf.h:1.1->1.1.2.1 libbuf/iobuf.c:1.1->1.1.2.1 libbuf/iobuf.h:1.1->1.1.2.1 libbuf/str.c:1.1->1.1.2.1 libbuf/str.h:1.1->1.1.2.1 src/Makefile.am:1.54.2.1.4.1->1.54.2.1.4.2 Index: squid/Makefile.am =================================================================== RCS file: /cvsroot/squid-sf//squid/Makefile.am,v retrieving revision 1.20.36.1 retrieving revision 1.20.36.2 diff -u -r1.20.36.1 -r1.20.36.2 --- squid/Makefile.am 2 Dec 2007 02:01:33 -0000 1.20.36.1 +++ squid/Makefile.am 2 Dec 2007 09:34:13 -0000 1.20.36.2 @@ -4,8 +4,8 @@ # AUTOMAKE_OPTIONS = dist-bzip2 subdir-objects 1.5 -DIST_SUBDIRS = lib libcore snmplib scripts src icons errors contrib doc helpers tools -SUBDIRS = lib libcore @makesnmplib@ scripts src icons errors doc helpers tools +DIST_SUBDIRS = lib libcore libbuf snmplib scripts src icons errors contrib doc helpers tools +SUBDIRS = lib libcore libbuf @makesnmplib@ scripts src icons errors doc helpers tools DISTCLEANFILES = include/stamp-h include/stamp-h[0-9]* DEFAULT_PINGER = $(libexecdir)/`echo pinger | sed '$(transform);s/$$/$(EXEEXT)/'` Index: squid/configure.in =================================================================== RCS file: /cvsroot/squid-sf//squid/configure.in,v retrieving revision 1.184.2.1.4.1 retrieving revision 1.184.2.1.4.2 diff -u -r1.184.2.1.4.1 -r1.184.2.1.4.2 --- squid/configure.in 2 Dec 2007 02:01:33 -0000 1.184.2.1.4.1 +++ squid/configure.in 2 Dec 2007 09:34:13 -0000 1.184.2.1.4.2 @@ -1,7 +1,7 @@ dnl dnl Configuration input file for Squid dnl -dnl $Id: configure.in,v 1.184.2.1.4.1 2007/12/02 02:01:33 adri Exp $ +dnl $Id: configure.in,v 1.184.2.1.4.2 2007/12/02 09:34:13 adri Exp $ dnl dnl dnl @@ -10,7 +10,7 @@ AM_CONFIG_HEADER(include/autoconf.h) AC_CONFIG_AUX_DIR(cfgaux) AM_INIT_AUTOMAKE -AC_REVISION($Revision: 1.184.2.1.4.1 $)dnl +AC_REVISION($Revision: 1.184.2.1.4.2 $)dnl AC_PREFIX_DEFAULT(/usr/local/squid) AM_MAINTAINER_MODE @@ -3174,6 +3174,7 @@ AC_OUTPUT([\ Makefile \ libcore/Makefile \ + libbuf/Makefile \ lib/Makefile \ scripts/Makefile \ scripts/RunCache \ Index: squid/doc/debug-sections.txt =================================================================== RCS file: /cvsroot/squid-sf//squid/doc/debug-sections.txt,v retrieving revision 1.10 retrieving revision 1.10.58.1 diff -u -r1.10 -r1.10.58.1 --- squid/doc/debug-sections.txt 28 Apr 2006 11:10:45 -0000 1.10 +++ squid/doc/debug-sections.txt 2 Dec 2007 09:34:15 -0000 1.10.58.1 @@ -88,3 +88,4 @@ section 82 External ACL section 83 SSL accelerator support section 84 Helper process maintenance +section 85 libbuf - buffer, string, iobuf --- /dev/null Mon Dec 3 01:19:29 2007 +++ squid/libbuf/Makefile.in Mon Dec 3 01:19:29 2007 @@ -0,0 +1,464 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# +# $Id: Makefile.in,v 1.1.2.1 2007/12/02 09:34:15 adri Exp $ +# + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = libbuf +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/autoconf.h +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) +ARFLAGS = cru +libbuf_a_AR = $(AR) $(ARFLAGS) +libbuf_a_DEPENDENCIES = buf.o iobuf.o str.o +am_libbuf_a_OBJECTS = buf.$(OBJEXT) iobuf.$(OBJEXT) str.$(OBJEXT) +libbuf_a_OBJECTS = $(am_libbuf_a_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(top_builddir)/include@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/cfgaux/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libbuf_a_SOURCES) +DIST_SOURCES = $(libbuf_a_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AR = @AR@ +AR_R = @AR_R@ +AUTH_LIBS = @AUTH_LIBS@ +AUTH_MODULES = @AUTH_MODULES@ +AUTH_OBJS = @AUTH_OBJS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASIC_AUTH_HELPERS = @BASIC_AUTH_HELPERS@ +CACHE_HTTP_PORT = @CACHE_HTTP_PORT@ +CACHE_ICP_PORT = @CACHE_ICP_PORT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CGIEXT = @CGIEXT@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CRYPTLIB = @CRYPTLIB@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIGEST_AUTH_HELPERS = @DIGEST_AUTH_HELPERS@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@ +ERR_LANGUAGES = @ERR_LANGUAGES@ +EXEEXT = @EXEEXT@ +EXTERNAL_ACL_HELPERS = @EXTERNAL_ACL_HELPERS@ +FALSE = @FALSE@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBDLMALLOC = @LIBDLMALLOC@ +LIBOBJS = @LIBOBJS@ +LIBREGEX = @LIBREGEX@ +LIBS = @LIBS@ +LIBSASL = @LIBSASL@ +LIB_DB = @LIB_DB@ +LIB_EPOLL = @LIB_EPOLL@ +LIB_LBER = @LIB_LBER@ +LIB_LDAP = @LIB_LDAP@ +LIB_MALLOC = @LIB_MALLOC@ +LN = @LN@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR = @MKDIR@ +MKDIR_P = @MKDIR_P@ +MV = @MV@ +NEGOTIATE_AUTH_HELPERS = @NEGOTIATE_AUTH_HELPERS@ +NTLM_AUTH_HELPERS = @NTLM_AUTH_HELPERS@ +OBJEXT = @OBJEXT@ +OPT_DEFAULT_HOSTS = @OPT_DEFAULT_HOSTS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PKGCONFIG = @PKGCONFIG@ +RANLIB = @RANLIB@ +REGEXLIB = @REGEXLIB@ +REPL_LIBS = @REPL_LIBS@ +REPL_OBJS = @REPL_OBJS@ +REPL_POLICIES = @REPL_POLICIES@ +RM = @RM@ +SET_MAKE = @SET_MAKE@ +SH = @SH@ +SHELL = @SHELL@ +SNMPLIB = @SNMPLIB@ +SSLLIB = @SSLLIB@ +STORE_LIBS = @STORE_LIBS@ +STORE_MODULES = @STORE_MODULES@ +STORE_OBJS = @STORE_OBJS@ +STRIP = @STRIP@ +TRUE = @TRUE@ +VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ +XTRA_LIBS = @XTRA_LIBS@ +XTRA_OBJS = @XTRA_OBJS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +makesnmplib = @makesnmplib@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +libbuf_a_SOURCES = \ + buf.c \ + iobuf.c \ + str.c + +libbuf_a_LIBADD = \ + buf.o \ + iobuf.o \ + str.o + +noinst_LIBRARIES = \ + libbuf.a + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign libbuf/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign libbuf/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libbuf.a: $(libbuf_a_OBJECTS) $(libbuf_a_DEPENDENCIES) + -rm -f libbuf.a + $(libbuf_a_AR) libbuf.a $(libbuf_a_OBJECTS) $(libbuf_a_LIBADD) + $(RANLIB) libbuf.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iobuf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES ctags distclean distclean-compile \ + distclean-generic distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: --- /dev/null Mon Dec 3 01:19:29 2007 +++ squid/libbuf/buf.c Mon Dec 3 01:19:29 2007 @@ -0,0 +1,171 @@ +#include +#include +#include +#include + +#include "../libcore/varargs.h" +#include "../libcore/debug.h" +#include "buf.h" + + +static int +buf_changesize(buf_t *b, int newsize) +{ + char *p; + /* + * buffer shouldn't ever be smaller than 'len', but we'll try + * to handle it.. + */ + debug (85, 5) ("buf_changesize: %p: size %d -> %d\n", b, b->size, newsize); + assert(newsize >= b->size); + assert(b->flags.isfinal == 0); + /* can't reallocate a fixed buffer! */ + if (b->flags.isfinal != 0) + return 0; + + p = realloc(b->b, newsize); + if (p == NULL) + return 0; + + b->b = p; + b->size = newsize; + /* truncate buffer length if/where possible */ + if (b->len > b->size) { + b->len = b->size; + } + return 1; +} + +buf_t * +buf_create(void) +{ + buf_t *b; + + b = malloc(sizeof(buf_t)); + if (! b) + return NULL; + bzero(b, sizeof(*b)); + debug (85, 5) ("buf_create: %p\n", b); + buf_ref(b); + return b; +} + +buf_t * +buf_create_size(int size) +{ + buf_t *b; + b = buf_create(); + if (!b) + return NULL; + if (! buf_changesize(b, size)) { + buf_deref(b); + return NULL; + } + return b; +} + +buf_t * +buf_create_const(const void *data, size_t len) +{ + buf_t *b; + + b = malloc(sizeof(buf_t)); + if (! b) + return NULL; + bzero(b, sizeof(*b)); + debug(85, 5) ("buf_create: %p\n", b); + b->b = (char *)data; + b->len = b->size = b->sofs = len; + b->flags.isconst = 1; + b->flags.isfinal = 1; + buf_ref(b); + return b; +} + +void +buf_free(buf_t *b) +{ + assert(b->flags.isfreed == 0); + debug (85, 5) ("buf_free: %p\n", b); + if (b->flags.isfreed == 0) { + b->flags.isfreed = 1; + (void) buf_deref(b); + } + /* b could be invalid at this point */ +} + +buf_t * +buf_ref(buf_t *b) +{ + debug(85, 5) ("buf_ref: %p\n", b); + b->nref++; + return b; /* for now, this might change .. */ +} + +/* XXX this should properly NULL out the pointer thats being held.. */ +buf_t * +buf_deref(buf_t *b) +{ + assert(b->nref >= 1); + b->nref--; + debug(85, 5) ("buf_deref: %p\n", b); + /* the free actually goes on 'ere */ + if (b->nref == 0) { + debug (85, 5) ("buf_deref: %p: FREEing\n", b); + if (!b->flags.isconst) { + free(b->b); + } + free(b); + return NULL; + } + /* b could be invalid here */ + return NULL; +} + +int +buf_fill(buf_t *b, int fd, int dogrow) +{ + int ret; + /* for now, always make sure there's 16k available space */ + debug(85, 5) ("buf_fill: fd %d\n", fd); + if (dogrow && b->size - b->len < 16384) { + if (! buf_changesize(b, b->size + 16384)) { + /* tsk! */ + return -1; + } + } + /* XXX we should never be given a full buffer to fill! */ + assert(!buf_isfull(b)); + ret = read(fd, b->b + b->len, b->size - b->len); + debug(85, 5) ("buf_fill: fd %d read %d bytes\n", fd, ret); + if (ret > 0) { + b->len += ret; + } + return ret; +} + +int +buf_append(buf_t *b, const void *src, size_t len) +{ + while (b->size - b->len < len) { + if (!buf_changesize(b, b->size + 16384)) { + /* tsk! */ + return -1; + } + } + memcpy(b->b + b->len, src, len); + b->len += len; + return len; +} + +int +buf_make_immutable(buf_t *buf, int newofs) +{ + if (newofs < buf->sofs) { + debug(85, 5) ("buf_make_immutable: %p: already seen %d bytes as immutable!!\n", buf, newofs); + return 1; + } + debug(85, 5) ("buf_make_immutable: %p: immutable amount now %d bytes\n", buf, newofs); + buf->sofs = newofs; + return 1; +} --- /dev/null Mon Dec 3 01:19:29 2007 +++ squid/libbuf/buf.h Mon Dec 3 01:19:29 2007 @@ -0,0 +1,48 @@ +#ifndef __BUF_H__ +#define __BUF_H__ + +struct _buf { + char *b; + int len; + int size; + int sofs; /* how much of the buffer can't be changed */ + struct { + char isactive:1; + char isfinal:1; + char isfreed:1; + char isconst:1; + } flags; + int nref; +}; + +typedef struct _buf buf_t; + +extern buf_t * buf_create(void); +extern buf_t * buf_create_size(int len); +extern buf_t * buf_create_const(const void *data, size_t len); +extern buf_t * buf_ref(buf_t *buf); +extern buf_t * buf_deref(buf_t *buf); +extern void buf_free(buf_t *buf); +extern int buf_fill(buf_t *buf, int fd, int dogrow); +extern int buf_make_immutable(buf_t *buf, int offset); +extern int buf_append(buf_t *buf, const void *src, size_t len); + +static inline int buf_len(const buf_t *buf) { return buf->len; } + +/* All use of this should be replaced by inline methods in C++. + * has to be a define in C due to the lack of typing (const vs no-const) + */ +#define buf_buf(buf) ((buf)->b) +#define buf_len(buf) ((buf)->len) + +static inline int +buf_get_chr(const buf_t *buf, int offset) { + if (offset >= buf->len) + return -1; + return (unsigned char)buf_buf(buf)[offset]; +} + +static inline int +buf_isfull(buf_t *b) { return (b->size == b->len); } + +#endif --- /dev/null Mon Dec 3 01:19:29 2007 +++ squid/libbuf/iobuf.c Mon Dec 3 01:19:29 2007 @@ -0,0 +1,267 @@ +#include +#include +#include +#include +#include +#include + +#include "../libcore/varargs.h" +#include "../libcore/debug.h" +#include "../libcore/tools.h" +#include "buf.h" +#include "str.h" +#include "iobuf.h" + +static void +iobuf_ient_grow(iobuf_t *iob, int newsize) +{ + if (newsize < iob->ients_cnt) + return; + + /* + * UIO_MAX under FreeBSD is 1024 - so for now lets just make sure we don't + * ever grow past a sensible level. Maybe this'll change later. + */ + assert(newsize < 256); + + newsize += 16; + debug (85, 5) ("iobuf_ient_grow: %p: growing to %d entries\n", iob, newsize); + + iob->ients = realloc(iob->ients, newsize * sizeof(iobuf_ent_t)); + iob->iov.ioents = realloc(iob->iov.ioents, newsize * sizeof(struct iovec)); + assert(iob->ients); + assert(iob->iov.ioents); + iob->ients_cnt = newsize; +} + +static inline int +iobuf_get_ent_len(iobuf_t *iob, int i) +{ + if (iob->ients[i].type == IET_STR) + return STR_LEN(&iob->ients[i].str); + else if (iob->ients[i].type == IET_CSTR) + return iob->ients[i].clen; + else + assert(1==0); /* XXX */ + return 0; +} + +static inline const char * +iobuf_get_ent_buf(iobuf_t *iob, int i) +{ + if (iob->ients[i].type == IET_STR) + return STR_BUF(&iob->ients[i].str); + else if (iob->ients[i].type == IET_CSTR) + return iob->ients[i].cstr; + else + assert(1==0); /* XXX */ + return 0; +} + +static int +iobuf_get_free_ent(iobuf_t *iob) +{ + iobuf_ient_grow(iob, iob->inum + 1); + assert(iob->inum < iob->ients_cnt); + return iob->inum++; +} + +/* XXX this doesn't update the inum fields! Be careful! */ +static void +iobuf_free_ent(iobuf_t *iob, int e) +{ + assert(e < iob->inum); + switch (iob->ients[e].type) { + case IET_CSTR: + /* nothing */ + break; + case IET_STR: + str_done(&iob->ients[e].str); + break; + default: + assert(1==0); /* Shouldn't get this! */ + } + bzero(&iob->ients[e], sizeof(iobuf_ent_t)); + bzero(&iob->iov.ioents[e], sizeof(struct iovec)); +} + +void +iobuf_init(iobuf_t *iob) +{ + iob->inum = 0; + iob->ients = NULL; + iob->ients_cnt = 0; + iob->iov.ioents = NULL; + iob->iov.iovdatalen = 0; + iobuf_ient_grow(iob, 0); + iob->flags.is_finished = 0; +} + +void +iobuf_free(iobuf_t *iob) +{ + int i; + for (i = 0; i < iob->inum; i++) { + if (iob->ients[i].type != IET_NONE) { + /* XXX this wastes a slight bit of time bzero'ing the ioent */ + iobuf_free_ent(iob, i); + } + } + free(iob->ients); iob->ients = NULL; + free(iob->iov.ioents); iob->iov.ioents = NULL; + iob->inum = 0; +} + +/* + * For now, we only writev() the data once the iobuf has been 'sealed'. + * We might want to allow users to append buffers whilst we've partially + * written one - it won't hurt.. + */ +int +iobuf_queue_cstr(iobuf_t *iob, char *cstr, int clen) +{ + int i; + i = iobuf_get_free_ent(iob); + if (i < 0) + return 0; + iob->ients[i].type = IET_CSTR; + iob->ients[i].cstr = cstr; + iob->ients[i].clen = clen; + + iob->iov.ioents[i].iov_base = cstr; + iob->iov.ioents[i].iov_len = clen; + iob->iov.iovdatalen += clen; + return 1; +} + +int +iobuf_queue_str(iobuf_t *iob, str_t *str) +{ + int i; + i = iobuf_get_free_ent(iob); + if (i < 0) + return 0; + iob->ients[i].type = IET_STR; + str_dup(&iob->ients[i].str, str); + iob->iov.ioents[i].iov_base = STR_BUF(&iob->ients[i].str); + iob->iov.ioents[i].iov_len = STR_LEN(&iob->ients[i].str); + iob->iov.iovdatalen += STR_LEN(&iob->ients[i].str); + return 1; +} + +/* + * XXX this routine isn't valid; it fails on partially-written iovecs that have + * XXX been updated to reflect the partial offset.. + */ +static void +iobuf_check_sanity(iobuf_t *iob) +{ + int i, iovsize = 0; + for (i = 0; i < iob->inum; i++) { + iovsize += iob->iov.ioents[i].iov_len; + } + assert(iovsize == iob->iov.iovdatalen); +} +/* + * Attempt to flush this iobuf list to the given FD. + * + * (One speedup: check if the write managed to write -everything- and, if so, + * unwind all the entries at once.) + * + * This routine issues a writev() and then checks to see how many entries were + * written. Unfortunately this requires us to loop through and keep checking. + * + * This code is horribly broken, ie: + * + * + It doesn't signal completion, error or partial completion proprerly! + * + It doesn't at all handle partial writes, and doesn't properly update + * the iob->ioevents[] array. + */ + +/* + * XXX this routine is hideously broken - rethink and rewrite it! + */ +int +iobuf_write_fd(iobuf_t *iob, int fd) +{ + int retval, written, t; + int i; + + /* We should never, ever be asked to write an empty buffer */ + assert(! iobuf_isempty(iob)); + + /* Debugging: make sure the iob->iov.iovdatalen size matches the contents of the iovec and the ioents */ + iobuf_check_sanity(iob); + + debug(85, 5) ("iobuf_write_fd: fd %d: begin writing\n", fd); + retval = writev(fd, iob->iov.ioents, iob->inum); + if (retval <= 0) { + debug(85, 2) ("iobuf_write_fd: fd %d: retval %d (errno %s)\n", fd, retval, strerror(errno)); + return retval; /* eof or error */ + } + debug(85, 5) ("iobuf_write_fd: fd %d: wrote %d of %d possible bytes; now checking iovec\n", fd, retval, iob->iov.iovdatalen); + assert(retval <= iob->iov.iovdatalen); + + /* now we check to see which ioents we've finished with */ + /* + * For now lets hope chunk IO is either done or not done; we'll worry about handling + * partial chunks later + */ + written = retval; + iob->iov.iovdatalen -= retval; + assert(iob->iov.iovdatalen >= 0); + for (i = 0; i < iob->inum; i++) { + assert(written >= 0); + t = iob->iov.ioents[i].iov_len; + assert(t >= iob->iov.ioents[i].iov_len); + debug(85, 5) ("write: %p: t = %d\n", iob, t); + /* + * Did we write less then the block? If so we break; this last block is a partial + * block. Update the iovec entry to point to the new offset. + */ + if (t > written) { + debug(85, 5) ("iobuf_write_fd: fd %d: entry %d is partially written (size %d bytes, but %d bytes were written\n", fd, i, t, written); + iob->iov.ioents[i].iov_base += written; + iob->iov.ioents[i].iov_len -= written; + assert(iob->iov.ioents[i].iov_len > 0); + break; + } + assert(written >= 0); + iobuf_free_ent(iob, i); /* the io entry is blank at this point! */ + written -= t; + debug(85, 5) (" written is now %d\n", written); + } + assert(i <= iob->inum); + + /* i points to the first non-written object; so move the rest of it to the beginning */ + /* we can optimise this out later by shifting the start pointer.. */ + if (i < iob->inum) { + memmove(&iob->iov.ioents[0], &iob->iov.ioents[i], sizeof(struct iovec) * (iob->inum - i)); + memmove(&iob->ients[0], &iob->ients[i], sizeof(iobuf_ent_t) * (iob->inum - i)); + assert(i < iob->inum); + } + + /* Update the number of entries to write in ioents */ + iob->inum -= i; + assert(iob->inum >= 0); + assert(written >= 0); + + if (iob->inum == 0) { + debug(85, 5) (" no more iovec; written: %d\n", written); + debug(85, 5) ("iobuf_write_fd: fd %d: all done!\n", fd); + iob->flags.is_finished = 1; + } + + /* Done - return how much was written */ + return retval; +} + +void +iobuf_printout(iobuf_t *b) +{ + int i; + debug(85, 2) ("iobuf_printf: %p: begin\n", b); + for (i = 0; i < b->inum; i++) + debug(85, 2) ("%.*s", iobuf_get_ent_len(b, i), iobuf_get_ent_buf(b, i)); + debug(85, 2) ("iobuf_printf: %p: end\n", b); +} --- /dev/null Mon Dec 3 01:19:29 2007 +++ squid/libbuf/iobuf.h Mon Dec 3 01:19:29 2007 @@ -0,0 +1,50 @@ +#ifndef __IOBUF_H__ +#define __IOBUF_H__ + +typedef enum { + IET_NONE, + IET_BUF, + IET_STR, + IET_CSTR +} iobuf_ent_type_t; + +struct _iobuf_ent { + iobuf_ent_type_t type; /* const string? buf? */ + buf_t *buf; + str_t str; + const char *cstr; + int clen; +}; +typedef struct _iobuf_ent iobuf_ent_t; + + +struct _iobuf { + iobuf_ent_t *ients; + int ients_cnt; /* size of array */ + int inum; /* number of active entries */ + struct { + struct iovec *ioents; + int iovdatalen; /* how many data bytes in the iovec */ + } iov; + struct { + int is_finished:1; + } flags; +}; +typedef struct _iobuf iobuf_t; + + +extern void iobuf_init(iobuf_t *iob); +extern void iobuf_free(iobuf_t *iob); +extern int iobuf_queue_cstr(iobuf_t *iob, char *cstr, int clen); +extern int iobuf_queue_str(iobuf_t *iob, str_t *str); +extern int iobuf_write_fd(iobuf_t *iob, int fd); +extern void iobuf_printout(iobuf_t *iob); + +static inline int iobuf_is_finished(iobuf_t *i) { return i->flags.is_finished; } + +#define iobuf_numleft(ii) ( MAX_ENTS - (ii)->inum ) +#define iobuf_isempty(ii) ( (ii)->inum == 0 ) +#define iobuf_datalen(ii) ( (ii)->iov.iovdatalen ) + + +#endif --- /dev/null Mon Dec 3 01:19:29 2007 +++ squid/libbuf/str.c Mon Dec 3 01:19:29 2007 @@ -0,0 +1,74 @@ +#include +#include +#include +#include +#include + +#include "../libcore/varargs.h" +#include "../libcore/debug.h" +#include "../libcore/tools.h" +#include "buf.h" +#include "str.h" + +/* + * Initialise the given string. It'll currently have NULL contents + * and will return an error whenever used. + * + * @param s pointer to string to initialise + * @return 1 on success, 0 on failure + */ +int +str_init(str_t *s) +{ + debug(85, 5) ("str_init: %p\n", s); + bzero(s, sizeof(*s)); + return 1; +} + +void +str_done(str_t *s) +{ + debug(85, 5) ("str_done: %p, buf %p\n", s, s->buf); + if (s->buf) + s->buf = buf_deref(s->buf); +} + +int +str_init_buf(str_t *s, buf_t *buf, int offset, int length) +{ + debug(85, 5) ("str_init: %p, buf %p\n", s, buf); + bzero(s, sizeof(*s)); + if (! buf_make_immutable(buf, offset + length)) + return 0; + assert(length > 0); + if (length <= 0) + return 0; + s->buf = buf_ref(buf); + s->offset = offset; + s->len = length; + s->flags.shared = 1; + return 1; +} + +int +str_dup(str_t *dst, str_t *src) +{ + assert(src->buf != NULL); + return (str_init_buf(dst, src->buf, src->offset, src->len)); +} + +int +str_init_cstr(str_t *s, const char *src, int len) +{ + debug(85, 5) ("str_init_cstr: %p\n", s); + bzero(s, sizeof(*s)); + /* Create a temporary buffer to use */ + s->buf = buf_create_const(src, len); + if (! buf_make_immutable(s->buf, len)) + return 0; + s->offset = 0; + s->len = len; + s->flags.shared = 0; + return 1; +} + --- /dev/null Mon Dec 3 01:19:29 2007 +++ squid/libbuf/str.h Mon Dec 3 01:19:29 2007 @@ -0,0 +1,66 @@ +#ifndef __STRING_H__ +#define __STRING_H__ + +/* + * this is a very, very simple string implementation. + * its -not- designed as a generic string replacement class by any means. + * instead its mostly designed to do representation of buffer regions with CoW + * semantics to avoid copying too much data. It also will have some routines + * that will come in handy when attempting to write string lists out to network + * sockets via writev(). + */ + +#define STR_BUF(s) ((s)->buf->b + (s)->offset) +#define STR_LEN(s) ((s)->len) + +struct _str { + buf_t *buf; + int offset; /* offset of string initial position inside buffer */ + int len; + struct { + char readonly:1; + char immutable:1; + char shared:1; + } flags; +}; +typedef struct _str str_t; + +/* Basic handling routines */ +extern int str_init(str_t *); +extern void str_done(str_t *); +extern int str_init_buf(str_t *, buf_t *, int offset, int length); +extern int str_init_cstr(str_t *, const char *c, int length); +extern int str_dup(str_t *dst, str_t *src); +static inline int str_len(str_t *s) { return s->len; } + +/* append routines */ +extern int str_append(str_t *dst, str_t *src); +extern int str_append_c(str_t *dst, const char *src); +extern int str_append_cl(str_t *dst, const char *src, int len); + +/* assignment */ +extern int str_copy(str_t *dst, str_t *src); +extern int str_copy_c(str_t *dst, const char *src); +extern int str_copy_cl(str_t *dst, const char *src, int len); + +/* comparison */ +typedef enum { + STRCMP_NONE, + STRCMP_NCASE, + STRCMP_URL +} str_cmp_t; +extern int str_cmp(str_t *a, str_t *b, str_cmp_t flags); +extern int str_cmp_c(str_t *a, char *b, str_cmp_t flags); +extern int str_cmp_cl(str_t *a, char *b, int len, str_cmp_t flags); + +#define str_len(ss) ( (ss).len ) +#define str_base(ss) ( (ss).buf + (ss).offset ) + +static inline int +str_get_chr(str_t *s, int offset) +{ + if (offset >= s->len) + return -1; + return buf_get_chr(s->buf, s->offset + offset); +} +#endif Index: squid/src/Makefile.am =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Makefile.am,v retrieving revision 1.54.2.1.4.1 retrieving revision 1.54.2.1.4.2 diff -u -r1.54.2.1.4.1 -r1.54.2.1.4.2 --- squid/src/Makefile.am 2 Dec 2007 02:01:33 -0000 1.54.2.1.4.1 +++ squid/src/Makefile.am 2 Dec 2007 09:34:15 -0000 1.54.2.1.4.2 @@ -273,6 +273,7 @@ squid_LDADD = \ -L../lib \ -L../libcore \ + -L../libbuf \ @XTRA_OBJS@ \ @REPL_OBJS@ \ @STORE_OBJS@ \ @@ -285,6 +286,7 @@ @LIB_EPOLL@ \ -lmiscutil \ -lcore \ + -lbuf \ @XTRA_LIBS@ \ $(MINGWEXLIB) @@ -322,7 +324,7 @@ data_DATA = \ mib.txt -LDADD = -L../lib -L../libcore -lcore -lmiscutil @XTRA_LIBS@ +LDADD = -L../lib -L../libcore -L../libbuf -lcore -lbuf -lmiscutil @XTRA_LIBS@ EXTRA_DIST = \ cf_gen_defines \