r3587 - in branches/2.0/varnish-cache: . bin/varnishd

tfheen at projects.linpro.no tfheen at projects.linpro.no
Thu Feb 5 10:24:49 CET 2009


Author: tfheen
Date: 2009-02-05 10:24:49 +0100 (Thu, 05 Feb 2009)
New Revision: 3587

Modified:
   branches/2.0/varnish-cache/bin/varnishd/Makefile.am
   branches/2.0/varnish-cache/bin/varnishd/cache_pool.c
   branches/2.0/varnish-cache/bin/varnishd/storage_umem.c
   branches/2.0/varnish-cache/configure.ac
Log:
Merge r3338: Solaris fallout

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: branches/2.0/varnish-cache/bin/varnishd/Makefile.am
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/Makefile.am	2009-02-05 09:17:38 UTC (rev 3586)
+++ branches/2.0/varnish-cache/bin/varnishd/Makefile.am	2009-02-05 09:24:49 UTC (rev 3587)
@@ -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: branches/2.0/varnish-cache/bin/varnishd/cache_pool.c
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/cache_pool.c	2009-02-05 09:17:38 UTC (rev 3586)
+++ branches/2.0/varnish-cache/bin/varnishd/cache_pool.c	2009-02-05 09:24:49 UTC (rev 3587)
@@ -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: branches/2.0/varnish-cache/bin/varnishd/storage_umem.c
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/storage_umem.c	2009-02-05 09:17:38 UTC (rev 3586)
+++ branches/2.0/varnish-cache/bin/varnishd/storage_umem.c	2009-02-05 09:24:49 UTC (rev 3587)
@@ -33,7 +33,7 @@
 
 #include "config.h"
 
-#ifdef HAVE_UMEM_H
+#ifdef HAVE_LIBUMEM
 
 #include <sys/types.h>
 

Modified: branches/2.0/varnish-cache/configure.ac
===================================================================
--- branches/2.0/varnish-cache/configure.ac	2009-02-05 09:17:38 UTC (rev 3586)
+++ branches/2.0/varnish-cache/configure.ac	2009-02-05 09:24:49 UTC (rev 3587)
@@ -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