2 * Check decoding of fchmodat syscall.
4 * Copyright (c) 2016-2018 Dmitry V. Levin <ldv@altlinux.org>
7 * SPDX-License-Identifier: GPL-2.0-or-later
11 #include <asm/unistd.h>
16 # include <sys/stat.h>
23 static const char sample[] = "fchmodat_sample";
25 if (open(sample, O_RDONLY | O_CREAT, 0400) < 0)
26 perror_msg_and_fail("open");
28 long rc = syscall(__NR_fchmodat, -100, sample, 0600);
29 printf("fchmodat(AT_FDCWD, \"%s\", 0600) = %s\n",
30 sample, sprintrc(rc));
33 perror_msg_and_fail("unlink");
35 rc = syscall(__NR_fchmodat, -100, sample, 051);
36 printf("fchmodat(AT_FDCWD, \"%s\", 051) = %s\n",
37 sample, sprintrc(rc));
39 rc = syscall(__NR_fchmodat, -100, sample, 004);
40 printf("fchmodat(AT_FDCWD, \"%s\", 004) = %s\n",
41 sample, sprintrc(rc));
43 puts("+++ exited with 0 +++");
49 SKIP_MAIN_UNDEFINED("__NR_fchmodat")