X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fmman%2Fmprotect.c;h=5ab2d8b0278896ace8109eed8251a3e72abe8c47;hb=ea34b1b90ca5ba3b87725662f6a1ff03b7a88a1f;hp=11d5e23110156e60c71a217a484fdee44d8a3c21;hpb=0b44a0315b47dd8eced9f3b7f31580cf14bbfc01;p=musl diff --git a/src/mman/mprotect.c b/src/mman/mprotect.c index 11d5e231..5ab2d8b0 100644 --- a/src/mman/mprotect.c +++ b/src/mman/mprotect.c @@ -1,7 +1,11 @@ #include +#include #include "syscall.h" int mprotect(void *addr, size_t len, int prot) { - return syscall3(__NR_mprotect, (long)addr, len, prot); + size_t start, end; + start = (size_t)addr & -PAGE_SIZE; + end = (size_t)((char *)addr + len + PAGE_SIZE-1) & -PAGE_SIZE; + return syscall(SYS_mprotect, start, end-start, prot); }