 +	return (0);
 +}
 +
-+#ifdef SYS_getrandom
-+static int
-+getentropy_getrandom(void *buf, size_t len)
-+{
-+	int pre_errno = errno;
-+	int ret;
-+	if (len > 256)
-+		return (-1);
-+	do {
-+		ret = syscall(SYS_getrandom, buf, len, 0);
-+	} while (ret == -1 && errno == EINTR);
-+
-+	if (ret != (int)len)
-+		return (-1);
-+	errno = pre_errno;
-+	return (0);
-+}
-+#endif
-+
 +static int
 +getentropy_urandom(void *buf, size_t len)
 +{
 +	struct stat st;
 +	size_t i;
-+	int fd, cnt, flags;
++	int fd, flags;
 +	int save_errno = errno;
 +
 +start:

+	errno = EIO;
+	return (-1);
+}
+
+#ifdef SYS__sysctl
+static int
+getentropy_sysctl(void *buf, size_t len)
+{
+	static int mib[] = { CTL_KERN, KERN_RANDOM, RANDOM_UUID };
+	size_t i;
+	int save_errno = errno;
+
+	for (i = 0; i < len; ) {
+		size_t chunk = min(len - i, 16);
+
+		/* SYS__sysctl because some systems already removed sysctl() */
+		struct __sysctl_args args = {
+			.name = mib,
+			.nlen = 3,
+			.oldval = (char *)buf + i,
+			.oldlenp = &chunk,
+		};
+		if (syscall(SYS__sysctl, &args) != 0)
+			goto sysctlfailed;
+		i += chunk;
+	}
+	if (gotdata(buf, len) == 0) {
+		errno = save_errno;
+		return (0);			/* satisfied */
+	}
+sysctlfailed:
+	errno = EIO;
+	return (-1);
+}
+#endif /* SYS__sysctl */
+
+static const int cl[] = {
+	CLOCK_REALTIME,

+#include <sys/param.h>
+#include <sys/ioctl.h>
+#include <sys/resource.h>
+#include <sys/syscall.h>
+#include <sys/statvfs.h>
+#include <sys/socket.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <link.h>
+#include <termios.h>
+#include <fcntl.h>
+#include <signal.h>
