|
Packit |
6f02de |
|
|
Packit |
6f02de |
Guide to Porting lsof 4 to Unix OS Dialects
|
|
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/lsof.README for its |
|
|
Packit |
6f02de |
| location. |
|
|
Packit |
6f02de |
**********************************************************************
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Contents
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
How Lsof Works
|
|
Packit |
6f02de |
/proc-based Linux Lsof -- a Different Approach
|
|
Packit |
6f02de |
General Guidelines
|
|
Packit |
6f02de |
Organization
|
|
Packit |
6f02de |
Source File Naming Conventions
|
|
Packit |
6f02de |
Coding Philosophies
|
|
Packit |
6f02de |
Data Requirements
|
|
Packit |
6f02de |
Dlsof.h and #include's
|
|
Packit |
6f02de |
Definitions That Affect Compilation
|
|
Packit |
6f02de |
Options: Common and Special
|
|
Packit |
6f02de |
Defining Dialect-Specific Symbols and Global Storage
|
|
Packit |
6f02de |
Coding Dialect-specific Functions
|
|
Packit |
6f02de |
Function Prototype Definitions and the _PROTOTYPE Macro
|
|
Packit |
6f02de |
The Makefile
|
|
Packit |
6f02de |
The Mksrc Shell Script
|
|
Packit |
6f02de |
The MkKernOpts Shell Script
|
|
Packit |
6f02de |
Testing and the lsof Test Suite
|
|
Packit |
6f02de |
Where Next?
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
How Lsof Works
|
|
Packit |
6f02de |
--------------
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Before getting on with porting guidelines, just a word or two about
|
|
Packit |
6f02de |
how lsof works.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Lsof obtains data about open UNIX dialect files by reading the
|
|
Packit |
6f02de |
kernel's proc structure information, following it to the related
|
|
Packit |
6f02de |
user structure, then reading the open file structures stored
|
|
Packit |
6f02de |
(usually) in the user structure. Typically lsof uses the kernel
|
|
Packit |
6f02de |
memory devices, /dev/kmem, /dev/mem, etc. to read kernel data.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Lsof stores information from the proc and user structures in an
|
|
Packit |
6f02de |
internal, local proc structure table. It then processes the open
|
|
Packit |
6f02de |
file structures by reading the file system nodes that lie behind
|
|
Packit |
6f02de |
them, extracting and storing relevant data in internal local file
|
|
Packit |
6f02de |
structures that are linked to the internal local process structure.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Once all data has been gathered, lsof reports it from its internal,
|
|
Packit |
6f02de |
local tables.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
There are a few variants on this subject. Some systems don't have
|
|
Packit |
6f02de |
just proc structures, but have task structures, too, (e.g., NeXTSTEP
|
|
Packit |
6f02de |
and OSF/1 derivatives). For some dialects lsof gets proc structures
|
|
Packit |
6f02de |
or process information (See "/proc-based Linux Lsof -- a Different
|
|
Packit |
6f02de |
Approach) from files of the /proc file system. It's not necessary
|
|
Packit |
6f02de |
for lsof to read user structures on some systems (recent versions
|
|
Packit |
6f02de |
of HP-UX), because the data lsof needs can be found in the task or
|
|
Packit |
6f02de |
proc structures. In the end lsof gathers the same data, just from
|
|
Packit |
6f02de |
slightly different sources.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
/proc-based Linux Lsof -- a Different Approach
|
|
Packit |
6f02de |
==============================================
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
For a completely different approach to lsof construction, take a
|
|
Packit |
6f02de |
look at the /proc-based Linux sources in .../dialects/linux/proc.
|
|
Packit |
6f02de |
(The sources in .../dialects/linux/kmem are for a traditional lsof
|
|
Packit |
6f02de |
that uses /dev/kmem to read information from kernel structures.)
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
The /proc-based lsof obtains all its information from the Linux
|
|
Packit |
6f02de |
/proc file system. Consequently, it is relatively immune to changes
|
|
Packit |
6f02de |
in Linux kernel structures and doesn't need to be re-compiled each
|
|
Packit |
6f02de |
time the Linux kernel version changes.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
There are some down-sides to the Linux /proc-based lsof:
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* It must run setuid-root in order to be able to read the
|
|
Packit |
6f02de |
/proc file system branches for all processes. In contrast,
|
|
Packit |
6f02de |
the /dev/kmem-based Linux lsof usually needs only setgid
|
|
Packit |
6f02de |
permission.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* It depends on the exact character format of /proc files, so
|
|
Packit |
6f02de |
it is sensitive to changes in /proc file composition.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* It is limited to the information a /proc file system
|
|
Packit |
6f02de |
implementor decides to provide. For example, if a
|
|
Packit |
6f02de |
/proc/net/<protocol> file lacks an inode number, the
|
|
Packit |
6f02de |
/proc-based lsof can't connect open socket files to that
|
|
Packit |
6f02de |
protocol. Another deficiency is that the /proc-based may
|
|
Packit |
6f02de |
not be able to report file offset (position) information,
|
|
Packit |
6f02de |
when it isn't available in the /proc/<PID>/fd/ entry for a
|
|
Packit |
6f02de |
file.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
In contrast the /dev/kmem-based lsof has full access to
|
|
Packit |
6f02de |
kernel structures and "sees" new data as soon as it appears.
|
|
Packit |
6f02de |
Of course, that new data requires that lsof be recompiled
|
|
Packit |
6f02de |
and usually also requires changes to lsof.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Overall the switch from a /dev/kmem base to a /proc one is an
|
|
Packit |
6f02de |
advantage to Linux lsof. The switch was made at lsof revision 4.23
|
|
Packit |
6f02de |
for Linux kernel versions 2.1.72 (approximately) and higher. The
|
|
Packit |
6f02de |
reason I'm not certain at which Linux kernel version a /proc-based
|
|
Packit |
6f02de |
lsof becomes possible is that the /proc additions needed to implement
|
|
Packit |
6f02de |
it have been added gradually to Linux 2.1.x in ways that I cannot
|
|
Packit |
6f02de |
measure.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
/proc-based lsof functions in many ways the same as /dev/kmem-based
|
|
Packit |
6f02de |
lsof. It scans the /proc directory, looking for <PID>/ subdirectories.
|
|
Packit |
6f02de |
Inside each one it collects process-related data from the cwd, exe,
|
|
Packit |
6f02de |
maps, root, and stat information files.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
It collects open file information from the fd/ subdirectory of each
|
|
Packit |
6f02de |
<PID>/ subdirectory. The lstat(2), readlink(2), and stat(2) system
|
|
Packit |
6f02de |
calls gather information about the files from the kernel.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Lock information comes from /proc/locks. It is matched to open
|
|
Packit |
6f02de |
files by inode number. Mount information comes from /proc/mounts.
|
|
Packit |
6f02de |
Per domain protocol information comes from the files of /proc/net;
|
|
Packit |
6f02de |
it's matched to open socket files by inode number.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
The Linux /proc file system implementors have done an amazing job
|
|
Packit |
6f02de |
of providing the information lsof needs. The /proc-based lsof
|
|
Packit |
6f02de |
project has so far generated only two kernel modification:
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* A modification to /usr/src/linux/net/ipx/af_ipx.c adds the
|
|
Packit |
6f02de |
inode number to the entries of /proc/net/ipx.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Jonathan Sergent did this kernel modification.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
It may be found in the .../dialects/linux/proc/patches
|
|
Packit |
6f02de |
subdirectory of the lsof distribution.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* An experimental modification to /usr/src/linux/fs/stat.c
|
|
Packit |
6f02de |
allows lstat(2) to return file position information for
|
|
Packit |
6f02de |
/proc/<PID>/fd/<FD> files.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Contact me for this modification.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
One final note about the /proc-based Linux lsof: it doesn't need
|
|
Packit |
6f02de |
any functions from the lsof library in the lib/ subdirectory.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
General Guidelines
|
|
Packit |
6f02de |
------------------
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
These are the general guidelines for porting lsof 4 to a new Unix
|
|
Packit |
6f02de |
dialect:
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* Understand the organization of the lsof sources and the
|
|
Packit |
6f02de |
philosophies that guide their coding.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* Understand the data requirements and determine the methods
|
|
Packit |
6f02de |
of locating the necessary data in the new dialect's kernel.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* Pick a name for the subdirectory in lsof4/dialects for your
|
|
Packit |
6f02de |
dialect. Generally I use a vendor operating system name
|
|
Packit |
6f02de |
abbreviation.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* Locate the necessary header files and #include them in the
|
|
Packit |
6f02de |
dialect's dlsof.h file. (You may not be able to complete
|
|
Packit |
6f02de |
this step until you have coded all dialect-specific functions.)
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* Determine the optional library functions of lsof to be used
|
|
Packit |
6f02de |
and set their definitions in the dialect's machine.h file.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* Define the dialect's specific symbols and global storage
|
|
Packit |
6f02de |
in the dialect's dlsof.h and dstore.c files.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* Code the dialect-specific functions in the appropriate
|
|
Packit |
6f02de |
source files of the dialect's subdirectory.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Include the necessary prototype definitions of the dialect-
|
|
Packit |
6f02de |
specific functions in the dproto.h file in the dialect's
|
|
Packit |
6f02de |
subdirectory.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* Define the dialect's Makefile and source construction shell
|
|
Packit |
6f02de |
script, Mksrc.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* If there are #define's that affect how kernel structures
|
|
Packit |
6f02de |
are organized, and those #define's are needed when compiling
|
|
Packit |
6f02de |
lsof, build a MkKernOpts shell script to locate the #define's
|
|
Packit |
6f02de |
and supply them to the Configure shell script.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Organization
|
|
Packit |
6f02de |
------------
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
The code in a dialect-specific version of lsof comes from three
|
|
Packit |
6f02de |
sources:
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
1) functions common to all versions, located in the top level
|
|
Packit |
6f02de |
directory, lsof4;
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
2) functions specific to the dialect, located in the dialect's
|
|
Packit |
6f02de |
subdirectory -- e.g., lsof4/dialects/sun;
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
3) functions that are common to several dialects, although
|
|
Packit |
6f02de |
not to all, organized in a library, liblsof.a. The functions
|
|
Packit |
6f02de |
in the library source can be selected and customized with
|
|
Packit |
6f02de |
definitions in the dialect machine.h header files.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
The tree looks like this:
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
lsof4 ----------------------+ 3) library --
|
|
Packit |
6f02de |
| \ lsof4/lib
|
|
Packit |
6f02de |
1) fully common functions + \
|
|
Packit |
6f02de |
e.g., lsof4/main.c + lsof4/dialects/
|
|
Packit |
6f02de |
/ / / / \
|
|
Packit |
6f02de |
+ + + + +
|
|
Packit |
6f02de |
2) dialect-specific subdirectories -- e.g., lsof4/dialects/sun
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
The code for a dialect-specific version is constructed from these
|
|
Packit |
6f02de |
three sources by the Configure shell script in the top level lsof4
|
|
Packit |
6f02de |
directory and definitions in the dialect machine.h header files.
|
|
Packit |
6f02de |
Configure uses the Mksrc shell script in each dialect's subdirectory,
|
|
Packit |
6f02de |
and may use an optional MkKernOpts shell script in selected dialect
|
|
Packit |
6f02de |
subdirectories.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Configure calls the Mksrc shell script in each dialect's subdirectory
|
|
Packit |
6f02de |
to assemble the dialect-specific sources in the main lsof directory.
|
|
Packit |
6f02de |
Configure may call MkKernOpts to determine kernel compile-time
|
|
Packit |
6f02de |
options that are needed for compiling kernel structures correctly
|
|
Packit |
6f02de |
for use by lsof. Configure puts the options in a dialect-specific
|
|
Packit |
6f02de |
Makefile it build, using a template in the dialect subdirectory.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
The assembly of dialect-specific sources in the main lsof directory
|
|
Packit |
6f02de |
is usually done by creating symbolic links from the top level to
|
|
Packit |
6f02de |
the dialect's subdirectory. The LSOF_MKC environment variable may
|
|
Packit |
6f02de |
be defined prior to using Configure to change the technique used
|
|
Packit |
6f02de |
to assemble the sources -- most commonly to use cp instead of ln -s.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
The Configure script completes the dialect's Makefile by adding
|
|
Packit |
6f02de |
string definitions, including the necessary kernel compile-time
|
|
Packit |
6f02de |
options, to a dialect skeleton Makefile while copying it from the
|
|
Packit |
6f02de |
dialect subdirectory to the top level lsof4 directory. Optionally
|
|
Packit |
6f02de |
Makefile may call the dialect's MkKernOpts script to add string
|
|
Packit |
6f02de |
definitions.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
When the lsof library, lsof4/lib/liblsof.a, is compiled its
|
|
Packit |
6f02de |
functions are selected and customized by #define's in the dialect
|
|
Packit |
6f02de |
machine.h header file.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Source File Naming Conventions
|
|
Packit |
6f02de |
------------------------------
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
With one exception, dialect-specific source files begin with a
|
|
Packit |
6f02de |
lower case `d' character -- ddev.c, dfile.c, dlsof.h. The one
|
|
Packit |
6f02de |
exception is the header file that contains dialect-specific
|
|
Packit |
6f02de |
definitions for the optional features of the common functions.
|
|
Packit |
6f02de |
It's called machine.h for historical reasons.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Currently all dialects use almost the same source file names. One
|
|
Packit |
6f02de |
exception to the rule happens in dialects where there must be
|
|
Packit |
6f02de |
different source files -- e.g., dnode[123].c -- to eliminate node
|
|
Packit |
6f02de |
header file structure element name conflicts. The source modules
|
|
Packit |
6f02de |
in a few subdirectories are organized that way.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Unusual situations occur for NetBSD and OpenBSD, and for NEXTSTEP
|
|
Packit |
6f02de |
and OPENSTEP. Each pair of dialects is so close in design that
|
|
Packit |
6f02de |
the same dialect sources from the n+obsd subdirectory serves NetBSD
|
|
Packit |
6f02de |
and OpenBSD; from n+os, NEXTSTEP and OPENSTEP.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
These are common files in lsof4/:
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Configure the configuration script
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Customize does some customization of the selected lsof
|
|
Packit |
6f02de |
dialect
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Inventory takes an inventory of the files in an lsof
|
|
Packit |
6f02de |
distribution
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
version the version number
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
dialects/ the dialects subdirectory
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
These are the common function source files in lsof4/:
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
arg.c common argument processing functions
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
lsof.h common header file that #include's the dialect-specific
|
|
Packit |
6f02de |
header files
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
main.c common main function for lsof 4
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
misc.c common miscellaneous functions -- e.g., special versions
|
|
Packit |
6f02de |
of stat() and readlink()
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
node.c common node reading functions -- readinode(), readvnode()
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
print.c common print support functions
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
proc.c common process and file structure functions
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
proto.h common prototype definitions, including the definition of
|
|
Packit |
6f02de |
the _PROTOTYPE() macro
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
store.c common global storage version.h the current lsof version
|
|
Packit |
6f02de |
number, derived from the file version by the Makefile
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
usage.c functions to display lsof usage panel
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
These are the dialect-specific files:
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Makefile the Makefile skeleton
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Mksrc a shell script that assists the Configure script
|
|
Packit |
6f02de |
in configuring dialect sources
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
MkKernOpts an optional shell script that identifies kernel
|
|
Packit |
6f02de |
compile-time options for selected dialects -- e.g.,
|
|
Packit |
6f02de |
Pyramid DC/OSx and Reliant UNIX
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
ddev.c device support functions -- readdev() -- may be
|
|
Packit |
6f02de |
eliminated by functions from lsof4/lib/
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
dfile.c file processing functions -- may be eliminated by
|
|
Packit |
6f02de |
functions from lsof4/lib/
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
dlsof.h dialect-specific header file -- contains #include's
|
|
Packit |
6f02de |
for system header files and dialect-specific global
|
|
Packit |
6f02de |
storage declarations
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
dmnt.c mount support functions -- may be eliminated by
|
|
Packit |
6f02de |
functions from lsof4/lib/
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
dnode.c node processing functions -- e.g., for gnode or vnode
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
dnode?.c additional node processing functions, used when node
|
|
Packit |
6f02de |
header files have duplicate and conflicting element
|
|
Packit |
6f02de |
names.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
dproc.c functions to access, read, examine and cache data about
|
|
Packit |
6f02de |
dialect-specific process structures -- this file contains
|
|
Packit |
6f02de |
the dialect-specific "main" function, gather_proc_info()
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
dproto.h dialect-specific prototype declarations
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
dsock.c dialect-specific socket processing functions
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
dstore.c dialect-specific global storage -- e.g., the nlist()
|
|
Packit |
6f02de |
structure
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
machine.h dialect specific definitions of common function options --
|
|
Packit |
6f02de |
e.g., a HASINODE definition to activate the readinode()
|
|
Packit |
6f02de |
function in lsof4/node.c
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
The machine.h header file also selects and customizes
|
|
Packit |
6f02de |
the functions of lsof4/lib/.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
These are the lib/ files. Definitions in the dialect machine.h
|
|
Packit |
6f02de |
header files select and customize the contained functions that are
|
|
Packit |
6f02de |
to be compiled and archived to liblsof.a.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Makefile.skel is a skeleton Makefile, used by Configure
|
|
Packit |
6f02de |
to construct the Makefile for the lsof
|
|
Packit |
6f02de |
library.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
cvfs.c completevfs() function
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
USE_LIB_COMPLETEVFS selects it.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
CVFS_DEVSAVE, CVFS_NLKSAVE, CVFS_SZSAVE,
|
|
Packit |
6f02de |
and HASFSINO customize it.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
dvch.c device cache functions
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASDCACHE selects them.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
DCACHE_CLONE, DCACHE_CLR, DCACHE_PSEUDO,
|
|
Packit |
6f02de |
DVCH_CHOWN, DVCH_DEVPATH, DVCH_EXPDEV,
|
|
Packit |
6f02de |
HASBLKDEV, HASENVDC, HASSYSDC, HASPERSDC,
|
|
Packit |
6f02de |
HASPERSDCPATH, and NOWARNBLKDEV customize
|
|
Packit |
6f02de |
them.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
fino.c find block and character device inode functions
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASBLKDEV and USE_LIB_FIND_CH_INO select them.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
isfn.c hashSfile() and is_file_named() functions
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
USE_LIB_IS_FILE_NAMED selects it.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
lkud.c device lookup functions
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASBLKDEV and USE_LIB_LKUPDEV select them.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
pdvn.c print device name functions
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASBLKDEV and USE_LIB_PRINTDEVNAME select them.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
prfp.c process_file() function
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
USE_LIB_PROCESS_FILE selects it.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
FILEPTR, DTYPE_PIPE, HASPIPEFN, DTYPE_GNODE,
|
|
Packit |
6f02de |
DTYPE_INODE, DTYPE_PORT, DTYPE_VNODE, DTYPE_PTS,
|
|
Packit |
6f02de |
HASF_VNODE, HASKQUEUE, HASPRIVFILETYPE,
|
|
Packit |
6f02de |
HASPSXSHM, HASPSXSEM and HASPTSFN customize it.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
ptti.c print_tcptpi() function
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
USE_LIB_PRINT_TCPTPI selects it.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASSOOPT, HASSBSTATE, HASSOSTATE, AHSTCPOPT,
|
|
Packit |
6f02de |
HASTCPTPIQ and HASTCPTPIW customize it.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
rdev.c readdev() function
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
USE_LIB_READDEV selects it.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
DIRTYPE, HASBLKDEV, HASDCACHE, HASDNAMLEN,
|
|
Packit |
6f02de |
RDEV_EXPDEV, RDEV_STATFN, USE_STAT, and
|
|
Packit |
6f02de |
WARNDEVACCESS customize it.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
rmnt.c readmnt() function
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
USE_LIB_READMNT selects it.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASFSTYPE, MNTSKIP, RMNT_EXPDEV, RMNT_FSTYPE,
|
|
Packit |
6f02de |
and MOUNTS_FSTYPE customize it.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
rnam.c BSD format name cache functions
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASNCACHE and USE_LIB_RNAM select them.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASFSINO, NCACHE, NCACHE_NC_CAST, NCACHE_NM,
|
|
Packit |
6f02de |
NCACHE_NMLEN, NCACHE_NODEADDR, NCACHE_NODEID,
|
|
Packit |
6f02de |
NCACHE_NO_ROOT, NCACHE_NXT, NCACHE_PARADDR,
|
|
Packit |
6f02de |
NCACHE_PARID, NCACHE_SZ_CAST, NCHNAMLEN,
|
|
Packit |
6f02de |
X_NCACHE, and X_NCSIZE, customize them.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
rnch.c Sun format name cache functions
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASNCACHE and USE_LIB_RNCH select them.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
ADDR_NCACHE, HASDNLCPTR, HASFSINO, NCACHE_DP,
|
|
Packit |
6f02de |
NCACHE_NAME, NCACHE_NAMLEN, NCACHE_NEGVN,
|
|
Packit |
6f02de |
NCACHE_NODEID, NCACHE_NXT, NCACHE_PARID,
|
|
Packit |
6f02de |
NCACHE_VP, X_NCACHE, and X_NCSIZE, customize
|
|
Packit |
6f02de |
them.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
snpf.c Source for the snprintf() family of functions
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
USE_LIB_SNPF selects it.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
The comments and the source code in these library files give more
|
|
Packit |
6f02de |
information on customization.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Coding Philosophies
|
|
Packit |
6f02de |
-------------------
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
A few basic philosophies govern the coding of lsof 4 functions:
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* Use as few #if/#else/#endif constructs as possible, even at
|
|
Packit |
6f02de |
the cost of nearly-duplicate code.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
When #if/#else/#endif constructs are necessary:
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
o Use the form
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
#if defined(s<symbol>)
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
in preference to
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
#ifdef <symbol>
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
to allow easier addition of tests to the #if.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
o Indent them to signify their level -- e.g.,
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
#if /* level one */
|
|
Packit |
6f02de |
# if /* level two */
|
|
Packit |
6f02de |
# endif /* level two */
|
|
Packit |
6f02de |
#else /* level one */
|
|
Packit |
6f02de |
#endif /* level one */
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
o Use ANSI standard comments on #else and #endif statements.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* Document copiously.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* Aim for ANSI-C compatibility:
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
o Use function prototypes for all functions, hiding them
|
|
Packit |
6f02de |
from compilers that cannot handle them with the _PROTOTYPE()
|
|
Packit |
6f02de |
macro.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
o Use the compiler's ANSI conformance checking wherever
|
|
Packit |
6f02de |
possible -- e.g., gcc's -ansi option.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Data Requirements
|
|
Packit |
6f02de |
-----------------
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Lsof's strategy in obtaining open file information is to access
|
|
Packit |
6f02de |
the process table via its proc structures, then obtain the associated
|
|
Packit |
6f02de |
user area and open file structures. The open file structures then
|
|
Packit |
6f02de |
lead lsof to file type specific structures -- cdrnodes, fifonodes,
|
|
Packit |
6f02de |
inodes, gnodes, hsfsnodes, pipenodes, pcnodes, rnodes, snodes,
|
|
Packit |
6f02de |
sockets, tmpnodes, and vnodes.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
The specific node structures must yield data about the open files. The
|
|
Packit |
6f02de |
most important items and device number (raw and cooked) and node
|
|
Packit |
6f02de |
number. (Lsof uses them to identify files and file systems named as
|
|
Packit |
6f02de |
arguments.) Link counts and file sizes are important, too, as are the
|
|
Packit |
6f02de |
special characteristics of sockets, pipes, FIFOs, etc.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
This means that to begin an lsof port to a new Unix dialect you
|
|
Packit |
6f02de |
must understand how to obtain these structures from the dialect's
|
|
Packit |
6f02de |
kernel. Look for kernel access functions -- e.g., the AIX readx()
|
|
Packit |
6f02de |
function, Sun and Sun-like kvm_*() functions, or SGI's syssgi()
|
|
Packit |
6f02de |
function. Look for clues in header files -- e.g. external declarations
|
|
Packit |
6f02de |
and macros.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
If you have access to them, look at sources to programs like ps(1),
|
|
Packit |
6f02de |
or the freely available monitor and top programs. They may give
|
|
Packit |
6f02de |
you important clues on reading proc and user area structures. An
|
|
Packit |
6f02de |
appeal to readers of dialect-specific news groups may uncover
|
|
Packit |
6f02de |
correspondents who can help.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Careful reading of system header files -- e.g., <sys/proc.h> --
|
|
Packit |
6f02de |
may give hints about how kernel storage is organized. Look for
|
|
Packit |
6f02de |
global variables declared under a KERNEL or _KERNEL #if. Run nm(1)
|
|
Packit |
6f02de |
across the kernel image (/vmunix, /unix, etc.) and look for references
|
|
Packit |
6f02de |
to structures of interest.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Even if there are support functions for reading structures, like the
|
|
Packit |
6f02de |
kvm_*() functions, you must still understand how to read data from
|
|
Packit |
6f02de |
kernel memory. Typically this requires an understanding of the
|
|
Packit |
6f02de |
nlist() function, and how to use /dev/kmem, /dev/mem, and /dev/swap.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Don't overlook the possibility that you may have to use the process
|
|
Packit |
6f02de |
file system -- e.g., /proc. I try to avoid using /proc when I can,
|
|
Packit |
6f02de |
since it usually requires that lsof have setuid(root) permission
|
|
Packit |
6f02de |
to read the individual /proc "files".
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Once you can access kernel structures, you must understand how
|
|
Packit |
6f02de |
they're connected. You must answer questions like:
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* How big are kernel addresses? How are they type cast?
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* How are kernel variable names converted to addresses?
|
|
Packit |
6f02de |
Nlist()?
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* How are the proc structures organized? Is it a static
|
|
Packit |
6f02de |
table? Are the proc structures linked? Is there a
|
|
Packit |
6f02de |
kernel pointer to the first proc structure? Is there a
|
|
Packit |
6f02de |
proc structure count?
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* How does one obtain copies of the proc structures? Via
|
|
Packit |
6f02de |
/dev/kmem? Via a vendor API?
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* If this is a Mach derivative, is it necessary to obtain the
|
|
Packit |
6f02de |
task and thread structures? How?
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* How does one obtain the user area (or the utask area in Mach
|
|
Packit |
6f02de |
systems) that corresponds to a process?
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* Where are the file structures located for open file
|
|
Packit |
6f02de |
descriptors and how are they located? Are all file
|
|
Packit |
6f02de |
structures in the user area? Is the file structure space
|
|
Packit |
6f02de |
extensible?
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* Where do the private data pointers in file structures lead?
|
|
Packit |
6f02de |
To gnodes? To inodes? To sockets? To vnodes? Hint: look
|
|
Packit |
6f02de |
in <sys/file.h> for DTYPE_* instances and further pointers.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* How are the nodes organized? To what other nodes do they
|
|
Packit |
6f02de |
lead and how? Where are the common bits of information in
|
|
Packit |
6f02de |
nodes -- device, node number, size -- stored? Hint: look
|
|
Packit |
6f02de |
in the header files for nodes for macros that may be used
|
|
Packit |
6f02de |
to obtain the address of one node from another -- e.g., the
|
|
Packit |
6f02de |
VTOI() macro that leads from a vnode to an inode.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* Are text reference nodes identified and how? Is it
|
|
Packit |
6f02de |
necessary to examine the virtual memory map of a process or
|
|
Packit |
6f02de |
a task to locate text references? Some kernels have text
|
|
Packit |
6f02de |
node pointers in the proc structures; some, in the user
|
|
Packit |
6f02de |
area; Mach kernels may have text information in the task
|
|
Packit |
6f02de |
structure, reached in various ways from the proc, user area,
|
|
Packit |
6f02de |
or user task structure.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* How is the device table -- e.g., /dev or /devices --
|
|
Packit |
6f02de |
organized? How is it read? Using direct or dirent structures?
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
How are major/minor device numbers represented? How are
|
|
Packit |
6f02de |
device numbers assembled and disassembled?
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Are there clone devices? How are they identified?
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* How is mount information obtained? Getmntinfo()? Getmntent()?
|
|
Packit |
6f02de |
Some special kernel call?
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* How are sockets identified and organized? BSD-style? As
|
|
Packit |
6f02de |
streams? Are there streams?
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* Are there special nodes -- CD-ROM nodes, FIFO nodes, etc.?
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* How is the kernel's name cache organized? Can lsof access
|
|
Packit |
6f02de |
it to get partial name components?
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Dlsof.h and #include's
|
|
Packit |
6f02de |
----------------------
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Once you have identified the kernel's data organization and know
|
|
Packit |
6f02de |
what structures it provides, you must add #include's to dlsof.h to
|
|
Packit |
6f02de |
access their definitions. Sometimes it is difficult to locate the
|
|
Packit |
6f02de |
header files -- you may need to introduce -I specifications in the
|
|
Packit |
6f02de |
Makefile via the DINC shell variable in the Configure script.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Sometimes it is necessary to define special symbols -- e.g., KERNEL,
|
|
Packit |
6f02de |
_KERNEL, _KMEMUSER -- to induce system header files to yield kernel
|
|
Packit |
6f02de |
structure definitions. Sometimes making those symbol definitions
|
|
Packit |
6f02de |
cause other header file and definition conflicts. There's no good
|
|
Packit |
6f02de |
general rule on how to proceed when conflicts occur.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Rarely it may be necessary to extract structure definitions from
|
|
Packit |
6f02de |
system header files and move them to dlsof.h, create special versions
|
|
Packit |
6f02de |
of system header files, or obtain special copies of system header
|
|
Packit |
6f02de |
files from "friendly" (e.g., vendor) sources. The dlsof.h header
|
|
Packit |
6f02de |
file in lsof4/dialects/sun shows examples of the first case; the
|
|
Packit |
6f02de |
second, no examples; the third, the irix5hdr subdirectory in
|
|
Packit |
6f02de |
lsof4/dialects/irix (a mixture of the first and third).
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Building up the necessary #includes in dlsof.h is an iterative
|
|
Packit |
6f02de |
process that requires attention as you build the dialect-specific
|
|
Packit |
6f02de |
functions that references kernel structures. Be prepared to revisit
|
|
Packit |
6f02de |
dlsof.h frequently.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Definitions That Affect Compilation
|
|
Packit |
6f02de |
-----------------------------------
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
The source files at the top level and in the lib/ subdirectory
|
|
Packit |
6f02de |
contain optional functions that may be activated with definitions
|
|
Packit |
6f02de |
in a dialect's machine.h header file. Some are functions for
|
|
Packit |
6f02de |
reading node structures that may not apply to all dialects -- e.g.
|
|
Packit |
6f02de |
CD-ROM nodes (cdrnode), or `G' nodes (gnode) -- and others are
|
|
Packit |
6f02de |
common functions that may occasionally be replaced by dialect-specific
|
|
Packit |
6f02de |
ones. Once you understand your kernel's data organization, you'll
|
|
Packit |
6f02de |
be able to decide the optional common node functions to activate.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Definitions in machine.h and dlsof.h also enable or disable other
|
|
Packit |
6f02de |
optional common features. The following is an attempt to list all
|
|
Packit |
6f02de |
the definitions that affect lsof code, but CAUTION, it is only
|
|
Packit |
6f02de |
attempt and may be incomplete. Always check lsof4 source code in
|
|
Packit |
6f02de |
lib/ and dialects/, and dialect machine.h header files for other
|
|
Packit |
6f02de |
possibilities
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
AFS_VICE See 00XCONFIG.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
AIX_KERNBITS specifies the kernel bit size, 32 or 64, of the Power
|
|
Packit |
6f02de |
architecture AIX 5.x kernel for which lsof was built.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
CAN_USE_CLNT_CREATE is defined for dialects where the more modern
|
|
Packit |
6f02de |
RPC function clnt_create() can be used in
|
|
Packit |
6f02de |
place of the deprecated clnttcp_create().
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
CLONEMAJ defines the name of the variable that
|
|
Packit |
6f02de |
contains the clone major device number.
|
|
Packit |
6f02de |
(Also see HAS_STD_CLONE and HAVECLONEMAJ.)
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
DEVDEV_PATH defines the path to the directory where device
|
|
Packit |
6f02de |
nodes are stored, usually /dev. Solaris 10
|
|
Packit |
6f02de |
uses /devices.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
DIALECT_WARNING may be defined by a dialect to provide a
|
|
Packit |
6f02de |
warning message that will be displayed with
|
|
Packit |
6f02de |
help (-h) and version (-v) output.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
FSV_DEFAULT defines the default file structure values to
|
|
Packit |
6f02de |
list. It may be composed of or'd FSV_*
|
|
Packit |
6f02de |
(See lsof.h) values. The default is none (0).
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
GET_MAJ_DEV is a macro to get major portion from device
|
|
Packit |
6f02de |
number instead of via the standard major()
|
|
Packit |
6f02de |
macro.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
GET_MIN_DEV is a macro to get minor portion from device
|
|
Packit |
6f02de |
number instead of via the standard minor()
|
|
Packit |
6f02de |
macro.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
GET_MAX_FD the name of the function that returns an
|
|
Packit |
6f02de |
int for the maximum open file descriptor
|
|
Packit |
6f02de |
plus one. If not defined, defaults to
|
|
Packit |
6f02de |
getdtablesize.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS9660FS enables CD9660 file system support in a
|
|
Packit |
6f02de |
BSD dialect.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_ADVLOCK_ARGS is defined for NetBSD and OpenBSD dialects
|
|
Packit |
6f02de |
whose <sys/lockf.h> references vop_advlock_args.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_AFS enables AFS support code for the dialect.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_AIO_REQ_STRUCT is defined for Solaris 10 and above systems that
|
|
Packit |
6f02de |
have the aio_req structure definition.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_ATOMIC_T indicates the Linux version has an
|
|
Packit |
6f02de |
<asm/atomic.h> header file and it contains
|
|
Packit |
6f02de |
"typedef struct .* atomic_t;"
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASAOPT indicates the dialect supports the AFS -A
|
|
Packit |
6f02de |
option when HAS_AFS is also defined.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_ASM_TERMIOBITS indicates for Linux Alpha that the
|
|
Packit |
6f02de |
<asm/termiobits.h> header file exists.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASAX25CBPTR indicates that the Linux sock struct has an
|
|
Packit |
6f02de |
ax25_db pointer.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASBLKDEV indicates the dialect has block device support.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASBUFQ_H indicates the *NSD dialect has the <sys/bufq.h>
|
|
Packit |
6f02de |
header file.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASCACHEFS enables cache file system support for the
|
|
Packit |
6f02de |
dialect.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_CDFS enables CDFS file system support for the
|
|
Packit |
6f02de |
dialect.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASCDRNODE enables/disables readcdrnode() in node.c.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_CLOSEFROM is defined when the FreeBSD C library contains the
|
|
Packit |
6f02de |
closefrom() function.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_CONN_NEW indicates the Solaris version has the new form
|
|
Packit |
6f02de |
of the conn_s structure, introduced in b134 of
|
|
Packit |
6f02de |
Solaris 11. This will always accompany the
|
|
Packit |
6f02de |
HAS_IPCLASSIFIER_H definition.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_CONST indicates that the compiler supports the
|
|
Packit |
6f02de |
const keyword.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASCPUMASK_T indicates the FreeBSD 5.2 or higher dialect
|
|
Packit |
6f02de |
has cpumask_t typedef's.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_CRED_IMPL_H indicates the Solaris 10 dialect has the
|
|
Packit |
6f02de |
<sys/cred_impl.h> header file available.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASCWDINFO indicates the cwdinfo structure is defined
|
|
Packit |
6f02de |
in the NetBSD <sys/filedesc.h>.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASDCACHE enables device file cache file support.
|
|
Packit |
6f02de |
The device cache file contains information
|
|
Packit |
6f02de |
about the names, device numbers and inode
|
|
Packit |
6f02de |
numbers of entries in the /dev (or /device)
|
|
Packit |
6f02de |
node subtree that lsof saves from call to
|
|
Packit |
6f02de |
call. See the 00DCACHE file of the lsof
|
|
Packit |
6f02de |
distribution for more information on this
|
|
Packit |
6f02de |
feature.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASDENTRY indicates the Linux version has a dentry
|
|
Packit |
6f02de |
struct defined in <linux/dcache.h>.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASDEVKNC indicates the Linux version has a kernel
|
|
Packit |
6f02de |
name cached keyed on device number.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_DINODE_U indicates the OpenBSD version has a dinode_u
|
|
Packit |
6f02de |
union in its inode structure.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASDNLCPTR is defined when the name cache entry of
|
|
Packit |
6f02de |
<sys/dnlc.h> has a name character pointer
|
|
Packit |
6f02de |
rather than a name character array.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_DUP2 is defined when the FreeBSD C library contains the
|
|
Packit |
6f02de |
dup2() function.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASEFFNLINK indicates the *BSD system has the i_effnlink
|
|
Packit |
6f02de |
member in the inode structure.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASENVDC enables the use of an environment-defined
|
|
Packit |
6f02de |
device cache file path and defines the name
|
|
Packit |
6f02de |
of the environment variable from which lsof
|
|
Packit |
6f02de |
may take it. (See the 00DCACHE file of
|
|
Packit |
6f02de |
the lsof distribution for information on
|
|
Packit |
6f02de |
when HASENVDC is used or ignored.)
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASEOPT indicates the dialect supports the -e option to
|
|
Packit |
6f02de |
eliminate kernel blocks on a named file system.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASEPTOPTS indicates the dialect supports the +|-E end point
|
|
Packit |
6f02de |
options.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASEXT2FS is defined for BSD dialects for which ext2fs
|
|
Packit |
6f02de |
file system support can be provided. A value
|
|
Packit |
6f02de |
of 1 indicates that the i_e2din member does not
|
|
Packit |
6f02de |
exist; 2, it exists.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASF_VNODE indicates the dialect's file structure has an
|
|
Packit |
6f02de |
f_vnode member in it.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_FDESCENTTBL indicates the FreeBSD system has the fdescenttbl
|
|
Packit |
6f02de |
structure.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_FILEDESCENT indicates the FreeBSD system has the filedescent
|
|
Packit |
6f02de |
definition in the <sys/filedesc.h> header file.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASFDESCFS enables file descriptor file system support
|
|
Packit |
6f02de |
for the dialect. A value of 1 indicates
|
|
Packit |
6f02de |
<miscfs/fdesc.h> has a Fctty definition; 2,
|
|
Packit |
6f02de |
it does not.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASFDLINK indicates the file descriptor file system
|
|
Packit |
6f02de |
node has the fd_link member.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASFIFONODE enables/disables readfifonode() in node.c.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_FL_FD indicates the Linux version has an fl_fd
|
|
Packit |
6f02de |
element in the lock structure of <linux/fs.h>.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_FL_FILE indicates the Linux version has an fl_file
|
|
Packit |
6f02de |
element in the lock structure of <linux/fs.h>.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_FL_WHENCE indicates the Linux version has an fl_whence
|
|
Packit |
6f02de |
element in the lock structure of <linux/fs.h>.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_F_OPEN indicates the UnixWare 7.x dialect has the
|
|
Packit |
6f02de |
f_open member in its file struct.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASFSINO enables the inclusion of the fs_ino element
|
|
Packit |
6f02de |
in the lfile structure definition in lsof.h.
|
|
Packit |
6f02de |
This contains the file system's inode number
|
|
Packit |
6f02de |
and may be needed when searching the kernel
|
|
Packit |
6f02de |
name cache. See dialects/osr/dproc.c for
|
|
Packit |
6f02de |
an example.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASFSTRUCT indicates the dialect has a file structure
|
|
Packit |
6f02de |
the listing of whose element values can be
|
|
Packit |
6f02de |
enabled with +f[cfn]. FSV_DEFAULT defines
|
|
Packit |
6f02de |
the default listing values.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASFSTYPE enables/disables the use of the file system's
|
|
Packit |
6f02de |
stat(2) st_fstype member.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
If the HASFSTYPE value is 1, st_fstype is
|
|
Packit |
6f02de |
treated as a character array; 2, it is
|
|
Packit |
6f02de |
treated as an integer.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
See also the RMNT_EXPDEV and RMNT_FSTYPE
|
|
Packit |
6f02de |
documentation in lib/rmnt.c
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASFUSEFS is defined when the FreeBSD system has FUSE file system
|
|
Packit |
6f02de |
support.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASGETBOOTFILE indicates the NetBSD or OpenBSD dialect has
|
|
Packit |
6f02de |
a getbootfile() function.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASGNODE enables/disables readgnode() in node.c.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASHASHPID is defined when the Linux version (probably
|
|
Packit |
6f02de |
above 2.1.35) has a pidhash_next member in
|
|
Packit |
6f02de |
its task structure.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASHSNODE enables/disables readhsnode() in node.c.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASI_E2FS_PTR indicates the BSD dialect has a pointer in
|
|
Packit |
6f02de |
its inode to the EXTFS dinode.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASI_FFS indicates the BSD dialect has i_ffs_size
|
|
Packit |
6f02de |
in <ufs/ufs/inode.h>.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASI_FFS1 indicates the BSD dialect supports the fast
|
|
Packit |
6f02de |
UFS1 and UFS2 file systems.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_INKERNEL indicates the SCO OSR 6.0.0 or higher, or
|
|
Packit |
6f02de |
UnixWare 7.1.4 or higher system uses the
|
|
Packit |
6f02de |
INKERNEL symbol in <netinet/in_pcb.h> or
|
|
Packit |
6f02de |
<netinet/tcp_var.h>.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASINODE enables/disables readinode() in node.c.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASINOKNC indicates the Linux version has a kernel
|
|
Packit |
6f02de |
name cache keyed on inode address.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASINADDRSTR is defined when the inp_[fl]addr members
|
|
Packit |
6f02de |
of the inpcb structure are structures.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASINRIAIPv6 is defined if the dialect has the INRIA IPv6
|
|
Packit |
6f02de |
support. (HASIPv6 will also be defined.)
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASINT16TYPE is defined when the dialect has a typedef
|
|
Packit |
6f02de |
for int16 that may conflict with some other
|
|
Packit |
6f02de |
header file's redefinition (e.g., <afs/std.h>).
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASINT32TYPE is defined when the dialect has a typedef
|
|
Packit |
6f02de |
for int32 that may conflict with some other
|
|
Packit |
6f02de |
header file's redefinition (e.g., <afs/std.h>).
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASINTSIGNAL is defined when signal() returns an int.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_IPCLASSIFIER_H is defined for Solaris dialects that have the
|
|
Packit |
6f02de |
<inet/ipclassifier.h> header file.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_IPC_S_PATCH is defined when the HP-UX 11 dialect has the
|
|
Packit |
6f02de |
ipc_s patch installed. It has a value of
|
|
Packit |
6f02de |
1 if the ipc_s structure has an ipc_ipis
|
|
Packit |
6f02de |
member, but the ipis_s structure lacks the
|
|
Packit |
6f02de |
ipis_msgsqueued member; 2, if ipc_s has
|
|
Packit |
6f02de |
ipc_ipis, but ipis_s lacks ipis_msgsqueued.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASIPv6 indicates the dialect supports the IPv6
|
|
Packit |
6f02de |
Internet address family.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_JFS2 The AIX >= 5.0 dialect has jfs2 support.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASKERNELKEYT indicates the Linux version has a
|
|
Packit |
6f02de |
__kernel_key_t typedef in <linux/types.h>.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASKERNFS is defined for BSD dialects for which
|
|
Packit |
6f02de |
/kern file system support can be provided.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASKERNFS_KFS_KT indicates *kfs_kt is in the BSD dialect's
|
|
Packit |
6f02de |
<miscfs/kernfs/kernfs.h>.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASKOPT enables/disables the ability to read the
|
|
Packit |
6f02de |
kernel's name list from a file -- e.g., from
|
|
Packit |
6f02de |
a crash dump file.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_PAUSE_SBT indicates the FreeBSD system's systm.h has the
|
|
Packit |
6f02de |
pause to pause_sbt definition.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASKQUEUE indicates the dialect supports the kqueue
|
|
Packit |
6f02de |
file type.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASKVMGETPROC2 The *BSD dialect has the kvm_gettproc2()
|
|
Packit |
6f02de |
function.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_KVM_VNODE indicates the FreeBSD 5.3 or higher dialect has
|
|
Packit |
6f02de |
"defined(_KVM_VNODE)" in <sys/vnode.h>.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASLFILEADD defines additional, dialect-specific elements
|
|
Packit |
6f02de |
SETLFILEADD in the lfile structure (defined in lsof.h).
|
|
Packit |
6f02de |
HASLFILEADD is a macro. The accompanying SETFILEADD
|
|
Packit |
6f02de |
macro is used in the alloc_lfile() function of
|
|
Packit |
6f02de |
proc.c to preset the additional elements.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_LF_LWP is defined for BSD dialects where the lockf
|
|
Packit |
6f02de |
structure has an lf_lwp member.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASLFS indicates the *BSD dialect has log-structured
|
|
Packit |
6f02de |
file system support.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_LGRP_ROOT_CONFLICT
|
|
Packit |
6f02de |
indicates the Solaris 9 or Solaris 10 system has
|
|
Packit |
6f02de |
a conflict over the lgrp_root symbol in the
|
|
Packit |
6f02de |
<sys/lgrp.h> and <sys/lgrp_user.h> header files.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_LIBCTF indicates the Solaris 10 and above system has
|
|
Packit |
6f02de |
the CTF library.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_LOCKF_ENTRY indicates the FreeBSD version has a lockf_entry
|
|
Packit |
6f02de |
structure in its <sys/lockf.h> header file.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_LWP_H is defined for BSD dialects that have the
|
|
Packit |
6f02de |
<sys/lwp.h> header file.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASMOPT enables/disables the ability to read kernel
|
|
Packit |
6f02de |
memory from a file -- e.g., from a crash
|
|
Packit |
6f02de |
dump file.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASMSDOSFS enables MS-DOS file system support in a
|
|
Packit |
6f02de |
BSD dialect.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASMNTSTAT indicates the dialect has a stat(2) status
|
|
Packit |
6f02de |
element in its mounts structure.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASMNTSUP indicates the dialect supports the mount supplement
|
|
Packit |
6f02de |
option.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASNAMECACHE indicates the FreeBSD dialect has a namecache
|
|
Packit |
6f02de |
structure definition in <sys/namei.h>.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASNCACHE enables the probing of the kernel's name cache
|
|
Packit |
6f02de |
to obtain path name components. A value
|
|
Packit |
6f02de |
of 1 directs printname() to prefix the
|
|
Packit |
6f02de |
cache value with the file system directory
|
|
Packit |
6f02de |
name; 2, avoid the prefix.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASNCVPID The *BSD dialect namecache struct has an
|
|
Packit |
6f02de |
nc_vpid member.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASNETDEVICE_H indicates the Linux version has a netdevice.h
|
|
Packit |
6f02de |
header file.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_NFS enables NFS support for the dialect.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASNFSKNC indicates the LINUX version has a separate
|
|
Packit |
6f02de |
NFS name cache.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASNFSPROTO indicates the NetBSD or OpenBSD version
|
|
Packit |
6f02de |
has the nfsproto.h header file.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASNFSVATTRP indicates the n_vattr member of the nfsnode of
|
|
Packit |
6f02de |
the *BSD dialect is a pointer.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASNLIST enables/disables nlist() function support.
|
|
Packit |
6f02de |
(See NLIST_TYPE.)
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASNOFSADDR is defined if the dialect has no file structure
|
|
Packit |
6f02de |
addresses. (HASFSTRUCT must be defined.)
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASNOFSCOUNT is defined if the dialect has no file structure counts.
|
|
Packit |
6f02de |
(HASFSTRUCT must be defined.)
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASNOFSFLAGS is defined if the dialect has no file structure flags.
|
|
Packit |
6f02de |
(HASFSTRUCT must be defined.)
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASNOFSNADDR is defined if the dialect has no file structure node
|
|
Packit |
6f02de |
addresses. (HASFSTRUCT must be defined.)
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_NO_6PORT is defined if the FreeBSD in_pcb.h has no in6p_.port
|
|
Packit |
6f02de |
definitions.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_NO_6PPCB is defined if the FreeBSD in_pcb.h has no in6p_ppcb
|
|
Packit |
6f02de |
definition.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_NO_IDEV indicates the FreeBSD system's inode has no i_dev
|
|
Packit |
6f02de |
member.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_NO_ISO_DEV indicates the FreeBSD 6 and higher system has
|
|
Packit |
6f02de |
no i_dev member in its iso_node structure.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_NO_LONG_LONG indicates the dialect has no support for the C
|
|
Packit |
6f02de |
long long type. This definition is used by
|
|
Packit |
6f02de |
the built-in snprintf() support of lib/snpf.c.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASNORPC_H indicates the dialect has no /usr/include/rpc/rpc.h
|
|
Packit |
6f02de |
header file.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_NO_SI_UDEV indicates the FreeBSD 6 and higher system has
|
|
Packit |
6f02de |
no si_udev member in its cdev structure.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASNOSOCKSECURITY enables the listing of open socket files,
|
|
Packit |
6f02de |
even when HASSECURITY restricts listing of
|
|
Packit |
6f02de |
open files to the UID of the user who is
|
|
Packit |
6f02de |
running lsof, provided socket file listing
|
|
Packit |
6f02de |
is selected with the "-i" option. This
|
|
Packit |
6f02de |
definition is only effective when HASSECURITY
|
|
Packit |
6f02de |
is also defined.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASNULLFS indicates the dialect (usually *BSD) has a
|
|
Packit |
6f02de |
null file system.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASOBJFS indicates the Pyramid version has OBJFS
|
|
Packit |
6f02de |
support.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASONLINEJFS indicates the HP-UX 11 dialect has the optional
|
|
Packit |
6f02de |
OnlineJFS package installed.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_PC_DIRENTPERSEC
|
|
Packit |
6f02de |
indicates the Solaris 10 system's <sys/fs/pc_node.h>
|
|
Packit |
6f02de |
header file has the pc_direntpersec() macro.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_PAD_MUTEX indicates the Solaris 11 system has the pad_mutex_t
|
|
Packit |
6f02de |
typedef in its <sys/mutex.h> header file.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASPERSDC enables the use of a personal device cache
|
|
Packit |
6f02de |
file path and specifies a format by which
|
|
Packit |
6f02de |
it is constructed. See the 00DCACHE file
|
|
Packit |
6f02de |
of the lsof distribution for more information
|
|
Packit |
6f02de |
on the format.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASPERSDCPATH enables the use of a modified personal
|
|
Packit |
6f02de |
device cache file path and specifies the
|
|
Packit |
6f02de |
name of the environment variable from which
|
|
Packit |
6f02de |
its component may be taken. See the 00DCACHE
|
|
Packit |
6f02de |
file of the lsof distribution for more
|
|
Packit |
6f02de |
information on the modified personal device
|
|
Packit |
6f02de |
cache file path.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASPINODEN declares that the inode number of a /proc file
|
|
Packit |
6f02de |
should be stored in its procfsid structure.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASPIPEFN defines the function that processes DTYPE_PIPE
|
|
Packit |
6f02de |
file structures. It's used in the prfp.c
|
|
Packit |
6f02de |
library source file. See the FreeBSD
|
|
Packit |
6f02de |
dialect source for an example.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASPIPENODE enables/disables readpipenode() in node.c.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASPMAPENABLED enables the automatic reporting of portmapper
|
|
Packit |
6f02de |
registration information for TCP and UDP
|
|
Packit |
6f02de |
ports that have been registered.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASPPID indicates the dialect has parent PID support.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASPR_LDT indicates the Solaris dialect has a pr_ldt
|
|
Packit |
6f02de |
member in the pronodetype enum.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASPR_GWINDOWS indicates the Solaris dialect has a pr_windows
|
|
Packit |
6f02de |
member in the pronodetype enum.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASPRINTDEV this value defines a private function for
|
|
Packit |
6f02de |
printing the dialect's device number. Used
|
|
Packit |
6f02de |
by print.c/print_file(). Takes one argument:
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
char *HASPRINTDEV(struct lfile *)
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASPRINTINO this value names a private function for
|
|
Packit |
6f02de |
printing the dialect's inode number. Used
|
|
Packit |
6f02de |
by print.c/print_file(). Takes one argument:
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
char *HASPRINTINO(struct lfile *)
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASPRINTNM this value names a private function for
|
|
Packit |
6f02de |
printing the dialect's file name. Used by
|
|
Packit |
6f02de |
print.c/print_file(). Takes one argument:
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
void HASPRINTNM(struct lfile *)
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASPRINTOFF this value names a private function for
|
|
Packit |
6f02de |
printing the dialect's file offset. Used
|
|
Packit |
6f02de |
by print.c/print_file(). Takes two arguments:
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
char *HASPRINTOFF(struct lfile *, int ty)
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Where ty == 0 if the offset is to be printed
|
|
Packit |
6f02de |
in 0t<decimal> format; 1, 0x<hexadecimal>.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASPRINTSZ this value names a private function for
|
|
Packit |
6f02de |
printing the dialect's file size. Used
|
|
Packit |
6f02de |
by print.c/print_file(). Takes one argument:
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
char *HASPRINTSZ(struct lfile *)
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
void HASPRINTNM(struct lfile *)
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASPRIVFILETYPE enables processing of the private file
|
|
Packit |
6f02de |
type, whose number (from f_type of the file
|
|
Packit |
6f02de |
struct) is defined by PRIVFILETYPE.
|
|
Packit |
6f02de |
HASPRIVFILETYPE defines the function that
|
|
Packit |
6f02de |
processes the file struct's f_data member.
|
|
Packit |
6f02de |
Processing is initiated from the process_file()
|
|
Packit |
6f02de |
function of the prfp.c library source file
|
|
Packit |
6f02de |
or from the dialect's own process_file()
|
|
Packit |
6f02de |
function.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASPRIVNMCACHE enables printing of a file path from a
|
|
Packit |
6f02de |
private name cache. HASPRIVNMCACHE defines
|
|
Packit |
6f02de |
the name of the printing function. The
|
|
Packit |
6f02de |
function takes one argument, a struct lfile
|
|
Packit |
6f02de |
pointer to the file, and returns non-zero
|
|
Packit |
6f02de |
if it prints a cached name to stdout.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASPRIVPRIPP is defined for dialects that have a private
|
|
Packit |
6f02de |
function for printing the IP protocol name.
|
|
Packit |
6f02de |
When this is not defined, the function to
|
|
Packit |
6f02de |
do that defaults to printiproto().
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASPROCFS defines the name (if any) of the process file
|
|
Packit |
6f02de |
system -- e.g., /proc.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASPROCFS_PFSROOT indicates PFSroot is in the BSD dialect's
|
|
Packit |
6f02de |
<miscfs/procfs/procfs.h>.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASPSEUDOFS indicates the FreeBSD dialect has pseudofs
|
|
Packit |
6f02de |
file system support.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASPSXSEM indicates the dialect has support for the POSIX
|
|
Packit |
6f02de |
semaphore file type.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASPSXSHM indicates the dialect has support for the POSIX
|
|
Packit |
6f02de |
shared memory file type.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASPTSFN indicates the dialect has a DNODE_PTS file descriptor
|
|
Packit |
6f02de |
type and defines the function that processes it.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASPTYEPT indicates the Linux dialect has support for the
|
|
Packit |
6f02de |
pseudoterminal endpoint option.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASPTYFS indicates the *BSD dialect has a ptyfs file system.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASRNODE enables/disables readrnode() in node.c.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASRNODE3 indicates the HPUX 10.20 or lower dialect has NFS3
|
|
Packit |
6f02de |
support with a modified rnode structure.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASRPCV2H The FreeBSD dialect has <nfs/rpcv2.h>.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_SANFS indicates the AIX system has SANFS file system
|
|
Packit |
6f02de |
support.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_SB_CC indicates the FreeBSD system's sockbuf structure has
|
|
Packit |
6f02de |
the sb_ccc member, rather than the sb_cc member.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASSBSTATE indicates the dialect has socket buffer state
|
|
Packit |
6f02de |
information (e.g., SBS_* symbols) available.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASSECURITY enables/disables restricting open file
|
|
Packit |
6f02de |
information access. (Also see HASNOSOCKSECURITY.)
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASSELINUX indicates the Linux dialect has SELinux security
|
|
Packit |
6f02de |
context support available.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASSETLOCALE is defined if the dialect has <locale.h> and
|
|
Packit |
6f02de |
setlocale().
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_SI_PRIV indicates the FreeBSD 6.0 and higher cdev
|
|
Packit |
6f02de |
structure has an si_priv member.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_SOCKET_PROTO_H indicates the Solaris 10 system has the header file
|
|
Packit |
6f02de |
<sys/socket_proto.h>.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASSOUXSOUA indicates that the Solaris <sys/socketvar.h> has
|
|
Packit |
6f02de |
soua_* members in its so_ux_addr structure.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASSPECDEVD indicates the dialect has a special device
|
|
Packit |
6f02de |
directory and defines the name of a function
|
|
Packit |
6f02de |
that processes the results of a successful
|
|
Packit |
6f02de |
stat(2) of a file in that directory.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASSPECNODE indicates the DEC OSF/1, or Digital UNIX,
|
|
Packit |
6f02de |
or Tru64 UNIX <sys/specdev.h> has a spec_node
|
|
Packit |
6f02de |
structure definition.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASSNODE indicates the dialect has snode support.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_SOCKET_SK indicates that the Linux socket structure
|
|
Packit |
6f02de |
has the ``struct sock *sk'' member.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASSOOPT indicates the dialect has socket option
|
|
Packit |
6f02de |
information (e.g., SO_* symbols) available.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASSOSTATE indicates the dialect has socket state
|
|
Packit |
6f02de |
information (e.g., SS_* symbols) available.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASSTATVFS indicates the NetBSD dialect has a statvfs
|
|
Packit |
6f02de |
struct definition.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASSTAT64 indicates the dialect's <sys/stat.h> contains
|
|
Packit |
6f02de |
stat64.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_STD_CLONE indicates the dialect uses a standard clone
|
|
Packit |
6f02de |
device structure that can be used in common
|
|
Packit |
6f02de |
library function clone processing. If the
|
|
Packit |
6f02de |
value is 1, the clone table will be built
|
|
Packit |
6f02de |
by readdev() and cached when HASDCACHE is
|
|
Packit |
6f02de |
defined; if the value is 2, it is assumed
|
|
Packit |
6f02de |
the clone table is built independently.
|
|
Packit |
6f02de |
(Also see CLONEMAJ and HAVECLONEMAJ.)
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASSTREAMS enables/disables streams. CAUTION, requires
|
|
Packit |
6f02de |
specific support code in the dialect sources.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_STRFTIME indicates the dialect has the gmtime() and
|
|
Packit |
6f02de |
strftime() C library functions that support
|
|
Packit |
6f02de |
the -r marker format option. Configure tests
|
|
Packit |
6f02de |
for the functions and defines this symbol.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASSYSDC enables the use of a system-wide device
|
|
Packit |
6f02de |
cache file and defines its path. See the
|
|
Packit |
6f02de |
00DCACHE file of the lsof distribution for
|
|
Packit |
6f02de |
more information on the system-wide device
|
|
Packit |
6f02de |
cache file path option.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_SYS_PIPEH indicates the dialect has a <sys/pipe.h>
|
|
Packit |
6f02de |
header file.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_SYS_SX_H indicates the FreeBSD 7.0 and higher system has
|
|
Packit |
6f02de |
a <sys/sx.h> header file.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASTAGTOPATH indicates the DEC OSF/1, Digital UNIX, or
|
|
Packit |
6f02de |
Tru64 UNIX dialect has a libmsfs.so,
|
|
Packit |
6f02de |
containing tag_to_path().
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_TMPFS indicates the FreeBSD system has the <fs/tmpfs.h>
|
|
Packit |
6f02de |
header file.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASTMPNODE enables/disables readtnode() in node.c.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASTCPOPT indicates the dialect has TCP option
|
|
Packit |
6f02de |
information (i.e., from TF_* symbols)
|
|
Packit |
6f02de |
available.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASTCPTPIQ is defined when the dialect can duplicate
|
|
Packit |
6f02de |
the receive and send queue sizes reported
|
|
Packit |
6f02de |
by netstat.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASTCPTPIW is defined when the dialect can duplicate
|
|
Packit |
6f02de |
the receive and send window sizes reported
|
|
Packit |
6f02de |
by netstat.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASTCPUDPSTATE is defined when the dialect has support for
|
|
Packit |
6f02de |
TCP and UDP state, including the "-s p:s"
|
|
Packit |
6f02de |
option and associated speed ehancements.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASTFS indicates that the Pyramid dialect has TFS
|
|
Packit |
6f02de |
file system support.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_UFS1_2 indicates the FreeBSD 6 and higher system has
|
|
Packit |
6f02de |
UFS1 and UFS2 members in its inode structure.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_UM_UFS indicates the OpenBSD version has UM_UFS[12]
|
|
Packit |
6f02de |
definitions.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASUNMINSOCK indicates the Linux version has a user name
|
|
Packit |
6f02de |
element in the socket structure; a value of
|
|
Packit |
6f02de |
0 says there is no unix_address member; 1,
|
|
Packit |
6f02de |
there is.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASUINT16TYPE is defined when the dialect has a typedef
|
|
Packit |
6f02de |
for u_int16 that may conflict with some other
|
|
Packit |
6f02de |
header file's redefinition (e.g., <afs/std.h>).
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASUXSOCKEPT indicates the Linux version has support for the
|
|
Packit |
6f02de |
UNIX socket endpoint option.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASUTMPX indicates the dialect has a <utmpx.h> header
|
|
Packit |
6f02de |
file.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_UVM_INCL indicates the NetBSD or OpenBSD dialect has
|
|
Packit |
6f02de |
a <uvm> include directory.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_UW_CFS indicates the UnixWare 7.1.1 or above dialect
|
|
Packit |
6f02de |
has CFS file system support.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_UW_NSC indicates the UnixWare 7.1.1 or above dialect
|
|
Packit |
6f02de |
has a NonStop Cluster (NSC) kernel.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_V_LOCKF indicates the FreeBSD version has a v_lockf
|
|
Packit |
6f02de |
member in the vode structure, defined in
|
|
Packit |
6f02de |
<sys/vnode.h>.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_VM_MEMATTR_T indicates the FreeBSD <sys/conf.h> uses the
|
|
Packit |
6f02de |
vm_memattr_t typedef.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASVMLOCKH indicates the FreeBSD dialect has <vm/lock.h>.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASVNODE enables/disables readvnode() function in node.c.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_V_PATH indicates the dialect's vnode structure has a
|
|
Packit |
6f02de |
v_path member.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_VSOCK indicates that the Solaris version has a VSOCK
|
|
Packit |
6f02de |
member in the vtype enum
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASVXFS enables Veritas VxFS file system support for
|
|
Packit |
6f02de |
the dialect. CAUTION, the dialect sources
|
|
Packit |
6f02de |
must have the necessary support code.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASVXFSDNLC indicates the VxFS file system has its own
|
|
Packit |
6f02de |
name cache.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASVXFS_FS_H indicates <sys/fs/vx_fs.h> exists.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASVXFS_MACHDEP_H indicates <sys/fs/vx_machdep.h> exists.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASVXFS_OFF64_T indicates <sys/fs/vx_solaris.h> exists and
|
|
Packit |
6f02de |
has an off64_t typedef.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASXVFSRNL indicates the dialect has VxFS Reverse Name
|
|
Packit |
6f02de |
Lookup (RNL) support.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASVXFS_SOL_H indicates <sys/fs/vx_sol.h> exists.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASVXFS_SOLARIS_H indicates <sys/fs/vx_solaris.h> exists.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASVXFS_U64_T if HASVXFS_SOLARIS_H is defined, this
|
|
Packit |
6f02de |
variable indicates that <sys/fs/vx_solaris.h>
|
|
Packit |
6f02de |
has a vx_u64_t typedef.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASVXFSUTIL indicates the Solaris dialect has VxFS 3.4
|
|
Packit |
6f02de |
or higher and has the utility libraries,
|
|
Packit |
6f02de |
libvxfsutil.a (32 bit) and libvxfsutil64.a
|
|
Packit |
6f02de |
(64 bit).
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASVXFS_VX_INODE indicates that <sys/fs/vx_inode.h> contains
|
|
Packit |
6f02de |
a vx_inode structure.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASWCTYPE_H indicates the FreeBSD version has wide-character
|
|
Packit |
6f02de |
support and the <wctype.h> header file. Note:
|
|
Packit |
6f02de |
the HASWIDECHAR #define will also be set.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASWIDECHAR indicates the dialect has the wide-character
|
|
Packit |
6f02de |
support functions iswprint(), mblen() and mbtowc().
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASXNAMNODE indicates the OSR dialect has <sys/fs/xnamnode.h>.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASXOPT defines help text for dialect-specific X option
|
|
Packit |
6f02de |
and enables X option processing in usage.c and
|
|
Packit |
6f02de |
main.c.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASXOPT_ROOT when defined, restricts the dialect-specific
|
|
Packit |
6f02de |
X option to processes whose real user ID
|
|
Packit |
6f02de |
is root.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASXOPT_VALUE defines the default binary value for the X option
|
|
Packit |
6f02de |
in store.c.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAS_ZFS indicates the dialect has support for the ZFS file
|
|
Packit |
6f02de |
system.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HASZONES the Solaris dialect has zones.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HAVECLONEMAJ defines the name of the status variable
|
|
Packit |
6f02de |
that indicates a clone major device number
|
|
Packit |
6f02de |
is available in CLONEMAJ. (Also see CLONEMAJ
|
|
Packit |
6f02de |
and HAS_STD_CLONE.)
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
HPUX_KERNBITS defines the number of bits in the HP-UX 10.30
|
|
Packit |
6f02de |
and above kernel "basic" word: 32 or 64.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
KA_T defines the type cast required to assign
|
|
Packit |
6f02de |
space to kernel pointers. When not defined
|
|
Packit |
6f02de |
by a dialect header file, KA_T defaults to
|
|
Packit |
6f02de |
unsigned long.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
KA_T_FMT_X defines the printf format for printing a
|
|
Packit |
6f02de |
KA_T -- the default is "%#lx" for the
|
|
Packit |
6f02de |
default unsigned long KA_T cast.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
LSOF_ARCH See 00XCONFIG.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
LSOF_BLDCMT See 00XCONFIG.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
LSOF_CC See 00XCONFIG.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
LSOF_CCV See 00XCONFIG.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
LSOF_HOST See 00XCONFIG.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
LSOF_INCLUDE See 00XCONFIG.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
LSOF_LOGNAME See 00XCONFIG.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
LSOF_MKC See the "The Mksrc Shell Script" section of
|
|
Packit |
6f02de |
this file.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
LSOF_SYSINFO See 00XCONFIG.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
LSOF_USER See 00XCONFIG.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
LSOF_VERS See 00XCONFIG.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
LSOF_VSTR See 00XCONFIG.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
MACH defines a MACH system.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
N_UNIXV defines an alternate value for the N_UNIV symbol.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
NCACHELDPFX defines C code to be executed before calling
|
|
Packit |
6f02de |
ncache_load().
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
NCACHELDSFX defines C code to be executed after calling
|
|
Packit |
6f02de |
ncache_load().
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
NEEDS_BOOL_TYPEDEF indicates the FreeBSD 10 system, being built on an
|
|
Packit |
6f02de |
i386 architecture systemn, needs typdef bool.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
NEEDS_BOOLEAN_T indicates the FreeBSD 9 and above system needs a
|
|
Packit |
6f02de |
boolean_t definition for <sys/conf.h>.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
NEEDS_DEVICE_T indicates the FreeBSD <sys/eventhandler.h> header file
|
|
Packit |
6f02de |
needs the device_t typedef.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
NEEDS_MACH_PORT_T is defined for Darwin versions that need the inclusion
|
|
Packit |
6f02de |
of the header file <device/device_types.h>.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
NEEDS_NETINET_TCPH is defined when the Linux version needs to #include
|
|
Packit |
6f02de |
<netinet/tcp.h> in place of <linux/tcp.h> in order to
|
|
Packit |
6f02de |
have access to the TCP_* definitions.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
NEVER_HASDCACHE keeps the Customize script from offering to
|
|
Packit |
6f02de |
change HASDCACHE by its presence anywhere
|
|
Packit |
6f02de |
in a dialect's machine.h header file --
|
|
Packit |
6f02de |
e.g., in a comment. See the Customize
|
|
Packit |
6f02de |
script or machine.h in dialects/linux/proc.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
NEVER_WARNDEVACCESS keeps the Customize script from offering to
|
|
Packit |
6f02de |
change WARNDEVACCESS by its presence anywhere
|
|
Packit |
6f02de |
in a dialect's machine.h header file --
|
|
Packit |
6f02de |
including in a comment. See the Customize
|
|
Packit |
6f02de |
script or machine.h in dialects/linux/proc.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
NLIST_TYPE is the type of the nlist table, Nl[], if it is
|
|
Packit |
6f02de |
not nlist. HASNLIST must be set for this
|
|
Packit |
6f02de |
definition to be effective.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
NOWARNBLKDEV specifies that no warning is to be issued
|
|
Packit |
6f02de |
when no block devices are found. This
|
|
Packit |
6f02de |
definiton is used only when HASBLKDEV is
|
|
Packit |
6f02de |
also defined.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
OFFDECDIG specifies how many decimal digits will be
|
|
Packit |
6f02de |
printed for the file offset in a 0t form
|
|
Packit |
6f02de |
before switching to a 0x form. The count
|
|
Packit |
6f02de |
includes the "0t". A count of zero means
|
|
Packit |
6f02de |
the size is unlimited.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
PRIVFILETYPE is the number of a private file type, found
|
|
Packit |
6f02de |
in the f_type member of the file struct, to
|
|
Packit |
6f02de |
be processed by the HASPRIVFILETYPE function.
|
|
Packit |
6f02de |
See the AIX dialect sources for an example.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
_PSTAT_STREAM_GET_XPORT
|
|
Packit |
6f02de |
indicates the HP-UX PSTAT header files require
|
|
Packit |
6f02de |
this symbol to be defined for proper handling of
|
|
Packit |
6f02de |
stream export data.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
SAVE_MP_IN_SFILE indicates the dialect needs to have the mounts
|
|
Packit |
6f02de |
structure pointer for a file system search argument
|
|
Packit |
6f02de |
recorded in the dialect's sfile structure. This
|
|
Packit |
6f02de |
definition is made in the dialect's dlsof.h header
|
|
Packit |
6f02de |
file within the sfile structure.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
TIMEVAL_LSOF defines the name of the timeval structure.
|
|
Packit |
6f02de |
The default is timeval. /dev/kmem-based
|
|
Packit |
6f02de |
Linux lsof redefines timeval with this
|
|
Packit |
6f02de |
symbol to avoid conflicts between glibc
|
|
Packit |
6f02de |
and kernel definitions.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
TYPELOGSECSHIFT defines the type of the cdfs_LogSecShift
|
|
Packit |
6f02de |
member of the cdfs structure for UnixWare
|
|
Packit |
6f02de |
7 and higher.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
UID_ARG_T defines the cast on a User ID when passed
|
|
Packit |
6f02de |
as a function argument.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
USE_LIB_COMPLETEVFS
|
|
Packit |
6f02de |
selects the use of the completevfs() function
|
|
Packit |
6f02de |
in lsof4/lib/cvfs.c.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
USE_LIB_FIND_CH_INO
|
|
Packit |
6f02de |
selects the use of the find_ch_ino() inode
|
|
Packit |
6f02de |
function in lsof4/lib/fino.c.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Note: HASBLKDEV selects the has_bl_ino()
|
|
Packit |
6f02de |
function.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
USE_LIB_IS_FILE_NAMED
|
|
Packit |
6f02de |
selects the use of the is_file_named() function
|
|
Packit |
6f02de |
in lsof4/lib/isfn.c.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
USE_LIB_LKUPDEV selects the use of the lkupdev() function
|
|
Packit |
6f02de |
in lsof4/lib/lkud.c.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Note: HASBLKDEV selects the lkupbdev() function.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
USE_LIB_PRINTDEVNAME
|
|
Packit |
6f02de |
selects the use of the printdevname() function
|
|
Packit |
6f02de |
in lsof4/lib/pdvn.c.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Note: HASBLKDEV selects the printbdevname()
|
|
Packit |
6f02de |
function.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
USE_LIB_PRINT_TCPTPI
|
|
Packit |
6f02de |
selects the use of the print_tcptpi() function
|
|
Packit |
6f02de |
in lsof4/lib/ptti.c.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
USE_LIB_PROCESS_FILE
|
|
Packit |
6f02de |
selects the use of the process_file() function
|
|
Packit |
6f02de |
in lsof4/lib/prfp.c.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
USE_LIB_READDEV selects the use of the readdev() and stkdir()
|
|
Packit |
6f02de |
functions in lsof4/lib/rdev.c.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
USE_LIB_READMNT selects the use of the readmnt() function
|
|
Packit |
6f02de |
in lsof4/lib/rmnt.c.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
USE_LIB_RNAM selects the use of the device cache functions
|
|
Packit |
6f02de |
in lsof4/lib/rnam.c.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Note: HASNCACHE must also be defined.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
USE_LIB_RNCH selects the use of the device cache functions
|
|
Packit |
6f02de |
in lsof4/lib/rnch.c.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Note: HASNCACHE must also be defined.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
USE_STAT is defined for those dialects that must
|
|
Packit |
6f02de |
use the stat(2) function instead of lstat(2)
|
|
Packit |
6f02de |
to scan /dev -- i.e., in the readdev()
|
|
Packit |
6f02de |
function.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
VNODE_VFLAG is an alternate name for the vnode structure's
|
|
Packit |
6f02de |
v_flag member.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
WARNDEVACCESS enables the issuing of a warning message when
|
|
Packit |
6f02de |
lsof is unable to access /dev (or /device)
|
|
Packit |
6f02de |
or one of its subdirectories, or stat(2)
|
|
Packit |
6f02de |
a file in them. Some dialects (e.g., HP-UX)
|
|
Packit |
6f02de |
have many inaccessible subdirectories and
|
|
Packit |
6f02de |
it is appropriate to inhibit the warning
|
|
Packit |
6f02de |
for them with WARNDEVACCESS. The -w option
|
|
Packit |
6f02de |
will also inhibit these warnings.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
WARNINGSTATE when defined, disables the default issuing
|
|
Packit |
6f02de |
of warning messages. WARNINGSTATE is
|
|
Packit |
6f02de |
undefined by default for all dialects in
|
|
Packit |
6f02de |
the lsof distribution.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
WIDECHARINCL defines the header file to be included (if any)
|
|
Packit |
6f02de |
when wide-character support is enabled with
|
|
Packit |
6f02de |
HASWIDECHAR.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
zeromem() defines a macro to zero memory -- e.g., using
|
|
Packit |
6f02de |
bzero() or memset().
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Any dialect's machine.h file and Configure stanza can serve as a
|
|
Packit |
6f02de |
template for building your own. All machine.h files usually have
|
|
Packit |
6f02de |
all definitions, disabling some (with comment prefix and suffix)
|
|
Packit |
6f02de |
and enabling others.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Options: Common and Special
|
|
Packit |
6f02de |
---------------------------
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
All but one lsof option is common; the specific option is ``-X''.
|
|
Packit |
6f02de |
If a dialect does not support a common option, the related #define
|
|
Packit |
6f02de |
in machine.h -- e.g., HASCOPT -- should be deselected.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
The specific option, ``-X'', may be used by any dialect for its
|
|
Packit |
6f02de |
own purpose. Right now (May 30, 1995) the ``-X'' option is binary
|
|
Packit |
6f02de |
(i.e., it's not allowed arguments of its own, and its value must
|
|
Packit |
6f02de |
be 0 or 1) but that could be changed should the need arise. The
|
|
Packit |
6f02de |
option is enabled with the HASXOPT definition in machine.h; its
|
|
Packit |
6f02de |
default value is defined by HASXOPT_VALUE.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
The value of HASXOPT should be the text displayed for ``-X'' by
|
|
Packit |
6f02de |
the usage() function in usage.c. HASXOPT_VALUE should be the
|
|
Packit |
6f02de |
default value, 0 or 1.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
AIX for the IBM RICS System/6000 defines the ``-X'' option to
|
|
Packit |
6f02de |
control readx() usage, since there is a bug in AIX kernels that
|
|
Packit |
6f02de |
readx() can expose for other processes.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Defining Dialect-Specific Symbols and Global Storage
|
|
Packit |
6f02de |
----------------------------------------------------
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
A dialect's dlsof.h and dstore.c files contain dialect-specific
|
|
Packit |
6f02de |
symbol and global storage definitions. There are symbol definitions,
|
|
Packit |
6f02de |
for example, for function and data casts, and for file paths.
|
|
Packit |
6f02de |
Dslof.h defines lookup names the nlist() table -- X_* symbols --
|
|
Packit |
6f02de |
when nlist() is being used.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Global storage definitions include such things as structures for
|
|
Packit |
6f02de |
local Virtual File System (vfs) information; mount information;
|
|
Packit |
6f02de |
search file information; and kernel memory file descriptors --
|
|
Packit |
6f02de |
e.g., Kmem for /dev/kmem, Mem for /dev/mem, Swap for /dev/drum.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Coding Dialect-specific Functions
|
|
Packit |
6f02de |
---------------------------------
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Each supported dialect must have some basic functions that the
|
|
Packit |
6f02de |
common functions of the top level may call. Some of them may be
|
|
Packit |
6f02de |
obtained from the library in lsof4/lib, selected and customized by
|
|
Packit |
6f02de |
#define's in the dialect machine.h header file. Others may have
|
|
Packit |
6f02de |
to be coded specifically for the dialect.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Each supported dialect usually has private functions, too. Those
|
|
Packit |
6f02de |
are wholly determined by the needs of the dialect's data organization
|
|
Packit |
6f02de |
and access.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
These are some of the basic functions that each dialect must supply
|
|
Packit |
6f02de |
-- they're all defined in proto.h:
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
initialize() function to initialize the dialect
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
is_file_named() function to check if a file was named
|
|
Packit |
6f02de |
by an optional file name argument
|
|
Packit |
6f02de |
(lsof4/lib/isfn.c)
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
gather_proc_info() function to gather process table
|
|
Packit |
6f02de |
and related information and cache it
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
printchdevname() function to locate and optionally
|
|
Packit |
6f02de |
print the name of a character device
|
|
Packit |
6f02de |
(lsof4/lib/pdvn.c)
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
print_tcptpistate() function to print the TCP or TPI
|
|
Packit |
6f02de |
state for a TCP or UDP socket file,
|
|
Packit |
6f02de |
if the one in lib/ptti.c isn't
|
|
Packit |
6f02de |
suitable (define USE_LIB_PRINT_TCPTPI
|
|
Packit |
6f02de |
to activate lib/ptti.c)
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
process_file() function to process an open file
|
|
Packit |
6f02de |
structure (lsof4/lib/prfp.c)
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
process_node() function to process a primary node
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
process_socket() function to process a socket
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
readdev() and stkdir() functions to read and cache device
|
|
Packit |
6f02de |
information (lsof4/lib/rdev.c)
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
readmnt() function to read mount table information
|
|
Packit |
6f02de |
(lsof4/lib/rmnt.c)
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Other common functions may be needed, and might be obtained from
|
|
Packit |
6f02de |
lsof4/lib, depending on the needs of the dialect's node and socket
|
|
Packit |
6f02de |
file processing functions.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Check the functions in lsof4/lib and specific lsof4/dialects/*
|
|
Packit |
6f02de |
files for examples.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
As you build these functions you will probably have to add #include's
|
|
Packit |
6f02de |
to dlsof.h.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Function Prototype Definitions and the _PROTOTYPE Macro
|
|
Packit |
6f02de |
-------------------------------------------------------
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Once you've defined your dialect-specific definitions, you should
|
|
Packit |
6f02de |
define their prototypes in dproto.h or locally in the file where
|
|
Packit |
6f02de |
they occur and are used. Do this even if your compiler is not ANSI
|
|
Packit |
6f02de |
compliant -- the _PROTOTYPE macro knows how to cope with that and
|
|
Packit |
6f02de |
will avoid creating prototypes that will confuse your compiler.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
The Makefile
|
|
Packit |
6f02de |
------------
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Here are some general rules for constructing the dialect Makefile.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* Use an existing dialect's Makefile as a template.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* Make sure the echo actions of the install rule are appropriate.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* Use the DEBUG string to set debugging options, like ``-g''.
|
|
Packit |
6f02de |
You may also need to use the -O option when forking and
|
|
Packit |
6f02de |
SIGCHLD signals defeat your debugger.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* Don't put ``\"'' in a compiler flags -D<symbol>=<string>
|
|
Packit |
6f02de |
clause in your Makefile. Leave off the ``\"'' even though
|
|
Packit |
6f02de |
you want <string> to be a string literal and instead adapt
|
|
Packit |
6f02de |
the N_UNIX* macros you'll find in Makefiles for FreeBSD
|
|
Packit |
6f02de |
and Linux. That will allow the Makefile's version.h rule
|
|
Packit |
6f02de |
to put CFLAGS into version.h without having to worry about
|
|
Packit |
6f02de |
the ``\"'' sequences.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* Finally, remember that strings can be passed from the top
|
|
Packit |
6f02de |
level's Configure shell script. That's an appropriate way
|
|
Packit |
6f02de |
to handle options, especially if there are multiple versions
|
|
Packit |
6f02de |
of the Unix dialect to which you are porting lsof 4.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
The Mksrc Shell Script
|
|
Packit |
6f02de |
----------------------
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Pattern your Mksrc shell script after an existing one from another
|
|
Packit |
6f02de |
dialect. Change the D shell variable to the name of your dialect's
|
|
Packit |
6f02de |
subdirectory in lsof4/dialects. Adjust any other shell variable
|
|
Packit |
6f02de |
to your local conditions. (Probably that won't be necessary.)
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Note that, if using symbolic links from the top level to your
|
|
Packit |
6f02de |
dialect subdirectory is impossible or impractical, you can set the
|
|
Packit |
6f02de |
LSOF_MKC shell variable in Configure to something other than
|
|
Packit |
6f02de |
"ln -s" -- e.g., "cp," and Configure will pass it to the Mksrc
|
|
Packit |
6f02de |
shell script in the M environment variable.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
The MkKernOpts Shell Script
|
|
Packit |
6f02de |
---------------------------
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
The MkKernOptrs shell script is used by some dialects -- e.g.,
|
|
Packit |
6f02de |
Pyramid DC/OSx and Reliant UNIX -- to determine the compile-time
|
|
Packit |
6f02de |
options used to build the current kernel that affect kernel structure
|
|
Packit |
6f02de |
definitions, so those same options can be used to build lsof.
|
|
Packit |
6f02de |
Configure calls MkKernOpts for the selected dialects.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
If your kernel is built with options that affect structure definitions.
|
|
Packit |
6f02de |
-- most commonly affected are the proc structure from <sys/proc.h>
|
|
Packit |
6f02de |
and the user structure from <sys/user.h> -- check the MkKernOpts
|
|
Packit |
6f02de |
in lsof4/dialects/irix for a comprehensive example.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Testing and the Lsof Test Suite
|
|
Packit |
6f02de |
-------------------------------
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Once you have managed to create a port, here are some tips for
|
|
Packit |
6f02de |
testing it.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* First look at the test suite in the tests/ sub-directory of the
|
|
Packit |
6f02de |
lsof distribution. While it will need to be customized to be
|
|
Packit |
6f02de |
usable with a new port, it should provide ideas on things to
|
|
Packit |
6f02de |
test. Look for more information about the test suite in the
|
|
Packit |
6f02de |
00TEST file.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* Pick a simple process whose open files you are likely to
|
|
Packit |
6f02de |
know and see if the lsof output agrees with what you know.
|
|
Packit |
6f02de |
(Hint: select the process with `lsof -p <process_PID>`.)
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Are the device numbers and device names correct?
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Are the file system names and mount points correct?
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Are inode numbers and sizes correct?
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Are command names, file descriptor numbers, UIDs, PIDs, PGIDs,
|
|
Packit |
6f02de |
and PPIDs correct?
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
A simple tool that does a stat(2) of the files being examined
|
|
Packit |
6f02de |
and reports the stat struct contents can provide a reference for
|
|
Packit |
6f02de |
some values; so can `ls -l /dev/<device>`.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* Let lsof list information about all open files and ask the
|
|
Packit |
6f02de |
same questions. Look also for error messages about not being
|
|
Packit |
6f02de |
able to read a node or structure.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* Pick a file that you know is open -- open it and hold it
|
|
Packit |
6f02de |
that way with a C program (not vi), if you must. Ask lsof to
|
|
Packit |
6f02de |
find the file's open instance by specifying its path to lsof.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* Create a C program that opens a large number of files and holds
|
|
Packit |
6f02de |
them open. Background the test process and ask lsof to list
|
|
Packit |
6f02de |
its files.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* Generate some locks -- you may need to write a C program to
|
|
Packit |
6f02de |
do this, hold the locked file open, and see if lsof can identify
|
|
Packit |
6f02de |
the lock properly. You may need to write several C programs
|
|
Packit |
6f02de |
if your dialect supports different lock functions -- fnctl(),
|
|
Packit |
6f02de |
flock(), lockf(), locking().
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* Identify a process with known Internet file usage -- inetd
|
|
Packit |
6f02de |
is a good one -- and ask lsof to list its open files. See if
|
|
Packit |
6f02de |
protocols and service names are listed properly.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
See if your lsof identifies Internet socket files properly for
|
|
Packit |
6f02de |
rlogind or telnetd processes.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* Create a UNIX domain socket file, if your dialect allows it,
|
|
Packit |
6f02de |
hold it open by backgrounding the process, and see if lsof can
|
|
Packit |
6f02de |
identify the open UNIX domain socket file properly.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* Create a FIFO file and see what lsof says about it.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* Watch an open pipe -- `lsof -u <your_login> | less` is a
|
|
Packit |
6f02de |
good way to do this.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* See if lsof can identify NFS files and their devices properly.
|
|
Packit |
6f02de |
Open and hold open an NFS file and see if lsof can find the open
|
|
Packit |
6f02de |
instance by path.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* If your test system has CD-ROM and floppy disk devices, open
|
|
Packit |
6f02de |
files on them and see if lsof reports their information correctly.
|
|
Packit |
6f02de |
Such devices often have special kernel structures associated
|
|
Packit |
6f02de |
with them and need special attention from lsof for their
|
|
Packit |
6f02de |
identification. Pay particular attention to the inode numbers
|
|
Packit |
6f02de |
lsof reports for CD-ROM and floppy disk files -- often they are
|
|
Packit |
6f02de |
calculated dynamically, rather than stored in a kernel node
|
|
Packit |
6f02de |
structure.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* If your implementation can probe the kernel name cache, look
|
|
Packit |
6f02de |
at some processes with open files whose paths you know to see
|
|
Packit |
6f02de |
if lsof identifies any name components. If it doesn't, make
|
|
Packit |
6f02de |
sure the name components are in the name cache by accessing
|
|
Packit |
6f02de |
the files yourself with ls or a similar tool.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* If your dialect supports the /proc file system, use a C program
|
|
Packit |
6f02de |
to open files there, background a test process, and ask lsof to
|
|
Packit |
6f02de |
report its open files.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
* If your dialect supports fattach(), create a small test program
|
|
Packit |
6f02de |
to use it, background a test process, and ask lsof to report
|
|
Packit |
6f02de |
its open files.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
I can supply some quick-and-dirty tools for reporting stat buffer
|
|
Packit |
6f02de |
contents, holding files open, creating UNIX domain files, creating
|
|
Packit |
6f02de |
FIFOs, etc., if you need them.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Where Next?
|
|
Packit |
6f02de |
-----------
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Is this document complete? Certainly not! One might wish that it
|
|
Packit |
6f02de |
were accompanied by man pages for all lsof functions, by free beer
|
|
Packit |
6f02de |
or chocolates, by ... (You get the idea.)
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
But those things are not likely to happen as long as lsof is a
|
|
Packit |
6f02de |
privately supported, one man operation.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
So, if you need more information on how lsof is constructed or
|
|
Packit |
6f02de |
works in order to do a port of your own, you'll have to read the
|
|
Packit |
6f02de |
lsof source code. You can also ask me questions via email, but
|
|
Packit |
6f02de |
keep in mind the private, one-man nature of current lsof support.
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
|
|
Packit |
6f02de |
Vic Abell <abe@purdue.edu>
|
|
Packit |
6f02de |
July 14, 2018
|