File: randstat.c

package info (click to toggle)
rng-tools-debian 2.6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 368 kB
  • sloc: ansic: 2,690; sh: 200; makefile: 58
file content (26 lines) | stat: -rw-r--r-- 433 bytes parent folder | download | duplicates (2)
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
#include <sys/fcntl.h>
#include <sys/ioctl.h>
#include <sys/poll.h>
#include <linux/types.h>
#include <linux/random.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>

int main(int argc, char **argv)
{
	int random_fd;
	int ent_count;

	random_fd = open("/dev/random", O_RDONLY);

	if (random_fd < 0)
		return 1;

	if (ioctl(random_fd, RNDGETENTCNT, &ent_count) != 0)
		return 1;

	printf("%d\n", ent_count);

	return 0;
}