1

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.

Zoredache
  • 130,897
  • 41
  • 276
  • 420
labradort
  • 1,169
  • 1
  • 8
  • 20

3 Answers3

1

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.

17.27 Solaris 10 ZFS probblems [sic]

17.27.1 Why does Configure ask for the location of ZFS header files?

To provide ZFS support when lsof is compiled it needs to have
access to the definitions of ZFS structures used by the kernel.
Those definitions are contained in header files that Sun does
not distribute with Solaris 10.
Dennis Williamson
  • 62,149
  • 16
  • 116
  • 151
  • It also says that the internal definitions from lsof can be used, and that is how I proceeded. I wouldn't expect that to trigger a compiling error. The mention of getting the header files uses the term "might" 3 times. Nothing very definitive about how to build it. I checked the URL to src.opensolaris.org and it wasn't obvious to me where to find the headers to try what "might" work. – labradort Nov 17 '09 at 21:10
  • Well, the "structure has no member" message struck me as indicating a header file problem. – Dennis Williamson Nov 17 '09 at 23:14
1

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.

labradort
  • 1,169
  • 1
  • 8
  • 20
0

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.

pra
  • 622
  • 1
  • 5
  • 13
  • Sorry, I should have followed your link. I found another thing called pcp - performance co-pilot, and checked into that. My previous comment was about performance co-pilot, which is more like sar, munin, etc. pcp the shell script does the task, but it is very slow compared to lsof. I'd prefer to have lsof working. – labradort Nov 18 '09 at 18:12