]> granicus.if.org Git - strace/blob - tests/statx.c
Update copyright headers
[strace] / tests / statx.c
1 /*
2  * Copyright (c) 2017-2018 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 <asm/unistd.h>
10
11 #ifdef __NR_statx
12
13 # include <linux/stat.h>
14 # include "xlat.h"
15 # include "xlat/statx_masks.h"
16 # include "xlat/statx_attrs.h"
17 # include "xlat/at_statx_sync_types.h"
18
19 # define IS_STATX 1
20 # define TEST_SYSCALL_STR "statx"
21 # define STRUCT_STAT struct statx
22 # define STRUCT_STAT_STR "struct statx"
23 # define STRUCT_STAT_IS_STAT64 0
24
25 static unsigned    TEST_SYSCALL_STATX_FLAGS     = AT_STATX_SYNC_AS_STAT;
26 static const char *TEST_SYSCALL_STATX_FLAGS_STR = "AT_STATX_SYNC_AS_STAT";
27 static unsigned    TEST_SYSCALL_STATX_MASK      = STATX_ALL;
28 static const char *TEST_SYSCALL_STATX_MASK_STR  = "STATX_ALL";
29
30 # define TEST_SYSCALL_INVOKE(sample, pst) \
31         syscall(__NR_statx, AT_FDCWD, sample, TEST_SYSCALL_STATX_FLAGS, \
32                 TEST_SYSCALL_STATX_MASK, pst)
33 # define PRINT_SYSCALL_HEADER(sample) \
34         do { \
35                 int saved_errno = errno; \
36                 printf("%s(AT_FDCWD, \"%s\", %s, %s, ", \
37                        TEST_SYSCALL_STR, sample, TEST_SYSCALL_STATX_FLAGS_STR, \
38                        TEST_SYSCALL_STATX_MASK_STR)
39 # define PRINT_SYSCALL_FOOTER(rc) \
40                 errno = saved_errno; \
41                 printf(") = %s\n", sprintrc(rc)); \
42         } while (0)
43
44 # include "xstatx.c"
45
46 #else
47
48 SKIP_MAIN_UNDEFINED("__NR_statx")
49
50 #endif