tdb2: Fix to always use 64-bit offset definition
authorRusty Russell <rusty@rustcorp.com.au>
Wed, 31 Aug 2011 01:10:12 +0000 (10:40 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 31 Aug 2011 01:10:12 +0000 (10:40 +0930)
We use off_t in the tdb2 interface (for tdb_attribute_flock); we need
to make sure that all callers agree on the size.

This also causes a problem in the tests: it's not enough to include
config.h first, we need the _FILE_OFFSET_BITS define from private.h.
Otherwise, we can disagree about the definitions of F_SETLK, F_SETLKW
and off_t, causing strange problems.

ccan/tdb2/private.h
ccan/tdb2/tdb2.h
ccan/tdb2/test/lock-tracking.c
ccan/tdb2/test/run-56-open-during-transaction.c
ccan/tdb2/test/run-57-die-during-transaction.c
ccan/tdb2/test/run-lockall.c

index 1650cf833d7988599e1d73e55181ed9317bbb1c6..6a742496971303a256b41779956669195ae7f3ca 100644 (file)
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
 
-#include "config.h"
-#if HAVE_FILE_OFFSET_BITS
-#define _FILE_OFFSET_BITS 64
-#endif
-#include <stdint.h>
-#include <stdbool.h>
+#include <ccan/tdb2/tdb2.h>
 #include <stdlib.h>
 #include <stddef.h>
 #include <sys/time.h>
 #include <sys/mman.h>
 #include <unistd.h>
 #include <fcntl.h>
-#include <string.h>
 #include <errno.h>
 #include <stdio.h>
 #include <utime.h>
 #include <unistd.h>
-#include <ccan/tdb2/tdb2.h>
 #include <ccan/likely/likely.h>
-#include <ccan/compiler/compiler.h>
 #include <ccan/endian/endian.h>
 
 #ifndef TEST_IT
index 2b9f46217db77247c6617e4fa2fa75e413d1018e..01413f206c8b99aa85cd2cc611d21f72982e2d32 100644 (file)
@@ -30,6 +30,10 @@ extern "C" {
 #endif
 
 #ifndef _SAMBA_BUILD_
+#include "config.h"
+#if HAVE_FILE_OFFSET_BITS
+#define _FILE_OFFSET_BITS 64
+#endif
 /* For mode_t */
 #include <sys/types.h>
 /* For O_* flags. */
index 05dba32fd3fb9d0fa34999dd11dfc0453706c902..ba09399219258d1cd2c56b28ca5c3b44a3447e18 100644 (file)
@@ -1,10 +1,10 @@
 /* We save the locks so we can reaquire them. */
+#include <ccan/tdb2/private.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <stdarg.h>
 #include <stdlib.h>
 #include <ccan/tap/tap.h>
-#include <ccan/tdb2/private.h>
 #include "lock-tracking.h"
 
 struct lock {
index 96107d637e4472b7026b587f26c031191b1c9631..88933e02ed4176424a4cb9c7eb54d758643f4481 100644 (file)
@@ -1,4 +1,4 @@
-#include "config.h"
+#include <ccan/tdb2/private.h>
 #include <unistd.h>
 #include "lock-tracking.h"
 
index 84f01eb21a8dd009d5a6d738485f96e790822a55..1b02802359ec5109fa69cca4170f88d2efcde47f 100644 (file)
@@ -1,4 +1,4 @@
-#include "config.h"
+#include <ccan/tdb2/private.h>
 #include <unistd.h>
 #include "lock-tracking.h"
 #include <ccan/tap/tap.h>
index 4aedf59743d81b48ad372f838d412be25bd64f0b..7f75159cca25a86be492cbeb1edb60b24b48c6db 100644 (file)
@@ -1,4 +1,4 @@
-#include "config.h"
+#include <ccan/tdb2/private.h>
 #include <unistd.h>
 #include "lock-tracking.h"