r3338 - in trunk/varnish-cache: . bin/varnishd

des at projects.linpro.no des at projects.linpro.no
Mon Oct 20 22:02:48 CEST 2008


Author: des
Date: 2008-10-20 22:02:48 +0200 (Mon, 20 Oct 2008)
New Revision: 3338

Modified:
   trunk/varnish-cache/bin/varnishd/Makefile.am
   trunk/varnish-cache/bin/varnishd/cache_pool.c
   trunk/varnish-cache/bin/varnishd/storage_umem.c
   trunk/varnish-cache/configure.ac
Log:
Clean up some of the fallout from the Solaris patch - mostly configure
script breakage.  In particular, disable the sendfile() check, as Solaris
doesn't have a working sendfile() any more than Linux does.  Actually, the
Solaris sendfile code was never compiled or used, because the #ifdefs in
cache_pool.c were all wrong.


Modified: trunk/varnish-cache/bin/varnishd/Makefile.am
===================================================================
--- trunk/varnish-cache/bin/varnishd/Makefile.am	2008-10-20 19:57:27 UTC (rev 3337)
+++ trunk/varnish-cache/bin/varnishd/Makefile.am	2008-10-20 20:02:48 UTC (rev 3338)
@@ -80,7 +80,7 @@
 	$(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \
 	$(top_builddir)/lib/libvcl/libvcl.la \
 	@JEMALLOC_LDADD@ \
-	${DL_LIBS} ${PTHREAD_LIBS} ${NET_LIBS} ${LIBM}
+	${DL_LIBS} ${PTHREAD_LIBS} ${NET_LIBS} ${LIBM} ${LIBUMEM}
 
 EXTRA_DIST = default.vcl
 DISTCLEANFILES = default_vcl.h
@@ -93,4 +93,3 @@
 
 # Explicitly record dependency
 mgt_vcc.c:	default_vcl.h
-

Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pool.c	2008-10-20 19:57:27 UTC (rev 3337)
+++ trunk/varnish-cache/bin/varnishd/cache_pool.c	2008-10-20 20:02:48 UTC (rev 3338)
@@ -193,8 +193,7 @@
 		    sendfile(*w->wfd, fd, &off, len) != len)
 			w->werr++;
 	} while (0);
-#elif defined(__sun)
-#ifdef HAVE_SENDFILEV
+#elif defined(__sun) && defined(HAVE_SENDFILEV)
 	do {
 		sendfilevec_t svvec[HTTP_HDR_MAX * 2 + 1];
 		size_t xferred = 0, expected = 0;
@@ -217,13 +216,12 @@
 		w->liov = 0;
 		w->niov = 0;
 	} while (0);
-#else
+#elif defined(__sun) && defined(HAVE_SENDFILE)
 	do {
 		if (WRK_Flush(w) == 0 &&
 		    sendfile(*w->wfd, fd, &off, len) != len)
 			w->werr++;
 	} while (0);
-#endif
 #else
 #error Unknown sendfile() implementation
 #endif

Modified: trunk/varnish-cache/bin/varnishd/storage_umem.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/storage_umem.c	2008-10-20 19:57:27 UTC (rev 3337)
+++ trunk/varnish-cache/bin/varnishd/storage_umem.c	2008-10-20 20:02:48 UTC (rev 3338)
@@ -33,7 +33,7 @@
 
 #include "config.h"
 
-#ifdef HAVE_UMEM_H
+#ifdef HAVE_LIBUMEM
 
 #include <sys/types.h>
 

Modified: trunk/varnish-cache/configure.ac
===================================================================
--- trunk/varnish-cache/configure.ac	2008-10-20 19:57:27 UTC (rev 3337)
+++ trunk/varnish-cache/configure.ac	2008-10-20 20:02:48 UTC (rev 3338)
@@ -70,8 +70,9 @@
 AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
 AC_HEADER_TIME
+AC_CHECK_HEADERS([sys/filio.h])
+AC_CHECK_HEADERS([sys/mount.h])
 AC_CHECK_HEADERS([sys/socket.h])
-AC_CHECK_HEADERS([sys/mount.h])
 AC_CHECK_HEADERS([sys/statvfs.h])
 AC_CHECK_HEADERS([sys/vfs.h])
 AC_CHECK_HEADERS([netinet/in.h])
@@ -109,7 +110,8 @@
 AC_CHECK_FUNCS([pthread_mutex_isowned_np])
 LIBS="${save_LIBS}"
 
-## This one is tricky, there are multiple versions
+# sendfile is tricky: there are multiple versions, and most of them
+# don't work.
 case $target in
 *-*-freebsd*)
 	AC_CACHE_CHECK([whether sendfile works],
@@ -125,28 +127,37 @@
 	    [ac_cv_so_sendfile_works=yes],
 	    [ac_cv_so_sendfile_works=no])
 	  ])
-	if test "$ac_cv_so_sendfile_works" = yes; then
-	   AC_DEFINE([SENDFILE_WORKS], [1], [Define if SENDFILE works])
-	fi
- 	;;
+	;;
+#*-*-solaris*)
+#	save_LIBS="${LIBS}"
+#	LIBS="${NET_LIBS}"
+#	AC_CHECK_LIB(sendfile, sendfile)
+#	AC_CHECK_FUNCS([sendfile])
+#	AC_CHECK_FUNCS([sendfilev])
+#	NET_LIBS="${LIBS}"
+#	LIBS="${save_LIBS}"
+*)
+	AC_MSG_WARN([won't look for sendfile() on $target])
+	;;
+esac
+if test "$ac_cv_so_sendfile_works" = yes; then
+	AC_DEFINE([SENDFILE_WORKS], [1], [Define if SENDFILE works])
+fi
+
+# Userland slab allocator, available only on Solaris
+case $target in
 *-*-solaris*)
-	AC_CHECK_HEADERS([sys/filio.h])
-	AC_CHECK_LIB(sendfile, sendfile)
-	AC_CHECK_LIB(umem, malloc)
 	AC_CHECK_HEADERS([umem.h])
-
-	if test "$ac_cv_lib_sendfile_sendfile" = yes; then
+	if test "$ac_cv_have_umem_h" = yes; then
 		save_LIBS="${LIBS}"
-		LIBS="${NET_LIBS}"
-		AC_CHECK_FUNCS([sendfile])
-		AC_CHECK_FUNCS([sendfilev])
+		LIBS=""
+		AC_CHECK_LIB(umem, umem_alloc)
+		LIBUMEM="${LIBS}"
 		LIBS="${save_LIBS}"
 	fi
 	;;
-*)
-	AC_MSG_WARN([won't look for sendfile() on $target])
-	;;
 esac
+AC_SUBST(LIBUMEM)
 
 # These functions are provided by libcompat on platforms where they
 # are not available




More information about the varnish-commit mailing list