version 1.60, 2007/10/01 22:06:02 |
version 1.61, 2008/04/08 14:46:45 |
|
|
#include <xfs/xfs_config.h> |
#include <xfs/xfs_config.h> |
#include <xfs/xfs_node.h> |
#include <xfs/xfs_node.h> |
|
|
|
#include <miscfs/specfs/specdev.h> |
|
|
#include <net/route.h> |
#include <net/route.h> |
#include <netinet/in.h> |
#include <netinet/in.h> |
#include <netinet/in_systm.h> |
#include <netinet/in_systm.h> |
|
|
int msdos_filestat(struct vnode *, struct filestat *); |
int msdos_filestat(struct vnode *, struct filestat *); |
int nfs_filestat(struct vnode *, struct filestat *); |
int nfs_filestat(struct vnode *, struct filestat *); |
int xfs_filestat(struct vnode *, struct filestat *); |
int xfs_filestat(struct vnode *, struct filestat *); |
|
int spec_filestat(struct vnode *, struct filestat *); |
void dofiles(struct kinfo_proc2 *); |
void dofiles(struct kinfo_proc2 *); |
void getinetproto(int); |
void getinetproto(int); |
void usage(void); |
void usage(void); |
|
|
dprintf("can't read vnode at %p for pid %ld", vp, (long)Pid); |
dprintf("can't read vnode at %p for pid %ld", vp, (long)Pid); |
return; |
return; |
} |
} |
if (vn.v_type == VNON || vn.v_tag == VT_NON) |
if (vn.v_type == VNON) |
badtype = "none"; |
badtype = "none"; |
else if (vn.v_type == VBAD) |
else if (vn.v_type == VBAD) |
badtype = "bad"; |
badtype = "bad"; |
|
|
if (!xfs_filestat(&vn, &fst)) |
if (!xfs_filestat(&vn, &fst)) |
badtype = "error"; |
badtype = "error"; |
break; |
break; |
|
case VT_NON: |
|
if (vn.v_flag & VCLONE) { |
|
if (!spec_filestat(&vn, &fst)) |
|
badtype = "error"; |
|
} else { |
|
badtype = "none"; /* not a clone */ |
|
} |
|
break; |
default: { |
default: { |
static char unknown[30]; |
static char unknown[30]; |
snprintf(badtype = unknown, sizeof unknown, |
snprintf(badtype = unknown, sizeof unknown, |
|
|
(void)printf(" - - %10s -\n", badtype); |
(void)printf(" - - %10s -\n", badtype); |
return; |
return; |
} |
} |
|
|
if (nflg) |
if (nflg) |
(void)printf(" %2ld,%-2ld", (long)major(fst.fsid), |
(void)printf(" %2ld,%-2ld", (long)major(fst.fsid), |
(long)minor(fst.fsid)); |
(long)minor(fst.fsid)); |
else |
else if (!(vn.v_flag & VCLONE)) |
(void)printf(" %-8s", getmnton(vn.v_mount)); |
(void)printf(" %-8s", getmnton(vn.v_mount)); |
|
else |
|
(void)printf(" clone"); |
if (nflg) |
if (nflg) |
(void)snprintf(mode, sizeof mode, "%o", fst.mode); |
(void)snprintf(mode, sizeof mode, "%o", fst.mode); |
else |
else |
|
|
fsp->rdev = xfs_node.attr.va_rdev; |
fsp->rdev = xfs_node.attr.va_rdev; |
|
|
return 1; |
return 1; |
|
} |
|
|
|
int |
|
spec_filestat(struct vnode *vp, struct filestat *fsp) |
|
{ |
|
struct specinfo specinfo; |
|
struct vnode parent; |
|
|
|
if (!KVM_READ(vp->v_specinfo, &specinfo, sizeof(struct specinfo))) { |
|
dprintf("can't read specinfo at %p for pid %ld", |
|
vp->v_specinfo, (long) Pid); |
|
return (0); |
|
} |
|
|
|
vp->v_specinfo = &specinfo; |
|
|
|
if (!KVM_READ(vp->v_specparent, &parent, sizeof(struct vnode))) { |
|
dprintf("can't read parent vnode at %p for pid %ld", |
|
vp->v_specparent, (long) Pid); |
|
return (0); |
|
} |
|
|
|
if (!ufs_filestat(&parent, fsp)) |
|
return (0); |
|
|
|
if (nflg) |
|
fsp->rdev = vp->v_rdev; |
|
|
|
return (1); |
} |
} |
|
|
char * |
char * |