r2239 - in branches/1.1: . bin/varnishd lib/libvarnish lib/libvarnishcompat

des at projects.linpro.no des at projects.linpro.no
Thu Nov 8 22:30:05 CET 2007


Author: des
Date: 2007-11-08 22:30:05 +0100 (Thu, 08 Nov 2007)
New Revision: 2239

Modified:
   branches/1.1/
   branches/1.1/autogen.sh
   branches/1.1/bin/varnishd/cache_acceptor.c
   branches/1.1/bin/varnishd/cache_http.c
   branches/1.1/bin/varnishd/storage_file.c
   branches/1.1/configure.ac
   branches/1.1/lib/libvarnish/vsb.c
   branches/1.1/lib/libvarnishcompat/daemon.c
   branches/1.1/lib/libvarnishcompat/strndup.c
Log:
Merged revisions 2222-2228 via svnmerge from 
svn+ssh://projects.linpro.no/svn/varnish/trunk/varnish-cache

........
  r2222 | des | 2007-11-01 22:47:58 +0100 (Thu, 01 Nov 2007) | 2 lines
  
  Add Solaris support.  Avoid kshisms.
........
  r2223 | des | 2007-11-01 22:48:54 +0100 (Thu, 01 Nov 2007) | 2 lines
  
  Add missing <strings.h>
........
  r2224 | des | 2007-11-01 22:52:34 +0100 (Thu, 01 Nov 2007) | 2 lines
  
  Don't rely on non-portable <paths.h>
........
  r2225 | des | 2007-11-01 22:53:59 +0100 (Thu, 01 Nov 2007) | 2 lines
  
  Header cleanup.
........
  r2226 | des | 2007-11-01 22:57:44 +0100 (Thu, 01 Nov 2007) | 2 lines
  
  Fix the struct statvfs issue.
........
  r2227 | des | 2007-11-02 15:09:17 +0100 (Fri, 02 Nov 2007) | 3 lines
  
  Test whether SO_{RCV,SND}TIMEO work (they are defined but unimplemented
  on Solaris, so simply checking for their presence is not enough)
........
  r2228 | des | 2007-11-03 13:30:06 +0100 (Sat, 03 Nov 2007) | 2 lines
  
  Typo in previous commit.
........



Property changes on: branches/1.1
___________________________________________________________________
Name: svnmerge-integrated
   - /trunk/varnish-cache:1-1722,1727-1729,1733,1738,1743-1777,1779-1798,1800-1815,1817,1819,1823,1830-1838,1846,1853-1855,1857-1859,1862,1865-1868,1871-1880,1883-1884,1886,1888-1889,1896,1898,1902-1905,1907,1909,1912-1916,1920-1928,1935-1939,1941-1949,1955,1957-1958,1967-1968,1970-1974,1976-1977,1984,1986-1989,1991-1998,2026,2031-2033,2057,2077-2080,2086,2088,2097,2106-2107,2116,2133,2154,2173,2181,2206,2211-2212,2215-2220
   + /trunk/varnish-cache:1-1722,1727-1729,1733,1738,1743-1777,1779-1798,1800-1815,1817,1819,1823,1830-1838,1846,1853-1855,1857-1859,1862,1865-1868,1871-1880,1883-1884,1886,1888-1889,1896,1898,1902-1905,1907,1909,1912-1916,1920-1928,1935-1939,1941-1949,1955,1957-1958,1967-1968,1970-1974,1976-1977,1984,1986-1989,1991-1998,2026,2031-2033,2057,2077-2080,2086,2088,2097,2106-2107,2116,2133,2154,2173,2181,2206,2211-2212,2215-2220,2222-2228

Modified: branches/1.1/autogen.sh
===================================================================
--- branches/1.1/autogen.sh	2007-11-08 21:29:23 UTC (rev 2238)
+++ branches/1.1/autogen.sh	2007-11-08 21:30:05 UTC (rev 2239)
@@ -17,12 +17,15 @@
 Linux)
     LIBTOOLIZE=libtoolize
     ;;
+SunOS)
+    LIBTOOLIZE=libtoolize
+    ;;
 *)
     warn "unrecognized platform:" `uname -s`
     LIBTOOLIZE=libtoolize
 esac
 
-automake_version=$(automake --version | tr ' ' '\n' | egrep '^[0-9]\.[0-9a-z.-]+')
+automake_version=`automake --version | tr ' ' '\n' | egrep '^[0-9]\.[0-9a-z.-]+'`
 if [ -z "$automake_version" ] ; then
     warn "unable to determine automake version"
 else

Modified: branches/1.1/bin/varnishd/cache_acceptor.c
===================================================================
--- branches/1.1/bin/varnishd/cache_acceptor.c	2007-11-08 21:29:23 UTC (rev 2238)
+++ branches/1.1/bin/varnishd/cache_acceptor.c	2007-11-08 21:30:05 UTC (rev 2239)
@@ -91,17 +91,22 @@
 	if (memcmp(&lin, &linger, l))
 		need_linger = 1;
 
+#ifdef SO_SNDTIMEO_WORKS
 	l = sizeof tv;
 	AZ(getsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, &l));
 	assert(l == sizeof tv);
 	if (memcmp(&tv, &tv_sndtimeo, l))
 		need_sndtimeo = 1;
+#endif
 
+#ifdef SO_RCVTIMEO_WORKS
 	l = sizeof tv;
 	AZ(getsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, &l));
 	assert(l == sizeof tv);
 	if (memcmp(&tv, &tv_rcvtimeo, l))
 		need_rcvtimeo = 1;
+#endif
+
 	need_test = 0;
 }
 
@@ -118,12 +123,16 @@
 	if (need_linger)
 		AZ(setsockopt(sp->fd, SOL_SOCKET, SO_LINGER,
 		    &linger, sizeof linger));
+#ifdef SO_SNDTIMEO_WORKS
 	if (need_sndtimeo)
 		AZ(setsockopt(sp->fd, SOL_SOCKET, SO_SNDTIMEO,
 		    &tv_sndtimeo, sizeof tv_sndtimeo));
+#endif
+#ifdef SO_RCVTIMEO_WORKS
 	if (need_rcvtimeo)
 		AZ(setsockopt(sp->fd, SOL_SOCKET, SO_RCVTIMEO,
 		    &tv_rcvtimeo, sizeof tv_rcvtimeo));
+#endif
 }
 
 /*--------------------------------------------------------------------*/
@@ -154,6 +163,7 @@
 
 	need_test = 1;
 	while (1) {
+#ifdef SO_SNDTIMEO_WORKS
 		if (params->send_timeout != tv_sndtimeo.tv_sec) {
 			need_test = 1;
 			tv_sndtimeo.tv_sec = params->send_timeout;
@@ -162,6 +172,8 @@
 				    SO_SNDTIMEO,
 				    &tv_sndtimeo, sizeof tv_sndtimeo));
 		}
+#endif
+#ifdef SO_RCVTIMEO_WORKS
 		if (params->sess_timeout != tv_rcvtimeo.tv_sec) {
 			need_test = 1;
 			tv_rcvtimeo.tv_sec = params->sess_timeout;
@@ -170,6 +182,7 @@
 				    SO_RCVTIMEO,
 				    &tv_rcvtimeo, sizeof tv_rcvtimeo));
 		}
+#endif
 		i = poll(pfd, heritage.nsocks, 1000);
 		for (j = 0; j < heritage.nsocks; j++) {
 			if (pfd[j].revents == 0)

Modified: branches/1.1/bin/varnishd/cache_http.c
===================================================================
--- branches/1.1/bin/varnishd/cache_http.c	2007-11-08 21:29:23 UTC (rev 2238)
+++ branches/1.1/bin/varnishd/cache_http.c	2007-11-08 21:30:05 UTC (rev 2239)
@@ -31,13 +31,14 @@
  * HTTP request storage and manipulation
  */
 
-#include <stdio.h>
+#include <ctype.h>
 #include <errno.h>
 #include <unistd.h>
 #include <stdarg.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <ctype.h>
+#include <strings.h>
 
 #include "heritage.h"
 #include "shmlog.h"

Modified: branches/1.1/bin/varnishd/storage_file.c
===================================================================
--- branches/1.1/bin/varnishd/storage_file.c	2007-11-08 21:29:23 UTC (rev 2238)
+++ branches/1.1/bin/varnishd/storage_file.c	2007-11-08 21:30:05 UTC (rev 2239)
@@ -33,7 +33,6 @@
 
 #include <sys/param.h>
 #include <sys/mman.h>
-#include <sys/mount.h>
 #include <sys/socket.h>
 #include <sys/stat.h>
 
@@ -120,7 +119,13 @@
 static void
 smf_calcsize(struct smf_sc *sc, const char *size, int newfile)
 {
+#if defined(HAVE_SYS_STATVFS_H)
+	struct statvfs fsst;
+#elif defined(HAVE_SYS_MOUNT_H) || defined(HAVE_SYS_VFS_H)
 	struct statfs fsst;
+#else
+#error no struct statfs / struct statvfs
+#endif
 	uintmax_t l, fssize;
 	unsigned bs;
 	char suff[2];
@@ -132,7 +137,13 @@
 	AZ(fstat(sc->fd, &st));
 	xxxassert(S_ISREG(st.st_mode));
 
+#if defined(HAVE_SYS_STATVFS_H)
+	AZ(fstatvfs(sc->fd, &fsst));
+#elif defined(HAVE_SYS_MOUNT_H) || defined(HAVE_SYS_VFS_H)
 	AZ(fstatfs(sc->fd, &fsst));
+#else
+#error no struct statfs / struct statvfs
+#endif
 
 	/* We use units of the larger of filesystem blocksize and pagesize */
 	bs = sc->pagesize;

Modified: branches/1.1/configure.ac
===================================================================
--- branches/1.1/configure.ac	2007-11-08 21:29:23 UTC (rev 2238)
+++ branches/1.1/configure.ac	2007-11-08 21:30:05 UTC (rev 2239)
@@ -114,6 +114,45 @@
 AC_CHECK_FUNCS([epoll_ctl])
 AC_CHECK_FUNCS([poll])
 
+# Solaris defines SO_{RCV,SND}TIMEO, but does not implement them
+AC_CACHE_CHECK([whether SO_RCVTIMEO works],
+  [ac_cv_so_rcvtimeo_works],
+  [AC_RUN_IFELSE(
+    [AC_LANG_PROGRAM([[
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+    ]],[[
+int sd = socket(AF_INET, SOCK_STREAM, 0);
+struct timeval tv = { 1, 0 };
+return !!setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof tv);
+    ]])],
+    [ac_cv_so_rcvtimeo_works=yes],
+    [ac_cv_so_rcvtimeo_works=no])
+  ])
+if test "$ac_cv_so_rcvtimeo_works" = yes; then
+   AC_DEFINE([SO_RCVTIMEO_WORKS], [1], [Define if SO_RCVTIMEO works])
+fi
+
+AC_CACHE_CHECK([whether SO_SNDTIMEO works],
+  [ac_cv_so_sndtimeo_works],
+  [AC_RUN_IFELSE(
+    [AC_LANG_PROGRAM([[
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+    ]],[[
+int sd = socket(AF_INET, SOCK_STREAM, 0);
+struct timeval tv = { 1, 0 };
+return !!setsockopt(sd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof tv);
+    ]])],
+    [ac_cv_so_sndtimeo_works=yes],
+    [ac_cv_so_sndtimeo_works=no])
+  ])
+if test "$ac_cv_so_sndtimeo_works" = yes; then
+   AC_DEFINE([SO_SNDTIMEO_WORKS], [1], [Define if SO_SNDTIMEO works])
+fi
+
 # Run-time directory
 VARNISH_STATE_DIR='${localstatedir}/varnish'
 AC_SUBST(VARNISH_STATE_DIR)

Modified: branches/1.1/lib/libvarnish/vsb.c
===================================================================
--- branches/1.1/lib/libvarnish/vsb.c	2007-11-08 21:29:23 UTC (rev 2238)
+++ branches/1.1/lib/libvarnish/vsb.c	2007-11-08 21:30:05 UTC (rev 2239)
@@ -34,6 +34,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <strings.h>
 
 #include "vsb.h"
 

Modified: branches/1.1/lib/libvarnishcompat/daemon.c
===================================================================
--- branches/1.1/lib/libvarnishcompat/daemon.c	2007-11-08 21:29:23 UTC (rev 2238)
+++ branches/1.1/lib/libvarnishcompat/daemon.c	2007-11-08 21:30:05 UTC (rev 2239)
@@ -35,7 +35,6 @@
 
 #include <errno.h>
 #include <fcntl.h>
-#include <paths.h>
 #include <stdlib.h>
 #include <signal.h>
 #include <unistd.h>
@@ -79,7 +78,7 @@
 	if (!nochdir)
 		(void)chdir("/");
 
-	if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
+	if (!noclose && (fd = open("/dev/null", O_RDWR, 0)) != -1) {
 		(void)dup2(fd, STDIN_FILENO);
 		(void)dup2(fd, STDOUT_FILENO);
 		(void)dup2(fd, STDERR_FILENO);

Modified: branches/1.1/lib/libvarnishcompat/strndup.c
===================================================================
--- branches/1.1/lib/libvarnishcompat/strndup.c	2007-11-08 21:29:23 UTC (rev 2238)
+++ branches/1.1/lib/libvarnishcompat/strndup.c	2007-11-08 21:30:05 UTC (rev 2239)
@@ -34,6 +34,7 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <strings.h>
 
 #ifndef HAVE_STRLCPY
 #include "compat/strlcpy.h"




More information about the varnish-commit mailing list