r3021 - in trunk/varnish-cache: . bin/varnishd bin/varnishlog

phk at projects.linpro.no phk at projects.linpro.no
Fri Jul 25 14:02:11 CEST 2008


Author: phk
Date: 2008-07-25 14:02:11 +0200 (Fri, 25 Jul 2008)
New Revision: 3021

Modified:
   trunk/varnish-cache/bin/varnishd/storage_file.c
   trunk/varnish-cache/bin/varnishlog/varnishlog.c
   trunk/varnish-cache/configure.ac
Log:
Figure out if we need O_LARGEFILE to be compatible with 1990 or later
size disks.

Submitted by:	wichert

Fixes ticket 283



Modified: trunk/varnish-cache/bin/varnishd/storage_file.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/storage_file.c	2008-07-24 22:20:10 UTC (rev 3020)
+++ trunk/varnish-cache/bin/varnishd/storage_file.c	2008-07-25 12:02:11 UTC (rev 3021)
@@ -194,7 +194,7 @@
 		    " to %ju due to system limitations\n", l);
 
 	if (l < st.st_size) {
-		AZ(ftruncate(sc->fd, l));
+		AZ(ftruncate(sc->fd, (off_t)l));
 	} else if (l - st.st_size > fssize) {
 		l = fssize * 80 / 100;
 		fprintf(stderr, "WARNING: storage file size reduced"
@@ -228,7 +228,7 @@
 {
 	smf_calcsize(sc, size, newfile);
 
-	AZ(ftruncate(sc->fd, sc->filesize));
+	AZ(ftruncate(sc->fd, (off_t)sc->filesize));
 
 	/* XXX: force block allocation here or in open ? */
 }
@@ -279,7 +279,11 @@
 	parent->priv = sc;
 
 	/* try to create a new file of this name */
+#ifdef O_LARGEFILE
+	sc->fd = open(fn, O_RDWR | O_CREAT | O_EXCL | O_LARGEFILE, 0600);
+#else
 	sc->fd = open(fn, O_RDWR | O_CREAT | O_EXCL, 0600);
+#endif
 	if (sc->fd >= 0) {
 		sc->filename = fn;
 		mgt_child_inherit(sc->fd, "storage_file");

Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c
===================================================================
--- trunk/varnish-cache/bin/varnishlog/varnishlog.c	2008-07-24 22:20:10 UTC (rev 3020)
+++ trunk/varnish-cache/bin/varnishlog/varnishlog.c	2008-07-25 12:02:11 UTC (rev 3021)
@@ -259,6 +259,9 @@
 	int fd, flags;
 
 	flags = (a_flag ? O_APPEND : O_TRUNC) | O_WRONLY | O_CREAT;
+#ifdef O_LARGEFILE
+        flags |= O_LARGEFILE;
+#endif
 	if (!strcmp(w_arg, "-"))
 		fd = STDOUT_FILENO;
 	else

Modified: trunk/varnish-cache/configure.ac
===================================================================
--- trunk/varnish-cache/configure.ac	2008-07-24 22:20:10 UTC (rev 3020)
+++ trunk/varnish-cache/configure.ac	2008-07-25 12:02:11 UTC (rev 3021)
@@ -142,6 +142,7 @@
 AC_CHECK_FUNCS([strndup])
 AC_CHECK_FUNCS([vis strvis strvisx])
 AC_CHECK_FUNCS([daemon])
+AC_SYS_LARGEFILE
 
 save_LIBS="${LIBS}"
 LIBS="${LIBS} ${RT_LIBS}"




More information about the varnish-commit mailing list