diff options
| author | christos <christos@NetBSD.org> | 2015-12-30 18:15:38 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2015-12-30 18:15:38 +0000 |
| commit | 7572f9b11a3e950588599bdc2b59438795ccd228 (patch) | |
| tree | f1e1bb3592d88335156ccca94fd12c8e06b6d120 /usr.bin/fstat | |
| parent | c884057dce97b65979641dafae4a110e73dc1a95 (diff) | |
Add rnd ops.
Diffstat (limited to 'usr.bin/fstat')
| -rw-r--r-- | usr.bin/fstat/misc.c | 50 |
1 files changed, 41 insertions, 9 deletions
diff --git a/usr.bin/fstat/misc.c b/usr.bin/fstat/misc.c index a37ca95397e..31c32b30ca2 100644 --- a/usr.bin/fstat/misc.c +++ b/usr.bin/fstat/misc.c @@ -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: |
