2 * Check decoding of fchmodat syscall.
4 * Copyright (c) 2016-2018 Dmitry V. Levin <ldv@altlinux.org>
5 * Copyright (c) 2016-2019 The strace developers.
8 * SPDX-License-Identifier: GPL-2.0-or-later
17 # include <sys/stat.h>
24 static const char sample[] = "fchmodat_sample";
26 if (open(sample, O_RDONLY | O_CREAT, 0400) < 0)
27 perror_msg_and_fail("open");
29 long rc = syscall(__NR_fchmodat, -100, sample, 0600);
30 printf("fchmodat(AT_FDCWD, \"%s\", 0600) = %s\n",
31 sample, sprintrc(rc));
34 perror_msg_and_fail("unlink");
36 rc = syscall(__NR_fchmodat, -100, sample, 051);
37 printf("fchmodat(AT_FDCWD, \"%s\", 051) = %s\n",
38 sample, sprintrc(rc));
40 rc = syscall(__NR_fchmodat, -100, sample, 004);
41 printf("fchmodat(AT_FDCWD, \"%s\", 004) = %s\n",
42 sample, sprintrc(rc));
44 puts("+++ exited with 0 +++");
50 SKIP_MAIN_UNDEFINED("__NR_fchmodat")