// the clock resolution is worse than that, it will be larger. In
// essence we're aiming at making the quantization noise 0.01%.
static const auto minNanoseconds =
- max(FLAGS_bm_min_usec * 1000UL, min(resolutionInNs * 100000, 1000000000UL));
+ max(FLAGS_bm_min_usec * 1000UL,
+ min(resolutionInNs * 100000, 1000000000ULL));
// We do measurements in several epochs and take the minimum, to
// account for jitter.
#error GCC required
#endif
+#ifndef FOLLY_NO_CONFIG
#include "folly/folly-config.h"
+#endif
+
#include "folly/detail/BitsDetail.h"
#include "folly/detail/BitIteratorDetail.h"
#include "folly/Likely.h"
#include "folly/FileUtil.h"
#include <cerrno>
+#ifdef __APPLE__
+#include <fcntl.h>
+#endif
#include "folly/detail/FileUtilDetail.h"
}
int fdatasyncNoInt(int fd) {
+#ifndef __APPLE__
return wrapNoInt(fdatasync, fd);
+#else
+ return wrapNoInt(fcntl, fd, F_FULLFSYNC);
+#endif
}
int ftruncateNoInt(int fd, off_t len) {
#include <bits/functexcept.h>
-/**
- * Declare rallocm() and malloc_usable_size() as weak symbols. It
- * will be provided by jemalloc if we are using jemalloc, or it will
- * be NULL if we are using another malloc implementation.
- */
-extern "C" int rallocm(void**, size_t*, size_t, size_t, int)
-__attribute__((weak));
-
/**
* Define various ALLOCM_* macros normally provided by jemalloc. We define
* them so that we don't have to include jemalloc.h, in case the program is
#define ALLOCM_LG_ALIGN(la) (la)
-#endif /* !ALLOCM_SUCCESS */
+#if defined(JEMALLOC_MANGLE) && defined(JEMALLOC_EXPERIMENTAL)
+#define rallocm je_rallocm
+#endif
+
+#endif /* ALLOCM_SUCCESS */
+
+/**
+ * Declare rallocm() and malloc_usable_size() as weak symbols. It
+ * will be provided by jemalloc if we are using jemalloc, or it will
+ * be NULL if we are using another malloc implementation.
+ */
+extern "C" int rallocm(void**, size_t*, size_t, size_t, int)
+__attribute__((weak));
#ifdef _LIBSTDCXX_FBSTRING
namespace std _GLIBCXX_VISIBILITY(default) {
#ifndef FOLLY_PORTABILITY_H_
#define FOLLY_PORTABILITY_H_
+#ifndef FOLLY_NO_CONFIG
#include "folly-config.h"
+#endif
#ifdef FOLLY_HAVE_FEATURES_H
#include <features.h>
#endif
+// portable version check
+#ifndef __GNUC_PREREQ
+# if defined __GNUC__ && defined __GNUC_MINOR__
+# define __GNUC_PREREQ(maj, min) ((__GNUC__ << 16) + __GNUC_MINOR__ >= \
+ ((maj) << 16) + (min))
+# else
+# define __GNUC_PREREQ(maj, min) 0
+# endif
+#endif
+
+
/* Define macro wrappers for C++11's "final" and "override" keywords, which
* are supported in gcc 4.7 but not gcc 4.6. */
#if !defined(FOLLY_FINAL) && !defined(FOLLY_OVERRIDE)
-# if defined(__clang__) || \
- (defined(__GNUC__) && defined(__GNUC_MINOR__) && \
- ((__GNUC__ << 16) + __GNUC_MINOR__) >= ((4 << 16) + 7))
+# if defined(__clang__) || __GNUC_PREREQ(4, 7)
# define FOLLY_FINAL final
# define FOLLY_OVERRIDE override
# else
// Define to 1 if you have the `preadv' and `pwritev' functions, respectively
#if !defined(FOLLY_HAVE_PREADV) && !defined(FOLLY_HAVE_PWRITEV)
-# if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
-# define FOLLY_HAVE_PREADV 1
-# define FOLLY_HAVE_PWRITEV 1
+# if defined(__GLIBC_PREREQ)
+# if __GLIBC_PREREQ(2, 10)
+# define FOLLY_HAVE_PREADV 1
+# define FOLLY_HAVE_PWRITEV 1
+# endif
# endif
#endif
#include <boost/thread/locks.hpp>
#include <boost/thread/mutex.hpp>
+#include <boost/thread/locks.hpp>
#include <glog/logging.h>
#include "folly/experimental/FileGen.h"
#include "folly/experimental/StringGen.h"
+#ifndef MAP_POPULATE
+#define MAP_POPULATE 0
+#endif
+
namespace folly {
namespace {
try {
new (&newp[pos]) value_type(std::move(*v));
} catch (...) {
- std::free(newh);
+ free(newh);
throw;
}
detail::moveToUninitialized(begin(), begin() + pos, newp);
} catch (...) {
newp[pos].~value_type();
- std::free(newh);
+ free(newh);
throw;
}
for (size_type i = 0; i <= pos; ++i) {
newp[i].~value_type();
}
- std::free(newh);
+ free(newh);
throw;
}
} else {
try {
detail::moveToUninitialized(begin(), end(), newp);
} catch (...) {
- std::free(newh);
+ free(newh);
throw;
}
}
void freeHeap() {
auto vp = detail::pointerFlagClear(pdata_.heap_);
- std::free(vp);
+ free(vp);
}
} FB_PACKED u;
} FB_PACKED;