2 * SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len)
14 static void sanitise_munmap(int childno
)
18 unsigned long nr_pages
;
19 unsigned long offset
, offsetpagenr
;
21 map
= common_set_mmap_ptr_len(childno
);
25 switch (rand() % 20) {
27 /* delete the whole mapping. */
32 /* unmap a range of the mapping. */
33 nr_pages
= map
->size
/ page_size
;
34 offsetpagenr
= (rand() % nr_pages
);
35 offset
= offsetpagenr
* page_size
;
36 shm
->syscall
[childno
].a1
= (unsigned long) map
->ptr
+ offset
;
38 len
= (rand() % (nr_pages
- offsetpagenr
)) + 1;
40 shm
->syscall
[childno
].a2
= len
;
44 /* just unmap 1 page of the mapping. */
45 shm
->syscall
[childno
].a1
= (unsigned long) map
->ptr
;
46 shm
->syscall
[childno
].a1
+= (rand() % map
->size
) & PAGE_MASK
;
47 shm
->syscall
[childno
].a2
= page_size
;
55 static void post_munmap(int childno
)
57 struct map
*map
= (struct map
*) shm
->scratch
[childno
];
59 if (shm
->syscall
[childno
].retval
!= 0)
63 delete_mapping(childno
, map
);
65 shm
->scratch
[childno
] = 0;
68 struct syscallentry syscall_munmap
= {
75 .sanitise
= sanitise_munmap
,