From b4fe201c19a6c398cd821b936572bf418b027467 Mon Sep 17 00:00:00 2001 From: Sergey Kandaurov Date: Mon, 27 Feb 2012 17:39:34 +0000 Subject: [PATCH] Backout r230934 which didn't work with unix sockets and several filesystem layers mounted at the specified path. Pointy hat to: pluknet --- usr.bin/fstat/fstat.c | 42 ++++++++---------------------------------- 1 file changed, 8 insertions(+), 34 deletions(-) diff --git a/usr.bin/fstat/fstat.c b/usr.bin/fstat/fstat.c index 9401ef8ce0e..6014dddc47c 100644 --- a/usr.bin/fstat/fstat.c +++ b/usr.bin/fstat/fstat.c @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include @@ -225,53 +224,28 @@ static void print_file_info(struct procstat *procstat, struct filestat *fst, const char *uname, const char *cmd, int pid) { - struct sockstat sock; struct vnstat vn; DEVS *d; const char *filename; int error, fsmatch = 0; char errbuf[_POSIX2_LINE_MAX]; - error = 0; filename = NULL; if (checkfile != 0) { - switch (fst->fs_type) { - case PS_FST_TYPE_VNODE: - case PS_FST_TYPE_FIFO: - error = procstat_get_vnode_info(procstat, fst, &vn, errbuf); - break; - case PS_FST_TYPE_SOCKET: - error = procstat_get_socket_info(procstat, fst, &sock, errbuf); - break; - default: + if (fst->fs_type != PS_FST_TYPE_VNODE && + fst->fs_type != PS_FST_TYPE_FIFO) return; - } + error = procstat_get_vnode_info(procstat, fst, &vn, errbuf); if (error != 0) return; for (d = devs; d != NULL; d = d->next) - switch (fst->fs_type) { - case PS_FST_TYPE_VNODE: - case PS_FST_TYPE_FIFO: - if (d->fsid == vn.vn_fsid) { - fsmatch = 1; - if ((unsigned)d->ino == vn.vn_fileid) { - filename = d->name; - break; - } + if (d->fsid == vn.vn_fsid) { + fsmatch = 1; + if ((unsigned)d->ino == vn.vn_fileid) { + filename = d->name; + break; } - break; - case PS_FST_TYPE_SOCKET: - if (sock.dom_family == AF_UNIX) { - fsmatch = 1; - if (strcmp(((struct sockaddr_un *) - (&sock.sa_local))->sun_path, - d->name) == 0) { - filename = d->name; - break; - } - } - break; } if (fsmatch == 0 || (filename == NULL && fsflg == 0)) return;