summaryrefslogtreecommitdiff
path: root/src/support/global.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/support/global.c')
-rw-r--r--src/support/global.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/src/support/global.c b/src/support/global.c
index 0234455b6ce..e0d5bafeaa8 100644
--- a/src/support/global.c
+++ b/src/support/global.c
@@ -12,6 +12,35 @@ WT_PROCESS __wt_process; /* Per-process structure */
static int __wt_pthread_once_failed; /* If initialization failed */
/*
+ * __wt_endian_check --
+ * Check the build matches the machine.
+ */
+static int
+__wt_endian_check(void)
+{
+ uint64_t v;
+ bool big;
+ const char *e;
+
+ v = 1;
+ big = *((uint8_t *)&v) == 0;
+
+#ifdef WORDS_BIGENDIAN
+ if (big)
+ return (0);
+ e = "big-endian";
+#else
+ if (!big)
+ return (0);
+ e = "little-endian";
+#endif
+ fprintf(stderr,
+ "This is a %s build of the WiredTiger data engine, incompatible "
+ "with this system\n", e);
+ return (EINVAL);
+}
+
+/*
* __wt_global_once --
* Global initialization, run once.
*/
@@ -31,10 +60,6 @@ __wt_global_once(void)
TAILQ_INIT(&__wt_process.connqh);
#ifdef HAVE_DIAGNOSTIC
- /* Verify the pre-computed metadata hash. */
- WT_ASSERT(NULL, WT_METAFILE_NAME_HASH ==
- __wt_hash_city64(WT_METAFILE_URI, strlen(WT_METAFILE_URI)));
-
/* Load debugging code the compiler might optimize out. */
(void)__wt_breakpoint();
#endif
@@ -50,6 +75,9 @@ __wt_library_init(void)
static bool first = true;
WT_DECL_RET;
+ /* Check the build matches the machine. */
+ WT_RET(__wt_endian_check());
+
/*
* Do per-process initialization once, before anything else, but only
* once. I don't know how heavy-weight the function (pthread_once, in