am b7b36b81
: Merge "mmap: Reinstate passing MADV_MERGEABLE on private anonymous maps"
* commit 'b7b36b819e8029a152859f3204ba2da38a0e2879': mmap: Reinstate passing MADV_MERGEABLE on private anonymous maps
This commit is contained in:
commit
4763ef2b5b
@ -34,10 +34,17 @@ extern void* __mmap2(void*, size_t, int, int, int, size_t);
|
||||
#define MMAP2_SHIFT 12
|
||||
void* mmap(void *addr, size_t size, int prot, int flags, int fd, long offset)
|
||||
{
|
||||
void *ret;
|
||||
|
||||
if (offset & ((1UL << MMAP2_SHIFT)-1)) {
|
||||
errno = EINVAL;
|
||||
return MAP_FAILED;
|
||||
}
|
||||
|
||||
return __mmap2(addr, size, prot, flags, fd, (size_t)offset >> MMAP2_SHIFT);
|
||||
ret = __mmap2(addr, size, prot, flags, fd, (size_t)offset >> MMAP2_SHIFT);
|
||||
|
||||
if (ret && (flags & (MAP_PRIVATE | MAP_ANONYMOUS)))
|
||||
madvise(ret, size, MADV_MERGEABLE);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user