From owner-freebsd-fs@FreeBSD.ORG Wed Dec 12 05:39:34 2007 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A67A316A477 for ; Wed, 12 Dec 2007 05:39:34 +0000 (UTC) (envelope-from moonshade@pnhz.kz) Received: from relay.pnhz.kz (relay.pnhz.kz [212.154.198.217]) by mx1.freebsd.org (Postfix) with ESMTP id 5612713C4CE for ; Wed, 12 Dec 2007 05:39:32 +0000 (UTC) (envelope-from moonshade@pnhz.kz) Received: from [192.168.121.40] (abyss.pnhz.kz [192.168.121.40]) by relay.pnhz.kz with ESMTP id lBC5TGJs096096 for ; Wed, 12 Dec 2007 11:29:17 +0600 (ALMT) (envelope-from moonshade@pnhz.kz) From: Denis Eremenko To: freebsd-fs@freebsd.org Content-Type: text/plain Date: Wed, 12 Dec 2007 11:29:16 +0600 Message-Id: <1197437356.5183.24.camel@abyss.pnhz.kz> Mime-Version: 1.0 X-Mailer: Evolution 2.12.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Subject: fstat and filenames X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Dec 2007 05:39:34 -0000 Why fstat so secretive about file names and unix domain sockets? # lsof -p `pgrep syslogd` COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME ... syslogd 577 root 4u unix 0xc34652c8 0t0 /var/run/log syslogd 577 root 5u unix 0xc3465000 0t0 /var/run/logpriv syslogd 577 root 6u IPv4 0xc34c321c 0t0 UDP *:syslog ... # fstat -p `pgrep syslogd` USER CMD PID FD MOUNT INUM MODE SZ|DV R/W ... root syslogd 577 4* local dgram c34676c0 root syslogd 577 5* local dgram c3467630 root syslogd 577 6* internet dgram udp c34c321c ... According to manpage 'file' argument should be specified to enable NAME field (why? not quite POLA-ish). With mountpoint as argument it shows nothing: # fstat -p `pgrep syslogd` /var And finally: "fstat -f /var" show some but w/o names as -f disables that, "fstat -f /var/*" shows only regulars and dirs, "lsof /var" shows twice more than "fstat -f /var" and with names. Is there any way to get open files (not only regular) and their filenames with fstat and some criteria (uid or pid)?