Skip navigation

After a bit of irc inspired digging, I’ve built a newer rev of LSOF and fortunately, it appears that the upcoming 4.83 release restores functionality on Solaris which has been broken for a while!

Will kick out some packages once it’s released.

(And yep, it supports ZFS)

If you juuuuuuust can’t wait, here are some simple instructions on building it:

Download and extract the 4.83K tar.bz2:

houston@charon:~/lsof > wget ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/NEW/lsof_4.83K.sun.tar.bz2
–2010-01-03 20:33:41– ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/NEW/lsof_4.83K.sun.tar.bz2
=> `lsof_4.83K.sun.tar.bz2′
Resolving lsof.itap.purdue.edu… 128.210.7.20
Connecting to lsof.itap.purdue.edu|128.210.7.20|:21… connected.
Logging in as anonymous … Logged in!
==> SYST … done. ==> PWD … done.
==> TYPE I … done. ==> CWD /pub/tools/unix/lsof/NEW … done.
==> SIZE lsof_4.83K.sun.tar.bz2 … 560608
==> PASV … done. ==> RETR lsof_4.83K.sun.tar.bz2 … done.
Length: 560608 (547K)

100%[======================================>] 560,608 367K/s in 1.5s

2010-01-03 20:33:43 (367 KB/s) – `lsof_4.83K.sun.tar.bz2′ saved [560608]

houston@charon:~/lsof > bzcat lsof_4.83K.sun.tar.bz2 | gtar -xf –
houston@charon:~/lsof >

Be slightly baffled by the confgure script, but continue on as follows:

houston@charon:~/lsof/lsof_4.83K.sun > ./Configure solaris
Testing prdata.h for PR_GWINDOWS, using gcc
Testing prdata.h for PR_LDT, using gcc
Testing gcc for 64 bit support

*********************************
* Configuring for 64 bit kernel *
*********************************

Testing vnode.h for VSOCK, using gcc

This configuration step (the Inventory script) takes inventory of
the lsof distribution. The script runs for a minute or two while
it checks that all the subdirectories, information files, scripts,
header files and source files that should be present really are.

It’s not absolutely necessary that you take inventory, but it’s a
good idea to do it right after the lsof distribution has been
unpacked. Once the inventory has been taken, this script creates
the file ./.ck00MAN as a signal that the inventory step has been
done.

You can call the Inventory script directly at any time to take
inventory. You can inhibit the inventory step permanently by
creating the file ./.neverInv, and you can tell the Configure script
to skip the inventory and customization steps with the -n option.

Do you want to take inventory (y|n) [y]? n
rm -f ddev.c dfile.c dlsof.h dmnt.c dnode*.c dproc.c dproto.h dsock.c dstore.c dzfs.h kernelbase.h machine.h machine.h.old new_machine.h __lseek.s Makefile Makefile.zfs ./tests/config.cflags
rm -f ./tests/config.cc ./tests/config.xobj ./tests/config.ldflags
Testing C library for localtime() and strftime(), using gcc … present
ln -s dialects/sun/ddev.c ddev.c
ln -s dialects/sun/dfile.c dfile.c
ln -s dialects/sun/dlsof.h dlsof.h
ln -s dialects/sun/dmnt.c dmnt.c
ln -s dialects/sun/dnode.c dnode.c
ln -s dialects/sun/dnode1.c dnode1.c
ln -s dialects/sun/dnode2.c dnode2.c
ln -s dialects/sun/dproc.c dproc.c
ln -s dialects/sun/dproto.h dproto.h
ln -s dialects/sun/dsock.c dsock.c
ln -s dialects/sun/dstore.c dstore.c
ln -s dialects/sun/machine.h machine.h
kernelbase.h assembled.
Makefile and lib/Makefile created.
./tests/config.cc created
./tests/config.cflags created
./tests/config.ldflags created
./tests/config.xobj created

You may now customize the machine.h header file for this UNIX
dialect. The customizations will take effect when you compile
lsof. You may also choose to skip customization and proceed to
the compilation of lsof.

If you don’t know if you need to customize or want to know more
about what you can customize, consult the 00DCACHE, 00FAQ, 00PORTING,
and 00README files of the lsof distribution. You might also find
it helpful to examine the machine.h header file for the dialect
you’re customizing.

You don’t need to use this procedure to customize lsof; you can
edit the machine.h header file directly. If you later decide you
want to use this procedure to customize machine.h, execute the
./Customize script.

Do you want to customize (y|n) [y]? n

houston@charon:~/lsof/lsof_4.83K.sun > gcc -v
Using built-in specs.
Target: sparc-sun-solaris2.8
Configured with: ../gcc-4.3.4/configure –with-gnu-as –with-as=/opt/csw/bin/gas –without-gnu-ld –with-ld=/usr/ccs/bin/ld –with-cpu=v7 –enable-threads=posix –enable-nls –prefix=/opt/csw/gcc4 –with-local-prefix=/opt/csw –enable-shared –enable-multilib –with-included-gettext –with-libiconv-prefix=/opt/csw –with-system-zlib –with-gmp=/opt/csw –with-mpfr=/opt/csw –enable-languages=c,c++,fortran,java,objc,ada –enable-bootstrap
Thread model: posix
gcc version 4.3.4 (GCC)

run gmake (output snipped):

houston@charon:~/lsof/lsof_4.83K.sun > gmake
houston@charon:~/lsof/lsof_4.83K.sun >

Appears to have linked OK:

houston@charon:~/lsof/lsof_4.83K.sun > ldd lsof
libctf.so.1 => /lib/64/libctf.so.1
libkvm.so.1 => /usr/lib/64/libkvm.so.1
libelf.so.1 => /lib/64/libelf.so.1
libsocket.so.1 => /lib/64/libsocket.so.1
libnsl.so.1 => /lib/64/libnsl.so.1
libc.so.1 => /lib/64/libc.so.1
libmp.so.2 => /lib/64/libmp.so.2
libmd.so.1 => /lib/64/libmd.so.1
libscf.so.1 => /lib/64/libscf.so.1
libdoor.so.1 => /lib/64/libdoor.so.1
libuutil.so.1 => /lib/64/libuutil.so.1
libgen.so.1 => /lib/64/libgen.so.1
libm.so.2 => /lib/64/libm.so.2
/platform/SUNW,Sun-Blade-2500/lib/sparcv9/libc_psr.so.1
/platform/SUNW,Sun-Blade-2500/lib/sparcv9/libmd_psr.so.1

Finally, we’ll copy it to a global zone and test it out:

root@snappy:~ > ./lsof_sparc -p 12151
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
sshd 12151 root cwd VDIR 136,8 1024 2 /
sshd 12151 root txt VREG 136,8 359244 228943 /usr/lib/ssh/sshd
sshd 12151 root txt VREG 136,8 392036 22431 /usr/lib/security/pkcs11_softtoken_extra.so.1
sshd 12151 root txt VREG 136,8 41124 3067 /platform/sun4u/lib/libmd_psr.so.1
sshd 12151 root txt VREG 136,8 149428 2659 /usr/lib/security/pkcs11_kernel.so.1
sshd 12151 root txt VREG 136,8 20572 4091 /lib/libdoor.so.1
sshd 12151 root txt VREG 136,8 55312 2586 /usr/lib/libcryptoutil.so.1
sshd 12151 root txt VREG 136,8 155092 2612 /usr/lib/libpkcs11.so.1
sshd 12151 root txt VREG 136,8 135100 22434 /usr/sfw/lib/libcrypto_extra.so.0.9.7
sshd 12151 root txt VREG 136,8 42084 4110 /lib/libnvpair.so.1
sshd 12151 root txt VREG 136,8 100972 4105 /lib/libmd.so.1
sshd 12151 root txt VREG 136,8 1639032 4412 /lib/libc.so.1
sshd 12151 root txt VREG 136,8 37400 4123 /lib/libsecdb.so.1
sshd 12151 root txt VREG 136,8 33348 4080 /lib/libcontract.so.1
sshd 12151 root txt VREG 136,8 1444348 5037 /usr/sfw/lib/libcrypto.so.0.9.7
sshd 12151 root txt VREG 136,8 27100 4078 /lib/libcmd.so.1
sshd 12151 root txt VREG 136,8 77228 6346 /usr/lib/libgss.so.1
sshd 12151 root txt VREG 136,8 62504 2740 /usr/sfw/lib/libwrap.so.1.0
sshd 12151 root txt VREG 136,8 229232 4075 /lib/libbsm.so.1
sshd 12151 root txt VREG 136,8 52920 3101 /lib/libpam.so.1
sshd 12151 root txt VREG 136,8 870128 45032 /lib/libnsl.so.1
sshd 12151 root txt VREG 136,8 80200 3850 /usr/lib/libz.so.1
sshd 12151 root txt VREG 136,8 93924 4125 /lib/libsocket.so.1
sshd 12151 root txt VREG 136,8 16856 3066 /platform/sun4u/lib/libc_psr.so.1
sshd 12151 root txt VREG 136,8 280840 4071 /lib/ld.so.1
sshd 12151 root 0u VCHR 13,2 6815752 /devices/pseudo/mm@0:null
sshd 12151 root 1u VCHR 13,2 6815752 /devices/pseudo/mm@0:null
sshd 12151 root 2u VCHR 13,2 6815752 /devices/pseudo/mm@0:null
sshd 12151 root 3u IPv6 0x30005e8c980 0t47908 TCP snappy:ssh->insomnia.lan:43612 (ESTABLISHED)
sshd 12151 root 4r DOOR 0t0 58 /var/run/name_service_door (door to nscd[133]) (FA:->0x3000236f580)
sshd 12151 root 5u FIFO 0x300016ca900 0t16 7062 (fifofs) PIPE->0x300016ca990
sshd 12151 root 6u FIFO 0x300016ca180 0t0 7067 (fifofs) PIPE->0x300016ca210
sshd 12151 root 7u FIFO 0x300016ca900 0t16 7062 (fifofs) PIPE->0x300016ca990
sshd 12151 root 8u FIFO 0x300016ca210 0t0 7067 (fifofs) PIPE->0x300016ca180

Enjoy 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: