create a set_rand_bitmask function and use instead of open-coding.
[trinity.git] / syscalls / write.c
blob3a61059b3acaca1320d79b74b93339d1238f0cb8
1 /*
2 * SYSCALL_DEFINE3(write, unsigned int, fd, const char __user *, buf, size_t, count)
3 */
4 #include <stdlib.h>
5 #include "arch.h" // page_size
6 #include "maps.h"
7 #include "sanitise.h"
8 #include "shm.h"
10 static void sanitise_write(int childno)
12 if ((rand() % 100) > 50)
13 shm->syscall[childno].a3 = 1;
14 else
15 shm->syscall[childno].a3 = rand() % page_size;
18 struct syscallentry syscall_write = {
19 .name = "write",
20 .num_args = 3,
21 .sanitise = sanitise_write,
22 .arg1name = "fd",
23 .arg1type = ARG_FD,
24 .arg2name = "buf",
25 .arg2type = ARG_NON_NULL_ADDRESS,
26 .arg3name = "count",
27 .arg3type = ARG_LEN,
28 .flags = NEED_ALARM,