1 /*
2 * Check decoding of copy_file_range syscall.
3 *
4 * Copyright (c) 2016 Dmitry V. Levin <ldv@strace.io>
5 * Copyright (c) 2016-2021 The strace developers.
6 * All rights reserved.
7 *
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
10
11 #include "tests.h"
12 #include "scno.h"
13
14 #include <stdio.h>
15 #include <unistd.h>
16
17 int
18 main(void)
19 {
20 const long int fd_in = (long int) 0xdeadbeefffffffff;
21 const long int fd_out = (long int) 0xdeadbeeffffffffe;
22 TAIL_ALLOC_OBJECT_CONST_PTR(long long int, off_in);
23 TAIL_ALLOC_OBJECT_CONST_PTR(long long int, off_out);
24 *off_in = 0xdeadbef1facefed1;
25 *off_out = 0xdeadbef2facefed2;
26 const size_t len = (size_t) 0xdeadbef3facefed3ULL;
27 const unsigned int flags = 0;
28
29 long rc = syscall(__NR_copy_file_range,
30 fd_in, off_in, fd_out, off_out, len, flags);
31 printf("copy_file_range(%d, [%lld], %d, [%lld], %zu, %u)"
32 " = %ld %s (%m)\n",
33 (int) fd_in, *off_in, (int) fd_out, *off_out, len, flags,
34 rc, errno2name());
35
36 puts("+++ exited with 0 +++");
37 return 0;
38 }