blob: 39c006a5d159f5ff4097d4eb5ee92a04595b1b0f [file] [log] [blame]
Fei Jiee2975b62016-03-25 17:47:15 +08001#include "tests.h"
2#include <sys/syscall.h>
3
4#ifdef __NR_faccessat
5
6# include <errno.h>
7# include <stdio.h>
8# include <unistd.h>
9
Fei Jiee2975b62016-03-25 17:47:15 +080010int
11main(void)
12{
Dmitry V. Levin90406df2016-03-28 00:16:17 +000013 static const char sample[] = "faccessat.sample";
Fei Jiee2975b62016-03-25 17:47:15 +080014 const long int fd = (long int) 0xdeadbeefffffffff;
Dmitry V. Levin90406df2016-03-28 00:16:17 +000015
16 int rc = syscall(__NR_faccessat, fd, sample, F_OK);
Fei Jiee2975b62016-03-25 17:47:15 +080017 printf("faccessat(%d, \"%s\", F_OK) = %d %s (%m)\n",
Dmitry V. Levin90406df2016-03-28 00:16:17 +000018 (int) fd, sample, rc,
Fei Jiee2975b62016-03-25 17:47:15 +080019 errno == ENOSYS ? "ENOSYS" : "EBADF");
20
21 puts("+++ exited with 0 +++");
22 return 0;
23}
24
25#else
26
27SKIP_MAIN_UNDEFINED("__NR_faccessat")
28
29#endif