2 * Check decoding of fadvise64 syscall.
4 * Copyright (c) 2016 Eugene Syromyatnikov <evgsyr@gmail.com>
5 * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
6 * Copyright (c) 2016-2019 The strace developers.
9 * SPDX-License-Identifier: GPL-2.0-or-later
21 do_fadvise(long fd, long long offset, long long llen, long advice)
26 # if (LONG_MAX > INT_MAX) \
27 || (defined __x86_64__ && defined __ILP32__) \
28 || defined LINUX_MIPSN32
29 ret = syscall(__NR_fadvise64, fd, offset, llen, advice);
30 errstr = sprintrc(ret);
31 printf("fadvise64(%d, %lld, %llu, ", (int) fd, offset, llen);
32 # elif defined LINUX_MIPSO32
33 ret = syscall(__NR_fadvise64, fd, 0,
34 LL_VAL_TO_PAIR(offset), LL_VAL_TO_PAIR(llen), advice);
35 errstr = sprintrc(ret);
36 printf("fadvise64(%d, %lld, %lld, ", (int) fd, offset, llen);
37 # else /* LONG_MAX == INT_MAX && !X32 && !LINUX_MIPSN32 */
38 long len = (long) llen;
40 ret = syscall(__NR_fadvise64, fd, 0,
41 LL_VAL_TO_PAIR(offset), len, advice);
43 ret = syscall(__NR_fadvise64, fd,
44 LL_VAL_TO_PAIR(offset), len, advice);
46 errstr = sprintrc(ret);
47 printf("fadvise64(%d, %lld, %lu, ", (int) fd, offset, len);
48 # endif /* LONG_MAX == INT_MAX && !X32 && !LINUX_MIPSN32 */
49 printxval(advise, (unsigned) advice, "POSIX_FADV_???");
50 printf(") = %s\n", errstr);
55 SKIP_MAIN_UNDEFINED("__NR_fadvise64");