summaryrefslogtreecommitdiffstats
path: root/access.c
diff options
context:
space:
mode:
Diffstat (limited to 'access.c')
-rw-r--r--access.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/access.c b/access.c
new file mode 100644
index 0000000..1f16552
--- /dev/null
+++ b/access.c
@@ -0,0 +1,29 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <stdint.h>
+#include <err.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stropts.h>
+
+#include "cachepc_user.h"
+
+int
+main(int argc, const char **argv)
+{
+ size_t i, len;
+ int fd, ret;
+ int count;
+
+ fd = open("/proc/cachepc", O_RDONLY);
+ if (fd < 0) err(1, "open");
+
+ for (i = 0; i < 50; i++) {
+ ret = ioctl(fd, CACHEPC_IOCTL_ACCESS_TEST, &count);
+ if (ret == -1) err(1, "ioctl fail");
+ printf("%i\n", count);
+ }
+
+ close(fd);
+}