summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDaniel Black <daniel@linux.ibm.com>2019-09-23 18:28:55 +1000
committerSergey Vojtovich <svoj@mariadb.org>2019-10-02 20:00:05 +0400
commit716c748f97d8f7cb7caaf39dd7b9cdaf79b2229a (patch)
treec6e5ea5d6bf7832d37ac73738cc513562a575011 /include
parent7e44c455f4de82081af5089e1f77378676aa45ff (diff)
downloadmariadb-git-716c748f97d8f7cb7caaf39dd7b9cdaf79b2229a.tar.gz
MDEV-20684: innodb/query cache use madvise CORE/NOCORE on FreeBSD
This applies to large allocations. This maps to the way Linux does it in MDEV-10814 except FreeBSD uses different constants. Adjust error string to match to implementation. Tested on FreeBSD-12.0
Diffstat (limited to 'include')
-rw-r--r--include/my_global.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/my_global.h b/include/my_global.h
index 819d388f367..a1cecdd8a6f 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 <sys/mman.h>
+#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 */