/* Cache the pagesize for the current host machine. Note that if the host
does not readily provide a getpagesize() function, we need to emulate it
/* Cache the pagesize for the current host machine. Note that if the host
does not readily provide a getpagesize() function, we need to emulate it
} else if (size < 0) {
/* We are deallocating memory. If the amount requested would cause
us to try to deallocate back past the base of the mmap'd region
} else if (size < 0) {
/* We are deallocating memory. If the amount requested would cause
us to try to deallocate back past the base of the mmap'd region
/* We are allocating memory. Make sure we have an open file
descriptor if not working with anonymous memory. */
if (!(mdp->flags & MMALLOC_ANONYMOUS) && mdp->fd < 0) {
/* We are allocating memory. Make sure we have an open file
descriptor if not working with anonymous memory. */
if (!(mdp->flags & MMALLOC_ANONYMOUS) && mdp->fd < 0) {
result = NULL;
} else if ((char *) mdp->breakval + size > (char *) mdp->top) {
/* The request would move us past the end of the currently
result = NULL;
} else if ((char *) mdp->breakval + size > (char *) mdp->top) {
/* The request would move us past the end of the currently
MAP_PRIVATE_OR_SHARED(mdp) | MAP_IS_ANONYMOUS(mdp) |
MAP_FIXED, MAP_ANON_OR_FD(mdp), foffset);
MAP_PRIVATE_OR_SHARED(mdp) | MAP_IS_ANONYMOUS(mdp) |
MAP_FIXED, MAP_ANON_OR_FD(mdp), foffset);
mdp->top = PAGE_ALIGN((char *) mdp->breakval + size);
result = (void *) mdp->breakval;
mdp->breakval = (char *) mdp->breakval + size;
mdp->top = PAGE_ALIGN((char *) mdp->breakval + size);
result = (void *) mdp->breakval;
mdp->breakval = (char *) mdp->breakval + size;