summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2002-05-18 17:54:16 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2002-05-18 17:54:16 +0000
commitec6c30847274adc9ee0891db4ee29aa47548e610 (patch)
tree7425b68d8edd5d69dd0e803770ce56f5dd088c04
parent0b06c334ac6726216450c8d7ab7d6c095fcff45a (diff)
grok crypto/kqueue/systrace vnodes
-rw-r--r--usr.bin/fstat/fstat.112
-rw-r--r--usr.bin/fstat/fstat.c80
2 files changed, 89 insertions, 3 deletions
diff --git a/usr.bin/fstat/fstat.1 b/usr.bin/fstat/fstat.1
index 08fa99fec19..a2568487023 100644
--- a/usr.bin/fstat/fstat.1
+++ b/usr.bin/fstat/fstat.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: fstat.1,v 1.20 2001/11/09 00:56:24 miod Exp $
+.\" $OpenBSD: fstat.1,v 1.21 2002/05/18 17:54:15 deraadt Exp $
.\"
.\" Copyright (c) 1987, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -243,6 +243,16 @@ the pipe and a state that is built of the letters
W - The pipe blocks waiting for the reader to read data.
R - The pipe blocks waiting for the writer to write data.
E - The pipe is in EOF state.
+.Sh CRYPTO
+Each systrace device is printed with only the kernel address of the
+device private data.
+.Sh KQUEUE
+Each kqueue is printed with some information as to queue length.
+Since these things are normally services quickly, it is likely that
+nothing of real importance can be discerned.
+.Sh SYSTRACE
+Each systrace device is printed with only the kernel address of the
+device private data.
.Sh SEE ALSO
.Xr netstat 1 ,
.Xr nfsstat 1 ,
diff --git a/usr.bin/fstat/fstat.c b/usr.bin/fstat/fstat.c
index cb42637b5cd..f48d8b8b618 100644
--- a/usr.bin/fstat/fstat.c
+++ b/usr.bin/fstat/fstat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fstat.c,v 1.36 2002/03/14 06:51:41 mpech Exp $ */
+/* $OpenBSD: fstat.c,v 1.37 2002/05/18 17:54:15 deraadt Exp $ */
/*-
* Copyright (c) 1988, 1993
@@ -41,7 +41,7 @@ static char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)fstat.c 8.1 (Berkeley) 6/6/93";*/
-static char *rcsid = "$OpenBSD: fstat.c,v 1.36 2002/03/14 06:51:41 mpech Exp $";
+static char *rcsid = "$OpenBSD: fstat.c,v 1.37 2002/05/18 17:54:15 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -54,10 +54,13 @@ static char *rcsid = "$OpenBSD: fstat.c,v 1.36 2002/03/14 06:51:41 mpech Exp $";
#include <sys/socketvar.h>
#include <sys/domain.h>
#include <sys/protosw.h>
+#include <sys/event.h>
+#include <sys/eventvar.h>
#include <sys/unpcb.h>
#include <sys/sysctl.h>
#include <sys/filedesc.h>
#include <sys/mount.h>
+#include <crypto/cryptodev.h>
#define _KERNEL
#include <sys/file.h>
#include <ufs/ufs/quota.h>
@@ -159,6 +162,9 @@ void usage(void);
void vtrans(struct vnode *, int, int, off_t);
int getfname(char *);
void pipetrans(struct pipe *, int);
+void kqueuetrans(struct kqueue *, int);
+void cryptotrans(void *, int i);
+void systracetrans(void *, int i);
int
main(argc, argv)
@@ -376,6 +382,15 @@ dofiles(kp)
} else if (file.f_type == DTYPE_PIPE) {
if (checkfile == 0)
pipetrans((struct pipe *)file.f_data, i);
+ } else if (file.f_type == DTYPE_KQUEUE) {
+ if (checkfile == 0)
+ kqueuetrans((struct kqueue *)file.f_data, i);
+ } else if (file.f_type == DTYPE_CRYPTO) {
+ if (checkfile == 0)
+ cryptotrans(file.f_data, i);
+ } else if (file.f_type == DTYPE_SYSTRACE) {
+ if (checkfile == 0)
+ systracetrans((void *)file.f_data, i);
} else {
dprintf("unknown file type %d for file %d of pid %d",
file.f_type, i, Pid);
@@ -774,6 +789,67 @@ bad:
printf("* error\n");
}
+void
+kqueuetrans(kq, i)
+ struct kqueue *kq;
+ int i;
+{
+ struct kqueue kqi;
+
+ PREFIX(i);
+
+ printf(" ");
+
+ /* fill it in */
+ if (!KVM_READ(kq, &kqi, sizeof(struct kqueue))) {
+ dprintf("can't read kqueue at %p", kq);
+ goto bad;
+ }
+
+ printf("kqueue %p %d state: %s%s", kq, kqi.kq_count,
+ (kqi.kq_state & KQ_SEL) ? "S" : "",
+ (kqi.kq_state & KQ_SLEEP) ? "W" : "");
+
+ printf("\n");
+ return;
+bad:
+ printf("* error\n");
+}
+
+void
+cryptotrans(f, i)
+ void *f;
+ int i;
+{
+ PREFIX(i);
+
+ printf(" ");
+
+ printf("crypto %p", f);
+
+ printf("\n");
+ return;
+bad:
+ printf("* error\n");
+}
+
+void
+systracetrans(f, i)
+ void *f;
+ int i;
+{
+ PREFIX(i);
+
+ printf(" ");
+
+ printf("systrace %p", f);
+
+ printf("\n");
+ return;
+bad:
+ printf("* error\n");
+}
+
#ifdef INET6
const char *
inet6_addrstr(p)