split up constants.h some
[trinity.git] / syscalls / tee.c
blobafaac23283cac6ddfa738479b376e014a2517750
1 /*
2 * SYSCALL_DEFINE4(tee, int, fdin, int, fdout, size_t, len, unsigned int, flags)
3 */
4 #include <stdlib.h>
5 #include "sanitise.h"
6 #include "shm.h"
8 # define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
9 # define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
10 (but we may still block on the fd
11 we splice from/to). */
12 # define SPLICE_F_MORE 4 /* Expect more data. */
13 # define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
15 static void sanitise_tee(int childno)
17 if ((rand() % 10) > 0) {
18 shm->syscall[childno].a1 = shm->pipe_fds[rand() % MAX_PIPE_FDS];
19 shm->syscall[childno].a2 = shm->pipe_fds[rand() % MAX_PIPE_FDS];
23 struct syscallentry syscall_tee = {
24 .name = "tee",
25 .num_args = 4,
26 .arg1name = "fdin",
27 .arg1type = ARG_FD,
28 .arg2name = "fdout",
29 .arg2type = ARG_FD,
30 .arg3name = "len",
31 .arg3type = ARG_LEN,
32 .arg4name = "flags",
33 .arg4type = ARG_LIST,
34 .arg4list = {
35 .num = 4,
36 .values = { SPLICE_F_MOVE, SPLICE_F_NONBLOCK, SPLICE_F_MORE, SPLICE_F_GIFT },
38 .sanitise = sanitise_tee,
39 .flags = NEED_ALARM,