Fei Jie | e2975b6 | 2016-03-25 17:47:15 +0800 | [diff] [blame^] | 1 | #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 | |
| 10 | # define TMP_FILE "faccessat_tmpfile" |
| 11 | |
| 12 | int |
| 13 | main(void) |
| 14 | { |
| 15 | const long int fd = (long int) 0xdeadbeefffffffff; |
| 16 | int rc = syscall(__NR_faccessat, fd, TMP_FILE, F_OK); |
| 17 | printf("faccessat(%d, \"%s\", F_OK) = %d %s (%m)\n", |
| 18 | (int) fd, TMP_FILE, rc, |
| 19 | errno == ENOSYS ? "ENOSYS" : "EBADF"); |
| 20 | |
| 21 | puts("+++ exited with 0 +++"); |
| 22 | return 0; |
| 23 | } |
| 24 | |
| 25 | #else |
| 26 | |
| 27 | SKIP_MAIN_UNDEFINED("__NR_faccessat") |
| 28 | |
| 29 | #endif |