Blame 00README

Packit Service 603f59
Packit Service 603f59
			Making and Installing lsof 4
Packit Service 603f59
Packit Service 603f59
********************************************************************
Packit Service 603f59
| The latest release of lsof is always available via anonymous ftp |
Packit Service 603f59
| from lsof.itap.purdue.edu.  Look in pub/tools/unix/lsof.         |
Packit Service 603f59
********************************************************************
Packit Service 603f59
Packit Service 603f59
				Contents
Packit Service 603f59
Packit Service 603f59
	Pre-built Lsof Binaries
Packit Service 603f59
	Making Lsof
Packit Service 603f59
	    Other Configure Script Options
Packit Service 603f59
	    Environment Variables
Packit Service 603f59
	    Security
Packit Service 603f59
	    Run-time Warnings
Packit Service 603f59
	    Device Access Warnings
Packit Service 603f59
	    NFS Blocks
Packit Service 603f59
	    Caches -- Name and Device
Packit Service 603f59
	    Raw Sockets
Packit Service 603f59
	    Other Compile-time Definitions
Packit Service 603f59
	    The AFSConfig Script
Packit Service 603f59
	    The Inventory Script
Packit Service 603f59
	    The Customize Script
Packit Service 603f59
	    Cautions
Packit Service 603f59
	    Warranty
Packit Service 603f59
	    License
Packit Service 603f59
	    Bug Reports
Packit Service 603f59
	    The 00FAQ File
Packit Service 603f59
	    The lsof-l Mailing List
Packit Service 603f59
	    Field Output Example Scripts
Packit Service 603f59
	    Field Output C Library
Packit Service 603f59
	Testing Lsof
Packit Service 603f59
	Dialect Notes
Packit Service 603f59
	    AFS
Packit Service 603f59
	    AIX
Packit Service 603f59
	    Apple Darwin
Packit Service 603f59
	    Auspex LFS (no longer maintained)
Packit Service 603f59
	    BSDI BSD/OS
Packit Service 603f59
	    DEC OSF/1, Digital UNIX, Tru64 UNIX
Packit Service 603f59
	    FreeBSD
Packit Service 603f59
	    HP-UX
Packit Service 603f59
	    IPv6
Packit Service 603f59
	    Linux
Packit Service 603f59
	    NetBSD
Packit Service 603f59
	    NEXTSTEP and OPENSTEP
Packit Service 603f59
	    OpenBSD
Packit Service 603f59
	    Pyramid DC/OSx and Reliant UNIX (no longer available)
Packit Service 603f59
	    Caldera OpenUNIX
Packit Service 603f59
	    SCO OpenServer
Packit Service 603f59
	    SCO|Caldera UnixWare
Packit Service 603f59
	    Solaris 2.x, 7, 8, 9 and 10
Packit Service 603f59
	    Ultrix (no longer available)
Packit Service 603f59
	    Veritas VxFS and VxVM
Packit Service 603f59
	User-contributed Dialect Support
Packit Service 603f59
	Dialects No Longer Supported
Packit Service 603f59
	Installing Lsof
Packit Service 603f59
	    Setuid-root Lsof Dialects
Packit Service 603f59
	    Setgid Lsof Dialects
Packit Service 603f59
	Porting lsof 4 to a New UNIX Dialect
Packit Service 603f59
	Quick Start to Using lsof
Packit Service 603f59
	Cross-configuring Lsof
Packit Service 603f59
	Environment Variables Affecting the Configure Script
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
=======================
Packit Service 603f59
Pre-built Lsof Binaries
Packit Service 603f59
=======================
Packit Service 603f59
Packit Service 603f59
Avoid using pre-built lsof binaries if you can; build your own
Packit Service 603f59
instead.
Packit Service 603f59
Packit Service 603f59
I do not support lsof binaries built and packaged by third parties nor
Packit Service 603f59
lsof binaries built from anything but the latest lsof revision.  (See
Packit Service 603f59
the Bug Reports section for more information on the details of lsof
Packit Service 603f59
support.)
Packit Service 603f59
Packit Service 603f59
One important reasone for those support restrictions is that when lsof
Packit Service 603f59
is built its Configure script tunes lsof to the features available on
Packit Service 603f59
the building system, often embodied in supporting header files and
Packit Service 603f59
libraries.  If the building system doesn't have support for a
Packit Service 603f59
particular feature, lsof won't be built to support the feature on any
Packit Service 603f59
system.
Packit Service 603f59
Packit Service 603f59
The Veritas VxFS file system is a good example of a feature that
Packit Service 603f59
requires build-time support.
Packit Service 603f59
Packit Service 603f59
UNIX dialect version differences --  Solaris 8 versus 9, AIX 4.3.3
Packit Service 603f59
vesus 5.2, etc. -- can also render a pre-built lsof binary useless
Packit Service 603f59
on a different version.  So can kernel bit size.
Packit Service 603f59
Packit Service 603f59
There are so many potential pitfalls to using an lsof binary
Packit Service 603f59
improperly that I strongly recommend lsof be used only where it is
Packit Service 603f59
built.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
===========
Packit Service 603f59
Making Lsof
Packit Service 603f59
===========
Packit Service 603f59
Packit Service 603f59
	$ cd <lsof source directory>
Packit Service 603f59
	$ ./Configure <your dialect's abbreviation>
Packit Service 603f59
	$ make
Packit Service 603f59
Packit Service 603f59
(Consult the 00FAQ and 00XCONFIG files of the lsof distribution
Packit Service 603f59
for information about using make command invocations and environment
Packit Service 603f59
variables to override lsof default Makefile strings.)
Packit Service 603f59
Packit Service 603f59
This lsof distribution can be used with many UNIX dialects.  However,
Packit Service 603f59
it must be configured specifically for each dialect.  Configuration
Packit Service 603f59
is done in three ways: 1) by changing definitions in the machine.h
Packit Service 603f59
header file of the UNIX dialect of interest; 2) by defining
Packit Service 603f59
environment variable values prior to calling Configure (see the
Packit Service 603f59
00XCONFIG file, the Environment Variabls and Environment Variables
Packit Service 603f59
Affecting the Configure Script sections of this file); and 3) by
Packit Service 603f59
running the Configure shell script found in the top level of the
Packit Service 603f59
distribution directory.
Packit Service 603f59
Packit Service 603f59
You may not need to change any machine.h definitions, but you might
Packit Service 603f59
want to look at them anyway.  Pay particular attention to the
Packit Service 603f59
definitions that are discussed in the Security section of this
Packit Service 603f59
file.  Please read that section.
Packit Service 603f59
Packit Service 603f59
The Configure script calls three other scripts in the lsof
Packit Service 603f59
distribution: AFSConfig; Inventory; and Customize.  The AFSConfig
Packit Service 603f59
script is called for selected dialects (AIX, HP-UX, NEXTSTEP, and
Packit Service 603f59
Solaris) to locate AFS header files and determine the AFS version.
Packit Service 603f59
See The AFSConfig Script section of this file for more information.
Packit Service 603f59
Packit Service 603f59
The Inventory script checks the completeness of the lsof distribution.
Packit Service 603f59
Configure calls Inventory after it has accepted the dialect
Packit Service 603f59
abbreviation, but before it configures the top-level directory for
Packit Service 603f59
the dialect.  See The Inventory Script section of this file for
Packit Service 603f59
more information.
Packit Service 603f59
Packit Service 603f59
Configure calls the Customize script after it has configured the
Packit Service 603f59
top-level lsof directory for the declared dialect.  Customize helps
Packit Service 603f59
you modify some of the important compile-time definitions of
Packit Service 603f59
machine.h.  See the The Customize Script section.
Packit Service 603f59
Packit Service 603f59
You should also think about where you will install lsof and its
Packit Service 603f59
man page, and whom you will let execute lsof.  Please read the
Packit Service 603f59
Installing Lsof section of this file for information on installation
Packit Service 603f59
considerations.
Packit Service 603f59
Packit Service 603f59
Once you have inspected the machine.h file for the dialect for
Packit Service 603f59
which you want to build lsof, and made any changes you need, run
Packit Service 603f59
the Configure script, supplying it with the abbreviation for the
Packit Service 603f59
dialect.  (See the following table.)  Configure selects the
Packit Service 603f59
appropriate options for the dialect and runs the Mksrc shell script
Packit Service 603f59
in the dialect sub-directory to construct the appropriate source
Packit Service 603f59
files in the top-level distribution directory.
Packit Service 603f59
Packit Service 603f59
Configure may also run the MkKernOpts script in the dialect
Packit Service 603f59
sub-directory to propagate kernel build options to the dialect
Packit Service 603f59
Makefile.  This is done for only a few dialects -- e.g., DC/OSx,
Packit Service 603f59
and Reliant UNIX.
Packit Service 603f59
Packit Service 603f59
Configure creates a dialect-specific Makefile.  You may want to
Packit Service 603f59
inspect or edit this Makefile to make it conform to local conventions.
Packit Service 603f59
If you want the Makefile to install lsof and its man page, you will
Packit Service 603f59
have to create an appropriate install rule.
Packit Service 603f59
Packit Service 603f59
Lsof may be configured using UNIX dialect abbreviations from the
Packit Service 603f59
following table.  Alternative abbreviations are indicated by a
Packit Service 603f59
separating `|'.   For example, for SCO OpenServer you can use either
Packit Service 603f59
the ``osr'' or the ``sco'' abbreviation:
Packit Service 603f59
Packit Service 603f59
	$ Configure osr
Packit Service 603f59
    or
Packit Service 603f59
	$ Configure sco
Packit Service 603f59
Packit Service 603f59
 Abbreviations		UNIX Dialect
Packit Service 603f59
 -------------		------------
Packit Service 603f59
Packit Service 603f59
    aix			IBM AIX 5.[23] and 5.3-ML1 using IBM's C Compiler
Packit Service 603f59
    aixgcc		IBM AIX 5.[12] and 5.3-ML1 using gcc
Packit Service 603f59
    darwin		Apple Darwin 7.x and 8.x for Power Macintosh systems
Packit Service 603f59
    decosf		DEC OSF/1, Digital UNIX, Tru64 UNIX 4.0 and 5.1
Packit Service 603f59
    digital_unix	Digital UNIX, DEC OSF/1, Tru64 UNIX 4.0 and 5.1
Packit Service 603f59
    du			Digital UNIX, DEC OSF/1, Tru64 UNIX 4.0 and 5.1
Packit Service 603f59
    freebsd		FreeBSD 4.x, 4.1x, 5.x and [67].x
Packit Service 603f59
    hpux		HP-UX 11.00, 11.11 and 11.23, using HP's C
Packit Service 603f59
			Compiler, both /dev/kmem-based and PSTAT-based
Packit Service 603f59
    hpuxgcc		HP-UX 11.00, 11.11 and 11.23, using gcc, both
Packit Service 603f59
			/dev/kmem-based and PSTAT-based
Packit Service 603f59
    linux		Linux 2.1.72 and above for x86-based systems
Packit Service 603f59
    netbsd		NetBSD 1.[456], 2.x and 3.x
Packit Service 603f59
    next		NEXTSTEP 3.[13]
Packit Service 603f59
    nextstep		NEXTSTEP 3.[13]
Packit Service 603f59
    ns			NEXTSTEP 3.[13]
Packit Service 603f59
    nxt			NEXTSTEP 3.[13]
Packit Service 603f59
    openbsd		OpenBSD 2.[89] and 3.[0-9]
Packit Service 603f59
    openstep		OPENSTEP 4.x
Packit Service 603f59
    os			OPENSTEP 4.x
Packit Service 603f59
    osr			SCO OpenServer Release 5.0.6, using the C compiler
Packit Service 603f59
			from the SCO developer's kit
Packit Service 603f59
    osrgcc		SCO OpenServer Release 5.0.6, using gcc
Packit Service 603f59
    osr6		SCO Openserver 6.0.0, using the SCO C compiler
Packit Service 603f59
    sco			SCO OpenServer Release 5.0.6, using the C compiler
Packit Service 603f59
			from the SCO developer's kit
Packit Service 603f59
    scogcc		SCO OpenServer Release 5.0.6, using gcc
Packit Service 603f59
    solaris		Solaris 2.x, 7, 8, 9 and 10 using gcc
Packit Service 603f59
    solariscc		Solaris 2.x, 7, 8, 9 and 10 using Sun's cc
Packit Service 603f59
    tru64		Tru64 UNIX, DEC OSF/1, Digital UNIX 4.0 and 5.1
Packit Service 603f59
    unixware		SCO|Caldera UnixWare 7.1.4
Packit Service 603f59
    uw			SCO|Caldera UnixWare 7.1.4
Packit Service 603f59
Packit Service 603f59
If you have an earlier version of a dialect not named in the above
Packit Service 603f59
list, lsof may still work on your system.  I have no way of testing
Packit Service 603f59
that myself.  Try configuring for the named dialect -- e.g., if
Packit Service 603f59
you're using Solaris 2.1, try configuring for Solaris 2.5.1.
Packit Service 603f59
Packit Service 603f59
After you have configured lsof for your UNIX dialect and have
Packit Service 603f59
selected options via the Customize script (See the The Customize
Packit Service 603f59
Script section.) , use the make command to build lsof -- e.g.,
Packit Service 603f59
Packit Service 603f59
	$ make
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
Other Configure Script Options
Packit Service 603f59
==============================
Packit Service 603f59
Packit Service 603f59
There are three other useful options to the Configure script besides
Packit Service 603f59
the dialect abbreviation:
Packit Service 603f59
Packit Service 603f59
	-clean          may be specified to remove all traces of
Packit Service 603f59
			a dialect configuration, including the
Packit Service 603f59
			Makefile, symbolic links, and library files.
Packit Service 603f59
Packit Service 603f59
	-h              may be specified to obtain a list of
Packit Service 603f59
	-help		Configure options, including dialect
Packit Service 603f59
			abbreviations.
Packit Service 603f59
Packit Service 603f59
	-n              may be specified to stop the Configure
Packit Service 603f59
			script from calling the Customize and
Packit Service 603f59
			Inventory scripts.
Packit Service 603f59
Packit Service 603f59
			Caution: -n also suppresses the AFSConfig
Packit Service 603f59
			step.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
Environment Variables
Packit Service 603f59
=====================
Packit Service 603f59
Packit Service 603f59
Lsof configuration, building, and execution may be affected by
Packit Service 603f59
environment variable settings.  See the Definitions That Affect
Packit Service 603f59
Compilation section in the 00PORTING file, the General Environment
Packit Service 603f59
Variables section in the 00XCONFIG file, the Dialect-Specific
Packit Service 603f59
Environment Variables section in the 00XCONFIG file, and the
Packit Service 603f59
Environment Variables Affecting the Configure Script section of
Packit Service 603f59
this file for more information.
Packit Service 603f59
Packit Service 603f59
Note in the General Environment Variables section of the 00XCONFIG
Packit Service 603f59
file that there are five environment variables that can be used to
Packit Service 603f59
pre-define values in lsof's -v output: LSOF_BLDCMT, LSOF_HOST,
Packit Service 603f59
LSOF_LOGNAME, LSOF_SYSINFO, and LSOF_USER.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
Security
Packit Service 603f59
========
Packit Service 603f59
Packit Service 603f59
If the symbol HASSECURITY is defined, a security mode is enabled,
Packit Service 603f59
and lsof will allow only the root user to list all open files.
Packit Service 603f59
Non-root users may list only open files whose processes have the
Packit Service 603f59
same user ID as the real user ID of the lsof process (the one that
Packit Service 603f59
its user logged on with).
Packit Service 603f59
Packit Service 603f59
However, if HASNOSOCKSECURITY is also defined, anyone may list
Packit Service 603f59
anyone else's open socket files, provided their listing is enabled
Packit Service 603f59
with the "-i" option.
Packit Service 603f59
Packit Service 603f59
Lsof is distributed with the security mode disabled -- HASSECURITY
Packit Service 603f59
is not defined.  (When HASSECURITY is not defined, the definition
Packit Service 603f59
of HASNOSOCKSECURITY has no meaning.)  You can enable the security
Packit Service 603f59
mode by defining HASSECURITY in the Makefile or in the machine.h
Packit Service 603f59
header file for the specific dialect you're using -- e.g.
Packit Service 603f59
dialects/aix/machine.h.
Packit Service 603f59
Packit Service 603f59
The Customize script, run by Configure when it has finished its
Packit Service 603f59
work, gives you the opportunity to define HASSECURITY and
Packit Service 603f59
HASNOSOCKSECURITY.  (See the The Customize Script section.)
Packit Service 603f59
Packit Service 603f59
The lsof -h output indicates the state HASSECURITY and HASNOSOCKSECURITY
Packit Service 603f59
had when lsof was built, reporting:
Packit Service 603f59
Packit Service 603f59
    "Only root can list all files;"
Packit Service 603f59
	if HASSECURITY was defined and HASNOSOCKSECURITY wasn't
Packit Service 603f59
	defined;
Packit Service 603f59
Packit Service 603f59
    "Only root can list all files, but anyone can list socket files."
Packit Service 603f59
	if HASSECURITY and HASNOSOCKSECURITY were both defined;
Packit Service 603f59
Packit Service 603f59
    "Anyone can list all files;"
Packit Service 603f59
	if HASSECURITY wasn't defined.  (The definition of
Packit Service 603f59
	HASNOSOCKSECURITY doesn't matter when HASSECURITY isn't
Packit Service 603f59
	defined.)
Packit Service 603f59
Packit Service 603f59
You should carefully consider the implications of using the default
Packit Service 603f59
security mode.  When lsof is compiled in the absence of the
Packit Service 603f59
HASSECURITY definition, anyone who can execute lsof may be able to
Packit Service 603f59
see the presence of all open files.  This may allow the lsof user
Packit Service 603f59
to observe open files -- e.g., log files used to track intrusions
Packit Service 603f59
-- whose presence you would rather not disclose.
Packit Service 603f59
Packit Service 603f59
As distributed, lsof writes a user-readable and user-writable device
Packit Service 603f59
cache file in the home directory of the real user ID executing
Packit Service 603f59
lsof.  There are other options for constructing the device cache file
Packit Service 603f59
path, and they each have security implications.
Packit Service 603f59
Packit Service 603f59
The 00DCACHE file in the lsof distribution discusses device cache
Packit Service 603f59
file path construction in great detail.   It tells how to disable
Packit Service 603f59
the various device cache file path options, or how to disable the
Packit Service 603f59
entire device cache file feature by removing the HASDCACHE definition
Packit Service 603f59
from the dialect's machine.h file.  There is also information on
Packit Service 603f59
the device cache file feature in the 00FAQ file.  (The 00DCACHE
Packit Service 603f59
and 00FAQ files are part of the lsof distribution package.)
Packit Service 603f59
Packit Service 603f59
The Customize script, run by Configure after it has finished its
Packit Service 603f59
work, gives you the opportunity to change the compile-time options
Packit Service 603f59
related to the device cache file.  (See The Customize Script
Packit Service 603f59
section.)
Packit Service 603f59
Packit Service 603f59
Since lsof may need setgid or setuid-root permission (See the Setgid
Packit Service 603f59
Lsof Dialects and Setuid-root Lsof Dialects sections.), its security
Packit Service 603f59
should always be viewed with skepticism.  Lest the setgid and
Packit Service 603f59
setuid-root permissions allow lsof to read kernel name list or
Packit Service 603f59
memory files, declared with the -k and -m options, that the lsof
Packit Service 603f59
user can't normally access, lsof uses access(2) to establish its
Packit Service 603f59
real user's authority to read such files when it can't surrender
Packit Service 603f59
its power before opening them.  This change was added at the
Packit Service 603f59
suggestion of Tim Ramsey.
Packit Service 603f59
Packit Service 603f59
Lsof surrenders setgid permission on most dialects when it has
Packit Service 603f59
gained access to the kernel's memory devices.  There are exceptions
Packit Service 603f59
to this rule, and some lsof implementations need to run setuid-root.
Packit Service 603f59
(The Setgid Lsof Dialects and Setuid-root Lsof Dialects sections
Packit Service 603f59
contains a list of lsof implementations and the permissions
Packit Service 603f59
recommended in the distribution's Makefiles.)
Packit Service 603f59
Packit Service 603f59
The surrendering of setgid permission is controlled by the WILLDROPGID
Packit Service 603f59
definition in the dialect machine.h header files.
Packit Service 603f59
Packit Service 603f59
In the end you must judge for yourself and your installation the
Packit Service 603f59
risks that lsof presents and restrict access to it according to
Packit Service 603f59
your circumstances and judgement.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
Run-time Warnings
Packit Service 603f59
=================
Packit Service 603f59
Packit Service 603f59
Lsof can issue warning messages when it runs -- e.g., about the
Packit Service 603f59
state of the device cache file, about an inability to access an
Packit Service 603f59
NFS file system, etc.  Issuance of warnings are enabled by default
Packit Service 603f59
in the lsof distribution.
Packit Service 603f59
Packit Service 603f59
Issuance or warnings may be disabled by default by defining
Packit Service 603f59
WARNINGSTATE in the dialect's machine.h.  The Customize script may
Packit Service 603f59
also be used to change the default warning message issuance state.
Packit Service 603f59
(See The Customize Script section.)
Packit Service 603f59
Packit Service 603f59
The ``-w'' option description of the ``-h'' option (help) output
Packit Service 603f59
will indicate the default warning issuance state.  Whatever the
Packit Service 603f59
state may be, it can be reversed with ``-w''.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
Device Access Warnings
Packit Service 603f59
======================
Packit Service 603f59
Packit Service 603f59
When lsof encounters a /dev (or /devices) directory, one of its
Packit Service 603f59
sub-directories, or one of their files that it cannot access with
Packit Service 603f59
opendir(3) or stat(2), it issues a warning message and continues.
Packit Service 603f59
Lsof will be more likely to issue such a warning when it has been
Packit Service 603f59
installed with setgid(<some group name>) permission; it won't have
Packit Service 603f59
trouble if it has been installed with setuid(root) permission or
Packit Service 603f59
is being run under the root login.
Packit Service 603f59
Packit Service 603f59
The lsof caller can inhibit or enable the warning with the -w
Packit Service 603f59
option, depending on the issuance state of run-time warnings.  (See
Packit Service 603f59
the Run-time Warnings section.)
Packit Service 603f59
Packit Service 603f59
The warning messages do not appear when lsof obtains device
Packit Service 603f59
information from a device cache file that it has built and believes
Packit Service 603f59
to be current or when warning message issuance is disabled by
Packit Service 603f59
default.  (See the "Caches -- Name and Device" section for more
Packit Service 603f59
information on the device cache file.)
Packit Service 603f59
Packit Service 603f59
The lsof builder can inhibit the warning by disabling the definition
Packit Service 603f59
of WARNDEVACCESS in the dialect's machine.h or disable all warnings
Packit Service 603f59
by defining WARNINGSTATE.  WARNDEVACCESS is defined by default for
Packit Service 603f59
most dialects.  However, some dialects have some device directory
Packit Service 603f59
elements that are private -- e.g., HP-UX -- and it is more convenient
Packit Service 603f59
for the lsof user if warning messages about them are inhibited.
Packit Service 603f59
Packit Service 603f59
Output from lsof's -h option indicates the status of WARNDEVACCESS.
Packit Service 603f59
If it was defined when lsof was compiled, this message will appear:
Packit Service 603f59
Packit Service 603f59
    /dev warnings = enabled
Packit Service 603f59
Packit Service 603f59
If WARNDEVACCESS was not defined when lsof was compiled, this
Packit Service 603f59
message will appear instead:
Packit Service 603f59
Packit Service 603f59
    /dev warnings = disabled
Packit Service 603f59
Packit Service 603f59
The Customize script, run by Configure after it has finished its
Packit Service 603f59
work, gives you the opportunity to change the WARNDEVACCESS
Packit Service 603f59
definition.  (See The Customize Script section.)
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
NFS Blocks
Packit Service 603f59
==========
Packit Service 603f59
Packit Service 603f59
Lsof is susceptible to NFS blocks when it tries to lstat() mounted
Packit Service 603f59
file systems and when it does further processing -- lstat() and
Packit Service 603f59
readlink() -- on its optional file and file system arguments.
Packit Service 603f59
Packit Service 603f59
Lsof tries to avoid being stopped completely by NFS blocks by doing
Packit Service 603f59
the lstat() and readlink() functions in a child process, which
Packit Service 603f59
returns the function response via a pipe.  The lsof parent limits
Packit Service 603f59
the wait for data to arrive in the pipe with a SIGALRM, and, if
Packit Service 603f59
the alarm trips, terminates the child process with a SIGINT and a
Packit Service 603f59
SIGKILL.
Packit Service 603f59
Packit Service 603f59
This is as reliable and portable a method for breaking NFS deadlocks
Packit Service 603f59
as I have found, although it still fails under some combinations
Packit Service 603f59
of NFS version, UNIX dialect, and NFS file system mount options.
Packit Service 603f59
It generally succeeds when the "intr" or "soft" mount options are
Packit Service 603f59
used; it generally fails when the "hard" mount option is used.
Packit Service 603f59
Packit Service 603f59
When lsof cannot kill the child process, a second timeout causes
Packit Service 603f59
it to stop waiting for the killed child to complete.  While the
Packit Service 603f59
second timeout allows lsof to complete, it may leave behind a hung
Packit Service 603f59
child process.  Unless warnings are inhibited by default or with
Packit Service 603f59
the -w option, lsof reports the possible hung child.
Packit Service 603f59
Packit Service 603f59
NFS block handling was updated with suggestions made by Andreas
Packit Service 603f59
Stolcke.  Andreas suggested using the alternate device numbers that
Packit Service 603f59
appear in the mount tables of some dialects when it is not possible
Packit Service 603f59
to stat(2) the mount points.
Packit Service 603f59
Packit Service 603f59
The -b option was added to direct lsof to avoid the stat(2) and
Packit Service 603f59
readlink(2) calls that might block on NFS mount points and always
Packit Service 603f59
use the alternate device numbers.  If warning message issuance is
Packit Service 603f59
enabled and you don't want warning messages about what lsof is
Packit Service 603f59
doing, use the -w option, too.
Packit Service 603f59
Packit Service 603f59
The -O option directs lsof to avoid doing the potentially blocking
Packit Service 603f59
operations in child processes.  Instead, when -O is specified, lsof
Packit Service 603f59
does them directly.  While this consumes far less system overhead,
Packit Service 603f59
it can cause lsof to hang, so I advise you to use -O sparingly.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
Caches -- Name and Device
Packit Service 603f59
==========================
Packit Service 603f59
Packit Service 603f59
Robert Ehrlich suggested that lsof obtain path name components for
Packit Service 603f59
open files from the kernel's name cache.  Where possible, lsof
Packit Service 603f59
dialect implementations do that.  The -C option inhibits kernel
Packit Service 603f59
name cache examination.
Packit Service 603f59
Packit Service 603f59
Since AFS apparently does not use the kernel's name cache, where
Packit Service 603f59
lsof supports AFS it is unable to identify AFS files with path name
Packit Service 603f59
components.
Packit Service 603f59
Packit Service 603f59
Robert also suggested that lsof cache the information it obtains
Packit Service 603f59
via stat(2) for nodes in /dev (or /devices) to reduce subsequent
Packit Service 603f59
running time.  Lsof does that, too.
Packit Service 603f59
Packit Service 603f59
In the default distribution the device cache file is stored in
Packit Service 603f59
.lsof_hostname, mode 0600, in the home directory of the login of
Packit Service 603f59
the user ID that executes lsof.  The suffix, hostname, is the first
Packit Service 603f59
component of the host's name returned by gethostname(2).  If lsof
Packit Service 603f59
is executed by a user ID whose home directory is NFS-mounted from
Packit Service 603f59
several hosts, the user ID's home directory may collect several
Packit Service 603f59
device cache files, one for each host from which it was executed.
Packit Service 603f59
Packit Service 603f59
Lsof senses accidental or malicious damage to the device cache file
Packit Service 603f59
with extensive integrity checks, including the use of a 16 bit CRC.
Packit Service 603f59
It also tries to sense changes in /dev (or /devices) that indicate
Packit Service 603f59
the device cache file is out of date.
Packit Service 603f59
Packit Service 603f59
There are other options for forming the device cache file path.
Packit Service 603f59
Methods the lsof builder can use to control and employ them are
Packit Service 603f59
documented in the separate 00DCACHE file of the lsof distribution.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
Raw Sockets
Packit Service 603f59
===========
Packit Service 603f59
Packit Service 603f59
On many UNIX systems raw sockets use a separate network control
Packit Service 603f59
block structure.  Display of files for applications using raw
Packit Service 603f59
sockets -- ping, using ICMP, for example -- need special support
Packit Service 603f59
for displaying their information.  This support is so dialect-specific
Packit Service 603f59
and information to provide it so difficult to find that not all
Packit Service 603f59
dialect revisions of lsof handle raw sockets completely.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
Other Compile-time Definitions
Packit Service 603f59
==============================
Packit Service 603f59
Packit Service 603f59
The machine.h and dlsof.h header files for each dialect contains
Packit Service 603f59
definitions that affect the compilation of lsof.  Check the
Packit Service 603f59
Definitions That Affect Compilation section of the 00PORTING file
Packit Service 603f59
of the lsof distribution for their descriptions.  (Also see The
Packit Service 603f59
Customize Script section.)
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
The AFSConfig Script
Packit Service 603f59
====================
Packit Service 603f59
Packit Service 603f59
Lsof supports AFS on some combinations of UNIX dialect and AFS
Packit Service 603f59
version.  See the AFS section of this document for a list of
Packit Service 603f59
supported combinations.
Packit Service 603f59
Packit Service 603f59
When configuring for dialects where AFS is supported, the Configure
Packit Service 603f59
script calls the AFSConfig script to determine the location of AFS
Packit Service 603f59
header files and the AFS version.  Configure will not call AFSConfig,
Packit Service 603f59
even for the selected dialects, unless the file /usr/vice/etc/ThisCell
Packit Service 603f59
exists.
Packit Service 603f59
Packit Service 603f59
The AFS header file location is recorded in the AFSHeaders file;
Packit Service 603f59
version, AFSVersion.  Once these values have been recorded, Configure
Packit Service 603f59
can be told to skip the calling of AFSConfig by specifying its
Packit Service 603f59
(Configure's) -n option.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
The Inventory Script
Packit Service 603f59
====================
Packit Service 603f59
Packit Service 603f59
The lsof distribution contains a script, called Inventory, that
Packit Service 603f59
checks the distribution for completeness.  It uses the file 00MANIFEST
Packit Service 603f59
in the distribution as a reference point.
Packit Service 603f59
Packit Service 603f59
After the Configure script has accepted the dialect abbreviation,
Packit Service 603f59
it normally calls the Inventory script to make sure the distribution
Packit Service 603f59
is complete.
Packit Service 603f59
Packit Service 603f59
After Inventory has run, it creates the file ".ck00MAN" in the
Packit Service 603f59
top-level directory to record for itself the fact that the inventory
Packit Service 603f59
has been check.  Should Inventory be called again, it senses this
Packit Service 603f59
file and asks the caller if another check is in order, or if the
Packit Service 603f59
check should be skipped.
Packit Service 603f59
Packit Service 603f59
The -n option may be supplied to Configure to make it bypass the
Packit Service 603f59
calling of the Inventory script.  (The option also causes Configure
Packit Service 603f59
to avoid calling the Customize script.)
Packit Service 603f59
Packit Service 603f59
The lsof power user may want to define (touch) the file ".neverInv".
Packit Service 603f59
Configure avoids calling the Inventory script when ".neverInv"
Packit Service 603f59
exists.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
The Customize Script
Packit Service 603f59
====================
Packit Service 603f59
Packit Service 603f59
Normally when the Configure script has finished its work, it calls
Packit Service 603f59
another shell script in the lsof distribution called Customize.
Packit Service 603f59
(You can tell Configure to bypass Customize with its -n option.)
Packit Service 603f59
Packit Service 603f59
Customize leads you through the specification of these important
Packit Service 603f59
compile-time definitions for the dialect's machine.h header file:
Packit Service 603f59
Packit Service 603f59
	HASDCACHE		device cache file control
Packit Service 603f59
	    HASENVDC		device cache file environment
Packit Service 603f59
				variable name
Packit Service 603f59
	    HASPERSDC		personal device cache file path
Packit Service 603f59
				format
Packit Service 603f59
	    HASPERSDCPATH	name of environment variable that
Packit Service 603f59
				provides an additional component
Packit Service 603f59
				of the personal device cache file
Packit Service 603f59
				path
Packit Service 603f59
	    HASSYSDC		system-wide device cache file path
Packit Service 603f59
	HASKERNIDCK		the build-time to run-time kernel
Packit Service 603f59
				identity check
Packit Service 603f59
	HASSECURITY		the security option
Packit Service 603f59
	HASNOSOCKSECURITY	the open socket listing option whe
Packit Service 603f59
				HASSECURITY is defined
Packit Service 603f59
	WARNDEVACCESS		/dev (or /devices) warning message
Packit Service 603f59
				control
Packit Service 603f59
	WARNINGSTATE		warning message issuance state
Packit Service 603f59
Packit Service 603f59
The Customize script accompanies its prompting for entry of new
Packit Service 603f59
values for these definitions with brief descriptions of each of
Packit Service 603f59
them.  More information on these definitions may be found in this
Packit Service 603f59
file or in the 00DCACHE and 00FAQ files of the lsof distribution.
Packit Service 603f59
Packit Service 603f59
You don't need to run Customize after Configure.  You can run it
Packit Service 603f59
later or you can edit machine.h directly.
Packit Service 603f59
Packit Service 603f59
The -n option may be supplied to Configure to make it bypass the
Packit Service 603f59
calling of the Customize script.  (The option also causes Configure
Packit Service 603f59
to avoid calling the Inventory script.)
Packit Service 603f59
Packit Service 603f59
The lsof power user may want to define (touch) the file ".neverCust".
Packit Service 603f59
Configure avoids calling the Customize script when ".neverCust"
Packit Service 603f59
exists.
Packit Service 603f59
Packit Service 603f59
Customize CAUTION: the Customize script works best when it is
Packit Service 603f59
applied to a newly configured lsof source base -- i.e., the machine.h
Packit Service 603f59
header file has not been previously modified by the Customize
Packit Service 603f59
script.  If you have previously configured lsof, and want to rerun
Packit Service 603f59
the Customize script, I recommend you clean out the previous
Packit Service 603f59
configuration and create a new one:
Packit Service 603f59
Packit Service 603f59
	$ Configure -clean
Packit Service 603f59
	$ Configure <dialect_abbreviation>
Packit Service 603f59
	...
Packit Service 603f59
	Customize in response to the Customize script prompts.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
Cautions
Packit Service 603f59
========
Packit Service 603f59
Packit Service 603f59
Lsof is a tool that is closely tied to the UNIX operating system
Packit Service 603f59
version.  It uses header files that describe kernel structures and
Packit Service 603f59
reads kernel structures that typically change from OS version to
Packit Service 603f59
OS version, and even within a version as vendor patches are applied.
Packit Service 603f59
Packit Service 603f59
DON'T TRY TO USE AN LSOF BINARY, COMPILED FOR ONE UNIX OS VERSION,
Packit Service 603f59
ON ANOTHER.  VENDOR PATCHES INFLUENCE THE VERSION IDENTITY.
Packit Service 603f59
Packit Service 603f59
On some UNIX dialects lsof versions may be even more restricted by
Packit Service 603f59
architecture type.
Packit Service 603f59
Packit Service 603f59
The bottom line is use lsof where you built it.  If you intend to
Packit Service 603f59
use a common lsof binary on multiple systems, make sure all systems
Packit Service 603f59
run exactly the same OS version and have exactly the same patches.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
Warranty
Packit Service 603f59
========
Packit Service 603f59
Packit Service 603f59
Lsof is provided as-is without any warranty of any kind, either
Packit Service 603f59
expressed or implied, including, but not limited to, the implied
Packit Service 603f59
warranties of merchantability and fitness for a particular purpose.
Packit Service 603f59
The entire risk as to the quality and performance of lsof is with
Packit Service 603f59
you.  Should lsof prove defective, you assume the cost of all
Packit Service 603f59
necessary servicing, repair, or correction.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
License
Packit Service 603f59
=======
Packit Service 603f59
Packit Service 603f59
Lsof has no license.  Its use and distribution are subject to these
Packit Service 603f59
terms and conditions, found in each lsof source file.  (The copyright
Packit Service 603f59
year in or format of the notice may vary slightly.)
Packit Service 603f59
Packit Service 603f59
    /*
Packit Service 603f59
     * Copyright 2002 Purdue Research Foundation, West Lafayette,
Packit Service 603f59
     * Indiana 47907.  All rights reserved.
Packit Service 603f59
     *
Packit Service 603f59
     * Written by Victor A. Abell
Packit Service 603f59
     *
Packit Service 603f59
     * This software is not subject to any license of the American
Packit Service 603f59
     * Telephone and Telegraph Company or the Regents of the
Packit Service 603f59
     * University of California.
Packit Service 603f59
     *
Packit Service 603f59
     * Permission is granted to anyone to use this software for
Packit Service 603f59
     * any purpose on any computer system, and to alter it and
Packit Service 603f59
     * redistribute it freely, subject to the following
Packit Service 603f59
     * restrictions:
Packit Service 603f59
     *
Packit Service 603f59
     * 1. Neither the authors nor Purdue University are responsible
Packit Service 603f59
     *    for any consequences of the use of this software.
Packit Service 603f59
     *
Packit Service 603f59
     * 2. The origin of this software must not be misrepresented,
Packit Service 603f59
     *    either by explicit claim or by omission.  Credit to the
Packit Service 603f59
     *    authors and Purdue University must appear in documentation
Packit Service 603f59
     *    and sources.
Packit Service 603f59
     *
Packit Service 603f59
     * 3. Altered versions must be plainly marked as such, and must
Packit Service 603f59
     *    not be misrepresented as being the original software.
Packit Service 603f59
     *
Packit Service 603f59
     * 4. This notice may not be removed or altered.
Packit Service 603f59
     */
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
Bug Reports
Packit Service 603f59
===========
Packit Service 603f59
Packit Service 603f59
Now that the obligatory disclaimer is out of the way, let me hasten to
Packit Service 603f59
add that I accept lsof bug reports and try hard to respond to them.  I
Packit Service 603f59
will also consider and discuss requests for new features, ports to new
Packit Service 603f59
dialects, or ports to new OS versions.
Packit Service 603f59
Packit Service 603f59
PLEASE DON'T SEND BUG REPORTS ABOUT LSOF TO THE UNIX DIALECT OR DIALECT
Packit Service 603f59
OPTION VENDOR.
Packit Service 603f59
Packit Service 603f59
At worst such bug reports will confuse the vendor; at best, the vendor
Packit Service 603f59
will forward the bug report to me.
Packit Service 603f59
Packit Service 603f59
PLEASE DON'T SEND BUG REPORTS ABOUT LSOF BINARIES BUILT OR DISTRIBUTED
Packit Service 603f59
BY SOMEONE ELSE, BECAUSE I CAN'T SUPPORT THEM.
Packit Service 603f59
Packit Service 603f59
Before you send me a bug report, please do these things:
Packit Service 603f59
Packit Service 603f59
    *  Make sure you try the latest lsof revision.
Packit Service 603f59
Packit Service 603f59
       +  Download the latest revision from:
Packit Service 603f59
Packit Service 603f59
	    ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof
Packit Service 603f59
Packit Service 603f59
       +  Verify the signatures of what you have downloaded;
Packit Service 603f59
Packit Service 603f59
       +  While connected to lsof.itap.purdue.edu, check for patches:
Packit Service 603f59
Packit Service 603f59
	    ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/patches
Packit Service 603f59
Packit Service 603f59
       +  If patches exist, install them in the latest revision
Packit Service 603f59
	  you just downloaded.  Then build the latest revision and
Packit Service 603f59
	  see if it fixes your bug.
Packit Service 603f59
Packit Service 603f59
    *  If you're having trouble compiling lsof with gcc, try the
Packit Service 603f59
       UNIX dialect vendor's compiler.  I don't have access to gcc on
Packit Service 603f59
       all test systems, so my support for it is hit-and-miss, and so
Packit Service 603f59
       is my ability to respond to gcc compilation problem reports.
Packit Service 603f59
Packit Service 603f59
    *  Check the lsof frequently asked questions file, 00FAQ,
Packit Service 603f59
       to see if there's a question and answer relevant to your
Packit Service 603f59
       problem.
Packit Service 603f59
Packit Service 603f59
    *  Make sure you're running the lsof you think you are by
Packit Service 603f59
       checking the path to it with which(1).  When in doubt, use an
Packit Service 603f59
       absolute path to lsof.  Make sure that lsof binary has
Packit Service 603f59
       sufficient permissions to do what you ask, including internal
Packit Service 603f59
       permissions given it (e.g., restrictions on what files lsof may
Packit Service 603f59
       report for whom) during its build.
Packit Service 603f59
Packit Service 603f59
When you send a bug report, make sure you include output from your
Packit Service 603f59
running of lsof's Configure script.  If you were able to compile a
Packit Service 603f59
running lsof, please also include:
Packit Service 603f59
Packit Service 603f59
    *  Output from which(1) that shows the absolute path to the
Packit Service 603f59
       lsof binary in question;
Packit Service 603f59
Packit Service 603f59
    *  Output from running lsof with its -h and -v options at
Packit Service 603f59
       lsof's absolute path;
Packit Service 603f59
Packit Service 603f59
    *  Output from "ls -l" directed to lsof's absolute path.
Packit Service 603f59
Packit Service 603f59
If you weren't able to compile a running lsof, please send me: the
Packit Service 603f59
compiler error output; identification of the lsof revision you're using
Packit Service 603f59
(contents of the lsof version.c file); identification of your system
Packit Service 603f59
(full uname output or output from whatever other tool identifies the
Packit Service 603f59
system); and compiler identification (e.g., gcc -v output).
Packit Service 603f59
Packit Service 603f59
Either set of output will help me understand how lsof was configured
Packit Service 603f59
and what UNIX dialect and lsof revision is involved.
Packit Service 603f59
Packit Service 603f59
Please send all bug reports, requests, etc. to me via e-mail at
Packit Service 603f59
<abe@purdue.edu>.  Make sure "lsof" appears in the "Subject:" line so
Packit Service 603f59
my e-mail filter won't classify your letter as Spam.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
The 00FAQ File
Packit Service 603f59
==============
Packit Service 603f59
Packit Service 603f59
The lsof distribution contains an extensive frequently asked
Packit Service 603f59
questions file on lsof features and problems.  I recommend you
Packit Service 603f59
consult it before sending me e-mail.  Use your favorite editor or
Packit Service 603f59
pager to search 00FAQ -- e.g., supplying as a search argument some
Packit Service 603f59
fixed text from an lsof error message.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
The lsof-l Mailing List
Packit Service 603f59
=======================
Packit Service 603f59
Packit Service 603f59
Information about lsof, including notices about the availability
Packit Service 603f59
of new revisions, may be found in mailings of the lsof-l listserv.
Packit Service 603f59
For more information about it, including instructions on how to
Packit Service 603f59
subscribe, read the 00LSOF-L file of the lsof distribution.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
Field Output Example Scripts
Packit Service 603f59
============================
Packit Service 603f59
Packit Service 603f59
Example AWK and Perl 4 or 5 scripts for post-processing lsof field
Packit Service 603f59
output are locate in the scripts sub-directory of the lsof distribution.
Packit Service 603f59
The scripts sub-directory contains a 00README file with information
Packit Service 603f59
about the scripts.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
Field Output C Library
Packit Service 603f59
======================
Packit Service 603f59
Packit Service 603f59
The lsof test suite (See "Testing Lsof."), checks basic lsof
Packit Service 603f59
operations using field output.  The test suite has its own library
Packit Service 603f59
of C functions for common test program operations, including
Packit Service 603f59
processing of field output.  The library or selections of its
Packit Service 603f59
functions could be adapted for use by C programs that want to
Packit Service 603f59
process lsof field output.  See the library in the file LTlib.c
Packit Service 603f59
in the tests/ sub-directory
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
Testing Lsof
Packit Service 603f59
============
Packit Service 603f59
Packit Service 603f59
Lsof has an automated test suite in the tests/ sub-directory that
Packit Service 603f59
can be used to test some basic lsof features -- once lsof has been
Packit Service 603f59
configured and made.  Tests are arranged in three groups: basic
Packit Service 603f59
tests that should run on all dialects; standard tests that should
Packit Service 603f59
run on all dialects; and optional tests that may not run on all
Packit Service 603f59
dialects or may need special resources to run.  See 00TEST for more
Packit Service 603f59
information.)
Packit Service 603f59
Packit Service 603f59
CAUTION!!!  Before you attempt to use the test suite make sure that
Packit Service 603f59
the lsof you want to test can access the necessary kernel resources
Packit Service 603f59
-- e.g., /dev/mem, /dev/kmem, /proc, etc.  Usually you want to test
Packit Service 603f59
the lsof you just built, so this is an important check.  (See
Packit Service 603f59
00TEST.)
Packit Service 603f59
Packit Service 603f59
To run the basic and standard tests, using the lsof in the parent
Packit Service 603f59
directory of tests/, do this:
Packit Service 603f59
Packit Service 603f59
	$ cd tests
Packit Service 603f59
	$ make test
Packit Service 603f59
    or	$ make std
Packit Service 603f59
    or	$ make standard
Packit Service 603f59
Packit Service 603f59
The basic and standard tests may be run as silently as possible,
Packit Service 603f59
using the lsof in the parent directory of tests/, with:
Packit Service 603f59
Packit Service 603f59
	$ cd tests
Packit Service 603f59
	$ make auto
Packit Service 603f59
Packit Service 603f59
This is the "automatic" test mode, designed for use by scripts that
Packit Service 603f59
build lsof.  The caller is expected to test the make exit code to
Packit Service 603f59
determine if the tests succeeded.  The caller should divert standard
Packit Service 603f59
output and standard error to /dev/null to suppress make's error
Packit Service 603f59
exit message.
Packit Service 603f59
Packit Service 603f59
The optional tests may be run, using the lsof in the parent directory
Packit Service 603f59
of tests/, with:
Packit Service 603f59
Packit Service 603f59
	$ cd tests
Packit Service 603f59
	$ make opt
Packit Service 603f59
    or	$ make optional
Packit Service 603f59
Packit Service 603f59
It's possible to excute individual tests, too.  See the 00TEST file
Packit Service 603f59
of this distribution for more informaiton on the tests, what they
Packit Service 603f59
do, and how to run and possibly customize each test.
Packit Service 603f59
Packit Service 603f59
It's possible to run the tests, using an lsof other than the one
Packit Service 603f59
in the parent directory of /tests, too.  See 00TEST for information
Packit Service 603f59
about using the LT_LSOF_PATH environment variable to do that.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
=============
Packit Service 603f59
Dialect Notes
Packit Service 603f59
=============
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
AFS
Packit Service 603f59
===
Packit Service 603f59
Packit Service 603f59
Lsof recognizes AFS files on the following combinations of UNIX
Packit Service 603f59
dialect and AFS versions:
Packit Service 603f59
Packit Service 603f59
	AIX 4.1.4 (AFS 3.4a)
Packit Service 603f59
	Linux 1.2.13 (AFS 3.3)
Packit Service 603f59
	NEXTSTEP 3.2 (AFS 3.3) (untested on recent lsof revisions)
Packit Service 603f59
	Solaris 2.6 (AFS 3.4a)
Packit Service 603f59
	Ultrix 4.2 RISC (AFS 3.2b) (no longer available)
Packit Service 603f59
Packit Service 603f59
Lsof has not been tested under other combinations -- e.g. HP-UX
Packit Service 603f59
10.10 and AFS 3.4a -- and probably won't even compile there.  Often
Packit Service 603f59
when a UNIX dialect version or AFS version changes, the new header
Packit Service 603f59
files come into conflict, causing compiler objections.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
AIX
Packit Service 603f59
===
Packit Service 603f59
Packit Service 603f59
Specify the aix Configure abbreviation for AIX 4.1.[45], 4.2[.1],
Packit Service 603f59
4.3[.123], 5L, and 5.[123].
Packit Service 603f59
Packit Service 603f59
Specify aixgcc on AIX above 4.1 to use the gcc compiler.  (Gcc can't be
Packit Service 603f59
used to compile lsof on AIX 4.1 and below because of kernel structure
Packit Service 603f59
alignment differences between it and xlc.)  Gcc results sometimes
Packit Service 603f59
depend on the version of the gcc compiler that is used.
Packit Service 603f59
Packit Service 603f59
Compilation of lsof with gcc on AIX 4.3[.123], 5L, and 5.[123] has been
Packit Service 603f59
sparsely tested with varying degrees of success: it has been reported
Packit Service 603f59
to succeed on AIX 4.3.3 and 32 bit Power AIX 5.1; to fail on ia64 AIX
Packit Service 603f59
5.1 and 64 bit Power AIX 5.1; and to succeed on 32 and 64 bit Power AIX
Packit Service 603f59
5.2.  Lsof compilation with gcc hasn't been tested on AIX 5.3.
Packit Service 603f59
Packit Service 603f59
At revision 4.61 and above lsof is configured and built to match the
Packit Service 603f59
bit size of the kernel of Power architecture AIX 5.1 systems.  Lsof
Packit Service 603f59
binaries built for 32 and 64 bit kernels are not interchangeable.  See
Packit Service 603f59
00FAQ for more information.
Packit Service 603f59
Packit Service 603f59
The Configure script uses /usr/bin/oslevel to determine the AIX version
Packit Service 603f59
for AIX less than 5 and ``uname -rv'' for AIX 5 and higher.  If
Packit Service 603f59
/usr/bin/oslevel isn't executable on AIX less than 5, the Configure
Packit Service 603f59
script issues a warning message and uses ``uname -rv'' to determine the
Packit Service 603f59
AIX version.
Packit Service 603f59
Packit Service 603f59
When Configure must use ``uname -rv'' on AIX less than 5 to determine
Packit Service 603f59
the AIX version, the result will lack a correct third component --
Packit Service 603f59
e.g., the `4' of ``4.1.4''.  If your AIX less than 5 system lacks lacks
Packit Service 603f59
an executable oslevel, I suggest you edit the Configure-produced
Packit Service 603f59
Makefile and complete the _AIXV definition in the CFGF string.
Packit Service 603f59
Packit Service 603f59
By default lsof avoids using the kernel's readx() function, causing
Packit Service 603f59
it to be unable to report information on some text and library file
Packit Service 603f59
references.  The ``-X'' option allows the lsof user to ask for the
Packit Service 603f59
information readx() supplies.
Packit Service 603f59
Packit Service 603f59
Lsof avoids readx() to avoid the possibility of triggering a kernel
Packit Service 603f59
problem, known as the Stale Segment ID kernel bug.  Kevin Ruderman
Packit Service 603f59
reported this bug to me.  The bug shows up when the kernel's
Packit Service 603f59
dir_search() function hangs, hanging the application process that
Packit Service 603f59
called it so completely that the application process can neither
Packit Service 603f59
be killed nor stopped.  The hang is the consequence of another
Packit Service 603f59
process (perhaps lsof) making legitimate use of the kernel's readx()
Packit Service 603f59
function to access the kernel memory that dir_search() is examining.
Packit Service 603f59
IBM has indicated they have no plans to fix the bug.
Packit Service 603f59
Packit Service 603f59
A fuller discussion of this bug may be found in the 00FAQ file of
Packit Service 603f59
the lsof distribution.  There you will find a description of the
Packit Service 603f59
Stale Segment ID bug, the APAR on it, and a discussion of the
Packit Service 603f59
sequence of events that exposes it.
Packit Service 603f59
Packit Service 603f59
I added the ``-X'' function so you can tell lsof to use readx(),
Packit Service 603f59
but if you use ``-X'', you should be alert to its possibly serious
Packit Service 603f59
side effects.  Although readx() is normally disabled, its state is
Packit Service 603f59
controlled with the HASXOPT, HASXOPT_ROOT, and HASXOPT_VALUE
Packit Service 603f59
definitions in dialects/aix/machine.h, and you can change its
Packit Service 603f59
default state by changing those definitions.  You can also change
Packit Service 603f59
HASXOPT_ROOT via the Customize script.
Packit Service 603f59
Packit Service 603f59
You can also compile lsof with readx() use permanently enabled or
Packit Service 603f59
disabled -- see the comments about the definitions in the
Packit Service 603f59
dialects/aix/machine.h header file.  You may want to permanently
Packit Service 603f59
disable lsof's use of readx() if you plan to make lsof publicly
Packit Service 603f59
executable.  You can also restrict -X to processes whose real UID
Packit Service 603f59
is root by defining HASXOPT_ROOT.
Packit Service 603f59
Packit Service 603f59
I have never seen lsof cause the Stale Segment ID bug to occur and
Packit Service 603f59
haven't had a report that it has, but I believe there is a possibility
Packit Service 603f59
it could.
Packit Service 603f59
Packit Service 603f59
AFS support for AIX was added with help help from Bob Cook and Jan
Packit Service 603f59
Tax who provided test systems.
Packit Service 603f59
Packit Service 603f59
Henry Grebler and David J. Wilson helped with lsof for AIX 4.2.
Packit Service 603f59
Packit Service 603f59
Bill Pemberton provided an AIX 4.3 test system.  Andrew Kephart
Packit Service 603f59
and Tom Weaver provided AIX 4.3 technical assistance.   Niklas
Packit Service 603f59
Edmundsson did 4.3.1 testing.  Doug Crabill provided an AIX 4.3.2
Packit Service 603f59
test system.  Jeff W. Stewart provided an AIX 4.3.3 test system.
Packit Service 603f59
Packit Service 603f59
The SMT file type for AIX 4.1.[45], 4.2[.1], and 4.3[.12] is my
Packit Service 603f59
fabrication.  See the 00FAQ file more information on it.
Packit Service 603f59
Packit Service 603f59
Loc Le and Nasser Momtaheni of IBM provided test systems for AIX 5L and
Packit Service 603f59
5.1.  Lsof for AIX 5L and 5.1 needs setuid-root permission to process
Packit Service 603f59
the -X option on systems whose architecture type is ia64.
Packit Service 603f59
Packit Service 603f59
Dale Talcott of Purdue provided AIX 5.1 and 5.2 test systems.  Dale and
Packit Service 603f59
John Jackson of Purdue provided an AIX 5.3 test system.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
Apple Darwin
Packit Service 603f59
============
Packit Service 603f59
Packit Service 603f59
The Apple Darwin port was provided by Allan Nathanson for version
Packit Service 603f59
1.2.  Allan also arranged for access to a test system for maintenance
Packit Service 603f59
and regression testing.  Dale Talcott provided a test system, too.
Packit Service 603f59
Packit Service 603f59
Allan supplied patches for updates to 1.4, 5.x, 6.x, 7.x and 8.x.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
BSDI BSD/OS
Packit Service 603f59
===========
Packit Service 603f59
Packit Service 603f59
As of lsof revision 4.77 support for BSDI BSD/OS has been
Packit Service 603f59
discontinued.  Lsof revision 4.76 with BSDI BSD/OS support may be found
Packit Service 603f59
on lsof.itap.purdue.edu in pub/tools/unix/lsof/src.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
DEC OSF/1, Digital UNIX, Tru64 UNIX
Packit Service 603f59
===================================
Packit Service 603f59
Packit Service 603f59
Robert Benites, Dean Brock, Angel Li, Dwight McKay, Berkley Shands,
Packit Service 603f59
Ron Young and Steve Wilson have kindly provided test systems.
Packit Service 603f59
Jeffrey Mogul has provided technical assistance.  Dave Morrison
Packit Service 603f59
and Lawrence MacIntyre did Digital UNIX V3.2 testing.
Packit Service 603f59
Packit Service 603f59
Lsof supports the ADVFS/MSFS layered file system product.  Lsof
Packit Service 603f59
can locate all the open files of an ADVFS/MSFS file system when
Packit Service 603f59
its path is specified, provided the file system is listed in
Packit Service 603f59
/etc/fstab with an ``advfs'' type.  (This /etc/fstab caveat applies
Packit Service 603f59
only to Digital UNIX 2.0.)  At Digital UNIX 4.0 and Tru64 UNIX,
Packit Service 603f59
using code provided by David Brock, lsof 4.20 and above can locate
Packit Service 603f59
ADVFS file paths.
Packit Service 603f59
Packit Service 603f59
Testing of lsof on DEC OSF/1 and Digital UNIX 4.0 ended with lsof
Packit Service 603f59
revision 4.74.  Hence, the lsof documentation has dropped the claim
Packit Service 603f59
that it works there.  For a distribution of lsof 4.74 that was tested
Packit Service 603f59
on DEC OSF/1 and Digital UNIX 4.0, check pub/tools/unix/lsof/OLD/src
Packit Service 603f59
on the lsof ftp home, lsof.itap.purdue.edu.
Packit Service 603f59
Packit Service 603f59
Lsof revisions past 4.74 have only been tested on Tru64 UNIX 5.1.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
FreeBSD
Packit Service 603f59
=======
Packit Service 603f59
Packit Service 603f59
Bill Bormann of Purdue University provided access to several FreeBSD
Packit Service 603f59
test systems.  Ade Barkah, John Clear, Ralph Forsythe, Michael
Packit Service 603f59
Haro, Kurt Jaeger, and William McVey have also provided FreeBSD
Packit Service 603f59
test systems.
Packit Service 603f59
Packit Service 603f59
The FreeBSD distribution header files are augmented by header files
Packit Service 603f59
in the dialects/freebsd/include directory.
Packit Service 603f59
Packit Service 603f59
Larry Rosenman maintains the lsof FreeBSD port package.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
HP-UX
Packit Service 603f59
=====
Packit Service 603f59
Packit Service 603f59
Lsof has two HP-UX bases: /dev/kmem for HP-UX 11.0 and earlier;
Packit Service 603f59
and PSTAT for HP-UX 11.11 and later.  The lsof Configure script
Packit Service 603f59
will pick the appropriate base.
Packit Service 603f59
Packit Service 603f59
To use the CCITT x.25 socket support for HP-UX, you must have the
Packit Service 603f59
x.25 header files in /etc/conf/x25
Packit Service 603f59
Packit Service 603f59
Pasi Kaara helped with the HP-UX port, especially with its CCITT
Packit Service 603f59
x.25 socket support.
Packit Service 603f59
Packit Service 603f59
Richard Allen provided HP-UX 10.x and 11.x test systems, as did
Packit Service 603f59
Mark Bixby, and Elias Halldor Agustsson.   Marc Winkler helped test
Packit Service 603f59
the 10.20 port.  Richard J. Rauenzahn provided a 64 bit HP-UX 11
Packit Service 603f59
test system and an HP-UX 11.11 development system.
Packit Service 603f59
Packit Service 603f59
AFS support for HP-UX was added thanks to help from Chaskiel Moses
Packit Service 603f59
Grundman, who provided a test system.
Packit Service 603f59
Packit Service 603f59
The /dev/kmem-based HP-UX 11.00 support is extremely fragile.  It
Packit Service 603f59
depends on privately developed kernel structure definitions.  (See
Packit Service 603f59
.../dialects/hpux/hpux11 for the header files making the definitions.)
Packit Service 603f59
Those header files and their definitions will not be updated by
Packit Service 603f59
HP-UX 11.00 patches, making it likely that any patch changing a
Packit Service 603f59
kernel structure critical to lsof will break lsof in some way.
Packit Service 603f59
Packit Service 603f59
It's possible to build a 64 bit lsof for 64 bit HP-UX 11.00 with
Packit Service 603f59
gcc, but you must have a gcc compiler capable of producing 64 bit
Packit Service 603f59
executables.  See the 00FAQ file for more information.
Packit Service 603f59
Packit Service 603f59
The PSTAT-based lsof for HP-UX 11.11 and later is much more solid.
Packit Service 603f59
I am indebted to the vision of HP for providing an lsof kernel API
Packit Service 603f59
through the PSTAT implementation.  Specifically I appreciate the
Packit Service 603f59
help of HP staff members Carl Davidson, Louis Huemiller, Rich
Packit Service 603f59
Rauenzahn, and Sailu Yallapragada that made PSTAT-based HP-UX lsof
Packit Service 603f59
possible.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
IPv6
Packit Service 603f59
====
Packit Service 603f59
Packit Service 603f59
Lsof has IPv6 support that has been tested for these UNIX dialects:
Packit Service 603f59
AIX 4.3.x; Apple Darwin 5.[12] and 6.0; the INRIA and KAME FreeBSD IPv6
Packit Service 603f59
implementations; PSTAT-based HP-UX; /proc-based Linux; the INRIA and
Packit Service 603f59
KAME NetBSD implementations; and Solaris 8 and 9.  Lsof has IPv6
Packit Service 603f59
support that hasn't been tested for: OpenBSD (KAME); OpenUNIX 8; Tru64
Packit Service 603f59
Unix 5.[01]; and UnixWare 7.1.[34].
Packit Service 603f59
Packit Service 603f59
Please let me know if your UNIX dialect has IPv6 support and I'll
Packit Service 603f59
see if it can be supported by lsof.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
Linux
Packit Service 603f59
=====
Packit Service 603f59
Packit Service 603f59
Tim Korb, Steve Logue, Joseph J. Nuspl Jr., and Jonathan Sergent
Packit Service 603f59
have provided Linux test systems.
Packit Service 603f59
Packit Service 603f59
Michael Shields helped add and test automatic handling of ELF/COFF
Packit Service 603f59
form names in /System.map, Marty Leisner and Keith Parks have helped
Packit Service 603f59
test many lsof revisions.  Marty has provided valuable suggestions,
Packit Service 603f59
Linux hints, and code, too.
Packit Service 603f59
Packit Service 603f59
The 00FAQ file gives some Linux tips, including information on
Packit Service 603f59
coping with system map file problems.
Packit Service 603f59
Packit Service 603f59
To determine the state of the Linux 2.1.x C library lseek() function,
Packit Service 603f59
the lsof Configure script runs a test program that must have
Packit Service 603f59
permission to read /dev/kmem.  The test determines if the lseek()
Packit Service 603f59
function properly handles kernel offsets, which appear to be negative
Packit Service 603f59
because their high order bit is set.  If the lseek() test reveals
Packit Service 603f59
a faulty lseek(), Configure activates the use of a private lseek()
Packit Service 603f59
function for kernel offset positioning.  See the Linux problems
Packit Service 603f59
section of the 00FAQ file of the lsof distribution for more
Packit Service 603f59
information.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
NetBSD
Packit Service 603f59
======
Packit Service 603f59
Packit Service 603f59
Greg Earle  and Paul Kranenburg have assisted with the NetBSD ports.
Packit Service 603f59
Paul has provided test systems.  Ray Phillips provided a NetBSA
Packit Service 603f59
Alpha test system.  Andrew Brown also provided a test system.
Packit Service 603f59
Packit Service 603f59
The NetBSD dialect version of lsof is compiled using the dialect
Packit Service 603f59
sources it shares with OpenBSD in the n+obsd dialect sub-directory.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
NEXTSTEP and OPENSTEP
Packit Service 603f59
=====================
Packit Service 603f59
Packit Service 603f59
Virtual memory header files that allow lsof to display text references
Packit Service 603f59
were derived from the contents of /usr/include/vm of NEXTSTEP 2.0.
Packit Service 603f59
NeXT did not ship the virtual memory header files with other NEXTSTEP
Packit Service 603f59
or OPENSTEP versions.
Packit Service 603f59
Packit Service 603f59
You may use the RC_FLAGS environment variable to declare compiler
Packit Service 603f59
options outside the Makefile.  A common use of this variable is to
Packit Service 603f59
define the architecture types to be included in a "fat" executable.
Packit Service 603f59
See the comments in dialects/next/Makefile for an example.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
OpenBSD
Packit Service 603f59
=======
Packit Service 603f59
Packit Service 603f59
David Mazieres has provided OpenBSD test systems.  The OpenBSD
Packit Service 603f59
dialect version of lsof is compiled using the dialect sources it
Packit Service 603f59
shares with NetBSD in the n+obsd dialect sub-directory.
Packit Service 603f59
Packit Service 603f59
Kenneth Stailey has provided OpenBSD testing and advice.
Packit Service 603f59
Packit Service 603f59
John Dzubera (Zube) reports, "lsof 4.33 compiles and runs on OpenBSD
Packit Service 603f59
2.3 for the pmax architecture (decstation 3100)."
Packit Service 603f59
Packit Service 603f59
I have not tested lsof on OpenBSD 3.8, but David Mazieres reports
Packit Service 603f59
revision 4.76 worked on OpenBSD 3.8.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
Pyramid DC/OSx and Reliant UNIX
Packit Service 603f59
===============================
Packit Service 603f59
Packit Service 603f59
As of lsof revision 4.52 support for all Pyramid dialects has been
Packit Service 603f59
discontinued.  Lsof revision 4.51 with Pyramid support may be
Packit Service 603f59
obtained upon request.  Send the request to abe@purdue.edu.
Packit Service 603f59
Packit Service 603f59
These two UNIX dialects are very similar and share dialect-specific
Packit Service 603f59
source files from the pyramid sub-directory.
Packit Service 603f59
Packit Service 603f59
The Reliant Unix Pyramid C compiler issues warning messages that
Packit Service 603f59
I haven't found a convenient way to suppress.  You can ignore
Packit Service 603f59
warning messages about casts and conversions that lose bits.  The
Packit Service 603f59
message "warning: undefining __STDC__" is intentionally caused by
Packit Service 603f59
the lsof MkKernOpts configuration script to suppress warning messages
Packit Service 603f59
about cast and conversion problems in standard system header files,
Packit Service 603f59
such as <stdio.h> and <string.h>.
Packit Service 603f59
Packit Service 603f59
Bruce Beare and Kevin Smith provided test systems.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
Caldera OpenUNIX
Packit Service 603f59
================
Packit Service 603f59
Packit Service 603f59
Larry Rosenman provided an OpenUNIX 8 test system.  Matthew Thurmaier
Packit Service 603f59
provided technical assistance, along with these people from Caldera:
Packit Service 603f59
Jack Craig, Robert Lipe, and Bela Lubkin.
Packit Service 603f59
Packit Service 603f59
Robert Lipe supplied changes to lsof for OpenUNIX 8.0.1.  Those
Packit Service 603f59
changes were also incorporated in UnixWare 7.1.3 when it became
Packit Service 603f59
the release name for OpenUNIX 8.0.1.
Packit Service 603f59
Packit Service 603f59
Support for lsof on OpenUNIX ended at lsof revision 4.74.  The last
Packit Service 603f59
lsof revision, 4.74, tested on OpenUNIX, may be found at the lsof
Packit Service 603f59
"home" ftp site, lsof.itap.purdue.edu, in pub/tools/unix/lsof/OLD/src.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
SCO OpenServer
Packit Service 603f59
==============
Packit Service 603f59
Packit Service 603f59
Dion Johnson, Bela Lubkin, and Nathan Peterson of SCO gave me copies
Packit Service 603f59
of SCO OpenServer and the SCO OpenServer Development System 3.0
Packit Service 603f59
and provided technical advice for the lsof port.
Packit Service 603f59
Packit Service 603f59
Hugh Dickins, Bela Lubkin, Craig B. Olofson, and Nathan Peterson
Packit Service 603f59
provided version 5.0 and gave technical advice for porting lsof to
Packit Service 603f59
it.  Bela provided the 5.0.4 changes.  D. Chris Daniels provided
Packit Service 603f59
a 5.0.4 test system, Lee Penn provided one for 5.0.5, and John
Packit Service 603f59
Dubois for 5.0.6.
Packit Service 603f59
Packit Service 603f59
The <netdb.h> header file was accidentally omitted from some SCO
Packit Service 603f59
OpenServer Development System releases.  The Configure script will
Packit Service 603f59
sense its absence and substitute an equivalent from the BSD
Packit Service 603f59
distribution.  The BSD <netdb.h> and the <sys/cdefs.h> header file
Packit Service 603f59
it includes are located in the dialects/os/include sub-directory
Packit Service 603f59
tree.
Packit Service 603f59
Packit Service 603f59
To compile lsof from its distribution sources you must have the
Packit Service 603f59
TCP/IP and NSF headers in /usr/include.  While those are optional
Packit Service 603f59
OpenServer packages, I have access to no system that doesn't have
Packit Service 603f59
them, so I'm unable to build lsof for such a configuration.  However,
Packit Service 603f59
it should be possible to modify the lsof Configure script and
Packit Service 603f59
sources so lsof would compile and work without those optional
Packit Service 603f59
packages.
Packit Service 603f59
Packit Service 603f59
If you have an OpenServer system configured without the TCP/IP and
Packit Service 603f59
NFS packages, and want to tackle the job of building lsof for it,
Packit Service 603f59
contact me via e-mail at <abe@purdue.edu>.  I'll identify the
Packit Service 603f59
Configure script, header file, and source file changes you will
Packit Service 603f59
need to make.  (Caution: this is not a simple task, or I would have
Packit Service 603f59
already done it.)
Packit Service 603f59
Packit Service 603f59
The optional osrgcc and scogcc Configure abbreviations construct
Packit Service 603f59
Makefiles for compiling lsof with gcc.
Packit Service 603f59
Packit Service 603f59
The UnixWare 7.1.4 sources are used for OpenServer Release 6.0.0.
Packit Service 603f59
Hence there is a separate Configure abbreviation for it, "osr6".
Packit Service 603f59
Richard of SCO provided a test system and technical assistance.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
SCO|Caldera UnixWare
Packit Service 603f59
============
Packit Service 603f59
Packit Service 603f59
D. Chris Daniels, John Hughes, Ken Laing, Andrew Merril, Lee Penn, and
Packit Service 603f59
Matthew Thurmaier provided test systems.  Bela Lubkin provided
Packit Service 603f59
technical assistance.  Larry Rosenman provided 7.1.[34] test systems.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
Solaris 2.x, 7, 8, 9 and 10
Packit Service 603f59
===========================
Packit Service 603f59
Packit Service 603f59
SEE THE CAUTIONS SECTION OF THIS DOCUMENT.
Packit Service 603f59
Packit Service 603f59
The latest Solaris revision of lsof 4 might work under Solaris
Packit Service 603f59
2.[1-4] and 2.5[.1] and 7 but hasn't been tested there.  I have no
Packit Service 603f59
test systems for those Solaris versions.
Packit Service 603f59
Packit Service 603f59
Lsof will compile with gcc and the Sun C compiler under Solaris.
Packit Service 603f59
If you want to use the Sun compiler, use the solariscc Configure
Packit Service 603f59
abbreviation.  If you use a gcc version less than 2.8 on Solaris,
Packit Service 603f59
make sure the gcc-specific includes have been updated for your
Packit Service 603f59
version of Solaris -- i.e., run the gcc fixincludes script.
Packit Service 603f59
Packit Service 603f59
Solaris 7, 8, 9 and 10 support for 64 bit kernels depends on a Sun
Packit Service 603f59
WorkShop or Forte C compiler version that supports the "-xarch=v9"
Packit Service 603f59
flag -- usually 5.0 or greater.  Gcc versions 2.95 and above *may*
Packit Service 603f59
be configured and built for 64 bit support, but it takes some extra
Packit Service 603f59
work, the resulting compiler may be fragile, and the gcc developers
Packit Service 603f59
discourage it.  I've built 64 bit capable gcc compilers for Solaris
Packit Service 603f59
7, 8 and 9 from gcc versions 2.95 through 3.0.1 and produced working
Packit Service 603f59
lsof executables with them.  More information on 64 bit gcc for
Packit Service 603f59
Solaris may be found in the 00FAQ file.
Packit Service 603f59
Packit Service 603f59
Solaris 10 ZFS support is questionable, because Sun does not distribute
Packit Service 603f59
the ZFS kernel structure definition header files.  The lsof Configure
Packit Service 603f59
script and source code use some risky work-arounds.  ZFS file system
Packit Service 603f59
support was made possible with help from Horst Scheuermann.
Packit Service 603f59
Packit Service 603f59
Dave Curry and Steve Kirsch provided resources for Solaris 2.x
Packit Service 603f59
ports.  Casper Dik and Gerry Singleton consulted and provided
Packit Service 603f59
valuable assistance.
Packit Service 603f59
Packit Service 603f59
Henry Katz, Joseph Kowalski, Charles Stephens, Mike Sullivan, and
Packit Service 603f59
Mike Tracy provided technical assistance.
Packit Service 603f59
Packit Service 603f59
AFS support was added to Solaris lsof with help from Curt Freeland,
Packit Service 603f59
Heidi Hornstein, Michael L. Lewis, Terry McCoy, Phillip Moore, and
Packit Service 603f59
Sushila R. Subramanian.
Packit Service 603f59
Packit Service 603f59
Casper Dik provided valuable assistance for the Solaris 8 support.
Packit Service 603f59
Packit Service 603f59
Sun has graciously provided me access to BETA versions of Solaris
Packit Service 603f59
2.5, 2.6, 7, 8, and 9.
Packit Service 603f59
Packit Service 603f59
John Dzubera provided Solaris 7 and 8 test systems.
Packit Service 603f59
Packit Service 603f59
Mike Miscevic provided  Solaris 10 test systems.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
Ultrix
Packit Service 603f59
======
Packit Service 603f59
Packit Service 603f59
As of lsof revision 4.52 support for Ultrix is no longer available,
Packit Service 603f59
because I no longer have an Ultrix test system.
Packit Service 603f59
Packit Service 603f59
Terry Friedrichsen, Dwight McKay, and Jeffrey Mogul helped me with
Packit Service 603f59
this port.
Packit Service 603f59
Packit Service 603f59
DECnet support was added to Ultrix lsof with the help of John
Packit Service 603f59
Beacom, who kindly provided a test system.  The Configure script
Packit Service 603f59
decides that DECnet support is available if /usr/lib/libdnet.a and
Packit Service 603f59
/usr/include/netdnet/dn.h exist and are readable.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
Veritas VxFS and VxVM
Packit Service 603f59
=====================
Packit Service 603f59
Packit Service 603f59
Lsof supports some versions of Veritas VxFS and VxVM on some UNIX
Packit Service 603f59
dialects.  Consult the lsof Configure script for the specific
Packit Service 603f59
dialect, and consult the lsof dialect-specific source files for
Packit Service 603f59
the UNIX dialect of interest.  Veritas support will usually be
Packit Service 603f59
found in a source file named dnode[1-9].c.
Packit Service 603f59
Packit Service 603f59
Since Veritas rarely has a version number that can be extracted
Packit Service 603f59
with shell commands, lsof doesn't use it.  Instead, when lsof
Packit Service 603f59
supports Veritas, the Configure script will form compile-time
Packit Service 603f59
definitions starting with HASVXFS.   Check the lsof 00PORTING
Packit Service 603f59
documentation file for more information.
Packit Service 603f59
Packit Service 603f59
Lsof Veritas support requires that the supporting Veritas header
Packit Service 603f59
files be installed -- e.g., in /usr/include/sys/fs.  (The location
Packit Service 603f59
will depend in the dialect's header file conventions.)
Packit Service 603f59
Packit Service 603f59
Some information on lsof support for Veritas extensions may be
Packit Service 603f59
found in the lsof 00DIST file.  (The ChangeLog file points to
Packit Service 603f59
00DIST.)
Packit Service 603f59
Packit Service 603f59
Chris Kordish and Andy Thomas have provided Solaris VxFS test
Packit Service 603f59
systems.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
================================
Packit Service 603f59
User-contributed Dialect Support
Packit Service 603f59
================================
Packit Service 603f59
Packit Service 603f59
There are some user-contributed dialect versions of lsof; more
Packit Service 603f59
information on them can be found at:
Packit Service 603f59
Packit Service 603f59
	ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/contrib
Packit Service 603f59
Packit Service 603f59
Check the 00INDEX file there for details.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
============================
Packit Service 603f59
Dialects No Longer Supported
Packit Service 603f59
============================
Packit Service 603f59
Packit Service 603f59
Because I don't have access to test systems, these UNIX dialects
Packit Service 603f59
are no longer supported by lsof:
Packit Service 603f59
Packit Service 603f59
	CDC EP/IX
Packit Service 603f59
	/dev/kmem-based Linux
Packit Service 603f59
	MIPS RISC/os
Packit Service 603f59
	Motorola V/88
Packit Service 603f59
	Pyramid DC/OSx
Packit Service 603f59
	Pyramid Reliant UNIX
Packit Service 603f59
	Sequent DYNIX
Packit Service 603f59
	SGI IRIX
Packit Service 603f59
	SunOS 4.x
Packit Service 603f59
	Ultrix
Packit Service 603f59
	UnixWare below 7.0
Packit Service 603f59
Packit Service 603f59
Remnants of the support lsof once provided for these dialects may
Packit Service 603f59
be found in:
Packit Service 603f59
Packit Service 603f59
	ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/OLD/dialects
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
===============
Packit Service 603f59
Installing Lsof
Packit Service 603f59
===============
Packit Service 603f59
Packit Service 603f59
The distributed Makefiles do not have actions that will install
Packit Service 603f59
lsof.  I've come to the conclusion there is no standard for installing
Packit Service 603f59
lsof or its man page, so I no longer distribute make rules for
Packit Service 603f59
installing them.  You should adjust the Makefile for your local
Packit Service 603f59
preferences.
Packit Service 603f59
Packit Service 603f59
The Makefile does have an install rule that will cause lsof to
Packit Service 603f59
compile by virtue of its dependency clause.  Some Makefiles also
Packit Service 603f59
have a dependency that causes the production of a man page that is
Packit Service 603f59
ready to install.  However, the actions of the install rule will
Packit Service 603f59
not cause the lsof executable or its man page to be installed in
Packit Service 603f59
any UNIX system-wide directory.
Packit Service 603f59
Packit Service 603f59
Instead, after the compilation and optional man page production
Packit Service 603f59
are completed, the install rule will produce a brief description
Packit Service 603f59
of what actions you might add to the install rule.  The description
Packit Service 603f59
will suggest the possible modes, ownerships, permissions, and
Packit Service 603f59
destinations your install rule might employ to install the lsof
Packit Service 603f59
executable and man page.
Packit Service 603f59
Packit Service 603f59
As you form your install rule, keep in mind that lsof usually needs
Packit Service 603f59
some type of special permission to do its job.  That may be permission
Packit Service 603f59
to read memory devices such as /dev/kmem, /dev/mem, or /dev/swap,
Packit Service 603f59
or it may be authorization to read entries in the /proc file system.
Packit Service 603f59
Packit Service 603f59
Memory device access can usually be provided by setting the modes
Packit Service 603f59
of the lsof executable so that it's effective group identifier when
Packit Service 603f59
it runs is the same as the group that has permission to read the
Packit Service 603f59
memory devices -- i.e., it is setgid-group.  The privileged group
Packit Service 603f59
is usually kmem, sys, or system.
Packit Service 603f59
Packit Service 603f59
Don't overlook using ACLs -- e.g., on AIX or Solaris 8 -- to give
Packit Service 603f59
lsof permission to access memory devices.  ACLs, coupled to a
Packit Service 603f59
separate group like kmem, can be safer than giving lsof setgid
Packit Service 603f59
authorization to a commonly used system group.
Packit Service 603f59
Packit Service 603f59
When lsof needs to read /proc file system entries, it must be
Packit Service 603f59
installed with modes that make its effective user identifier root
Packit Service 603f59
when it runs -- i.e., it must be setuid-root.  If lsof must be
Packit Service 603f59
installed setuid-root (only the AIX 5L, PSTAT-based HPUX, and
Packit Service 603f59
/proc-based Linux, ports need such power.), then access to memory
Packit Service 603f59
devices is automatic (or not needed in the case of /proc-based
Packit Service 603f59
Linux).
Packit Service 603f59
Packit Service 603f59
Your choice of permissions for lsof may also be affected by your
Packit Service 603f59
desire to allow anyone to use it or your need to restrict its usage
Packit Service 603f59
to specific individuals.  You will have to be guided by local policy
Packit Service 603f59
and convention in this case.
Packit Service 603f59
Packit Service 603f59
The next two sections, Setgid Lsof Dialect Versions and Setuid-root
Packit Service 603f59
Lsof Dialect Versions, list recommended install permissions.
Packit Service 603f59
Packit Service 603f59
The system directory where you install the lsof executable is also
Packit Service 603f59
open to choice.  A traditional place for a tool like lsof is
Packit Service 603f59
/usr/local/etc, but recent changes in directory structure organization
Packit Service 603f59
suggest that somewhere in /opt may be more suitable.
Packit Service 603f59
Packit Service 603f59
Bear one other factor in mind when choosing a location for the lsof
Packit Service 603f59
executable -- it usually is a shared executable, requiring access
Packit Service 603f59
to shared libraries.  Thus, locations like /sbin or /usr/sbin are
Packit Service 603f59
probably unsuitable.
Packit Service 603f59
Packit Service 603f59
Once you've chosen a location for the executable you may find that
Packit Service 603f59
the location for the man page follows -- e.g., if the executable
Packit Service 603f59
goes in /usr/local/etc, then the man page goes in /usr/local/man.
Packit Service 603f59
If the executable location doesn't imply a location for the man
Packit Service 603f59
page, you'll have to let local custom guide you.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
Setuid-root Lsof Dialect Versions
Packit Service 603f59
=================================
Packit Service 603f59
Packit Service 603f59
These dialect versions should be installed with setuid-root
Packit Service 603f59
permission -- i.e., the lsof binary should be owned by root and
Packit Service 603f59
its setuid execution bit (04000) should be set.
Packit Service 603f59
Packit Service 603f59
	AIX 5L and above for full use of the -X option
Packit Service 603f59
	Apple Darwin 8.x for Power Macintosh systems
Packit Service 603f59
	PSTAT-based HP-UX 11.11 and 11.23
Packit Service 603f59
	/proc-based Linux (generally 2.1.72 and above)
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
Setgid Lsof Dialect Versions
Packit Service 603f59
============================
Packit Service 603f59
Packit Service 603f59
These dialect versions should be installed with setgid permission,
Packit Service 603f59
owned by the group that can read kernel memory devices such as
Packit Service 603f59
/dev/drum, /dev/kmem, /dev/ksyms, /dev/mem, /dev/swap.  ACLs may
Packit Service 603f59
be another mechanism (e.g., under AIX or Solaris 8) you can use to
Packit Service 603f59
grant read permission to the kernel memory devices.
Packit Service 603f59
Packit Service 603f59
	AIX 4.1.[45], 4.2[.1], and 4.3[.123]
Packit Service 603f59
	Apple Darwin 7.x for Power Macintosh systems
Packit Service 603f59
	DEC OSF/1, Digital UNIX, Tru64 UNIX 2.0, 3.2, 4.0, and 5.[01]
Packit Service 603f59
	FreeBSD 2.1.6, 2.2[.x], 3.x, 4.x, 5.x, [6789].x and 1[012].x
Packit Service 603f59
	NetBSD 1.[456], 2.x and 3.x
Packit Service 603f59
	NEXTSTEP 3.[13]
Packit Service 603f59
	OpenBSD 2.[89] and 3.[0-9]
Packit Service 603f59
	OPENSTEP 4.x
Packit Service 603f59
	Caldera OpenUNIX 8
Packit Service 603f59
	SCO OpenServer 5.0.[46]
Packit Service 603f59
	SCO UnixWare 7.0 and 7.1.[0134]
Packit Service 603f59
	Solaris 2.6, 8, 9 and 10
Packit Service 603f59
	Ultrix 4.2 (no longer available)
Packit Service 603f59
Packit Service 603f59
====================================
Packit Service 603f59
Porting lsof 4 to a New UNIX Dialect
Packit Service 603f59
====================================
Packit Service 603f59
Packit Service 603f59
If you're brave enough to consider this, look at the 00PORTING
Packit Service 603f59
file.  Please contact me before you start.  I might be able to help
Packit Service 603f59
you or even do the port myself.
Packit Service 603f59
Packit Service 603f59
Don't overlook the contrib/ directory in pub/tools/unix/lsof on my
Packit Service 603f59
ftp server, lsof.itap.purdue.edu.  It contains user-contributed ports
Packit Service 603f59
of lsof to dialects I don't distribute, because I can't test new
Packit Service 603f59
revisions of lsof on them.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
=========================
Packit Service 603f59
Quick Start to Using lsof
Packit Service 603f59
=========================
Packit Service 603f59
Packit Service 603f59
For information on how to get started quickly using lsof, consult
Packit Service 603f59
the 00QUICKSTART file of the lsof distribution.  It cuts past the
Packit Service 603f59
formal density of the lsof man page to provide quick examples of
Packit Service 603f59
using lsof to solve common open file display problems.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
======================
Packit Service 603f59
Cross-configuring Lsof
Packit Service 603f59
======================
Packit Service 603f59
Packit Service 603f59
Using environment variables it is possible to Configure (and possibly
Packit Service 603f59
build) lsof for one UNIX dialect on a different one -- e.g., you
Packit Service 603f59
are running Configure on a Linux 2.3 system and you want to Configure
Packit Service 603f59
and build lsof for Linux 2.4.
Packit Service 603f59
Packit Service 603f59
See the 00XCONFIG file of the lsof distribution for a discussion
Packit Service 603f59
of how to do this.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
====================================================
Packit Service 603f59
Environment Variables Affecting the Configure Script
Packit Service 603f59
====================================================
Packit Service 603f59
Packit Service 603f59
Configure script actions can be modified by introducing values to
Packit Service 603f59
the script via environment variables.  In many cases the environment
Packit Service 603f59
variable values take the place of test operations the Configure
Packit Service 603f59
script makes.
Packit Service 603f59
Packit Service 603f59
For more information on environment variables that can affect
Packit Service 603f59
Configure, consult the 00XCONFIG file of the lsof distribution.
Packit Service 603f59
See the General Environment Variables sections for descriptions of
Packit Service 603f59
ones that affect all dialects.  Consult the Dialect-Specific
Packit Service 603f59
Environment Variables section for ones that might affect the dialect
Packit Service 603f59
you are trying to configure.
Packit Service 603f59
Packit Service 603f59
Packit Service 603f59
Vic Abell <abe@purdue.edu>
Packit Service 603f59
February 14, 2018