diff --git a/include/my_global.h b/include/my_global.h index 819d388f36761..a1cecdd8a6f0d 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -445,6 +445,20 @@ C_MODE_END #if HAVE_MADVISE && !HAVE_DECL_MADVISE && defined(__cplusplus) extern "C" int madvise(void *addr, size_t len, int behav); #endif +#ifdef HAVE_SYS_MMAN_H +#include +#endif +/** FreeBSD equivalent */ +#if defined(MADV_CORE) && !defined(MADV_DODUMP) +#define MADV_DODUMP MADV_CORE +#define MADV_DONTDUMP MADV_NOCORE +#define DODUMP_STR "MADV_CORE" +#define DONTDUMP_STR "MADV_NOCORE" +#else +#define DODUMP_STR "MADV_DODUMP" +#define DONTDUMP_STR "MADV_DONTDUMP" +#endif + #define QUOTE_ARG(x) #x /* Quote argument (before cpp) */ #define STRINGIFY_ARG(x) QUOTE_ARG(x) /* Quote argument, after cpp */ diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index c44be9a11f5ed..7052572568995 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -2662,7 +2662,7 @@ size_t Query_cache::init_cache() #if defined(DBUG_OFF) && defined(HAVE_MADVISE) && defined(MADV_DONTDUMP) if (madvise(cache, query_cache_size+additional_data_size, MADV_DONTDUMP)) { - DBUG_PRINT("warning", ("coudn't mark query cache memory as MADV_DONTDUMP: %s", + DBUG_PRINT("warning", ("coudn't mark query cache memory as " DONTDUMP_STR ": %s", strerror(errno))); } #endif @@ -2831,7 +2831,7 @@ void Query_cache::free_cache() #if defined(DBUG_OFF) && defined(HAVE_MADVISE) && defined(MADV_DODUMP) if (madvise(cache, query_cache_size+additional_data_size, MADV_DODUMP)) { - DBUG_PRINT("warning", ("coudn't mark query cache memory as MADV_DODUMP: %s", + DBUG_PRINT("warning", ("coudn't mark query cache memory as " DODUMP_STR ": %s", strerror(errno))); } #endif diff --git a/storage/innobase/include/ut0new.h b/storage/innobase/include/ut0new.h index 6732a12ecf1f3..46867a6002382 100644 --- a/storage/innobase/include/ut0new.h +++ b/storage/innobase/include/ut0new.h @@ -252,7 +252,7 @@ static inline void ut_allocate_trace_dontdump(void *ptr, size_t bytes, #if defined(DBUG_OFF) && defined(HAVE_MADVISE) && defined(MADV_DONTDUMP) if (dontdump && madvise(ptr, bytes, MADV_DONTDUMP)) { - ib::warn() << "Failed to set memory to DONTDUMP: " + ib::warn() << "Failed to set memory to " DONTDUMP_STR ": " << strerror(errno) << " ptr " << ptr << " size " << bytes; @@ -270,7 +270,7 @@ static inline void ut_allocate_trace_dontdump(void *ptr, size_t bytes, static inline void ut_dodump(void* ptr, size_t m_size) { if (ptr && madvise(ptr, m_size, MADV_DODUMP)) { - ib::warn() << "Failed to set memory to DODUMP: " + ib::warn() << "Failed to set memory to " DODUMP_STR ": " << strerror(errno) << " ptr " << ptr << " size " << m_size;