diff --git a/third_party/mempool/mempool/ncx_slab.c b/third_party/mempool/mempool/ncx_slab.c index ee87f74..57dcc34 100644 --- a/third_party/mempool/mempool/ncx_slab.c +++ b/third_party/mempool/mempool/ncx_slab.c @@ -60,6 +60,11 @@ static ncx_uint_t ncx_pagesize; static ncx_uint_t ncx_pagesize_shift; static ncx_uint_t ncx_real_pages; +#ifdef __APPLE__ +#include +#include +#endif + void ncx_slab_init(ncx_slab_pool_t* pool) { u_char* p; size_t size; @@ -67,7 +72,13 @@ void ncx_slab_init(ncx_slab_pool_t* pool) { ncx_slab_page_t* slots; /*pagesize*/ +#ifdef __APPLE__ + vm_size_t pagesize; + host_page_size(mach_host_self(), &pagesize); + ncx_pagesize = pagesize; +#else ncx_pagesize = getpagesize(); +#endif for (n = ncx_pagesize, ncx_pagesize_shift = 0; n >>= 1; ncx_pagesize_shift++) { /* void */ @@ -669,7 +680,13 @@ static void ncx_slab_free_pages(ncx_slab_pool_t* pool, ncx_slab_page_t* page, void ncx_slab_dummy_init(ncx_slab_pool_t* pool) { ncx_uint_t n; +#ifdef __APPLE__ + vm_size_t pagesize; + host_page_size(mach_host_self(), &pagesize); + ncx_pagesize = pagesize; +#else ncx_pagesize = getpagesize(); +#endif for (n = ncx_pagesize, ncx_pagesize_shift = 0; n >>= 1; ncx_pagesize_shift++) { /* void */