aboutsummaryrefslogtreecommitdiff
path: root/sys/src/mprotect.c
blob: 6d20dc1b6d2e7d2dc47ce766495c229cff3f2f0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include "internal.h"

int
sys·mprotect(void *addr, uintptr len, int prot)
{
    long ret;
    uintptr beg, end;

    beg = (uintptr)addr & -PAGESIZE;
    end = (uintptr)(addr + len + PAGESIZE-1) & -PAGESIZE;

    ret = syscall(·MProtect, beg, end-beg, prot);
    return error(ret);
}