Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/fstat Bring into line with recent ktrace changes
details: https://anonhg.NetBSD.org/src/rev/e283b98042c9
branches: trunk
changeset: 486664:e283b98042c9
user: sommerfeld <sommerfeld%NetBSD.org@localhost>
date: Sat May 27 15:02:04 2000 +0000
description:
Bring into line with recent ktrace changes
diffstat:
usr.bin/fstat/fstat.c | 47 ++++++++++++++++++++++++++++-------------------
1 files changed, 28 insertions(+), 19 deletions(-)
diffs (89 lines):
diff -r 47f2b8b96a3e -r e283b98042c9 usr.bin/fstat/fstat.c
--- a/usr.bin/fstat/fstat.c Sat May 27 14:45:36 2000 +0000
+++ b/usr.bin/fstat/fstat.c Sat May 27 15:02:04 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fstat.c,v 1.41 2000/02/04 11:02:00 jdolecek Exp $ */
+/* $NetBSD: fstat.c,v 1.42 2000/05/27 15:02:04 sommerfeld Exp $ */
/*-
* Copyright (c) 1988, 1993
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)fstat.c 8.3 (Berkeley) 5/2/95";
#else
-__RCSID("$NetBSD: fstat.c,v 1.41 2000/02/04 11:02:00 jdolecek Exp $");
+__RCSID("$NetBSD: fstat.c,v 1.42 2000/05/27 15:02:04 sommerfeld Exp $");
#endif
#endif /* not lint */
@@ -162,6 +162,7 @@
int ufs_filestat __P((struct vnode *, struct filestat *));
void usage __P((void));
void vtrans __P((struct vnode *, int, int));
+void ftrans __P((struct file *, int));
int
main(argc, argv)
@@ -309,7 +310,6 @@
struct kinfo_proc *kp;
{
int i;
- struct file file;
struct filedesc0 filed0;
#define filed filed0.fd_fd
struct cwdinfo cwdi;
@@ -348,7 +348,7 @@
* ktrace vnode, if one
*/
if (p->p_tracep)
- vtrans(p->p_tracep, TRACE, FREAD|FWRITE);
+ ftrans(p->p_tracep, TRACE);
/*
* open files
*/
@@ -367,21 +367,30 @@
for (i = 0; i <= filed.fd_lastfile; i++) {
if (ofiles[i] == NULL)
continue;
- if (!KVM_READ(ofiles[i], &file, sizeof (struct file))) {
- dprintf("can't read file %d at %p for pid %d",
- i, ofiles[i], Pid);
- continue;
- }
- if (file.f_type == DTYPE_VNODE)
- vtrans((struct vnode *)file.f_data, i, file.f_flag);
- else if (file.f_type == DTYPE_SOCKET) {
- if (checkfile == 0)
- socktrans((struct socket *)file.f_data, i);
- }
- else {
- dprintf("unknown file type %d for file %d of pid %d",
- file.f_type, i, Pid);
- }
+ ftrans(ofiles[i], i);
+ }
+}
+
+void
+ftrans (fp, i)
+ struct file *fp;
+ int i;
+{
+ struct file file;
+
+ if (!KVM_READ(fp, &file, sizeof (struct file))) {
+ dprintf("can't read file %d at %p for pid %d",
+ i, fp, Pid);
+ return;
+ }
+ if (file.f_type == DTYPE_VNODE)
+ vtrans((struct vnode *)file.f_data, i, file.f_flag);
+ else if (file.f_type == DTYPE_SOCKET) {
+ if (checkfile == 0)
+ socktrans((struct socket *)file.f_data, i);
+ } else {
+ dprintf("unknown file type %d for file %d of pid %d",
+ file.f_type, i, Pid);
}
}
Home |
Main Index |
Thread Index |
Old Index