Date: Thu, 09 Dec 2010 02:30:05 +0300 From: Anonymous <swell.k@gmail.com> To: Bruce Cran <bruce@cran.org.uk> Cc: FreeBSD-Hackers <freebsd-hackers@freebsd.org>, Matthew Fleming <mdf356@gmail.com>, Chuck Robey <chuckr@telenix.org> Subject: Re: getting a list of open files versus PID nos.? Message-ID: <86k4jjg7wi.fsf@gmail.com> In-Reply-To: <20101208230139.2097c2e8@core.draftnet> (Bruce Cran's message of "Wed, 8 Dec 2010 23:01:39 %2B0000") References: <4D000448.1050606@telenix.org> <AANLkTinssm_1rPZ-pPbpGKghDbQfDx29y-y8e-NRSJHo@mail.gmail.com> <20101208230139.2097c2e8@core.draftnet>
next in thread | previous in thread | raw e-mail | index | archive | help
Bruce Cran <bruce@cran.org.uk> writes: > On Wed, 8 Dec 2010 14:54:57 -0800 > Matthew Fleming <mdf356@gmail.com> wrote: > >> This is what lsof is for. I believe there's one in ports, but I have >> never tried it. > > Is there any advantage to using lsof instead of fstat(1) (fstat -p pid)? procstat(1) can display actual files instead of inodes, e.g. $ procstat -f $(pgrep qemu) PID COMM FD T V FLAGS REF OFFSET PRO NAME 14300 qemu-system-x86_64 cwd v d -------- - - - /home/holo 14300 qemu-system-x86_64 root v d -------- - - - / 14300 qemu-system-x86_64 0 v c rw------ 6 3247126 - /dev/pts/4 14300 qemu-system-x86_64 1 v c rw------ 6 3247126 - /dev/pts/4 14300 qemu-system-x86_64 2 v c rw------ 6 3247126 - /dev/pts/4 14300 qemu-system-x86_64 3 p - rw---n-- 1 0 - - 14300 qemu-system-x86_64 4 p - rw---n-- 1 0 - - 14300 qemu-system-x86_64 5 v r rw--f--- 1 4294967296 - /b/blah.img 14300 qemu-system-x86_64 6 p - rw---n-- 1 0 - - 14300 qemu-system-x86_64 7 p - rw---n-- 1 0 - - 14300 qemu-system-x86_64 8 v r r---f--- 1 283918336 - /b/netbsd-amd64cd-201012060900Z.iso 14300 qemu-system-x86_64 9 s - rw---n-- 1 0 TCP ::.4444 ::.0 14300 qemu-system-x86_64 10 s - rw---n-- 1 0 TCP ::ffff:127.0.0.1.4444 ::ffff:127.0.0.1.26806
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86k4jjg7wi.fsf>