blob: 2920db504dd7fe7e9e7daea5d09eda403f75706e [file] [log] [blame]
Fei Jief9141942016-04-21 15:53:51 +08001#include "tests.h"
2#include <sys/syscall.h>
3
4#ifdef __NR_access
5
Fei Jief9141942016-04-21 15:53:51 +08006# include <stdio.h>
7# include <unistd.h>
8
9int
10main(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",
Dmitry V. Levin9f6611b2016-04-21 17:49:32 +000016 sample, rc, errno2name());
Fei Jief9141942016-04-21 15:53:51 +080017
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",
Dmitry V. Levin9f6611b2016-04-21 17:49:32 +000020 sample, rc, errno2name());
Fei Jief9141942016-04-21 15:53:51 +080021
22 return 0;
23}
24
25#else
26
27SKIP_MAIN_UNDEFINED("__NR_access")
28
29#endif