How can I know which files a proccess is accessing?

Eduardo Meyer dudu.meyer at gmail.com
Wed Jun 7 16:13:22 UTC 2006


> > # ps 16543
> >  PID  TT  STAT      TIME COMMAND
> > 16543  ??  S      0:02.43 /usr/local/sbin/httpd -k start -DSSL
> >
> > Any tuning would do the job?
>
> Are you running with tightened up security that might prevent fstat from
> accessing /dev/kmem?  I don't know fstat failures from experience or
> what causes it to just show inode numbers - perhaps delete files that
> are still open.
>
> I'm unsure about the reason for lsof's complaint; if you installed a
> package, try rebuilding the port.
>
> Something different, if fstat and lsof continue to fail: you may try
> attaching a syscall tracer such as truss, ktrace or strace (the latter
> from ports) to the process and see if it leaks file descriptors. This
> may fail due to permissions however.

Hello Matthias,

No, no security measurements prevent lsof from accessing any device.
In fact with lower disk demand (small number of open files) lsof works
fine, but in the situation I need it, when the odd things start to
happen, it doesnt. If a single proccess is opening hundres of files,
lsof fails with the mentioned message.

I have tried 2 different versions from lsof, all built from ports (the
latest and 2 revisions ago with portdowngrade to be sure it is not a
problem that belongs only to the latest version).

fstat doesnt fail under the same workload...

My wish is that fstat had an option to show file name instead of inodes :)

For those who pointed me using find(1) looking for inum from the
output of fstat(1), thank you; it is a very heavy loading option (disk
usage increases around 30% while doing this) but it seemed to be the
interesting option (at least, the options that worded).

Again, thank you everybody who replied.


More information about the freebsd-stable mailing list