修复macos编译
This commit is contained in:
parent
19c2b0fe2b
commit
c19236283b
17
third_party/mempool/mempool/ncx_slab.c
vendored
17
third_party/mempool/mempool/ncx_slab.c
vendored
@ -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 <mach/mach.h>
|
||||
#include <mach/mach_host.h>
|
||||
#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 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user