#include <u.h>
#include <libc.h>
#define NODEFINE
#include <9pm/u.h>
#include <9pm/libc.h>

long
pm_randomread(void *a, long n)
{
	int fd;
	long m;

	fd = open("/dev/random", OREAD);
	if(fd < 0)
		sysfatal("open /dev/random: %r");
	werrstr("early eof");
	m = readn(fd, a, n);
	if(m != n)
		sysfatal("short read from /dev/random: %r");
	return n;
}


syntax highlighted by Code2HTML, v. 0.9.1