Blame 00README

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