Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Dec 2007 11:29:16 +0600
From:      Denis Eremenko <moonshade@pnhz.kz>
To:        freebsd-fs@freebsd.org
Subject:   fstat and filenames
Message-ID:  <1197437356.5183.24.camel@abyss.pnhz.kz>

next in thread | raw e-mail | index | archive | help
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)?






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1197437356.5183.24.camel>