1 /*
2 * Copyright (c) 2017-2021 The strace developers.
3 * All rights reserved.
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
7
8 #include "tests.h"
9 #include "scno.h"
10
11 #include <linux/stat.h>
12 #include "xlat.h"
13 #include "xlat/statx_masks.h"
14 #include "xlat/statx_attrs.h"
15 #include "xlat/at_statx_sync_types.h"
16
17 #define IS_STATX 1
18 #define TEST_SYSCALL_STR "statx"
19 #define STRUCT_STAT struct statx
20 #define STRUCT_STAT_STR "struct statx"
21 #define STRUCT_STAT_IS_STAT64 0
22
23 static unsigned TEST_SYSCALL_STATX_FLAGS = AT_STATX_SYNC_AS_STAT;
24 static const char *TEST_SYSCALL_STATX_FLAGS_STR = "AT_STATX_SYNC_AS_STAT";
25 static unsigned TEST_SYSCALL_STATX_MASK = STATX_ALL;
26 static const char *TEST_SYSCALL_STATX_MASK_STR = "STATX_ALL";
27
28 #define TEST_SYSCALL_INVOKE(sample, pst) \
29 syscall(__NR_statx, AT_FDCWD, sample, TEST_SYSCALL_STATX_FLAGS, \
30 TEST_SYSCALL_STATX_MASK, pst)
31 #define PRINT_SYSCALL_HEADER(sample) \
32 do { \
33 int saved_errno = errno; \
34 printf("%s(AT_FDCWD, \"%s\", %s, %s, ", \
35 TEST_SYSCALL_STR, sample, TEST_SYSCALL_STATX_FLAGS_STR, \
36 TEST_SYSCALL_STATX_MASK_STR)
37 #define PRINT_SYSCALL_FOOTER(rc) \
38 errno = saved_errno; \
39 printf(") = %s\n", sprintrc(rc)); \
40 } while (0)
41
42 #include "xstatx.c"