Linux-only fdatasync() in 3c13bc
authorXīcò <xico@atelo.org>
Tue, 6 May 2014 19:59:39 +0000 (12:59 +1700)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 18:02:16 +0000 (10:02 -0800)
e3/1d633dabf098cb86b909a2f91f48fe89a2d28c [new file with mode: 0644]

diff --git a/e3/1d633dabf098cb86b909a2f91f48fe89a2d28c b/e3/1d633dabf098cb86b909a2f91f48fe89a2d28c
new file mode 100644 (file)
index 0000000..8607a8b
--- /dev/null
@@ -0,0 +1,151 @@
+Return-Path: <xico@atelo.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 37A48431FC2\r
+       for <notmuch@notmuchmail.org>; Tue,  6 May 2014 12:59:49 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.001\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.001 tagged_above=-999 required=5\r
+       tests=[UNPARSEABLE_RELAY=0.001] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id KrOD6dt+-G2j for <notmuch@notmuchmail.org>;\r
+       Tue,  6 May 2014 12:59:42 -0700 (PDT)\r
+Received: from mail.atelo.org (atelo.org [192.95.27.91])\r
+       (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 01CDE431FAF\r
+       for <notmuch@notmuchmail.org>; Tue,  6 May 2014 12:59:41 -0700 (PDT)\r
+Received: from coyotlan.Tlalpan (ovo.atelo.org [192.168.1.7]);\r
+       by mail.atelo.org (OpenSMTPD) with ESMTP id e2586fe2;\r
+       for <notmuch@notmuchmail.org>; Tue, 6 May 2014 19:59:21 +0000 (UTC)\r
+Received: from localhost (1001@localhost [local]);\r
+       by localhost (OpenSMTPD) with ESMTPA id efec25c4;\r
+       for <notmuch@notmuchmail.org>; Tue, 6 May 2014 12:59:39 -0700 (PDT)\r
+Date: Tue, 6 May 2014 12:59:39 -0700\r
+From: =?utf-8?B?WMSrY8Oy?= <xico@atelo.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: Linux-only fdatasync() in 3c13bc\r
+Message-ID: <20140506195938.GA18213@coyotlan.Tlalpan>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/mixed; boundary="k1lZvvs/B4yU6o8G"\r
+Content-Disposition: inline\r
+Content-Transfer-Encoding: 8bit\r
+User-Agent: Mutt/1.5.23 (2014-03-12)\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 06 May 2014 19:59:49 -0000\r
+\r
+\r
+--k1lZvvs/B4yU6o8G\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Disposition: inline\r
+Content-Transfer-Encoding: 8bit\r
+\r
+Also, commit 3c13bc introduced a call to fdatasync() which is not\r
+available on FreeBSD, and probably not either on MacOS at least.\r
+\r
+Best,\r
+\r
+--\r
+Xīcò\r
+\r
+--k1lZvvs/B4yU6o8G\r
+Content-Type: text/x-diff; charset=us-ascii\r
+Content-Disposition: attachment;\r
+ filename="0002-Compatibility-for-Linux-s-fdatasync.patch"\r
+\r
+>From e2b9520e69e52b35348d07eb53a6a88d1397fa3f Mon Sep 17 00:00:00 2001\r
+From: =?UTF-8?q?X=C4=ABc=C3=B2?= <xico@atelo.org>\r
+Date: Tue, 6 May 2014 12:56:03 -0700\r
+Subject: [PATCH 1/1] =?UTF-8?q?Compatibility=20for=20Linux=E2=80=99s=20fda?=\r
+ =?UTF-8?q?tasync().?=\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=UTF-8\r
+Content-Transfer-Encoding: 8bit\r
+\r
+---\r
+ configure      | 7 +++++++\r
+ notmuch-dump.c | 4 ++++\r
+ 2 files changed, 11 insertions(+)\r
+\r
+diff --git a/configure b/configure\r
+index 7204812..7bc602d 100755\r
+--- a/configure\r
++++ b/configure\r
+@@ -271,6 +271,7 @@ EOF\r
+ errors=0\r
\r
+ libdir_in_ldconfig=0\r
++have_fdatasync=0\r
\r
+ printf "Checking which platform we are on... "\r
+ uname=`uname`\r
+@@ -294,6 +295,7 @@ elif [ $uname = "Linux" ] || [ $uname = "GNU" ] ; then\r
+     printf "$uname\n"\r
+     platform="$uname"\r
+     linker_resolves_library_dependencies=1\r
++    have_fdatasync=1\r
\r
+     printf "Checking for $libdir_expanded in ldconfig... "\r
+     ldconfig_paths=$(/sbin/ldconfig -N -X -v 2>/dev/null | sed -n -e 's,^\(/.*\):\( (.*)\)\?$,\1,p')\r
+@@ -859,6 +861,9 @@ HAVE_D_TYPE = ${have_d_type}\r
+ # Whether the Xapian version in use supports compaction\r
+ HAVE_XAPIAN_COMPACT = ${have_xapian_compact}\r
\r
++# Optimized fsync() on Linux\r
++HAVE_FDATASYNC = ${have_fdatasync}\r
++\r
+ # Whether the getpwuid_r function is standards-compliant\r
+ # (if not, then notmuch will #define _POSIX_PTHREAD_SEMANTICS\r
+ # to enable the standards-compliant version -- needed for Solaris)\r
+@@ -926,6 +931,7 @@ CONFIGURE_CFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS)      \\\r
+                  -DSTD_GETPWUID=\$(STD_GETPWUID)                       \\\r
+                  -DSTD_ASCTIME=\$(STD_ASCTIME)                         \\\r
+                  -DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT)         \\\r
++                 -DHAVE_FDATASYNC=\$(HAVE_FDATASYNC)                   \\\r
+                  -DUTIL_BYTE_ORDER=\$(UTIL_BYTE_ORDER)\r
\r
+ CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS)    \\\r
+@@ -939,6 +945,7 @@ CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS)    \\\r
+                    -DSTD_GETPWUID=\$(STD_GETPWUID)                     \\\r
+                    -DSTD_ASCTIME=\$(STD_ASCTIME)                       \\\r
+                    -DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT)       \\\r
++                   -DHAVE_FDATASYNC=\$(HAVE_FDATASYNC)                 \\\r
+                    -DUTIL_BYTE_ORDER=\$(UTIL_BYTE_ORDER)\r
\r
+ CONFIGURE_LDFLAGS =  \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(ZLIB_LDFLAGS) \$(XAPIAN_LDFLAGS)\r
+diff --git a/notmuch-dump.c b/notmuch-dump.c\r
+index 2849eab..86b275a 100644\r
+--- a/notmuch-dump.c\r
++++ b/notmuch-dump.c\r
+@@ -169,7 +169,11 @@ notmuch_database_dump (notmuch_database_t *notmuch,\r
+     }\r
\r
+     if (output_file_name) {\r
++#if HAVE_FDATASYNC\r
+       ret = fdatasync (outfd);\r
++#else\r
++      ret = fsync (outfd);\r
++#endif\r
+       if (ret) {\r
+           fprintf (stderr, "Error syncing %s to disk: %s\n",\r
+                    name_for_error, strerror (errno));\r
+-- \r
+1.9.2\r
+\r
+\r
+--k1lZvvs/B4yU6o8G--\r