summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2012-12-01 11:05:50 +0000
committerKeith Bostic <keith@wiredtiger.com>2012-12-01 11:05:50 +0000
commit0d81af2d0ffc81ed6d73e52b137cc87c41715450 (patch)
tree896d1c3b3e0c0ab46a16840496368d467bf13e9a
parent4bb5e8cc9f0256f39af41b2b80c96ff749dcabe7 (diff)
downloadmongo-0d81af2d0ffc81ed6d73e52b137cc87c41715450.tar.gz
SunOS doesn't include strtouq(3), add a local version that calls strtoull(3)
(with a test that the size of a ULL equals the size of a quad, just in case).
-rw-r--r--build_posix/configure.ac.in3
-rw-r--r--dist/filelist1
-rw-r--r--src/os_posix/os_strtouq.c21
3 files changed, 24 insertions, 1 deletions
diff --git a/build_posix/configure.ac.in b/build_posix/configure.ac.in
index caf2287988a..82aee50d2bc 100644
--- a/build_posix/configure.ac.in
+++ b/build_posix/configure.ac.in
@@ -70,7 +70,8 @@ AC_PROG_INSTALL
AC_CHECK_LIB(pthread, pthread_create)
AC_CHECK_LIB(dl, dlopen)
AC_CHECK_LIB(rt, sched_yield)
-AC_CHECK_FUNCS([clock_gettime gettimeofday fcntl posix_fadvise posix_memalign])
+AC_CHECK_FUNCS([\
+ clock_gettime fcntl gettimeofday posix_fadvise posix_memalign strtouq])
AC_SYS_LARGEFILE
AC_C_BIGENDIAN
diff --git a/dist/filelist b/dist/filelist
index dfa2ef16757..db1ba9cfae0 100644
--- a/dist/filelist
+++ b/dist/filelist
@@ -98,6 +98,7 @@ src/os_posix/os_remove.c
src/os_posix/os_rename.c
src/os_posix/os_rw.c
src/os_posix/os_sleep.c
+src/os_posix/os_strtouq.c
src/os_posix/os_thread.c
src/os_posix/os_time.c
src/os_posix/os_yield.c
diff --git a/src/os_posix/os_strtouq.c b/src/os_posix/os_strtouq.c
new file mode 100644
index 00000000000..afc2ae4fc32
--- /dev/null
+++ b/src/os_posix/os_strtouq.c
@@ -0,0 +1,21 @@
+/*-
+ * Copyright (c) 2008-2012 WiredTiger, Inc.
+ * All rights reserved.
+ *
+ * See the file LICENSE for redistribution information.
+ */
+
+#include "wt_internal.h"
+
+#if !defined(HAVE_STRTOUQ)
+/*
+ * Convert a string to an unsigned quad integer.
+ */
+uint64_t
+strtouq(const char *nptr, char **endptr, int base)
+{
+ STATIC_ASSERT(sizeof(uint64_t) == sizeof(unsigned long long));
+
+ return (strtoull(nptr, endptr, base));
+}
+#endif