The pre-compiled packages of lsof for Solaris (e.g. from Blastwave or sunfreeware) do not show the ports open, such as when using the options : "-Pni". The wisdom of the creator of lsof is that we should compile lsof ourselves. The tar bundle, configuration, etc., are very different than most open source packages one can compile from source. I'm running low on clues within the package to learn what is wrong with my build attempt.
I have Sun Studio 11 to provide C compiler. Also installed Gcc 3.4.5
The system is sparc, with ZFS on all file systems. OS is Solaris 10, U7.
uname -a
SunOS myhostname 5.10 Generic_141444-09 sun4u sparc SUNW,Sun-Fire-280R
lsof source is for 4.82. I configure with default options and ZFS support on.
With either cc or gcc, the failure when running make is similar:
gcc -Dsolaris=100000 -DHASPR_GWINDOWS -m64 -DHASIPv6 -DHASSOUXSOUA -DHAS_IPCLASSIFIER_H -DHAS_CRED_IMPL_H -DHAS_V_PATH -DHASZONES -DHAS_ZFS=1 -DZFS_VERS=15 -DHASUTMPX -DHAS_VSOCK -DHAS_STRFTIME -DLSOF_VSTR=\"5.10\" -O -c dnode.c
dnode.c: In function `process_node':
dnode.c:2082: error: structure has no member named `pcfs_entps'
*** Error code 1
make: Fatal error: Command failed for target `dnode.o'
I did get this to compile on a non-ZFS system with 4.77 many months ago, but I can't remember how.
The lsof FAQ states that the necessary header files are not supplied by Sun and after the section quoted below goes on to suggest how to obtain them from Open Solaris and further problems that might be encountered.
I found this reference to the problem from googling on the part of the compile error
http://unix.derkeiler.com/Newsgroups/comp.unix.solaris/2009-07/msg00575.html
There is no need to get any header files from OpenSolaris or elsewhere. The beta version of 4.83 works on my Sparc ZFS box with defaults to the Configure script.
I now have a working lsof -Pni on Solaris 10.
While you're waiting for the real answer, you might give pcp a try as an alternative to lsof on solaris. It's built around the very useful solaris command
pfiles
.