]> granicus.if.org Git - strace/blob - tests/tee.c
Update copyright headers
[strace] / tests / tee.c
1 /*
2  * This file is part of tee strace test.
3  *
4  * Copyright (c) 2016-2018 Dmitry V. Levin <ldv@altlinux.org>
5  * All rights reserved.
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  */
9
10 #include "tests.h"
11 #include <asm/unistd.h>
12
13 #if defined __NR_tee
14
15 # include <stdio.h>
16 # include <unistd.h>
17
18 int
19 main(void)
20 {
21         const long int fd_in = (long int) 0xdeadbeefffffffffULL;
22         const long int fd_out = (long int) 0xdeadbeeffffffffeULL;
23         const size_t len = (size_t) 0xdeadbef3facefed3ULL;
24         const unsigned int flags = 15;
25
26         long rc = syscall(__NR_tee, fd_in, fd_out, len, flags);
27         printf("tee(%d, %d, %zu, %s) = %ld %s (%m)\n",
28                (int) fd_in, (int) fd_out, len,
29                "SPLICE_F_MOVE|SPLICE_F_NONBLOCK|SPLICE_F_MORE|SPLICE_F_GIFT",
30                rc, errno2name());
31
32         puts("+++ exited with 0 +++");
33         return 0;
34 }
35
36 #else
37
38 SKIP_MAIN_UNDEFINED("__NR_tee")
39
40 #endif