diff options
| author | Louis Burda <quent.burda@gmail.com> | 2022-08-13 16:44:04 +0200 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2022-08-13 16:45:08 +0200 |
| commit | 98babf91dcf166bc7644a3d70a90dac272f12a75 (patch) | |
| tree | 529acab95367ae6ed35eddf0731ee82f73c94842 /test/access.c | |
| parent | 88d598bc2894c28d8dd9c2259c5c8cbe2ec7ce55 (diff) | |
| download | cachepc-98babf91dcf166bc7644a3d70a90dac272f12a75.tar.gz cachepc-98babf91dcf166bc7644a3d70a90dac272f12a75.zip | |
Reorder repo into module and tests
Diffstat (limited to 'test/access.c')
| -rw-r--r-- | test/access.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/access.c b/test/access.c new file mode 100644 index 0000000..636471e --- /dev/null +++ b/test/access.c @@ -0,0 +1,29 @@ +#include "cachepc_user.h" + +#include <stdlib.h> +#include <stdio.h> +#include <fcntl.h> +#include <stdint.h> +#include <err.h> +#include <fcntl.h> +#include <unistd.h> +#include <stropts.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); +} |
