file and processes information retrieval from the running kernel via sysctl
in the form of new library, libprocstat. The library also supports KVM backend
for analyzing memory crash dumps. Both procstat(1) and fstat(1) utilities have
been modified to take advantage of the library (as the bonus point the fstat(1)
utility no longer need superuser privileges to operate), and the procstat(1)
utility is now able to display information from memory dumps as well.
The newly introduced fuser(1) utility also uses this library and able to operate
via sysctl and kvm backends.
The library is by no means complete (e.g. KVM backend is missing vnode name
resolution routines, and there're no manpages for the library itself) so I
plan to improve it further. I'm commiting it so it will get wider exposure
and review.
We won't be able to MFC this work as it relies on changes in HEAD, which
was introduced some time ago, that break kernel ABI. OTOH we may be able
to merge the library with KVM backend if we really need it there.
Discussed with: rwatson
the open file-listing. It is added as a separate source file, so it can
respect WITH_/WITHOUT_CDDL as compile-flags.
- The warnlevel of the Makefile was decreased to quell solaris #pragma
warnings.
- Expect that fstat(1) doesn't work with kernel compiled with
DEBUG_VFS_LOCKS/DEBUG_LOCKS for now.
Approved by: pjd (mentor)
2) Use %p to print a pointer.
3) Use longs for fileids and ino to avoid comparing signed and unsigned.
4) Make the KVM_READ macro a little more cranky.
5) Set WARNS while I'm here.
find out if files on msdosfs and cd9660 filestores are open.
There was also a movement of some common things to a header, a
small cleanup.
PR: bin/16364 bin/7043
Submitted by: Peter Edwards <peter.edwards@openet-telecom.com>