summaryrefslogtreecommitdiffstats
path: root/access.c
blob: 1f165525387dea41a4746e7fe92b8d7557476bce (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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);
}