support printing rnd descriptor info
This commit is contained in:
parent
48ee8a077a
commit
3d7bb1da45
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: misc.c,v 1.10 2012/11/25 01:05:49 christos Exp $ */
|
||||
/* $NetBSD: misc.c,v 1.11 2012/11/25 15:30:28 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
@ -30,7 +30,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: misc.c,v 1.10 2012/11/25 01:05:49 christos Exp $");
|
||||
__RCSID("$NetBSD: misc.c,v 1.11 2012/11/25 15:30:28 christos Exp $");
|
||||
|
||||
#define _KMEMUSER
|
||||
#include <stdbool.h>
|
||||
@ -50,6 +50,10 @@ __RCSID("$NetBSD: misc.c,v 1.10 2012/11/25 01:05:49 christos Exp $");
|
||||
#include <sys/file.h>
|
||||
#define copyout_t int
|
||||
#include <sys/ksem.h>
|
||||
#define _LIB_LIBKERN_LIBKERN_H_
|
||||
#define mutex_enter(a)
|
||||
#define mutex_exit(a)
|
||||
#include <sys/cprng.h>
|
||||
#undef _KERNEL
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/mount.h>
|
||||
@ -57,6 +61,7 @@ __RCSID("$NetBSD: misc.c,v 1.10 2012/11/25 01:05:49 christos Exp $");
|
||||
#include <net/bpfdesc.h>
|
||||
|
||||
#include <err.h>
|
||||
#include <util.h>
|
||||
#include <string.h>
|
||||
#include <kvm.h>
|
||||
#include "fstat.h"
|
||||
@ -96,7 +101,9 @@ static struct nlist nl[] = {
|
||||
{ .n_name = "vnops" },
|
||||
#define NL_XENEVT 16
|
||||
{ .n_name = "xenevt_fileops" },
|
||||
#define NL_MAX 17
|
||||
#define NL_RND 17
|
||||
{ .n_name = "rnd_fileops" },
|
||||
#define NL_MAX 18
|
||||
{ .n_name = NULL }
|
||||
};
|
||||
|
||||
@ -189,6 +196,35 @@ p_kqueue(struct file *f)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
p_rnd(struct file *f)
|
||||
{
|
||||
rp_ctx_t rp;
|
||||
|
||||
if (!KVM_READ(f->f_data, &rp, sizeof(rp))) {
|
||||
dprintf("can't read rnd at %p for pid %d", f->f_data, Pid);
|
||||
return 0;
|
||||
}
|
||||
(void)printf("* rnd ");
|
||||
if (rp.hard)
|
||||
printf("bytesonkey=%d, ", rp.bytesonkey);
|
||||
if (rp.cprng) {
|
||||
cprng_strong_t cprng;
|
||||
if (!KVM_READ(rp.cprng, &cprng, sizeof(cprng))) {
|
||||
dprintf("can't read rnd cprng at %p for pid %d",
|
||||
rp.cprng, Pid);
|
||||
} else {
|
||||
char buf[128];
|
||||
snprintb(buf, sizeof(buf), CPRNG_FMT, cprng.flags);
|
||||
(void)printf("name=%s, serial=%d%s, flags=%s\n",
|
||||
cprng.name, cprng.entropy_serial,
|
||||
cprng.reseed_pending ? ", reseed" : "", buf);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
return 0;
|
||||
}
|
||||
int
|
||||
pmisc(struct file *f, const char *name)
|
||||
{
|
||||
@ -222,6 +258,8 @@ pmisc(struct file *f, const char *name)
|
||||
return p_kqueue(f);
|
||||
case NL_SEM:
|
||||
return p_sem(f);
|
||||
case NL_RND:
|
||||
return p_rnd(f);
|
||||
case NL_TAP:
|
||||
printf("* tap %lu\n", (unsigned long)(intptr_t)f->f_data);
|
||||
return 0;
|
||||
@ -229,7 +267,7 @@ pmisc(struct file *f, const char *name)
|
||||
printf("* crypto %p\n", f->f_data);
|
||||
return 0;
|
||||
case NL_MAX:
|
||||
printf("* %s %p\n", name, f->f_data);
|
||||
printf("* %s ops=%p %p\n", name, f->f_ops, f->f_data);
|
||||
return 0;
|
||||
default:
|
||||
printf("* %s %p\n", nl[i].n_name, f->f_data);
|
||||
|
Loading…
Reference in New Issue
Block a user