Elliott Hughes | d35df49 | 2017-02-15 15:19:05 -0800 | [diff] [blame] | 1 | #include "tests.h" |
| 2 | #include <asm/unistd.h> |
| 3 | |
| 4 | #ifdef __NR_access |
| 5 | |
| 6 | # include <stdio.h> |
| 7 | # include <unistd.h> |
| 8 | |
| 9 | int |
| 10 | main(void) |
| 11 | { |
| 12 | static const char sample[] = "access_sample"; |
| 13 | |
| 14 | long rc = syscall(__NR_access, sample, F_OK); |
| 15 | printf("access(\"%s\", F_OK) = %ld %s (%m)\n", |
| 16 | sample, rc, errno2name()); |
| 17 | |
| 18 | rc = syscall(__NR_access, sample, R_OK|W_OK|X_OK); |
| 19 | printf("access(\"%s\", R_OK|W_OK|X_OK) = %ld %s (%m)\n", |
| 20 | sample, rc, errno2name()); |
| 21 | |
Elliott Hughes | 39bac05 | 2017-05-25 16:56:11 -0700 | [diff] [blame^] | 22 | puts("+++ exited with 0 +++"); |
Elliott Hughes | d35df49 | 2017-02-15 15:19:05 -0800 | [diff] [blame] | 23 | return 0; |
| 24 | } |
| 25 | |
| 26 | #else |
| 27 | |
| 28 | SKIP_MAIN_UNDEFINED("__NR_access") |
| 29 | |
| 30 | #endif |