Module Name: src
Committed By: christos
Date: Wed Dec 30 18:15:38 UTC 2015
Modified Files:
src/usr.bin/fstat: misc.c
Log Message:
Add rnd ops.
To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/fstat/misc.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/fstat/misc.c
diff -u src/usr.bin/fstat/misc.c:1.14 src/usr.bin/fstat/misc.c:1.15
--- src/usr.bin/fstat/misc.c:1.14 Sun Aug 10 12:44:37 2014
+++ src/usr.bin/fstat/misc.c Wed Dec 30 13:15:38 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: misc.c,v 1.14 2014/08/10 16:44:37 tls Exp $ */
+/* $NetBSD: misc.c,v 1.15 2015/12/30 18:15:38 christos Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: misc.c,v 1.14 2014/08/10 16:44:37 tls Exp $");
+__RCSID("$NetBSD: misc.c,v 1.15 2015/12/30 18:15:38 christos Exp $");
#define _KMEMUSER
#include <stdbool.h>
@@ -87,19 +87,21 @@ static struct nlist nl[] = {
{ .n_name = "pipeops" },
#define NL_PUTTER 9
{ .n_name = "putter_fileops", },
-#define NL_SEM 10
+#define NL_RND 10
+ { .n_name = "rnd_fileops", },
+#define NL_SEM 11
{ .n_name = "semops", },
-#define NL_SOCKET 11
+#define NL_SOCKET 12
{ .n_name = "socketops" },
-#define NL_SVR4_NET 12
+#define NL_SVR4_NET 13
{ .n_name = "svr4_netops" },
-#define NL_SVR4_32_NET 13
+#define NL_SVR4_32_NET 14
{ .n_name = "svr4_32_netops" },
-#define NL_TAP 14
+#define NL_TAP 15
{ .n_name = "tap_fileops", },
-#define NL_VNOPS 15
+#define NL_VNOPS 16
{ .n_name = "vnops" },
-#define NL_XENEVT 16
+#define NL_XENEVT 17
{ .n_name = "xenevt_fileops" },
#define NL_MAX 18
{ .n_name = NULL }
@@ -182,6 +184,34 @@ p_mqueue(struct file *f)
}
static int
+p_rnd(struct file *f)
+{
+ struct cprng_strong {
+ char cs_name[16];
+ int cs_flags;
+ /*...*/
+ } str;
+ struct rnd_ctx {
+ struct cprng_strong *rc_cprng;
+ bool rc_hard;
+ } ctx;
+ char buf[1024];
+
+ if (!KVM_READ(f->f_data, &ctx, sizeof(ctx))) {
+ dprintf("can't read rnd_ctx at %p for pid %d", f->f_data, Pid);
+ return 0;
+ }
+ if (!KVM_READ(ctx.rc_cprng, &str, sizeof(str))) {
+ dprintf("can't read cprng_strong at %p for pid %d", f->f_data,\
+ Pid);
+ return 0;
+ }
+ snprintb(buf, sizeof(buf), CPRNG_FMT, str.cs_flags);
+ (void)printf("* rnd \"%s\" flags %s\n", str.cs_name, buf);
+ return 0;
+}
+
+static int
p_kqueue(struct file *f)
{
struct kqueue kq;
@@ -225,6 +255,8 @@ pmisc(struct file *f, const char *name)
return p_mqueue(f);
case NL_KQUEUE:
return p_kqueue(f);
+ case NL_RND:
+ return p_rnd(f);
case NL_SEM:
return p_sem(f);
case NL_TAP: