move_pages: just use calloc
[trinity.git] / syscalls / mprotect.c
blob478c578b2ae1cb89d2420885bff0f290cc8ea7f8
1 /*
2 * sys_mprotect(unsigned long start, size_t len, unsigned long prot)
3 */
4 #include <asm/mman.h>
5 #include "arch.h"
6 #include "maps.h"
7 #include "random.h"
8 #include "sanitise.h"
9 #include "shm.h"
10 #include "utils.h"
12 static void sanitise_mprotect(int childno)
14 (void) common_set_mmap_ptr_len(childno);
18 * If we successfully did an mprotect, update our record of the mappings prot bits.
20 static void post_mprotect(int childno)
22 struct map *map = (struct map *) shm->scratch[childno];
24 if (shm->syscall[childno].retval != 0)
25 map->prot = shm->syscall[childno].a3;
27 shm->scratch[childno] = 0;
30 struct syscallentry syscall_mprotect = {
31 .name = "mprotect",
32 .num_args = 3,
33 .arg1name = "start",
34 .arg1type = ARG_MMAP,
35 .arg2name = "len",
36 .arg3name = "prot",
37 .arg3type = ARG_LIST,
38 .arg3list = {
39 .num = 6,
40 .values = { PROT_READ, PROT_WRITE, PROT_EXEC, PROT_SEM, PROT_GROWSDOWN, PROT_GROWSUP },
42 .sanitise = sanitise_mprotect,
43 .group = GROUP_VM,
44 .post = post_mprotect,