rm wtf
This commit is contained in:
parent
fd98f7f4fb
commit
e5bcf53b17
|
@ -265,15 +265,17 @@ static void *alloc_pages(mpool_t *mp_p, const unsigned int page_n,
|
||||||
|
|
||||||
|
|
||||||
state = MAP_PRIVATE;
|
state = MAP_PRIVATE;
|
||||||
|
|
||||||
#if defined(MAP_FILE)
|
#if defined(MAP_FILE)
|
||||||
state |= MAP_FILE;
|
state |= MAP_FILE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MAP_VARIABLE)
|
#if defined(MAP_VARIABLE)
|
||||||
state |= MAP_VARIABLE;
|
state |= MAP_VARIABLE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* mmap from /dev/zero */
|
/* mmap from /dev/zero */
|
||||||
mem = mmap(mp_p->mp_addr, size, mp_p->mp_mmflags, state,
|
mem = mmap(mp_p->mp_addr, size, PROT_READ | PROT_WRITE, state | mp_p->mp_mmflags,
|
||||||
mp_p->mp_fd, mp_p->mp_top);
|
mp_p->mp_fd, mp_p->mp_top);
|
||||||
if (mem == (void *)MAP_FAILED) {
|
if (mem == (void *)MAP_FAILED) {
|
||||||
if (errno == ENOMEM) {
|
if (errno == ENOMEM) {
|
||||||
|
@ -283,12 +285,13 @@ static void *alloc_pages(mpool_t *mp_p, const unsigned int page_n,
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
mp_p->mp_top += size;
|
mp_p->mp_top += size;
|
||||||
|
|
||||||
if (mp_p->mp_addr != NULL) {
|
if (mp_p->mp_addr != NULL) {
|
||||||
mp_p->mp_addr = (char *)mp_p->mp_addr + size;
|
mp_p->mp_addr = (char *)mp_p->mp_addr + size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
mp_p->mp_page_c += page_n;
|
mp_p->mp_page_c += page_n;
|
||||||
|
|
||||||
SET_POINTER(error_p, MPOOL_ERROR_NONE);
|
SET_POINTER(error_p, MPOOL_ERROR_NONE);
|
||||||
|
@ -932,7 +935,7 @@ mpool_t *mpool_open(const unsigned int flags, const unsigned int page_size,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mp.mp_mmflags = PROT_READ | PROT_WRITE;
|
mp.mp_mmflags = 0;
|
||||||
|
|
||||||
if (BIT_IS_SET(flags, MPOOL_FLAG_ANONYMOUS)) {
|
if (BIT_IS_SET(flags, MPOOL_FLAG_ANONYMOUS)) {
|
||||||
mp.mp_fd = -1;
|
mp.mp_fd = -1;
|
||||||
|
@ -1109,7 +1112,7 @@ int mpool_close(mpool_t *mp_p)
|
||||||
addr = mp_p;
|
addr = mp_p;
|
||||||
}
|
}
|
||||||
size = SIZE_OF_PAGES(mp_p, PAGES_IN_SIZE(mp_p, sizeof(mpool_t)));
|
size = SIZE_OF_PAGES(mp_p, PAGES_IN_SIZE(mp_p, sizeof(mpool_t)));
|
||||||
printf("WTF\n");
|
|
||||||
(void)munmap(addr, size);
|
(void)munmap(addr, size);
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue