move_pages: just use calloc
[trinity.git] / syscalls / mbind.c
blob47fec59a09465e1be0403d19828a0555b23724bd
1 /*
2 * SYSCALL_DEFINE6(mbind, unsigned long, start, unsigned long, len,
3 unsigned long, mode, unsigned long __user *, nmask,
4 unsigned long, maxnode, unsigned, flags)
5 */
7 #include <linux/mempolicy.h>
8 #include "arch.h"
9 #include "maps.h"
10 #include "random.h"
11 #include "sanitise.h"
12 #include "shm.h"
14 #define MPOL_F_STATIC_NODES (1 << 15)
15 #define MPOL_F_RELATIVE_NODES (1 << 14)
17 static void sanitise_mbind(int childno)
19 unsigned long maxnode;
21 (void) common_set_mmap_ptr_len(childno);
23 retry_maxnode:
24 shm->syscall[childno].a5 &= ~((page_size * 8) - 1);
26 maxnode = shm->syscall[childno].a5;
28 if (maxnode < 2 || maxnode > (page_size * 8)) {
29 shm->syscall[childno].a5 = rand32();
30 goto retry_maxnode;
35 struct syscallentry syscall_mbind = {
36 .name = "mbind",
37 .num_args = 6,
38 .arg1name = "start",
39 .arg1type = ARG_MMAP,
41 .arg2name = "len",
43 .arg3name = "mode",
44 .arg3type = ARG_LIST,
45 .arg3list = {
46 .num = 4,
47 .values = { MPOL_DEFAULT, MPOL_BIND, MPOL_INTERLEAVE, MPOL_PREFERRED },
50 .arg4name = "nmask",
51 .arg4type = ARG_ADDRESS,
53 .arg5name = "maxnode",
54 .arg5type = ARG_RANGE,
55 .low5range = 0,
56 .hi5range = 32,
58 .arg6name = "flags",
59 .arg6type = ARG_LIST,
60 .arg6list = {
61 .num = 2,
62 .values = { MPOL_F_STATIC_NODES, MPOL_F_RELATIVE_NODES },
64 .sanitise = sanitise_mbind,
65 .group = GROUP_VM,