From 2254e20d4cc5d497cd8bcdb0fd50098408534e75 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Wed, 22 Jul 2020 10:54:58 +0100 Subject: [PATCH] some apis are available on Illumos which are not available on stock Solaris thus availability evelavated from cflags. discard some sporadically for large pages support mainly. --- src/os.c | 8 ++++++++ src/static.c | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/src/os.c b/src/os.c index 8079e5a0..24252c85 100644 --- a/src/os.c +++ b/src/os.c @@ -8,6 +8,14 @@ terms of the MIT license. A copy of the license can be found in the file #define _DEFAULT_SOURCE // ensure mmap flags are defined #endif +#if defined(__sun) +// illumos provides new mman.h api when any of these are defined +// otherwise the old api based on caddr_t which predates the void pointers one. +// stock solaris provides only the former, chose to atomically to discard those +// flags only here rather than project wide tough. +#undef _XOPEN_SOURCE +#undef _POSIX_C_SOURCE +#endif #include "mimalloc.h" #include "mimalloc-internal.h" #include "mimalloc-atomic.h" diff --git a/src/static.c b/src/static.c index bf86166d..4fafb4f5 100644 --- a/src/static.c +++ b/src/static.c @@ -5,6 +5,11 @@ terms of the MIT license. A copy of the license can be found in the file "LICENSE" at the root of this distribution. -----------------------------------------------------------------------------*/ #define _DEFAULT_SOURCE +#if defined(__sun) +// same remarks as os.c for the static's context. +#undef _XOPEN_SOURCE +#undef _POSIX_C_SOURCE +#endif #include "mimalloc.h" #include "mimalloc-internal.h"