]> git.ipfire.org Git - thirdparty/rng-tools.git/blob - contrib/randstat.c
Import rng-tools from private subversion repo.
[thirdparty/rng-tools.git] / contrib / randstat.c
1
2
3 #include <sys/fcntl.h>
4 #include <sys/ioctl.h>
5 #include <sys/poll.h>
6 #include <linux/types.h>
7 #include <linux/random.h>
8 #include <unistd.h>
9 #include <stdio.h>
10 #include <string.h>
11
12 int main(int argc, char **argv)
13 {
14 int random_fd;
15 int ent_count;
16
17 random_fd = open("/dev/random", O_RDONLY);
18
19 if (random_fd < 0)
20 return 1;
21
22 if (ioctl(random_fd, RNDGETENTCNT, &ent_count) != 0)
23 return 1;
24
25 printf("%d\n", ent_count);
26
27 return 0;
28 }
29