diff --git a/.cirrus.yml b/.cirrus.yml
new file mode 100644
index 0000000000000000000000000000000000000000..e04fe1be6fa8f93f68136db31fe888b05f5d5829
--- /dev/null
+++ b/.cirrus.yml
@@ -0,0 +1,28 @@
+# freebsd13_task:
+#   freebsd_instance:
+#     image: freebsd-13-0-current-amd64-v20190503
+#   timeout_in: 120m
+#   install_script: pkg install -y gcc git bash
+#   script:
+#     - ./Configure freebsd
+#     - make
+
+freebsd12_task:
+  freebsd_instance:
+    image: freebsd-12-0-release-amd64
+  timeout_in: 120m
+  install_script: pkg install -y gcc git bash
+  script:
+    - ./Configure -n freebsd
+    - make
+    - bash ./check.bash freebsd
+
+freebsd11_task:
+  freebsd_instance:
+    image: freebsd-11-2-release-amd64
+  timeout_in: 120m
+  install_script: pkg install -y gcc git bash
+  script:
+    - ./Configure -n freebsd
+    - make
+    - bash ./check.bash freebsd
diff --git a/.ck00MAN b/.ck00MAN
new file mode 100644
index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc
--- /dev/null
+++ b/.ck00MAN
@@ -0,0 +1 @@
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..c200ad632dabfab49c5990d4a2d6cec0f40d8dad
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,96 @@
+#
+# Glob patterns generated by GitHub
+#
+# Prerequisites
+*.d
+
+# Object files
+*.o
+*.ko
+*.obj
+*.elf
+
+# Linker output
+*.ilk
+*.map
+*.exp
+
+# Precompiled Headers
+*.gch
+*.pch
+
+# Libraries
+*.lib
+*.a
+*.la
+*.lo
+
+# Shared objects (inc. Windows DLLs)
+*.dll
+*.so
+*.so.*
+*.dylib
+
+# Executables
+*.exe
+*.out
+*.app
+*.i*86
+*.x86_64
+*.hex
+
+# Debug files
+*.dSYM/
+*.su
+*.idb
+*.pdb
+
+# Kernel Module Compile Results
+*.mod*
+*.cmd
+.tmp_versions/
+modules.order
+Module.symvers
+Mkfile.old
+dkms.conf
+
+#
+# Lsof specific patterns
+#
+
+# Generated files
+*.gcda
+*.gcno
+*~
+Makefile
+TAGS
+lsof
+tags
+tests/config.*
+version.h
+
+#
+# Symbolic links to a diaclt implementation
+#
+/dfile.c
+/dlsof.h
+/dmnt.c
+/dnode.c
+/dproc.c
+/dproto.h
+/dsock.c
+/dstore.c
+/machine.h
+
+#
+# Traditional test related files
+#
+LTbasic
+LTbigf
+LTdnlc
+LTlock
+LTnfs
+LTnlink
+LTsock
+LTszoff
+LTunix
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000000000000000000000000000000000000..285f8c1cdfd90eb105473d61e54599101757c1a9
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,63 @@
+#
+# Derived from
+# https://github.com/steveno/ctags/blob/master/.travis.yml
+#
+
+dist: xenial
+
+language: c
+
+os:
+  - linux
+  - osx
+
+compiler:
+  - gcc
+  - clang
+
+sudo: true
+
+addons:
+  apt:
+    packages:
+      - lcov
+      - procps
+      - netcat
+before_install:
+  - |
+    gem install lcoveralls
+
+script:
+  - |
+    case $TRAVIS_OS_NAME in
+        linux) dialect=linux;;
+        osx)   dialect=darwin;;
+    esac
+    ./Configure -n $dialect
+
+  - |
+    if [ $CC = 'gcc' ]; then
+        CC_EXTRA="--coverage"
+    fi
+    make CDEF="${CC_EXTRA}" CC="${CC} ${CC_EXTRA}"
+
+  - |
+    case $TRAVIS_OS_NAME in
+        linux) dialect=linux;;
+        osx)   dialect=darwin;;
+    esac
+    sudo bash ./check.bash $dialect
+
+after_success:
+  - |
+    if [ $CC = 'gcc' ] && [ $TRAVIS_OS_NAME = 'linux' ]; then
+    (
+            for f in /home/travis/.rvm/gems/ruby-2*/gems/lcoveralls-*/lib/lcoveralls/color_formatter.rb; do
+                    sed -i -e 's/severity.capitalize!/severity = severity.capitalize/' $f
+            done
+            for f in /home/travis/.rvm/gems/ruby-2*/gems/lcoveralls-*/lib/lcoveralls/runner.rb; do
+                    sed -i -e 's/\(.*format.*f\)\(%\)\('"'"'.*$\)/\1%%\3/' $f
+            done
+    ) || :
+    lcov -c -b . -d . -o coverage.info && lcoveralls --root . --retry-count 5 coverage.info
+    fi
diff --git a/0..README.BEFORE.README.FIRST b/0..README.BEFORE.README.FIRST
new file mode 120000
index 0000000000000000000000000000000000000000..61cfe9a5107fae536f07d58ec97a68923b00b292
--- /dev/null
+++ b/0..README.BEFORE.README.FIRST
@@ -0,0 +1 @@
+./README.md
\ No newline at end of file
diff --git a/00CREDITS b/00CREDITS
index 9f6205cca06ee2a39d218bc0c98afbc7e4628e5b..714e496ed709a169433fe94e0751c144e1eed92c 100644
--- a/00CREDITS
+++ b/00CREDITS
@@ -393,6 +393,7 @@ provided test systems where I was able to do development work.
 	Philippe-Andre Prindeville
 	David Putz
 	Tom Qin
+	Jan Rybar
 	Kurtis Rader
 	Peter Radig
 	Jean-Pierre Radley
@@ -461,7 +462,7 @@ provided test systems where I was able to do development work.
 	Diana Stockdale
 	Andreas Stolcke
 	Jeff Stoner
-	Kristna Streitov
+	Kristyna Streitova
 	Sushila Subramanian
 	Jan Ole Suhr
 	Mike Sullivan
@@ -536,11 +537,12 @@ provided test systems where I was able to do development work.
 	Karel Zak
 	Donald Zoch
 	Malcom Zung
-	and Waldemar Zurowski
+	Waldemar Zurowski and
+	@eranik (github account)
 
 If I have omitted a contributor's name, the fault is wholly mine,
 and I apologize for the error.
 
 
 Vic Abell <abe@purdue.edu>
-February 14, 2018
+March 27, 2018
diff --git a/00DIST b/00DIST
index ea4c375909fe176ddb5282491f331c0ea06fb5a3..352af29c79ec1c422bff2e829b5e6aa61678d074 100644
--- a/00DIST
+++ b/00DIST
@@ -2,8 +2,11 @@
 	    Notes for the distribution of lsof version 4
 
 ********************************************************************
-| The latest release of lsof is always available via anonymous ftp |
-| from lsof.itap.purdue.edu.  Look in pub/tools/unix/lsof.         |
+| The latest release of lsof is always available from
+| https://github.com/lsof-org/lsof/releases
+|
+| From 4.92.1, git is introduced to manage changes.
+| You can consult the details of changes with git.
 ********************************************************************
 
 		Contents
@@ -120,6 +123,7 @@
 		4.89, July 7, 2015
 		4.90, February 14, 2018
 		4.91, March 26, 2018
+		4.92, May 5, 2018
 
 
 Dialects Supported
@@ -4816,7 +4820,7 @@ Supplement	Regenerated the 4.04 distribution to correct a non-
 		option work correctly.
 
 		Added a patch to prevent NFS blocking in Linux supplied by
-		Kristna Streitov <kstreitova@suse.com>.
+		Kristyna Streitova <kstreitova@suse.com>.
 
 		Installed a FreeBSD patch that prevents examining a TCP state
 		structure during a race condition.  The patch was supplied by
@@ -4883,5 +4887,54 @@ Supplement	Regenerated the 4.04 distribution to correct a non-
 		endpoint processing bug. Masatake YAMATO <yamato@redhat.com>
 		supplied the fixes.
 
+4.92		July 14, 2018
+		THIS IS A FREEBSD-ONLY DISTRIBUTION!
+
+		Fixes Configure script section that creates the FreeBSD
+		lockf_owner.h header file; fixes <string.h> conflicts with
+		FreeBSD kernel header files. Mateusz Gusik supplied part of
+		the fix.
+
+		Released lsof to GitHub with Purdue releases documented in
+		support/GitHub-release.
+
 Vic Abell <abe@purdue.edu>
-March 26, 2018
+July 14, 2018
+
+
+4.92.1		May 6, 2019
+
+		!!!NOTE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+		!                                                        !
+		!  The maintainership is switched from Vic to lsof-org   !
+		!  at GitHub team officially.                            !
+		!  We thank Vic for working on lsof over the years.      !
+		!                                                        !
+		!  lsof-org at GitHub team (https://github.com/lsof-org) !
+		!!!NOTE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+		This is just for testing "Release" feature of GitHub.
+		Many documentations are not updated yet.
+		URLs in -v output and -h output are updated.
+
+4.93.0		May 7, 2019
+
+		[freebsd] Made FreeBSD 13 adjustment.
+		[darwin] Fix a typo causing a build error.
+		Fix a potential memory leak.
+		[linux] use tirpc for rpc if libc doesn't provide rpc.h.
+		Fix a typo in man page.
+		[linux] fix memory leaks detected by valgrind about unix
+		endpoint information.
+		Update the description about -fg and -fG options on linux.
+
+4.93.1		May 7, 2019
+
+		Fix a broken symbolic link.
+
+4.93.2		May 8, 2019
+
+		Update the version number embedded in lsof executable.
+
+Masatake YAMATO <yamato@redhat.com>, a member of lsof-org
+May 8, 2019
diff --git a/00PORTING b/00PORTING
index 8708e509737afd12dc594d9547ad697d1b72ccaf..8e6d45dc4c0f0b6caa31778db6cf741df74d45ae 100644
--- a/00PORTING
+++ b/00PORTING
@@ -1459,6 +1459,9 @@ possibilities
     NEEDS_BOOLEAN_T	indicates the FreeBSD 9 and above system needs a
 			boolean_t definition for <sys/conf.h>.
 
+    NEEDS_DEVICE_T	indicates the FreeBSD <sys/eventhandler.h> header file
+			needs the device_t typedef.
+
     NEEDS_MACH_PORT_T	is defined for Darwin versions that need the inclusion
 			of the header file <device/device_types.h>.
 
@@ -1884,4 +1887,4 @@ keep in mind the private, one-man nature of current lsof support.
 
 
 Vic Abell <abe@purdue.edu>
-February 14, 2018
+July 14, 2018
diff --git a/Configure b/Configure
index f3dc281cd99310c58065c5b64a7ec8ebe0c2de32..b25327468406df1a2c901584de1bd528410f9153 100755
--- a/Configure
+++ b/Configure
@@ -14,7 +14,7 @@
 # shell script, named $LSOF_MK, that places its source modules in this
 # directory.
 #
-# $Id: Configure,v 1.165 2018/02/14 14:18:48 abe Exp $
+# $Id: Configure,v 1.166 2018/07/14 12:13:52 abe Exp $
 
 # LSOF_CFLAGS_OVERRIDE=1 may be introduced through the environment to cause
 #	the library Makefile's CFLAGS definition to override any in the
@@ -1624,6 +1624,10 @@ kernel generation process.
 	LSOF_TSTBIGF=" "
 	LSOF_VERS=12000
 	;;
+      13*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=13000
+	;;
       *)
 	echo Unknown FreeBSD release: `uname -r`
 	rm -f $LSOF_HLP
@@ -1939,6 +1943,11 @@ cpumask_t c;
 	    then
 	      LSOF_CFGF="$LSOF_CFGF -DHAS_VM_MEMATTR_T"
 	    fi	# }
+	    grep -q device_t ${LSOF_INCLUDE}/sys/eventhandler.h
+	    if test $? -eq 0	# {
+	    then
+	      LSOF_CFGF="$LSOF_CFGF -DNEEDS_DEVICE_T"
+	    fi	# }
 	    grep -q "^#define	minor(" ${LSOF_INCLUDE}/sys/conf.h
 	    if test $? -eq 0	# {
 	    then
@@ -2086,7 +2095,7 @@ FBSD_MINOR3
 	      rm -f ./lockf_owner.h
 	      if test -r ${FREEBSD_SYS}/kern/kern_lockf.c	# {
 	      then
-		LSOF_TMP1=`grep -n "^struct lock_owner" ${FREEBSD_SYS}/kern/kern_lockf.c | sed 's/\([0-9]*\):.*$/\1/'`
+		LSOF_TMP1=`grep -n "^struct lock_owner {" ${FREEBSD_SYS}/kern/kern_lockf.c | sed 's/\([0-9]*\):.*$/\1/'`
 		if test "X$LSOF_TMP1" != "X"	# {
 		then
 		  LSOF_TMP2=0
@@ -2945,8 +2954,14 @@ return(0); }
 
     # Test for <rpc/rpc.h>.
 
-    if ! test -r ${LSOF_INCLUDE}/rpc/rpc.h	# {
+    if test -r ${LSOF_INCLUDE}/rpc/rpc.h	# {
+    then
+      :	# Do nothing
+    elif test -r ${LSOF_INCLUDE}/tirpc/rpc/rpc.h
     then
+      LSOF_DINC="${LSOF_DINC} -I${LSOF_INCLUDE}/tirpc"
+      LSOF_CFGL="${LSOF_CFGL} -ltirpc"
+    else
       LSOF_CFGF="$LSOF_CFGF -DHASNORPC_H"
     fi	# }
 
diff --git a/lsof.8 b/Lsof.8
similarity index 99%
rename from lsof.8
rename to Lsof.8
index bc48e3b49ebab36a3534489d2ed9e567a35df6ae..5ad623477941ef2d4d2a4dbff36ccb6779a797ee 100644
--- a/lsof.8
+++ b/Lsof.8
@@ -1,4 +1,4 @@
-.ds VN 4.91
+.so ./version
 .TH LSOF 8 Revision-\*(VN
 \" Register )P is used neither by this file nor any groff macro.  However,
 \" some versions of nroff require it.
@@ -74,10 +74,7 @@ revision \*(VN lists on its standard output file information about files
 opened by processes for the following UNIX dialects:
 .PP
 .nf
-	Apple Darwin 9 and Mac OS X 10.[567]
-	FreeBSD 8.[234], 9.0 and 1[012].0 for AMD64-based systems
-	Linux 2.1.72 and above for x86-based systems
-	Solaris 9, 10 and 11
+.so ./00DIALECTS
 .fi
 .PP
 (See the
@@ -1497,7 +1494,7 @@ Or, for example, to list network files with all UDP states except
 Idle, use:
 .IP
 .nf
-	\-iUDP -sUDP:Idle
+	\-iUDP -sUDP:^Idle
 .fi
 .IP
 State names vary with UNIX dialects, so it's not possible to
@@ -4374,7 +4371,7 @@ One way to create such file structures is to run X clients with the DISPLAY
 variable set to ``:0.0''.
 .PP
 The
-.BI +|\-f [cfgGn]
+.BI +|\-f [cfn]
 option is not supported under /proc\-based Linux
 .IR lsof ,
 because it doesn't read kernel structures from kernel memory.
diff --git a/NEW/2004-2005-report.bz2 b/NEW/2004-2005-report.bz2
new file mode 100644
index 0000000000000000000000000000000000000000..28656e6365ef17d4e5c67fd1eb9022376d2bbfa8
Binary files /dev/null and b/NEW/2004-2005-report.bz2 differ
diff --git a/NEW/PSTAT-white-paper b/NEW/PSTAT-white-paper
new file mode 100644
index 0000000000000000000000000000000000000000..64652c1398ed15e5ef8c8771e8fee398538b533b
--- /dev/null
+++ b/NEW/PSTAT-white-paper
@@ -0,0 +1 @@
+http://docs.hp.com/hpux/onlinedocs/os/11i/pstat_whitepaper.pdf
diff --git a/NEW/basic_RE b/NEW/basic_RE
new file mode 100644
index 0000000000000000000000000000000000000000..6c6aee836470025c750a25354fbf4211d4f5e521
--- /dev/null
+++ b/NEW/basic_RE
@@ -0,0 +1,20 @@
+       Obsolete (``basic'') regular expressions differ in several
+       respects.   `|',  `+', and `?' are ordinary characters and
+       there is  no  equivalent  for  their  functionality.   The
+       delimiters  for bounds are `\{' and `\}', with `{' and `}'
+       by themselves ordinary characters.   The  parentheses  for
+       nested  subexpressions are `\(' and `\)', with `(' and `)'
+       by themselves ordinary characters.   `^'  is  an  ordinary
+       character  except at the beginning of the RE or the begin<AD>
+       ning of a parenthesized subexpression, `$' is an  ordinary
+       character  except  at  the  end  of the RE or the end of a
+       parenthesized subexpression, and `*' is an ordinary  char<AD>
+       acter  if  it  appears  at  the beginning of the RE or the
+       beginning of a parenthesized subexpression (after a possi<AD>
+       ble leading `^').  Finally, there is one new type of atom,
+       a back reference: `\' followed by a non-zero decimal digit
+       d  matches  the same sequence of characters matched by the
+       dth parenthesized subexpression (numbering  subexpressions
+       by  the  positions  of  their opening parentheses, left to
+       right), so that (e.g.) `\([bc]\)\1' matches `bb'  or  `cc'
+       but not `bc'.
diff --git a/NEW/ckssh.gz b/NEW/ckssh.gz
new file mode 100755
index 0000000000000000000000000000000000000000..c78e5c870bdfffeab4c339917c6831390d16458d
Binary files /dev/null and b/NEW/ckssh.gz differ
diff --git a/NEW/cktn.gz b/NEW/cktn.gz
new file mode 100755
index 0000000000000000000000000000000000000000..f2979beed50d0894c0a529a194c3435b522b598d
Binary files /dev/null and b/NEW/cktn.gz differ
diff --git a/NEW/faker.c.gz b/NEW/faker.c.gz
new file mode 100644
index 0000000000000000000000000000000000000000..57dacdaf8951d4db8d16d47d1704d5f090d54d4d
Binary files /dev/null and b/NEW/faker.c.gz differ
diff --git a/NEW/getcc b/NEW/getcc
new file mode 100755
index 0000000000000000000000000000000000000000..4b15da72c89d1ae8463e6cda1d3e3b73b2e5fdf3
--- /dev/null
+++ b/NEW/getcc
@@ -0,0 +1,9 @@
+#!/bin/sh
+D=/etc/ftpd/access
+R=ftp.dom
+rm -f $R
+for i in $D/9*.gz
+do
+  gunzip -c $i | sed '1,/^Domains/d' | sed '/^$/d' | sed '/^  --  /,$d' >> $R
+  echo $i
+done
diff --git a/NEW/irix.zip b/NEW/irix.zip
new file mode 100644
index 0000000000000000000000000000000000000000..d0ae1750ca8d6209bdfad5db8eaeee7fc8e93f75
Binary files /dev/null and b/NEW/irix.zip differ
diff --git a/NEW/lsofAPI.tar.gz b/NEW/lsofAPI.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..7432da69c763a02f226e7316159c0df5cabcb059
Binary files /dev/null and b/NEW/lsofAPI.tar.gz differ
diff --git a/NEW/lsofAPI/lsofAPI.1 b/NEW/lsofAPI/lsofAPI.1
new file mode 100644
index 0000000000000000000000000000000000000000..e3a0f876b23bbde725a5594dc9f4504cd41fb75b
--- /dev/null
+++ b/NEW/lsofAPI/lsofAPI.1
@@ -0,0 +1,278 @@
+
+			Current lsof data sources
+		      and what it does with the data.
+
+    From the proc and user structures:
+
+	process status (p_stat) (e.g., SZOMB)
+
+	    Lsof uses this information to decide if the process
+	    is active or is a "zombie" it should ignore.
+
+	command name
+
+	    Lsof reports this information to the user.
+
+	Process IDentification number (PID) (p_pid)
+
+	    Lsof reports this information to the user and uses
+	    it in some error messages.
+
+	Process Group ID (PGRP) (p_pgrp)
+
+	    Lsof reports this information to the user, if requested
+	    to do so with an option.  Lsof post-processing scripts
+	    may use this information to establish process chains.
+
+	Parent PID (PPID) (p_ppid)
+
+	    Lsof reports this information to the user, if requested.
+	    to do so with an option.
+
+	User ID (UID) (p_uid)
+
+	    Lsof reports this information to the user.  By
+	    default it converts UID to login name, but the default
+	    mode can be change with an option.
+
+	Current working directory vnode pointer (p_cdir)
+
+	    Lsof normally reports CWD, but its reporting can be
+	    suppressed.  CWD vnode pointer processing is handled as
+	    any other vnode pointer from the file structure would be.
+
+	Root directory vnode pointer (p_rdir)
+
+	    Lsof normally reports a root directory, if it exists,
+	    but the reporting can be suppressed.  Root directory
+	    vnode pointer processing is handled as any other
+	    vnode pointer from the file structure would be.
+
+	Text and loader file information (via VM map)
+	
+	    Lsof follows the pregion and region changes leading
+	    from the process' VM pointer to any vnodes that are
+	    shadowed by memory regions.  It then processes their
+	    vnode pointers just as it processes any others.  This
+	    results in a display of the text file used by the
+	    process, and the shared library files it uses.
+
+    From file structures:
+
+	The file structure address (from the open file "chunk")
+
+	    Lsof uses this pointer to read the file structure.
+
+	    It also reports the address for post-processing scripts
+	    that need to identify unique file structure usage --
+	    e.g., check for file descriptor leakage between child
+	    and parent processes.
+
+	The usage count (f_count)
+
+	    Lsof uses this to determine if the file structure is
+	    worth further examination.
+
+	The node address (f_data)
+
+	    Lsof uses this to read file structure successor --
+	    e.g., socket, vnode.
+
+	    Lsof also reports this address for post-processing
+	    scripts that need to identify unique file usage.
+
+	The access code (f_flag)
+
+	    Lsof uses this code to report whether the file was opened
+ 	    for read access, write access, or read/write access.  Lsof
+ 	    can also be asked to report the full contents of f_flag.
+
+	The file structure type (f_type)
+
+	    Lsof determines the processing to be applied to the
+	    file structure successor, pointed at by f_data.
+
+	The file offset (f_offset)
+
+	    Lsof saves this *most* useful information for reporting
+	    to the user.  It's particularly interesting, for example,
+	    on character device tape files, because when it changes,
+	    the tape user knows the tape is moving.
+
+    From socket structures:
+
+	Lsof sometimes uses the file structure alone to identify
+	socket files.  At other times it also uses the socket stream
+	header pointer.
+
+	Lsof gets the socket structure pointer from f_data in file
+	structures whose f_type is DTYPE_SOCKET.  (UNIX dialects
+	whose socket implementations are stream based often don't
+	have file structure types.)  It then reads the socket
+	structure and uses these fields:
+
+	    Socket type (so_type)
+
+		Lsof uses the socket type -- e.g., SOCK_RAW for
+		special processing of its structures.
+
+	    Socket protocol (so_proto)
+	
+		Lsof reads the protocol domain switch, protosw,
+		to get the domain structure, so it can find out
+		to what domain -- e.g., AF_INET -- the socket
+		belongs.
+
+	    Socket receive buffer parameters (so_rcv)
+	    Socket send parameters (so_snd)
+
+		Lsof reads these buffer parameters to be able to
+		report file size or position.  For example, an
+		advancing position on an ftp socket can be used
+		as an indicator that the transfer is making progress.
+
+	    Socket protocol control block address (so_pcb)
+
+		Lsof gets TCP/IP addresses from the protocol control
+		block.
+
+	    Socket stream header (so_sth)
+
+		Lsof sometimes uses the stream head pointer to
+		learn information about the socket file.  It reads
+		the stream module names, looking for IP, TCP and
+		UDP modules and their private q_ptr addresses.
+
+		If an IP q_ptr is located, lsof reads the ipcs_s
+		structure to which it points to get TCP/IP connection
+		addresses.
+
+		Lsof also reads other TCP and UDP structures to
+		get state and read/write buffer information that
+		it can report to the lsof user.
+
+    From the vnode:
+
+	Lsof gets the vnode address from the f_data member of file
+	structures.
+
+	It saves the vnode address for use in extracting path
+	name components from the kernel name cache.
+
+	Reading the vnode:
+
+	    Usually f_data values point to vnodes.  Lsof reads the
+	    structure appropriate to the file type.
+
+	Vnode type (derived from v_op)
+
+	    Lsof must know the vnode type in order to be able to
+	    read any further information about the open file from
+	    the structures that follow the vnode.  It determines
+	    the vnode type by comparing the v_op address to a
+	    set of *_vnodeops switch addresses it gets from the
+	    kernel via nlist().
+
+	Vnode locks (v_locklist)
+
+	    If the vnode has a lock list pointer, lsof examines
+	    the chain it addresses, looking for locks belonging
+	    to the process owning the file.
+
+	Vnode virtual file system structure (v_vfsp)
+
+	    Lsof reads the virtual file system structure to
+	    determine the file system on which the vnode resides.
+	    The vfs structure yields the file system information --
+	    mounted-on directory, mounted-on device, NFS device
+	    number, etc.  This information is cached by vfs structure
+	    address so vfs information for later vnodes can be
+	    found quickly.
+
+	Vnode successors (v_data)
+
+	    Based on the vnode type it established from v_op, lsof
+	    reads the vnode successor structures addressed by v_data.
+
+	    AFS type vnodes lead to an AFS node structure; VxFS type
+	    vnodes lead to a vxnode; CDFS nodes to a cdnode; NFS vnodes
+	    to an rnode; etc.
+
+	    There are many special cases -- e.g., FIFOs and pipes.
+	    The most special are VCHR nodes.  They can lead to
+	    snodes, and from there back to vnodes.  They can lead
+	    to device nodes on a special file system -- e.g., /dev
+	    nodes on a VxFS file system.  They can lead to simple
+	    inodes.
+
+	    Eventually lsof derives the following data from the
+	    nodes it reads:
+
+		Vnode address
+
+		File device numbers -- cooked and raw
+
+		File node number
+
+		   Most node structures have a number, but lsof may
+		   have to generate a node number from /dev information
+		   for some character device files.
+
+		File size
+
+		Link count
+
+		File type (v_type) (e.g., FIFO, VREG, etc.)
+
+		    It's a good indicator of the purpose of the file.
+
+	Streams (v_stream)
+
+	    Lsof saves the device numbers for streams and checks
+	    their module names for IP, TCP, and UDP.  If any of
+	    those three appear, lsof processes the vnode stream as
+	    a socket stream.
+
+    The kernel name cache:
+
+	While device and inode  number uniquely identify files,
+	they aren't easy to use by people who read lsof output.
+	Lsof output readers want path names.
+
+	Lsof tries to accommodate that by reading the contents of
+	the kernel name cache, keyed by vnode addresses, and matching
+	that to vnode addresses accumulated while reading open file
+	structures and vnodes.
+
+	Since the kernel cache for a particular vnode also points
+	to the vnode of its parent, lsof is often successful in
+	constructing an entire path name from the kernel cache.
+	Sometimes it can't construct the entire name, but some
+	terminating components, and even that is helpful.
+
+    The mount table:
+
+	Lsof reads the mount table via the setmntent()/getmntent()
+	interface and stores the information for decoding file
+	system residence, especially when printing open file results.
+	The file system, for example, is the first component of a
+	full path name, derived from the kernel name cache, even
+	when lsof finds all other path name components in the kernel
+	name cache.
+
+    The device table:
+
+	Lsof reads the device table (/dev) using opendir(), readdir(),
+	and stat() calls, so it can report full device names on
+	VCHR files.
+
+	Since the above operations are sometimes time-consuming
+	and the information seldom changes, lsof caches the
+	information and tries to get it first from a cache file,
+	located in the user's home directory.  (The cache file may
+	be stored globally, but it's much more restricted [for
+	security reasons] in that case.)
+
+
+    Vic Abell <abe@purdue.edu>
+    March 15, 1999
diff --git a/NEW/lsofAPI/lsofAPI.2 b/NEW/lsofAPI/lsofAPI.2
new file mode 100644
index 0000000000000000000000000000000000000000..30f565fcba1e9f750abd76fb648d0b442363f93b
--- /dev/null
+++ b/NEW/lsofAPI/lsofAPI.2
@@ -0,0 +1,247 @@
+
+			Data lsof reports and where
+			     lsof got the data.
+	
+    COMMAND
+
+	This is the command name from the process or user structure.
+	Lsof prints only the first 9 characters.  However, it
+	reports all characters in field output.
+
+	Lsof can be told to filter output by the command name via
+	its -c option.
+
+    PID
+
+	This is the Process IDentification number from the process
+	structure.
+
+	Lsof can be told to filter output by PID number via its -p
+	option.
+
+    PPID
+
+	This is the Parent Process IDentification number.
+
+	There is no filter option for PPID.
+
+    PGRP
+
+	This is the Process Group IDentification number.
+
+	Lsof can be told to filter output by PGRP ID via its -g
+	option.
+
+    USER
+
+	This is the identification of the user who owns the process.
+	Sometimes UID is taken from the p_uid member of the process
+	structure and sometimes from the pid struct to which the
+	proc structure points.
+
+	User identification is normally reported as a login name,
+	but can be reported as a User IDentification number via
+	lsof's -l option.
+
+	Lsof can be told to filter by use identification with its
+	-u option.
+
+    FD
+
+	Usually this is the file descriptor number, but can have
+	some special forms for open files that aren't connected
+	to file descriptors:
+
+		cwd	for the current working directory
+		rtd	for the root directory
+		txt	for text (executable) files occupying
+			memory regions
+		mem	for other memory-mapped files
+		Rxx	for unrecognized region files whose
+			p_type is the two digit number xx.
+
+	The file descriptor is followed by two characters: 1) a
+	file access mode; and 2) a file lock status.
+
+	The file access mode is 'r' for read; 'w', write; and 'u'
+	for read and write.  This information is taken from the
+ 	f_flag member of the file structure.  Lsof can also be
+ 	directed to report the contents of f_flag.
+
+	The file lock status is determined by following the lock
+	list chain from the vnode.  The first lock encountered in
+	the list determine what is reported: 'r' for a read lock
+	on part of the file; 'R' for a read lock on the entire
+	file; 'w' for a write lock on part of the file; and 'W"
+        for a write lock on the entire file.
+
+    TYPE
+
+	Usually this is the type reported in v_type -- e.g., VCHR,
+	VDIR, VREG, etc.  However, lsof tries to limit the length
+	to four characters, so VFIFO becomes FIFO.
+
+	Lsof also uses the TYPE column to indicate socket files:
+
+	   inet  Internet domain
+	   IPv4	 where lsof supports IPv4 and IPv6
+	   IPv6	 where lsof supports IPv4 and IPv6
+	   sock  unknown domain
+	   unix  Unix domain
+
+    FILE-ADDR
+
+	This is the kernel file structure address lsof read from
+	the proc structure or file chunks.  It is useful for
+	detecting (usually via scripts that post-process lsof field
+	output) file descriptors shared between processes -- e.g.,
+	inherited by a child from its parent -- especially when
+	excessive file descriptor use ("leaks") appear to be
+	occurring.
+
+	This item is only reported when selected with lsof's +ff
+	option, and when the open file is represented by a file
+	descriptor.
+
+
+    FCT
+
+	This is the f_count member of the file structure.  It is
+	useful when chasing file descriptor "leaks" for determining
+	how many references a file descriptor has.
+
+	This item is only reported when selected with lsof's +fc
+	option, and when the open file is represented by a file
+	descriptor.
+
+    NODE-ID
+
+	This is the vnode address from the f_data member of the
+	file structure.  It is useful for detecting (usually via
+	scripts that post-process lsof field output) files that
+	are shared between processes.
+
+	This item is only reported when selected with lsof's +fp
+	option, and when the open file is represented by a file
+	descriptor.
+
+    DEVICE
+
+	Two things may appear in the device column: 1) the major
+	and minor device number doublet of character and block
+	devices; or 2) a hexadecimal number that represents the
+	"device" of a pipe or socket -- e.g., the TCP/IP protocol
+	address also reported by netstat -A.
+
+	There are two reasons for reporting a hex number: 1) to
+	match with netstat -A output; and 2) to match a pipe or
+	socket whose only destination address is a similar hex
+	number.
+
+    SIZE/OFF
+
+	Lsof reports the file size or current position (offset from
+	f_offset of the file structure) in this column.
+
+	The default mode is to report offset for files that don't
+	have size in their node structures -- e.g., pipes, sockets,
+	character device files -- and size from the node structure
+	for everything else.
+
+	Several lsof options control what is reported: -o selects
+	offset (and suppresses size); -s selects size (and suppresses
+	offset); and -o[n] specifies how many offset digits are
+	to be reported in decimal (default 8) before the output
+	form switches to hexadecimal.
+
+	File size is very useful when a system administrator is
+	searching for unlinked files that are still consuming disk
+	space.
+
+	File offset is very useful to anyone who is watching for
+	activity on a character device file or socket.  I use it
+	to measure progress of ftp transfers, for example.
+
+    NLINK
+
+	The file (e.g. inode) link count.  This is usefile for
+	locating large unlinked files that are still being written
+	and are consuming needed disk space.
+
+	Lsof has a elementary filter for link count.
+
+    NODE
+
+	Usually the value in the NODE column is the associated node
+	structure's ID number -- e.g., the inode number.
+
+	However, some open files don't have a node structure.  For
+	them lsof uses this column in a variety of ways.
+
+	NODE may contain the protocol (PF_*) value for TCP/IP
+	sockets.
+
+	NODE is blank for Unix sockets.
+
+	NODE may contain STR for streams.
+
+    NAME
+
+	The NAME column is the most complicated and overloaded
+	output field lsof produces.
+
+	Originally it was designed to receive the node name of
+	files attached to device nodes (VCHR) files or the mounted-on
+	directory and mounted-on device names for file systems  In
+	many cases that information still appears in the NAME column.
+
+	However, along the way the NAME column has become used for
+	a wide variety of miscellaneous file information, including:
+
+	*  Error messages about situations lsof has encountered --
+	   e.g., it can't read a node structure via /dev/kmem.
+
+	*  Socket file information:
+
+	   o  TCP/IP connection addresses (ports or service names, and
+	      host names or IP numbers)
+
+	   o  TCP/IP connection information -- states (e.g., ESTABLISH,
+	      or Unbound), received and send queue sizes, receive and
+	      send queue window sizes
+
+	   o  FIFO and pipe information -- peer connection ID, data
+	      in the pipes
+
+	   o  Unix socket information -- peer connection ID, file
+	      system object (i.e., path name)
+
+	   o  The name of a file or file system specified as a search
+	      search argument
+
+	   o  NFS mount points
+
+	   o  Stream module names, perhaps accompanied by a device,
+	      clone device, or pseudo device name
+
+	   o  Raw socket address information
+
+	   o  Socket pair information
+
+	   o  Namefs (via fattach(3C)) information
+
+	   o  Full and partial path names, anchored at the containing
+	      file system and extending through some or all kernel
+	      name cache components
+
+	   o  Clone device names
+
+	   o  Pseudo device names
+
+	Of all these NAME column items, file system name, socket
+	connection parameters, character device node names, and
+	full path names are the most useful.
+
+
+    Vic Abell <abe@purdue.edu>
+    March 16, 1999
diff --git a/NEW/lsofAPI/lsofAPI.3 b/NEW/lsofAPI/lsofAPI.3
new file mode 100644
index 0000000000000000000000000000000000000000..7938593d82bc06d8c427ac65c3a46294206264a1
--- /dev/null
+++ b/NEW/lsofAPI/lsofAPI.3
@@ -0,0 +1,70 @@
+
+			General lsof Features
+
+    Lsof does more than just report on open files, or look for
+    Internet addresses for disovering the processes associated with
+    them.
+
+    It has two major additional features: 1) extensive filtering
+    of open file information; and 2) reporting open file information
+    in a way convenient for post-processing with filters (e.g.,
+    AWK or Perl) scripts.
+
+    Filtering
+
+	Lsof has the following options for filtering open file
+	information:
+
+	-c	select a command or list of commands for reporting
+
+	+|-d	search for open files in a specified directory
+	+|-D
+
+	-d	select by file descriptor
+
+	-g	select by process group ID
+
+	-i	select by Internet service names or port numbers,
+		addresses or host names, and protocol
+
+	+L	select by node link count
+
+	-N	select NFS files
+
+	-p	select by PID
+
+	-u	select by login or UID
+
+	-U	select Unix domain socket files
+
+	<name>	search for an open file by name
+		search for all open files on a named file system
+
+    Output for Filtering
+
+	Lsof produces output for post-filtering scripts.  It's
+	called field output, because it's organized in field records,
+	identified by key characters.
+
+	The lsof distribution comes with sample scripts that use
+	field output to:
+
+	   Watch a particular file.
+
+	   Watch for new TCP/IP connections.
+
+	   Count processes and files.
+
+	   Implement an identd or pidentd server.
+
+	   Identify the Internet source of rlogin, telnet and ssh
+	   connections.
+
+	   Identifying processes that share file descriptors or
+	   files.
+
+	   Identify users and applications on X Window System work
+	   stations.
+
+    Vic Abell <abe@purdue.edu>
+    March 17 1999
diff --git a/NEW/lsofAPI/lsofAPI.4 b/NEW/lsofAPI/lsofAPI.4
new file mode 100644
index 0000000000000000000000000000000000000000..0cbd7f57c9a7f75708798a96af47596b95b1bf7d
--- /dev/null
+++ b/NEW/lsofAPI/lsofAPI.4
@@ -0,0 +1,136 @@
+
+
+			    An Lsof API
+
+    This lsof API definition is based on obtaining the information
+    lsof currently delivers in its /dev/kmem configuration.  There
+    may be better ways to get the necessary information, and I'll
+    try to indicate where options are possible.
+
+    I've not tried to determine if any current API already provides
+    any of the following information.
+
+    Lsof needs information on processes and their open files, so
+    I'll divide the API discussion into those two sections, and
+    add a section on how lsof might be provided path name information.
+
+    Process Information
+    ===================
+
+    For each process lsof needs the following information:
+
+	The name of the command executing for the process.
+
+	The process PID.
+
+	The process parent PID.
+
+	The process group ID.
+
+	The UID of the owner of the process.
+
+	All open file information on:
+
+	    The current working directory
+
+	    The root directory
+
+	    The executing text file
+
+	    Share libraries
+
+	    Any memory-mapped files
+
+    Open File Information
+    =====================
+
+	For each open file, lsof needs this information:
+
+	    File table address -- this information is used for
+		checking for file descriptor leaks, for example.
+		Any sort of unique ID that would enable that check
+		would suffice.
+
+	    Current file position
+
+	    Number of open instances of the file
+
+	    File size
+
+	    Link count
+
+	    Device (raw and cooked) major and minor numbers
+
+	    File system identification -- mounted-on directory
+		and mounted-on device name
+
+	    Open state -- read, write, or read/write
+
+	    File type -- e.g., regular, directory, fifo, pipe,
+		socket, etc.
+
+	    Vnode address -- this information is used in two ways:
+		1) to identify files shared by processes; and 2) to
+		locate path name components in the kernel name cache.
+
+		Sometimes the vnode has a "capability" ID that connects
+		it to the cache entry.  Lsof might need that.
+
+		A unique identifier could satisfy the first need.
+		A full path name could satisfy the second.
+
+	    Node number -- CD node number, NFS node number, inode
+		number, etc.
+
+	    Full path names or a way to get path names from the
+		kernel's name cache
+
+	    For sockets:
+
+		Protocol, including AF_*, PF_*, and IPPROTO_*
+		    values, IPv4 or IPv6, etc.
+
+		Local and remote IP (v4 or v6) addresses and ports
+
+		Unix domain information -- peer ID, file system
+		    object (path name, device, node number)
+
+	    For pipes:
+
+		Pipe ID
+
+		Peer ID
+
+		Pipe status -- read or write, amount in the pipe, etc.
+
+
+    Path Names
+
+	Lsof currently reports path names by using vnode addresses to
+	assemble their components from the kernel name cache.
+
+	I see two options here: 1) report full path names directly
+	in the API; or 2) provide an API that delivers the kernel
+	name cache data to lsof that it can connect to open files
+	-- e.g., via vnode address, or (device,node_number) doublet.
+
+	Here's what lsof extracts from the kernel name cache that
+	an API would need to supply:
+
+	    A connection between open files and cache entries, such
+		a vnode address or a (device,node_number) doublet
+
+	    The path entry name component -- e.g., the "stat.h"
+		part of "/usr/include/sys/stat.h".
+
+	    A connection from the cache entry to its immediate
+		directory parent -- e.g., from stat.h to sys.
+		In this cache this is usually done with a vnode
+		pointer.
+
+	    Any unique ID (i.e., a "capability" ID from the vnode)
+		that might distinguish the cache entry.
+
+
+    Vic Abell <abe@purdue.edu>
+    March 18, 1999
diff --git a/NEW/lsofAPI/lsofAPI.5 b/NEW/lsofAPI/lsofAPI.5
new file mode 100644
index 0000000000000000000000000000000000000000..78dba094ec5dd5f0c13b60101803558651b9ce4f
--- /dev/null
+++ b/NEW/lsofAPI/lsofAPI.5
@@ -0,0 +1,240 @@
+
+
+			Functions of An Lsof API
+
+    In the functions I describe I have made no direct reference to
+    a particular API.  Instead, I've tried to describe a general
+    interface as independent of Unix dialect implementation details
+    as I can make it.
+
+    I envision an lsof API having these functions:
+
+    *  Get basic process information about a process or a set
+       of processes.
+
+    *  Get extended information for a single process.
+
+    *  Get extended information for a file or a set of files.
+
+    *  Get file name cache information.  (This function may
+       not be needed if the extended file information has
+       path name.)
+
+    Get Basic Process Information
+    =============================
+
+    Lsof should be able to get the following basic information
+    on a single process or a set of processes.  The process set
+    might include all processes -- and generally will.
+
+    *  The process ID (PID)
+
+    *  The parent process ID (PPID)
+
+    *  The process group ID (PGRP)
+
+    *  The owner of the process (UID)
+
+    *  The status of the process -- i.e., is it a "zombie", is
+       it a system process, is it swapped out, etc.?
+
+    *  The command being executed by the process
+
+    *  Reference values for the current working and root directories
+       that can be supplied to the get extended file information
+       function to learn more about these directories.
+
+       File Reference Value
+       ====================
+       The file reference values should be globally unique, so lsof
+       can report them for analysis of all open files by the lsof
+       user.  Vnode address might be a good reference value.  Adding
+       file structure address and file descriptor number to the
+       file reference value, when they are available, might be
+       necessary.
+
+       The file reference value might look like this:
+
+       struct file_ref_val {
+	   pid_t frv_pid;		/* PID owning or using this file */
+	   void *frv_node:		/* file's kernel vnode address */
+	   void *frv_file;		/* file's kernel file structure address
+					 * (NULL if not applicable) */
+	   int frv_fd;			/* file's descriptor number
+					 * (if frv_file is non-NULL) */
+       };
+
+       Implementation Suggestion:
+       =========================
+
+       I like best the way AIX delivers a full process table
+       information set.  It supplies its getproc() function with
+       a receiving table address and count.  Those parameters are
+       started at a table of size 1.  Getproc() returns an ENOSPC
+       error if the supplied size isn't big enough, and an estimate
+       in the first entry of the supplied structure buffer of how
+       many entries would be enough.  The caller realloc()s its
+       buffer to the suggested reply value and calls getproc()
+       again.
+
+    Get Extended Process Information
+    ================================
+
+    I envision this function applying to a single process.  Lsof
+    would use it after determining a given process is of further
+    interest by looking at its basic information.
+
+    This function needs to return two variable size arrays:
+
+    *  A list of file reference values for the executing text
+       file, shared libraries, and memory mapped files  -- and any
+       other process-related files -- in use by the process.  Lsof
+       should be able to use these as arguments to the get extended
+       file information function.
+
+    *  A list of file reference values for open file descriptors.
+       Lsof should be able to use these as arguments to the get
+       extended file information function.
+
+       These file reference values should also be usable in
+       identifying processes that share the same file descriptor.
+       The file structure address could be used to do that.
+
+    Get Extended File Information
+    =============================
+
+    This function takes a file reference value -- a process current
+    working directory response value or a file descriptor reference
+    value -- and returns the information lsof needs for a full
+    report on the file.  The basic information would include:
+
+    *  File type -- regular file, directory, socket, NFS file,
+       FIFO, pipe, etc.
+
+    *  Access mode -- how the file was opened -- read, write, or
+       read and write
+
+    *  Type of lock that the owning process has applied to the
+       file -- read, write, full file, partial file
+
+    *  Current position -- file offset
+
+    *  File link count
+
+    *  Number of current users of the file
+
+    *  FIle system information (when the file resides on a file
+       system) -- mounted-on directory and device names,  file
+       system type, file system (major,minor) device doublets (raw
+       and cooked), file system root inode number
+
+    *  Indication of the type of further file data -- socket, FIFO,
+       character, etc.
+
+       o  For sockets:
+
+          .  Protocol -- Internet, Unix, etc.
+
+          .  For TCP/IP sockets:
+
+	     x  Protocol -- IPPROTO_*
+
+	     x  Identifier -- e.g. protocol control block address
+
+	     x  Type -- IPv4 or IPv6
+
+	     x  Local and remote host Internet numbers and port numbers
+
+	     x  Connection state -- e.g. ESTABLISHED or Unbound
+
+	     x  Read and write queue sizes
+
+	     x  Read and write window sizes
+
+          .  For Unix domain sockets
+
+	     x  Identifier -- e.g., protocol control block address
+
+	     x  Remote peer identifier
+
+	     x  File reference value for any name bound to the
+	        Unix domain socket
+
+	     x  Name bound to the Unix domain socket
+
+	     x  Read and write queue sizes
+
+       o  For pipes and FIFOs:
+
+          .  Remote peer identifier -- e.g., a file reference value
+
+          .  Any associated name
+
+          .  Node number, if applicable
+
+          .  Data in pipe or FIFO -- read and write quantities
+
+       o  For streams
+
+          .  Stream device identification:
+
+	     x  (major,minor) device number doublets (raw and "cooked")
+
+	     x  Node number
+
+	     x  Path name
+
+          .  Stream module names
+
+          .  Stream queue read and write sizes
+
+       o  For character device files
+
+          .  raw and cooked (major,minor) device number doublets
+
+          .  Character device node number
+
+          .  Optional -- device node path name
+
+       o  For regular files
+
+          .  File system (major,minor) device number doublet -- both raw
+	     and "cooked"
+
+          .  Device "node" number
+
+          .  File size
+
+          .  Full path name (optional -- see the get file name cache
+	     function description)
+
+       o  For fattach()'d files:
+
+          .  Attached-to file's file reference value
+
+
+    Get File Name Cache Information
+    ===============================
+
+    This function is an option to having the get extended file
+    information function return full path names.
+
+    If this function is used, it would return information from
+    the kernel's name cache with file reference values that can
+    be connected to extended file information.
+
+    For example, this function might return:
+
+    *  Vnode address
+
+    *  (major,minor) device number doublet
+
+    *  Capability ID (a unique-ifier)
+
+    *  Name
+
+    *  Parent vnode address and capability ID
+
+
+    Vic Abell <abe@purdue.edu>
+    March 20, 1999
diff --git a/NEW/paper b/NEW/paper
new file mode 100644
index 0000000000000000000000000000000000000000..9f6fc1e7edd2f602eb5da62b0f7d759198d3ead5
--- /dev/null
+++ b/NEW/paper
@@ -0,0 +1,43 @@
+
+			Topics for lsof Paper
+
+Why?
+	To look at open files with a consistent output interface,
+	both readable and program-parsable, across many Unix dialects
+
+How?
+	How variants:
+		/dev/kmem
+			Problems caused by dynamics
+				Get proc structures in tight loop
+			KERNELBASE
+		/proc
+		syssgi/sysi86
+		getproc/getuser
+		pstat
+	How problems
+		Authorization
+			/proc
+		Swapped users
+	Filters
+		Built-in
+		External (Field Output)
+	Porting
+		Special purpose additions -- i.e., -X
+
+Uses and Examples
+	Watching ftp/rlogin transfers
+		My lsofwho script
+	Searching for TCP/IP listeners
+	Watching a tape drive
+
+The Lsof Data Source
+	Field output
+	Terminators
+
+Lsof Alternatives
+	crash
+	ff
+	fuser
+	fstat
+	ofiles
diff --git a/NEW/posting.gz b/NEW/posting.gz
new file mode 100644
index 0000000000000000000000000000000000000000..843c0fae2c7da5a7b4cd0d4e6066e546297ae867
Binary files /dev/null and b/NEW/posting.gz differ
diff --git a/NEW/pstat.proto.gz b/NEW/pstat.proto.gz
new file mode 100644
index 0000000000000000000000000000000000000000..aadee0d13287f58f84b3be334ab0c3ec139749b7
Binary files /dev/null and b/NEW/pstat.proto.gz differ
diff --git a/NEW/rns.c.gz b/NEW/rns.c.gz
new file mode 100644
index 0000000000000000000000000000000000000000..84a75606f4b9f9e616c8bbe144e8660a6c0aa3b4
Binary files /dev/null and b/NEW/rns.c.gz differ
diff --git a/NEW/samples b/NEW/samples
new file mode 100644
index 0000000000000000000000000000000000000000..a028f1834def8709616b91fd27edd3c85c53a570
--- /dev/null
+++ b/NEW/samples
@@ -0,0 +1,26 @@
+char *
+print_off(lf, ty)
+	struct lfile *lf;		/* file whose size is to be printed */
+	int ty;				/* format type: 0 == 0t<decimal>
+					 *		1 == 0x<hexadecimal> */
+{
+	static buf[128];
+
+	if (!ty)
+	    (void) sprintf(buf, SzOffFmt_0t, lf->off);
+	else 
+	    (void) sprintf(buf, SzOffFmt_x, lf->off);
+	return(buf);
+
+}
+
+
+char *
+print_sz(lf)
+	struct lfile *lf;		/* file whose size is to be printed */
+{
+	static buf[128];
+
+	(void) sprintf(buf, SzOffFmt_d, lf->sz);
+	return(buf);
+}
diff --git a/NEW/self_hex_dmp b/NEW/self_hex_dmp
new file mode 100644
index 0000000000000000000000000000000000000000..af243036724f2dd203a5f72d5531982b6115586b
--- /dev/null
+++ b/NEW/self_hex_dmp
@@ -0,0 +1,23 @@
+/* DEBUG */
+	{
+	    int iD, jD;
+	    unsigned long *upD;
+
+	    fprintf(stderr, "%ld: %s, fd=%s\n", (long)Lp->pid, Lp->cmd, Lf->fd);
+	    for (iD = jD = 0, upD = (unsigned long *)&fsc;
+		 iD < sizeof(struct fsContext)/8;
+		 iD++, upD++)
+	    {
+		if (!jD)
+		    fprintf(stderr, "  %2d: %016lx", iD, *upD);
+		else
+		    fprintf(stderr, " %016lx", *upD);
+		if (++jD >= 4) {
+		    jD = 0;
+		    putc((int)'\n', stderr);
+		}
+	    }
+	    if (jD)
+		putc((int)'\n', stderr);
+	}
+/* DEBUG */
diff --git a/NEW/sgi b/NEW/sgi
new file mode 100644
index 0000000000000000000000000000000000000000..a612d688ea4c7deeb2011178bfae7e6e0af624b4
--- /dev/null
+++ b/NEW/sgi
@@ -0,0 +1,22 @@
+
+		Lsof for IRIX; Contacts and Information
+
+    comp.sys.sgi.admin:
+
+	IRIX lsof end-of-life proposed
+
+    SGI IRIX case 0982584
+
+    E-mail addresses:
+
+	Mark Bartelt <mark@cacr.caltech.edu>
+	Mike Kienenberger <mkienenb@paranoia.gamenet.org>
+	Robinson, George H <george_robinson@reyrey.com>
+	Igor Schein <igor@txc.com>
+	Dave Sill <MaxFreedom@sws5.ctd.ornl.gov>
+	Peter Van Epp <vanepp@sfu.ca>
+
+
+    SGI Contact:
+
+	Dave Olson <olson@anchor.engr.sgi.com>
diff --git a/NEW/sleeper.c b/NEW/sleeper.c
new file mode 100644
index 0000000000000000000000000000000000000000..357bb4ce0be37f591ba1213a3550b1786646eada
--- /dev/null
+++ b/NEW/sleeper.c
@@ -0,0 +1,5 @@
+#include <stdio.h>
+
+main() {
+sleep(3600);
+}
diff --git a/NEW/usage.c b/NEW/usage.c
new file mode 100644
index 0000000000000000000000000000000000000000..6b913b284cc19b86bab8b50d65d127a1ebbcda7b
--- /dev/null
+++ b/NEW/usage.c
@@ -0,0 +1,754 @@
+/*
+ * usage.c - usage functions for lsof
+ */
+
+
+/*
+ * Copyright 1998 Purdue Research Foundation, West Lafayette, Indiana
+ * 47907.  All rights reserved.
+ *
+ * Written by Victor A. Abell
+ *
+ * This software is not subject to any license of the American Telephone
+ * and Telegraph Company or the Regents of the University of California.
+ *
+ * Permission is granted to anyone to use this software for any purpose on
+ * any computer system, and to alter it and redistribute it freely, subject
+ * to the following restrictions:
+ *
+ * 1. Neither the authors nor Purdue University are responsible for any
+ *    consequences of the use of this software.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ *    explicit claim or by omission.  Credit to the authors and Purdue
+ *    University must appear in documentation and sources.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ *    misrepresented as being the original software.
+ *
+ * 4. This notice may not be removed or altered.
+ */
+
+#ifndef lint
+static char copyright[] =
+"@(#) Copyright 1998 Purdue Research Foundation.\nAll rights reserved.\n";
+static char *rcsid = "$Id: usage.c,v 1.22 2004/07/06 19:09:32 abe Exp $";
+#endif
+
+
+#include "lsof.h"
+#include "version.h"
+
+
+/*
+ * Local function prototypes
+ */
+
+_PROTOTYPE(static char *isnullstr,(char *s));
+_PROTOTYPE(static void report_HASDCACHE,(int type, char *ttl, char *det));
+_PROTOTYPE(static void report_HASKERNIDCK,(char *pfx, char *verb));
+_PROTOTYPE(static void report_SECURITY,(char *pfx, char *punct));
+_PROTOTYPE(static void report_WARNDEVACCESS,(char *pfx, char *verb,
+					     char *punct));
+
+
+/*
+ * isnullstr() - is it a null string?
+ */
+
+static char *
+isnullstr(s)
+	char *s;			/* string pointer */
+{
+	if (!s)
+		return((char *)NULL);
+	while (*s) {
+		if (*s != ' ')
+			return(s);
+		s++;
+	}
+	return((char *)NULL);
+}
+
+
+/*
+ * report_HASDCACHE() -- report device cache file state
+ */
+
+static void
+report_HASDCACHE(type, ttl, det)
+	int type;				/* type: 0 == read path report
+						 *       1 == full report */
+	char *ttl;				/* title lines prefix
+						 * (NULL if none) */
+	char *det;				/* detail lines prefix
+						 * (NULL if none) */
+{
+
+#if	defined(HASDCACHE)
+	char *cp;
+	int dx;
+
+# if	defined(WILLDROPGID)
+	int saved_Setgid = Setgid;
+
+	Setgid = 0;
+# endif	/* defined(WILLDROPGID) */
+
+	if (type) {
+
+	/*
+	 * Report full device cache information.
+	 */
+	    (void) fprintf(stderr, "%sDevice cache file read-only paths:\n",
+		ttl ? ttl : "");
+	    if ((dx = dcpath(1, 0)) < 0)
+		(void) fprintf(stderr, "%snone\n", det ? det : "");
+	    else {
+		(void) fprintf(stderr, "%sNamed via -D: %s\n",
+		    det ? det : "",
+		    DCpath[0] ? DCpath[0] : "none");
+
+# if	defined(HASENVDC)
+		(void) fprintf(stderr,
+		    "%sNamed in environment variable %s: %s\n",
+		    det ? det : "",
+		    HASENVDC, DCpath[1] ? DCpath[1] : "none");
+# endif	/* defined(HASENVDC) */
+
+# if	defined(HASSYSDC)
+		if (DCpath[2])
+		    (void) fprintf(stderr,
+			"%sSystem-wide device cache: %s\n",
+			det ? det : "",
+			DCpath[2]);
+# endif	/* defined(HASSYSDC) */
+
+# if	defined(HASPERSDC)
+		(void) fprintf(stderr,
+		    "%sPersonal path format (HASPERSDC): \"%s\"\n",
+		    det ? det : "",
+		    HASPERSDC);
+#  if	defined(HASPERSDCPATH)
+		(void) fprintf(stderr,
+		    "%sModified personal path environment variable: %s\n",
+		    det ? det : "",
+		    HASPERSDCPATH);
+		cp = getenv(HASPERSDCPATH);
+		(void) fprintf(stderr, "%s%s value: %s\n",
+		    det ? det : "",
+		    HASPERSDCPATH, cp ? cp : "none");
+#  endif	/* defined(HASPERSDCPATH) */
+		(void) fprintf(stderr, "%sPersonal path: %s\n",
+		    det ? det : "",
+		    DCpath[3] ? DCpath[3] : "none");
+# endif	/* defined(HASPERSDC) */
+	    }
+	    (void) fprintf(stderr, "%sDevice cache file write paths:\n",
+		ttl ? ttl : "");
+	    if ((dx = dcpath(2, 0)) < 0)
+		(void) fprintf(stderr, "%snone\n", det ? det : "");
+	    else {
+		(void) fprintf(stderr, "%sNamed via -D: %s\n",
+		    det ? det : "",
+		    DCstate == 2 ? "none"
+				 : DCpath[0] ? DCpath[0] : "none");
+
+# if	defined(HASENVDC)
+		(void) fprintf(stderr,
+		    "%sNamed in environment variable %s: %s\n",
+		    det ? det : "",
+		    HASENVDC, DCpath[1] ? DCpath[1] : "none");
+# endif	/* defined(HASENVDC) */
+
+# if	defined(HASPERSDC)
+		(void) fprintf(stderr,
+		    "%sPersonal path format (HASPERSDC): \"%s\"\n",
+		    det ? det : "",
+		    HASPERSDC);
+#  if	defined(HASPERSDCPATH)
+		(void) fprintf(stderr,
+		    "%sModified personal path environment variable: %s\n",
+		    det ? det : "",
+		    HASPERSDCPATH);
+		cp = getenv(HASPERSDCPATH);
+		(void) fprintf(stderr, "%s%s value: %s\n",
+		    det ? det : "",
+		    HASPERSDCPATH, cp ? cp : "none");
+#  endif	/* defined(HASPERSDCPATH) */
+		 (void) fprintf(stderr, "%sPersonal path: %s\n",
+		    det ? det : "",
+		    DCpath[3] ? DCpath[3] : "none");
+# endif	/* defined(HASPERSDC) */
+	    }
+	} else {
+
+	/*
+	 * Report device cache read file path.
+	 */
+
+# if	defined(HASENVDC) || defined(HASPERSDC) || defined(HASSYSDC)
+	    cp = NULL;
+#  if	defined(HASENVDC)
+	    if ((dx = dcpath(1, 0)) >= 0)
+		cp = DCpath[1];
+#  endif	/* defined(HASENVDC) */
+#  if	defined(HASSYSDC)
+	    if (!cp)
+		cp = HASSYSDC;
+#  endif	/* defined(HASSYSDC) */
+#  if	defined(HASPERSDC)
+	    if (!cp && dx != -1 && (dx = dcpath(1, 0)) >= 0)
+		cp = DCpath[3];
+#  endif	/* defined(HASPERSDC) */
+	    if (cp)
+		(void) fprintf(stderr,
+		    "%s%s is the default device cache file read path.\n",
+		    ttl ? ttl : "",
+		    cp
+		);
+# endif    /* defined(HASENVDC) || defined(HASPERSDC) || defined(HASSYSDC) */
+	}
+
+# if	defined(WILLDROPGID)
+	Setgid = saved_Setgid;
+# endif	/* defined(WILLDROPGID) */
+
+#endif	/* defined(HASDCACHE) */
+
+}
+
+
+/*
+ * report_HASKERNIDCK() -- report HASKERNIDCK state
+ */
+
+static void
+report_HASKERNIDCK(pfx, verb)
+	char *pfx;				/* prefix (NULL if none) */
+	char *verb;				/* verb (NULL if none) */
+{
+	(void) fprintf(stderr, "%sernel ID check %s%s%s.\n",
+	    pfx ? pfx : "",
+	    verb ? verb : "",
+	    verb ? " " : "",
+
+#if	defined(HASKERNIDCK)
+		"enabled"
+#else	/* !defined(HASKERNIDCK) */
+		"disabled"
+#endif	/* defined(HASKERNIDCK) */
+
+	    );
+}
+
+
+/*
+ * report_SECURITY() -- report *SECURITY states
+ */
+
+static void
+report_SECURITY(pfx, punct)
+	char *pfx;				/* prefix (NULL if none) */
+	char *punct;				/* short foem punctuation
+						 * (NULL if none) */
+{
+	fprintf(stderr, "%s%s can list all files%s",
+	    pfx ? pfx : "",
+
+#if	defined(HASSECURITY)
+	    "Only root",
+# if	defined(HASNOSOCKSECURITY)
+	    ", but anyone can list socket files.\n"
+# else	/* !defined(HASNOSOCKSECURITY) */
+	    punct ? punct : ""
+# endif	/* defined(HASNOSOCKSECURITY) */
+#else	/* !defined(HASSECURITY) */
+	    "Anyone",
+	    punct ? punct : ""
+#endif	/* defined(HASSECURITY) */
+
+	);
+}
+
+
+/*
+ * report_WARNDEVACCESS() -- report WEARNDEVACCESS state
+ */
+
+static void
+report_WARNDEVACCESS(pfx, verb, punct)
+	char *pfx;				/* prefix (NULL if none) */
+	char *verb;				/* verb (NULL if none) */
+	char *punct;				/* punctuation */
+{
+	(void) fprintf(stderr, "%s/dev warnings %s%s%s%s",
+	    pfx ? pfx : "",
+	    verb ? verb : "",
+	    verb ? " " : "",
+
+#if	defined(WARNDEVACCESS)
+	    "enabled",
+#else	/* !defined(WARNDEVACCESS) */
+	    "disabled",
+#endif	/* defined(WARNDEVACCESS) */
+
+	    punct);
+}
+
+
+/*
+ * usage() - display usage and exit
+ */
+
+void
+usage(xv, fh, version)
+	int xv;				/* exit value */
+	int fh;				/* ``-F ?'' status */
+	int version;			/* ``-v'' status */
+{
+	char buf[MAXPATHLEN+1], *cp, *cp1, *cp2;
+	int  i;
+
+	if (Fhelp || xv) {
+	    (void) fprintf(stderr, "%s %s\n latest revision: %s\n",
+		Pn, LSOF_VERSION, LSOF_URL);
+	    (void) fprintf(stderr, " latest FAQ: %sFAQ\n", LSOF_URL);
+	    (void) fprintf(stderr, " latest man page: %slsof_man\n", LSOF_URL);
+	    (void) fprintf(stderr,
+		" usage: [-?ab%shlnNoOP%sstUvV%s]",
+
+#if	defined(HASNCACHE)
+		"C",
+#else	/* !defined(HASNCACHE) */
+		"",
+#endif	/* defined(HASNCACHE) */
+
+#if	defined(HASPPID)
+		"R",
+#else	/* !defined(HASPPID) */
+		"",
+#endif	/* defined(HASPPID) */
+
+#if	defined(HASXOPT)
+# if	defined(HASXOPT_ROOT)
+		(Myuid == 0) ? "X" : ""
+# else	/* !defined(HASXOPT_ROOT) */
+		"X"
+# endif	/* defined(HASXOPT_ROOT) */
+#else	/* !defined(HASXOPT) */
+		""
+#endif	/* defined(HASXOPT) */
+
+	    );
+
+#if	defined(HAS_AFS) && defined(HASAOPT)
+	    (void) fprintf(stderr, " [-A A]");
+#endif	/* defined(HAS_AFS) && defined(HASAOPT) */
+
+	    (void) fprintf(stderr, " [+|-c c] [+|-d s] [+%sD D]",
+
+#if	defined(HASDCACHE)
+		"|-"
+#else	/* !defined(HASDCACHE) */
+		""
+#endif	/* defined(HASDCACHE) */
+
+		);
+
+	    (void) fprintf(stderr, " [+|-f%s]\n [-F [f]] [-g [s]] [-i [i]]",
+
+#if	defined(HASFSTRUCT)
+		"[cfgGn]"
+#else	/* !defined(HASFSTRUCT) */
+		""
+#endif	/* defined(HASFSTRUCT) */
+
+		);
+
+#if	defined(HASKOPT)
+	    (void) fprintf(stderr, " [-k k]");
+#endif	/* defined(HASKOPT) */
+
+	    (void) fprintf(stderr, " [+|-L [l]]");
+
+#if	defined(HASMOPT) || defined(HASMNTSUP)
+	    (void) fprintf(stderr,
+# if	defined(HASMOPT)
+#  if	defined(HASMNTSUP)
+		" [+|-m [m]]"
+#  else	/* !defined(HASMNTSUP) */
+		" [-m m]"
+#  endif	/* defined(HASMNTSUP) */
+# else	/* !defined(HASMOPT) */
+		" [+m [m]]"
+# endif	/* defined(HASMOPT) */
+		);
+#endif	/* defined(HASMOPT) || defined(HASMNTSUP) */
+
+	    (void) fprintf(stderr,
+	        " [+|-M] [-o [o]]\n[-p s] [+|-r [t]] [-S [t]] [-T [t]]");
+	    (void) fprintf(stderr, " [-u s] [+|-w] [-x [fl]]");
+
+#if	defined(HASZONES)
+	    (void) fprintf(stderr, " [-z [z]]");
+#endif	/* defined(HASZONES) */
+
+	    (void) fprintf(stderr, " [--] [names]\n");
+	}
+	if (xv && !Fhelp) {
+	    (void) fprintf(stderr,
+		"Use the ``-h'' option to get more help information.\n");
+	    if (!fh)
+    		Exit(xv);
+	}
+	if (Fhelp) {
+	    (void) fprintf(stderr,
+		"Defaults in parentheses; comma-separate set (s) items;");
+	    (void) fprintf(stderr, " dash-separate ranges.\n");
+	    (void) fprintf(stderr, "  %-23.23s", "-?|-h list help");
+	    (void) fprintf(stderr, "  %-25.25s", "-a AND selections (OR)");
+	    (void) fprintf(stderr, "  %s\n", "-b avoid kernel blocks");
+	    (void) fprintf(stderr, "  %-23.23s", "-c c  cmd c, /c/[bix]");
+	    (void) snpf(buf, sizeof(buf), "+c w  COMMAND width (%d)", CMDL);
+	    (void) fprintf(stderr, "  %-25.25s", buf);
+
+	    (void) fprintf(stderr, "  %s\n", 
+
+#if	defined(HASNCACHE)
+		"-C no kernel name cache");
+#else	/* !defined(HASNCACHE) */
+		" ");
+#endif	/* defined(HASNCACHE) */
+
+	    (void) fprintf(stderr, "  %-23.23s", "+d s  dir s files");
+	    (void) fprintf(stderr, "  %-25.25s", "-d s  select by FD set");
+	    (void) fprintf(stderr, "  %s\n", "+D D  dir D tree *SLOW?*");
+
+#if	defined(HASDCACHE)
+	    if (Setuidroot)
+		cp = "?|i|r";
+
+# if	!defined(WILLDROPGID)
+	    else if (Myuid)
+		cp = "?|i|r<path>";
+# endif	/* !defined(WILLDROPGID) */
+
+	    else
+		cp = "?|i|b|r|u[path]";
+	    (void) snpf(buf, sizeof(buf), "-D D  %s", cp);
+#else	/* !defined(HASDCACHE) */
+	    (void) snpf(buf, sizeof(buf), " ");
+#endif	/* defined(HASDCACHE) */
+
+	    (void) fprintf(stderr, "  %-23.23s", buf);
+	    (void) snpf(buf, sizeof(buf), "-i select IPv%s files",
+
+#if	defined(HASIPv6)
+			  "[46]"
+#else	/* !defined(HASIPv6) */
+			  "4"
+#endif	/* defined(HASIPv6) */
+
+			  );
+	    (void) fprintf(stderr, "  %-25.25s", buf);
+	    (void) fprintf(stderr, "  %s\n", "-l list UID numbers");
+	    (void) fprintf(stderr, "  %-23.23s", "-n no host names");
+	    (void) fprintf(stderr, "  %-25.25s", "-N select NFS files");
+	    (void) fprintf(stderr, "  %s\n", "-o list file offset");
+	    (void) fprintf(stderr, "  %-23.23s", "-O avoid overhead *RISKY*");
+	    (void) fprintf(stderr, "  %-25.25s", "-P no port names");
+	    (void) fprintf(stderr, "  %s\n",
+
+#if	defined(HASPPID)
+	 	"-R list paRent PID"
+#else	/* !defined(HASPPID) */
+		""
+#endif	/* defined(HASPPID) */
+
+	    );
+	    (void) fprintf(stderr, "  %-23.23s", "-s list file size");
+	    (void) fprintf(stderr, "  %-25.25s", "-t terse listing");
+	    (void) fprintf(stderr, "  %s\n", "-T disable TCP/TPI info");
+	    (void) fprintf(stderr, "  %-23.23s", "-U select Unix socket");
+	    (void) fprintf(stderr, "  %-25.25s", "-v list version info");
+	    (void) fprintf(stderr, "  %s\n", "-V verbose search");
+	    (void) snpf(buf, sizeof(buf), "+|-w  Warnings (%s)",
+
+#if	defined(WARNINGSTATE)
+		"-"
+#else	/* !defined(WARNINGSTATE) */
+		"+"
+#endif	/* defined(WARNINGSTATE) */
+
+	    );
+	    (void) fprintf(stderr, "  %-23.23s", buf);
+
+#if	defined(HASXOPT)
+# if	defined(HASXOPT_ROOT)
+	    if (Myuid == 0)
+		(void) snpf(buf, sizeof(buf), "-X %s", HASXOPT);
+	    else
+		buf[0] = '\0';
+# else	/* !defined(HASXOPT_ROOT) */
+	    (void) snpf(buf, sizeof(buf), "-X %s", HASXOPT);
+# endif	/* defined(HASXOPT_ROOT) */
+# else	/* !defined(HASXOPT) */
+	    buf[0] = '\0';
+#endif	/* defined(HASXOPT) */
+
+	    if (buf[0])
+		(void) fprintf(stderr, "  %-25.25s", buf);
+
+#if	defined(HASZONES)
+	    (void) fprintf(stderr,
+		(buf[0]) ? " %s\n" : "  %-25.25s", "-z z  zone [z]");
+#endif	/* defined(HASZONES) */
+
+	    (void) fprintf(stderr, "  %s\n", "-- end option scan");
+	    (void) fprintf(stderr, "  %-36.36s",
+		"+f|-f  +filesystem or -file names");
+
+#if	defined(HASFSTRUCT)
+	    (void) fprintf(stderr,
+		"  +|-f[cfgGn] Ct,Fstr,flaGs,Node %s%s%s%s%s%s%s\n",
+		Fsv ? "(" : "",
+		(Fsv & FSV_CT) ? "C" : "",
+		(Fsv & FSV_FA) ? "F" : "",
+		((Fsv & FSV_FG) && FsvFlagX)  ? "g" : "",
+		((Fsv & FSV_FG) && !FsvFlagX) ? "G" : "",
+		(Fsv & FSV_NI) ? "N" : "",
+		Fsv ? ")" : "");
+#else	/* !defined(HASFSTRUCT) */
+	    putc('\n', stderr);
+#endif	/* defined(HASFSTRUCT) */
+
+	    (void) fprintf(stderr, "  %-36.36s",
+		"-F [f] select fields; -F? for help");
+
+#if	defined(HASKOPT)
+	    (void) fprintf(stderr,
+		"  -k k   kernel symbols (%s)\n",
+		Nmlst ? Nmlst
+# if	defined(N_UNIX)
+		      : N_UNIX
+# else	/* !defined(N_UNIX) */
+		      : (Nmlst = get_nlist_path(1)) ? Nmlst
+						    : "none found"
+# endif	/* defined(N_UNIX) */
+
+	    );
+#else	/* !defined(HASKOPT) */
+	    putc('\n', stderr);
+#endif	/* defined(HASKOPT) */
+
+	    (void) fprintf(stderr,
+		"  +|-L [l] list (+) suppress (-) link counts < l (0 = all; default = 0)\n");
+
+#if	defined(HASMOPT) || defined(HASMNTSUP)
+# if	defined(HASMOPT)
+	    (void) snpf(buf, sizeof(buf), "-m m   kernel memory (%s)", KMEM);
+# else	/* !defined(HASMOPT) */
+	    buf[0] = '\0';
+# endif	/* defined(HASMOPT) */
+
+	    (void) fprintf(stderr, "  %-36.36s", buf);
+
+# if	defined(HASMNTSUP)
+	    (void) fprintf(stderr, "  +m [m] use|create mount supplement\n");
+# else	/* !defined(HASMNTSUP) */
+	    (void) fprintf(stderr, "\n");
+# endif	/* defined(HASMNTSUP) */
+#endif	/* defined(HASMOPT) || defined(HASMNTSUP) */
+
+	    (void) snpf(buf, sizeof(buf), "+|-M   portMap registration (%s)",
+
+#if	defined(HASPMAPENABLED)
+		"+"
+#else	/* !defined(HASPMAPENABLED) */
+		"-"
+#endif	/* defined(HASPMAPENABLED) */
+
+	    );
+	    (void) fprintf(stderr, "  %-36.36s", buf);
+	    (void) snpf(buf, sizeof(buf), "-o o   o 0t offset digits (%d)",
+		OFFDECDIG);
+	    (void) fprintf(stderr, "  %s\n", buf);
+	    (void) fprintf(stderr, "  %-36.36s",
+		"-p s   exclude(^)|select PIDs");
+	    (void) fprintf(stderr, "  -S [t] t second stat timeout (%d)\n",
+		TMLIMIT);
+	    (void) snpf(buf, sizeof(buf),
+		"-T %s%ss%s TCP/TPI %s%sSt%s (s) info",
+
+#if     defined(HASSOOPT) || defined(HASSOSTATE) || defined(HASTCPOPT)
+		"f",
+#else	/* !defined(HASSOOPT) && !defined(HASSOSTATE) && !defined(HASTCPOPT)*/
+		"",
+#endif	/* defined(HASSOOPT) || defined(HASSOSTATE) || defined(HASTCPOPT)*/
+
+#if 	defined(HASTCPTPIQ)
+		"q",
+#else	/* !defined(HASTCPTPIQ) */
+		" ",
+#endif	/* defined(HASTCPTPIQ) */
+
+#if 	defined(HASTCPTPIW)
+		"w",
+#else	/* !defined(HASTCPTPIW) */
+		"",
+#endif	/* defined(HASTCPTPIW) */
+
+#if     defined(HASSOOPT) || defined(HASSOSTATE) || defined(HASTCPOPT)
+		"Fl,",
+#else	/* !defined(HASSOOPT) && !defined(HASSOSTATE) && !defined(HASTCPOPT)*/
+		"",
+#endif	/* defined(HASSOOPT) || defined(HASSOSTATE) || defined(HASTCPOPT)*/
+
+#if 	defined(HASTCPTPIQ)
+		"Q,",
+#else	/* !defined(HASTCPTPIQ) */
+		"",
+#endif	/* defined(HASTCPTPIQ) */
+
+#if 	defined(HASTCPTPIW)
+		",Win"
+#else	/* !defined(HASTCPTPIW) */
+		""
+#endif	/* defined(HASTCPTPIW) */
+
+	    );
+	    (void) fprintf(stderr, "  %s\n", buf);
+
+#if	defined(HAS_AFS) && defined(HASAOPT)
+	    (void) fprintf(stderr,
+		"  -A A   AFS name list file (%s)\n", AFSAPATHDEF);
+#endif	/* defined(HAS_AFS) && defined(HASAOPT) */
+
+	    (void) fprintf(stderr,
+		"  -g [s] exclude(^)|select and print process group IDs\n");
+	    (void) fprintf(stderr, "  -i i   select by IPv%s address:",
+
+#if	defined(HASIPv6)
+			  "[46]"
+#else	/* !defined(HASIPv6) */
+			  "4"
+#endif	/* defined(HASIPv6) */
+
+			  );
+	    (void) fprintf(stderr,
+		" [%s][proto][@host|addr][:svc_list|port_list]\n",
+
+#if	defined(HASIPv6)
+		"46"
+#else	/* !defined(HASIPv6) */
+		"4"
+#endif	/* defined(HASIPv6) */
+
+		);
+	    (void) fprintf(stderr,
+		"  +|-r [t] repeat every t seconds (%d);", RPTTM);
+	    (void) fprintf(stderr, " + until no files, - forever\n");
+	    (void) fprintf(stderr,
+		"  -u s   exclude(^)|select login|UID set s\n");
+	    (void) fprintf(stderr,
+		"  -x [fl] cross over +d|+D File systems or symbolic Links\n");
+	    (void) fprintf(stderr,
+		"  names  select named files or files on named file systems\n");
+	    (void) report_SECURITY(NULL, "; ");
+	    (void) report_WARNDEVACCESS(NULL, NULL, ";");
+	    (void) report_HASKERNIDCK(" k", NULL);
+	    (void) report_HASDCACHE(0, NULL, NULL);
+	}
+	if (fh) {
+	    (void) fprintf(stderr, "%s:\tID    field description\n", Pn);
+	    for (i = 0; FieldSel[i].nm; i++) {
+
+#if	!defined(HASPPID)
+		if (FieldSel[i].id == LSOF_FID_PPID)
+		    continue;
+#endif	/* !defined(HASPPID) */
+
+#if	!defined(HASFSTRUCT)
+		if (FieldSel[i].id == LSOF_FID_FA
+		||  FieldSel[i].id == LSOF_FID_CT
+		||  FieldSel[i].id == LSOF_FID_FG
+		||  FieldSel[i].id == LSOF_FID_NI)
+		    continue;
+#endif	/* !defined(HASFSTRUCT) */
+
+#if	!defined(HASZONES)
+		if (FieldSel[i].id == LSOF_FID_ZONE)
+		    continue;
+#endif	/* !defined(HASZONES) */
+
+		(void) fprintf(stderr, "\t %c    %s\n",
+		    FieldSel[i].id, FieldSel[i].nm);
+	    }
+	}
+
+#if	defined(HASDCACHE)
+	if (DChelp)
+	    report_HASDCACHE(1, NULL, "    ");
+#endif	/* defined(HASDCACHE) */
+
+	if (version) {
+
+	/*
+	 * Display version information in reponse to ``-v''.
+	 */
+	    (void) fprintf(stderr, "%s version information:\n", Pn);
+	    (void) fprintf(stderr, "    revision: %s\n", LSOF_VERSION);
+	    (void) fprintf(stderr, "    latest revision: %s\n", LSOF_URL);
+	    (void) fprintf(stderr, "    latest FAQ: %sFAQ\n",
+		LSOF_URL);
+	    (void) fprintf(stderr, "    latest man page: %slsof_man\n",
+		LSOF_URL);
+
+#if	defined(LSOF_CINFO)
+	    if ((cp = isnullstr(LSOF_CINFO)))
+		(void) fprintf(stderr, "    configuration info: %s\n", cp);
+#endif	/* defined(LSOF_CINFO) */
+
+	    if ((cp = isnullstr(LSOF_CCDATE)))
+		(void) fprintf(stderr, "    constructed: %s\n", cp);
+	    cp = isnullstr(LSOF_HOST);
+	    if (!(cp1 = isnullstr(LSOF_LOGNAME)))
+		cp1 = isnullstr(LSOF_USER);
+	    if (cp || cp1) {
+		if (cp && cp1)
+		    cp2 = "by and on";
+		else if (cp)
+		    cp2 = "on";
+		else
+		    cp2 = "by";
+		(void) fprintf(stderr, "    constructed %s: %s%s%s\n",
+		    cp2,
+		    cp1 ? cp1 : "",
+		    (cp && cp1) ? "@" : "",
+		    cp  ? cp  : ""
+		);
+	    }
+
+#if	defined(LSOF_BLDCMT)
+	    if ((cp = isnullstr(LSOF_BLDCMT)))
+		(void) fprintf(stderr, "    builder's comment: %s\n", cp);
+#endif	/* defined(LSOF_BLDCMT) */
+
+	    if ((cp = isnullstr(LSOF_CC)))
+		(void) fprintf(stderr, "    compiler: %s\n", cp);
+	    if ((cp = isnullstr(LSOF_CCV)))
+		(void) fprintf(stderr, "    compiler version: %s\n", cp);
+	    if ((cp = isnullstr(LSOF_CCFLAGS)))
+		(void) fprintf(stderr, "    compiler flags: %s\n", cp);
+	    if ((cp = isnullstr(LSOF_LDFLAGS)))
+		(void) fprintf(stderr, "    loader flags: %s\n", cp);
+	    if ((cp = isnullstr(LSOF_SYSINFO)))
+		(void) fprintf(stderr, "    system info: %s\n", cp);
+	    (void) report_SECURITY("    ", ".\n");
+	    (void) report_WARNDEVACCESS("    ", "are", ".\n");
+	    (void) report_HASKERNIDCK("    K", "is");
+	    (void) report_HASDCACHE(1, "    ", "\t");
+	}
+	Exit(xv);
+}
diff --git a/NEW/version b/NEW/version
new file mode 100644
index 0000000000000000000000000000000000000000..bdfb8931517ed94d6c5fac1a541ff0910dd60997
--- /dev/null
+++ b/NEW/version
@@ -0,0 +1 @@
+.ds VN 4.75
diff --git a/OLD/00PORTING b/OLD/00PORTING
new file mode 100644
index 0000000000000000000000000000000000000000..d84c1f526e87100303a264d2d341eac7af5a06b8
--- /dev/null
+++ b/OLD/00PORTING
@@ -0,0 +1,1884 @@
+
+		Guide to Porting lsof 4 to Unix OS Dialects
+
+**********************************************************************
+| The latest release of lsof is always available via anonymous ftp   |
+| from lsof.itap.purdue.edu.  Look in pub/lsof.README for its        |
+| location.                                                          |
+**********************************************************************
+
+			    Contents
+
+	How Lsof Works
+	/proc-based Linux Lsof -- a Different Approach
+	General Guidelines
+	Organization
+	Source File Naming Conventions
+	Coding Philosophies
+	Data Requirements
+	Dlsof.h and #include's
+	Definitions That Affect Compilation
+	Options: Common and Special
+	Defining Dialect-Specific Symbols and Global Storage
+	Coding Dialect-specific Functions
+	Function Prototype Definitions and the _PROTOTYPE Macro
+	The Makefile
+	The Mksrc Shell Script
+	The MkKernOpts Shell Script
+	Testing and the lsof Test Suite
+	Where Next?
+
+
+How Lsof Works
+--------------
+
+Before getting on with porting guidelines, just a word or two about
+how lsof works.
+
+Lsof obtains data about open UNIX dialect files by reading the
+kernel's proc structure information, following it to the related
+user structure, then reading the open file structures stored
+(usually) in the user structure.  Typically lsof uses the kernel
+memory devices, /dev/kmem, /dev/mem, etc. to read kernel data.
+
+Lsof stores information from the proc and user structures in an
+internal, local proc structure table.  It then processes the open
+file structures by reading the file system nodes that lie behind
+them, extracting and storing relevant data in internal local file
+structures that are linked to the internal local process structure.
+
+Once all data has been gathered, lsof reports it from its internal,
+local tables.
+
+There are a few variants on this subject.  Some systems don't have
+just proc structures, but have task structures, too, (e.g., NeXTSTEP
+and OSF/1 derivatives).  For some dialects lsof gets proc structures
+or process information (See "/proc-based Linux Lsof -- a Different
+Approach) from files of the /proc file system.  It's not necessary
+for lsof to read user structures on some systems (recent versions
+of HP-UX), because the data lsof needs can be found in the task or
+proc structures.  In the end lsof gathers the same data, just from
+slightly different sources.
+
+
+/proc-based Linux Lsof -- a Different Approach
+==============================================
+
+For a completely different approach to lsof construction, take a
+look at the /proc-based Linux sources in .../dialects/linux/proc.
+(The sources in .../dialects/linux/kmem are for a traditional lsof
+that uses /dev/kmem to read information from kernel structures.)
+
+The /proc-based lsof obtains all its information from the Linux
+/proc file system.  Consequently, it is relatively immune to changes
+in Linux kernel structures and doesn't need to be re-compiled each
+time the Linux kernel version changes.
+
+There are some down-sides to the Linux /proc-based lsof:
+
+    *  It must run setuid-root in order to be able to read the
+       /proc file system branches for all processes.  In contrast,
+       the /dev/kmem-based Linux lsof usually needs only setgid
+       permission.
+
+    *  It depends on the exact character format of /proc files, so
+       it is sensitive to changes in /proc file composition.
+
+    *  It is limited to the information a /proc file system
+       implementor decides to provide.  For example, if a
+       /proc/net/<protocol> file lacks an inode number, the
+       /proc-based lsof can't connect open socket files to that
+       protocol.  Another deficiency is that the /proc-based may
+       not be able to report file offset (position) information,
+       when it isn't available in the /proc/<PID>/fd/ entry for a
+       file.
+
+       In contrast the /dev/kmem-based lsof has full access to
+       kernel structures and "sees" new data as soon as it appears.
+       Of course, that new data requires that lsof be recompiled
+       and usually also requires changes to lsof.
+
+Overall the switch from a /dev/kmem base to a /proc one is an
+advantage to Linux lsof.  The switch was made at lsof revision 4.23
+for Linux kernel versions 2.1.72 (approximately) and higher.  The
+reason I'm not certain at which Linux kernel version a /proc-based
+lsof becomes possible is that the /proc additions needed to implement
+it have been added gradually to Linux 2.1.x in ways that I cannot
+measure.
+
+/proc-based lsof functions in many ways the same as /dev/kmem-based
+lsof.  It scans the /proc directory, looking for <PID>/ subdirectories.
+Inside each one it collects process-related data from the cwd, exe,
+maps, root, and stat information files.
+
+It collects open file information from the fd/ subdirectory of each
+<PID>/ subdirectory.  The lstat(2), readlink(2), and stat(2) system
+calls gather information about the files from the kernel.
+
+Lock information comes from /proc/locks.  It is matched to open
+files by inode number.  Mount information comes from /proc/mounts.
+Per domain protocol information comes from the files of /proc/net;
+it's matched to open socket files by inode number.
+
+The Linux /proc file system implementors have done an amazing job
+of providing the information lsof needs.  The /proc-based lsof
+project has so far generated only two kernel modification:
+
+    *  A modification to /usr/src/linux/net/ipx/af_ipx.c adds the
+       inode number to the entries of /proc/net/ipx.
+
+       Jonathan Sergent did this kernel modification.
+
+       It may be found in the .../dialects/linux/proc/patches
+       subdirectory of the lsof distribution.
+
+    *  An experimental modification to /usr/src/linux/fs/stat.c
+       allows lstat(2) to return file position information for
+       /proc/<PID>/fd/<FD> files.
+       
+       Contact me for this modification.
+
+
+One final note about the /proc-based Linux lsof: it doesn't need
+any functions from the lsof library in the lib/ subdirectory.
+
+
+General Guidelines
+------------------
+
+These are the general guidelines for porting lsof 4 to a new Unix
+dialect:
+
+    *  Understand the organization of the lsof sources and the
+       philosophies that guide their coding.
+
+    *  Understand the data requirements and determine the methods
+       of locating the necessary data in the new dialect's kernel.
+
+    *  Pick a name for the subdirectory in lsof4/dialects for your
+       dialect.  Generally I use a vendor operating system name
+       abbreviation.
+
+    *  Locate the necessary header files and #include them in the
+       dialect's dlsof.h file.  (You may not be able to complete
+       this step until you have coded all dialect-specific functions.)
+
+    *  Determine the optional library functions of lsof to be used
+       and set their definitions in the dialect's machine.h file.
+
+    *  Define the dialect's specific symbols and global storage
+       in the dialect's dlsof.h and dstore.c files.
+
+    *  Code the dialect-specific functions in the appropriate
+       source files of the dialect's subdirectory.
+
+       Include the necessary prototype definitions of the dialect-
+       specific functions in the dproto.h file in the dialect's
+       subdirectory.
+
+    *  Define the dialect's Makefile and source construction shell
+       script, Mksrc.
+
+    *  If there are #define's that affect how kernel structures
+       are organized, and those #define's are needed when compiling
+       lsof, build a MkKernOpts shell script to locate the #define's
+       and supply them to the Configure shell script.
+
+
+Organization
+------------
+
+The code in a dialect-specific version of lsof comes from three
+sources:
+
+    1)  functions common to all versions, located in the top level
+	directory, lsof4;
+
+    2)  functions specific to the dialect, located in the dialect's
+	subdirectory -- e.g., lsof4/dialects/sun;
+
+    3)  functions that are common to several dialects, although
+	not to all, organized in a library, liblsof.a.  The functions
+	in the library source can be selected and customized with
+	definitions in the dialect machine.h header files.
+
+The tree looks like this:
+
+			    lsof4 ----------------------+ 3) library --
+			    |   \			     lsof4/lib
+  1) fully common functions +    \
+      e.g., lsof4/main.c	  + lsof4/dialects/
+			   / / / / \
+			   + + + +  +
+  2) dialect-specific subdirectories -- e.g., lsof4/dialects/sun
+
+The code for a dialect-specific version is constructed from these
+three sources by the Configure shell script in the top level lsof4
+directory and definitions in the dialect machine.h header files.
+Configure uses the Mksrc shell script in each dialect's subdirectory,
+and may use an optional MkKernOpts shell script in selected dialect
+subdirectories.
+
+Configure calls the Mksrc shell script in each dialect's subdirectory
+to assemble the dialect-specific sources in the main lsof directory.
+Configure may call MkKernOpts to determine kernel compile-time
+options that are needed for compiling kernel structures correctly
+for use by lsof.  Configure puts the options in a dialect-specific
+Makefile it build, using a template in the dialect subdirectory.
+
+The assembly of dialect-specific sources in the main lsof directory
+is usually done by creating symbolic links from the top level to
+the dialect's subdirectory.  The LSOF_MKC environment variable may
+be defined prior to using Configure to change the technique used
+to assemble the sources -- most commonly to use cp instead of ln -s.
+
+The Configure script completes the dialect's Makefile by adding
+string definitions, including the necessary kernel compile-time
+options, to a dialect skeleton Makefile while copying it from the
+dialect subdirectory to the top level lsof4 directory.  Optionally
+Makefile may call the dialect's MkKernOpts script to add string
+definitions.
+
+When the lsof library, lsof4/lib/liblsof.a, is compiled its
+functions are selected and customized by #define's in the dialect
+machine.h header file.
+
+
+Source File Naming Conventions
+------------------------------
+
+With one exception, dialect-specific source files begin with a
+lower case `d' character -- ddev.c, dfile.c, dlsof.h.  The one
+exception is the header file that contains dialect-specific
+definitions for the optional features of the common functions.
+It's called machine.h for historical reasons.
+
+Currently all dialects use almost the same source file names.  One
+exception to the rule happens in dialects where there must be
+different source files -- e.g., dnode[123].c -- to eliminate node
+header file structure element name conflicts.  The source modules
+in a few subdirectories are organized that way.
+
+Unusual situations occur for NetBSD and OpenBSD, and for NEXTSTEP
+and OPENSTEP.  Each pair of dialects is so close in design that
+the same dialect sources from the n+obsd subdirectory serves NetBSD
+and OpenBSD; from n+os, NEXTSTEP and OPENSTEP.
+
+These are common files in lsof4/:
+
+    Configure	the configuration script
+
+    Customize	does some customization of the selected lsof
+		dialect
+
+    Inventory	takes an inventory of the files in an lsof
+		distribution
+
+    version	the version number
+
+    dialects/	the dialects subdirectory
+
+These are the common function source files in lsof4/:
+
+    arg.c	common argument processing functions
+
+    lsof.h	common header file that #include's the dialect-specific
+		header files
+
+    main.c	common main function for lsof 4
+
+    misc.c	common miscellaneous functions -- e.g., special versions
+		of stat() and readlink()
+
+    node.c	common node reading functions -- readinode(), readvnode()
+
+    print.c	common print support functions
+
+    proc.c	common process and file structure functions
+
+    proto.h	common prototype definitions, including the definition of
+		the _PROTOTYPE() macro
+
+    store.c	common global storage version.h	the current lsof version
+		number, derived from the file version by the Makefile
+
+    usage.c	functions to display lsof usage panel
+
+These are the dialect-specific files:
+
+    Makefile	the Makefile skeleton
+
+    Mksrc	a shell script that assists the Configure script
+		in configuring dialect sources
+
+    MkKernOpts  an optional shell script that identifies kernel
+		compile-time options for selected dialects -- e.g.,
+		Pyramid DC/OSx and Reliant UNIX
+
+    ddev.c	device support functions -- readdev() -- may be
+		eliminated by functions from lsof4/lib/
+
+    dfile.c	file processing functions -- may be eliminated by
+		functions from lsof4/lib/
+
+    dlsof.h	dialect-specific header file -- contains #include's
+		for system header files and dialect-specific global
+		storage declarations
+
+    dmnt.c	mount support functions -- may be eliminated by
+		functions from lsof4/lib/
+
+    dnode.c	node processing functions -- e.g., for gnode or vnode
+
+    dnode?.c	additional node processing functions, used when node
+		header files have duplicate and conflicting element
+		names.
+
+    dproc.c	functions to access, read, examine and cache data about
+		dialect-specific process structures -- this file contains
+		the dialect-specific "main" function, gather_proc_info()
+
+    dproto.h	dialect-specific prototype declarations
+
+    dsock.c	dialect-specific socket processing functions
+
+    dstore.c	dialect-specific global storage -- e.g., the nlist()
+		structure
+
+    machine.h	dialect specific definitions of common function options --
+		e.g., a HASINODE definition to activate the readinode()
+		function in lsof4/node.c
+
+		The machine.h header file also selects and customizes
+		the functions of lsof4/lib/.
+
+These are the lib/ files.  Definitions in the dialect machine.h
+header files select and customize the contained functions that are
+to be compiled and archived to liblsof.a.
+
+    Makefile.skel	is a skeleton Makefile, used by Configure
+			to construct the Makefile for the lsof
+			library.
+
+    cvfs.c		completevfs() function
+
+			USE_LIB_COMPLETEVFS selects it.
+
+			CVFS_DEVSAVE, CVFS_NLKSAVE, CVFS_SZSAVE,
+			and HASFSINO customize it.
+
+    dvch.c		device cache functions
+
+			HASDCACHE selects them.
+
+			DCACHE_CLONE, DCACHE_CLR, DCACHE_PSEUDO,
+			DVCH_CHOWN, DVCH_DEVPATH, DVCH_EXPDEV,
+			HASBLKDEV, HASENVDC, HASSYSDC, HASPERSDC,
+			HASPERSDCPATH, and NOWARNBLKDEV customize
+			them.
+
+    fino.c		find block and character device inode functions
+
+			HASBLKDEV and USE_LIB_FIND_CH_INO select them.
+
+    isfn.c		hashSfile() and is_file_named() functions
+
+			USE_LIB_IS_FILE_NAMED selects it.
+
+    lkud.c		device lookup functions
+
+			HASBLKDEV and USE_LIB_LKUPDEV select them.
+
+    pdvn.c		print device name functions
+
+			HASBLKDEV and USE_LIB_PRINTDEVNAME select them.
+
+    prfp.c		process_file() function
+
+			USE_LIB_PROCESS_FILE selects it.
+
+			FILEPTR, DTYPE_PIPE, HASPIPEFN, DTYPE_GNODE,
+			DTYPE_INODE, DTYPE_PORT, DTYPE_VNODE, DTYPE_PTS,
+			HASF_VNODE, HASKQUEUE, HASPRIVFILETYPE,
+			HASPSXSHM, HASPSXSEM and HASPTSFN customize it.
+
+    ptti.c		print_tcptpi() function
+
+			USE_LIB_PRINT_TCPTPI selects it.
+
+			HASSOOPT, HASSBSTATE, HASSOSTATE, AHSTCPOPT,
+			HASTCPTPIQ and HASTCPTPIW customize it.
+
+    rdev.c		readdev() function
+
+			USE_LIB_READDEV selects it.
+
+			DIRTYPE, HASBLKDEV, HASDCACHE, HASDNAMLEN,
+			RDEV_EXPDEV, RDEV_STATFN, USE_STAT, and
+			WARNDEVACCESS customize it.
+
+    rmnt.c		readmnt() function
+
+			USE_LIB_READMNT selects it.
+
+			HASFSTYPE, MNTSKIP, RMNT_EXPDEV, RMNT_FSTYPE,
+			and MOUNTS_FSTYPE customize it.
+
+    rnam.c		BSD format name cache functions
+
+			HASNCACHE and USE_LIB_RNAM select them.
+
+			HASFSINO, NCACHE, NCACHE_NC_CAST, NCACHE_NM,
+			NCACHE_NMLEN, NCACHE_NODEADDR, NCACHE_NODEID,
+			NCACHE_NO_ROOT, NCACHE_NXT, NCACHE_PARADDR,
+			NCACHE_PARID, NCACHE_SZ_CAST, NCHNAMLEN,
+			X_NCACHE, and X_NCSIZE, customize them.
+
+    rnch.c		Sun format name cache functions
+
+			HASNCACHE and USE_LIB_RNCH select them.
+
+			ADDR_NCACHE, HASDNLCPTR, HASFSINO, NCACHE_DP,
+			NCACHE_NAME, NCACHE_NAMLEN, NCACHE_NEGVN,
+			NCACHE_NODEID, NCACHE_NXT, NCACHE_PARID,
+			NCACHE_VP, X_NCACHE, and X_NCSIZE, customize
+			them.
+
+    snpf.c		Source for the snprintf() family of functions
+
+			USE_LIB_SNPF selects it.
+
+
+The comments and the source code in these library files give more
+information on customization.
+
+
+Coding Philosophies
+-------------------
+
+A few basic philosophies govern the coding of lsof 4 functions:
+
+    *  Use as few #if/#else/#endif constructs as possible, even at
+       the cost of nearly-duplicate code.
+
+       When #if/#else/#endif constructs are necessary:
+       
+       o  Use the form
+
+		#if	defined(s<symbol>)
+	
+	  in preference to
+	
+		#ifdef	<symbol>
+	
+	  to allow easier addition of tests to the #if.
+
+       o  Indent them to signify their level -- e.g.,
+
+		#if	/* level one */
+		# if	/* level two */
+		# endif	/* level two */
+		#else	/* level one */
+		#endif	/* level one */
+
+	o  Use ANSI standard comments on #else and #endif statements.
+
+    *  Document copiously.
+
+    *  Aim for ANSI-C compatibility:
+    
+       o  Use function prototypes for all functions, hiding them
+	  from compilers that cannot handle them with the _PROTOTYPE()
+	  macro.
+
+       o  Use the compiler's ANSI conformance checking wherever
+	  possible -- e.g., gcc's -ansi option.
+
+
+Data Requirements
+-----------------
+
+Lsof's strategy in obtaining open file information is to access
+the process table via its proc structures, then obtain the associated
+user area and open file structures.  The open file structures then
+lead lsof to file type specific structures -- cdrnodes, fifonodes,
+inodes, gnodes, hsfsnodes, pipenodes, pcnodes, rnodes, snodes,
+sockets, tmpnodes, and vnodes.
+
+The specific node structures must yield data about the open files.  The
+most important items and device number (raw and cooked) and node
+number.  (Lsof uses them to identify files and file systems named as
+arguments.)  Link counts and file sizes are important, too, as are the
+special characteristics of sockets, pipes, FIFOs, etc.
+
+This means that to begin an lsof port to a new Unix dialect you
+must understand how to obtain these structures from the dialect's
+kernel.  Look for kernel access functions -- e.g., the AIX readx()
+function, Sun and Sun-like kvm_*() functions, or SGI's syssgi()
+function.  Look for clues in header files -- e.g. external declarations
+and macros.
+
+If you have access to them, look at sources to programs like ps(1),
+or the freely available monitor and top programs.  They may give
+you important clues on reading proc and user area structures.  An
+appeal to readers of dialect-specific news groups may uncover
+correspondents who can help.
+
+Careful reading of system header files -- e.g., <sys/proc.h> --
+may give hints about how kernel storage is organized.  Look for
+global variables declared under a KERNEL or _KERNEL #if.  Run nm(1)
+across the kernel image (/vmunix, /unix, etc.) and look for references
+to structures of interest.
+
+Even if there are support functions for reading structures, like the
+kvm_*() functions, you must still understand how to read data from
+kernel memory.  Typically this requires an understanding of the
+nlist() function, and how to use /dev/kmem, /dev/mem, and /dev/swap.
+
+Don't overlook the possibility that you may have to use the process
+file system -- e.g., /proc.  I try to avoid using /proc when I can,
+since it usually requires that lsof have setuid(root) permission
+to read the individual /proc "files".
+
+Once you can access kernel structures, you must understand how
+they're connected.  You must answer questions like:
+
+    *  How big are kernel addresses?  How are they type cast?
+
+    *  How are kernel variable names converted to addresses?
+       Nlist()?
+
+    *  How are the proc structures organized?  Is it a static
+       table?  Are the proc structures linked?  Is there a
+       kernel pointer to the first proc structure?  Is there a
+       proc structure count?
+
+    *  How does one obtain copies of the proc structures?  Via
+       /dev/kmem?  Via a vendor API?
+
+    *  If this is a Mach derivative, is it necessary to obtain the
+       task and thread structures?  How?
+
+    *  How does one obtain the user area (or the utask area in Mach
+       systems) that corresponds to a process?
+
+    *  Where are the file structures located for open file
+       descriptors and how are they located?  Are all file
+       structures in the user area?  Is the file structure space
+       extensible?
+
+    *  Where do the private data pointers in file structures lead?
+       To gnodes?  To inodes?  To sockets?  To vnodes?  Hint: look
+       in <sys/file.h> for DTYPE_* instances and further pointers.
+
+    *  How are the nodes organized?  To what other nodes do they
+       lead and how?  Where are the common bits of information in
+       nodes -- device, node number, size -- stored?  Hint: look
+       in the header files for nodes for macros that may be used
+       to obtain the address of one node from another -- e.g., the
+       VTOI() macro that leads from a vnode to an inode.
+
+    *  Are text reference nodes identified and how?  Is it
+       necessary to examine the virtual memory map of a process or
+       a task to locate text references?  Some kernels have text
+       node pointers in the proc structures; some, in the user
+       area; Mach kernels may have text information in the task
+       structure, reached in various ways from the proc, user area,
+       or user task structure.
+
+    *  How is the device table -- e.g., /dev or /devices --
+       organized?  How is it read?  Using direct or dirent structures?
+
+       How are major/minor device numbers represented?  How are
+       device numbers assembled and disassembled?
+
+       Are there clone devices?  How are they identified?
+
+    *  How is mount information obtained?  Getmntinfo()?  Getmntent()?
+       Some special kernel call?
+
+    *  How are sockets identified and organized?  BSD-style?  As
+       streams?  Are there streams?
+
+    *  Are there special nodes -- CD-ROM nodes, FIFO nodes, etc.?
+
+    *  How is the kernel's name cache organized?  Can lsof access
+       it to get partial name components?
+
+
+Dlsof.h and #include's
+----------------------
+
+Once you have identified the kernel's data organization and know
+what structures it provides, you must add #include's to dlsof.h to
+access their definitions.  Sometimes it is difficult to locate the
+header files -- you may need to introduce -I specifications in the
+Makefile via the DINC shell variable in the Configure script.
+
+Sometimes it is necessary to define special symbols -- e.g., KERNEL,
+_KERNEL, _KMEMUSER -- to induce system header files to yield kernel
+structure definitions.  Sometimes making those symbol definitions
+cause other header file and definition conflicts.  There's no good
+general rule on how to proceed when conflicts occur.
+
+Rarely it may be necessary to extract structure definitions from
+system header files and move them to dlsof.h, create special versions
+of system header files, or obtain special copies of system header
+files from "friendly" (e.g., vendor) sources.  The dlsof.h header
+file in lsof4/dialects/sun shows examples of the first case; the
+second, no examples; the third, the irix5hdr subdirectory in
+lsof4/dialects/irix (a mixture of the first and third).
+
+Building up the necessary #includes in dlsof.h is an iterative
+process that requires attention as you build the dialect-specific
+functions that references kernel structures.  Be prepared to revisit
+dlsof.h frequently.
+
+
+Definitions That Affect Compilation
+-----------------------------------
+
+The source files at the top level and in the lib/ subdirectory
+contain optional functions that may be activated with definitions
+in a dialect's machine.h header file.  Some are functions for
+reading node structures that may not apply to all dialects -- e.g.
+CD-ROM nodes (cdrnode), or `G' nodes (gnode) -- and others are
+common functions that may occasionally be replaced by dialect-specific
+ones.  Once you understand your kernel's data organization, you'll
+be able to decide the optional common node functions to activate.
+
+Definitions in machine.h and dlsof.h also enable or disable other
+optional common features.  The following is an attempt to list all
+the definitions that affect lsof code, but CAUTION, it is only
+attempt and may be incomplete.  Always check lsof4 source code in
+lib/ and dialects/, and dialect machine.h header files for other
+possibilities
+
+    AFS_VICE		See 00XCONFIG.
+
+    AIX_KERNBITS	specifies the kernel bit size, 32 or 64, of the Power
+			architecture AIX 5.x kernel for which lsof was built.
+
+    CAN_USE_CLNT_CREATE	is defined for dialects where the more modern
+			RPC function clnt_create() can be used in
+			place of the deprecated clnttcp_create().
+
+    CLONEMAJ            defines the name of the variable that
+			contains the clone major device number.
+			(Also see HAS_STD_CLONE and HAVECLONEMAJ.)
+
+    DEVDEV_PATH		defines the path to the directory where device
+			nodes are stored, usually /dev.  Solaris 10
+			uses /devices.
+
+    DIALECT_WARNING	may be defined by a dialect to provide a
+			warning message that will be displayed with
+			help (-h) and version (-v) output.
+
+    FSV_DEFAULT		defines the default file structure values to
+			list.  It may be composed of or'd FSV_*
+			(See lsof.h) values.  The default is none (0).
+
+    GET_MAJ_DEV         is a macro to get major portion from device
+			number instead of via the standard major()
+			macro.
+
+    GET_MIN_DEV		is a macro to get minor portion from device
+			number instead of via the standard minor()
+			macro.
+
+    GET_MAX_FD		the name of the function that returns an
+			int for the maximum open file descriptor
+			plus one.  If not defined, defaults to
+			getdtablesize.
+
+    HAS9660FS           enables CD9660 file system support in a
+			BSD dialect.
+
+    HAS_ADVLOCK_ARGS    is defined for NetBSD and OpenBSD dialects
+			whose <sys/lockf.h> references vop_advlock_args.
+
+    HAS_AFS		enables AFS support code for the dialect.
+
+    HAS_AIO_REQ_STRUCT	is defined for Solaris 10 and above systems that
+			have the aio_req structure definition.
+
+    HAS_ATOMIC_T	indicates the Linux version has an
+			<asm/atomic.h> header file and it contains
+			"typedef struct .* atomic_t;"
+
+    HASAOPT		indicates the dialect supports the AFS -A
+			option when HAS_AFS is also defined.
+
+    HAS_ASM_TERMIOBITS  indicates for Linux Alpha that the
+			<asm/termiobits.h> header file exists.
+
+    HASAX25CBPTR	indicates that the Linux sock struct has an
+			ax25_db pointer.
+
+    HASBLKDEV		indicates the dialect has block device support.
+
+    HASBUFQ_H		indicates the *NSD dialect has the <sys/bufq.h>
+			header file.
+
+    HASCACHEFS		enables cache file system support for the
+			dialect.
+
+    HAS_CDFS		enables CDFS file system support for the
+			dialect.
+
+    HASCDRNODE		enables/disables readcdrnode() in node.c.
+
+    HAS_CLOSEFROM	is defined when the FreeBSD C library contains the
+			closefrom() function.
+
+    HAS_CONN_NEW        indicates the Solaris version has the new form
+			of the conn_s structure, introduced in b134 of
+			Solaris 11.  This will always accompany the
+			HAS_IPCLASSIFIER_H definition.
+
+    HAS_CONST		indicates that the compiler supports the
+			const keyword.
+
+    HASCPUMASK_T	indicates the FreeBSD 5.2 or higher dialect
+			has cpumask_t typedef's.
+
+    HAS_CRED_IMPL_H	indicates the Solaris 10 dialect has the
+			<sys/cred_impl.h> header file available.
+
+    HASCWDINFO          indicates the cwdinfo structure is defined
+			in the NetBSD <sys/filedesc.h>.
+
+    HASDCACHE           enables device file cache file support.
+			The device cache file contains information
+			about the names, device numbers and inode
+			numbers of entries in the /dev (or /device)
+			node subtree that lsof saves from call to
+			call.  See the 00DCACHE file of the lsof
+			distribution for more information on this
+			feature.
+
+    HASDENTRY		indicates the Linux version has a dentry
+			struct defined in <linux/dcache.h>.
+
+    HASDEVKNC           indicates the Linux version has a kernel
+			name cached keyed on device number.
+
+    HAS_DINODE_U	indicates the OpenBSD version has a dinode_u
+			union in its inode structure.
+
+    HASDNLCPTR          is defined when the name cache entry of
+			<sys/dnlc.h> has a name character pointer
+			rather than a name character array.
+
+    HAS_DUP2		is defined when the FreeBSD C library contains the
+			dup2() function.
+
+    HASEFFNLINK		indicates the *BSD system has the i_effnlink
+			member in the inode structure.
+
+    HASENVDC            enables the use of an environment-defined
+			device cache file path and defines the name
+			of the environment variable from which lsof
+			may take it.  (See the 00DCACHE file of
+			the lsof distribution for information on
+			when HASENVDC is used or ignored.)
+
+    HASEOPT		indicates the dialect supports the -e option to
+			eliminate kernel blocks on a named file system.
+
+    HASEPTOPTS		indicates the dialect supports the +|-E end point
+			options.
+
+    HASEXT2FS           is defined for BSD dialects for which ext2fs
+			file system support can be provided.  A value
+			of 1 indicates that the i_e2din member does not
+			exist; 2, it exists.
+
+    HASF_VNODE		indicates the dialect's file structure has an
+			f_vnode member in it.
+
+    HAS_FDESCENTTBL	indicates the FreeBSD system has the fdescenttbl
+			structure.
+
+    HAS_FILEDESCENT	indicates the FreeBSD system has the filedescent
+			definition in the <sys/filedesc.h> header file.
+
+    HASFDESCFS		enables file descriptor file system support
+			for the dialect.   A value of 1 indicates
+			<miscfs/fdesc.h> has a Fctty definition; 2,
+			it does not.
+
+    HASFDLINK		indicates the file descriptor file system
+			node has the fd_link member.
+
+    HASFIFONODE		enables/disables readfifonode() in node.c.
+
+    HAS_FL_FD		indicates the Linux version has an fl_fd
+			element in the lock structure of <linux/fs.h>.
+
+    HAS_FL_FILE		indicates the Linux version has an fl_file
+			element in the lock structure of <linux/fs.h>.
+
+    HAS_FL_WHENCE	indicates the Linux version has an fl_whence
+			element in the lock structure of <linux/fs.h>.
+
+    HAS_F_OPEN		indicates the UnixWare 7.x dialect has the
+			f_open member in its file struct.
+
+    HASFSINO            enables the inclusion of the fs_ino element
+			in the lfile structure definition in lsof.h.
+			This contains the file system's inode number
+			and may be needed when searching the kernel
+			name cache.  See dialects/osr/dproc.c for
+			an example.
+
+    HASFSTRUCT		indicates the dialect has a file structure
+			the listing of whose element values can be
+			enabled with +f[cfn].  FSV_DEFAULT defines
+			the default listing values.
+
+    HASFSTYPE           enables/disables the use of the file system's
+			stat(2) st_fstype member.
+
+			If the HASFSTYPE value is 1, st_fstype is
+			treated as a character array; 2, it is
+			treated as an integer.
+
+			See also the RMNT_EXPDEV and RMNT_FSTYPE
+			documentation in lib/rmnt.c
+
+    HASFUSEFS		is defined when the FreeBSD system has FUSE file system
+			support.
+
+    HASGETBOOTFILE	indicates the NetBSD or OpenBSD dialect has
+			a getbootfile() function.
+
+    HASGNODE		enables/disables readgnode() in node.c.
+
+    HASHASHPID		is defined when the Linux version (probably
+			above 2.1.35) has a pidhash_next member in
+			its task structure.
+
+    HASHSNODE		enables/disables readhsnode() in node.c.
+
+    HASI_E2FS_PTR	indicates the BSD dialect has a pointer in
+			its inode to the EXTFS dinode.
+
+    HASI_FFS            indicates the BSD dialect has i_ffs_size
+			in <ufs/ufs/inode.h>.
+
+    HASI_FFS1		indicates the BSD dialect supports the fast
+			UFS1 and UFS2 file systems.
+
+    HAS_INKERNEL        indicates the SCO OSR 6.0.0 or higher, or
+			UnixWare 7.1.4 or higher system uses the
+			INKERNEL symbol in <netinet/in_pcb.h> or
+			<netinet/tcp_var.h>.
+
+    HASINODE		enables/disables readinode() in node.c.
+
+    HASINOKNC		indicates the Linux version has a kernel
+			name cache keyed on inode address.
+
+    HASINADDRSTR	is defined when the inp_[fl]addr members
+			of the inpcb structure are structures.
+
+    HASINRIAIPv6	is defined if the dialect has the INRIA IPv6
+			support.  (HASIPv6 will also be defined.)
+
+    HASINT16TYPE	is defined when the dialect has a typedef
+			for int16 that may conflict with some other
+			header file's redefinition (e.g., <afs/std.h>).
+
+    HASINT32TYPE	is defined when the dialect has a typedef
+			for int32 that may conflict with some other
+			header file's redefinition (e.g., <afs/std.h>).
+
+    HASINTSIGNAL	is defined when signal() returns an int.
+
+    HAS_IPCLASSIFIER_H	is defined for Solaris dialects that have the
+			<inet/ipclassifier.h> header file.
+
+    HAS_IPC_S_PATCH	is defined when the HP-UX 11 dialect has the
+			ipc_s patch installed.  It has a value of
+			1 if the ipc_s structure has an ipc_ipis
+			member, but the ipis_s structure lacks the
+			ipis_msgsqueued member; 2, if ipc_s has
+			ipc_ipis, but ipis_s lacks ipis_msgsqueued.
+
+    HASIPv6             indicates the dialect supports the IPv6
+			Internet address family.
+
+    HAS_JFS2		The AIX >= 5.0 dialect has jfs2 support.
+
+    HASKERNELKEYT       indicates the Linux version has a
+			__kernel_key_t typedef in <linux/types.h>.
+
+    HASKERNFS           is defined for BSD dialects for which
+			/kern file system support can be provided.
+
+    HASKERNFS_KFS_KT	indicates *kfs_kt is in the BSD dialect's
+			<miscfs/kernfs/kernfs.h>.
+
+    HASKOPT		enables/disables the ability to read the
+			kernel's name list from a file -- e.g., from
+			a crash dump file.
+
+    HAS_PAUSE_SBT	indicates the FreeBSD system's systm.h has the
+			pause to pause_sbt definition.
+
+    HASKQUEUE           indicates the dialect supports the kqueue
+			file type.
+
+    HASKVMGETPROC2      The *BSD dialect has the kvm_gettproc2()
+			function.
+
+    HAS_KVM_VNODE	indicates the FreeBSD 5.3 or higher dialect has
+			"defined(_KVM_VNODE)" in <sys/vnode.h>.
+
+    HASLFILEADD		defines additional, dialect-specific elements
+    SETLFILEADD		in the lfile structure (defined in lsof.h).
+			HASLFILEADD is a macro. The accompanying SETFILEADD
+			macro is used in the alloc_lfile() function of
+			proc.c to preset the additional elements.
+
+    HAS_LF_LWP          is defined for BSD dialects where the lockf
+			structure has an lf_lwp member.
+
+    HASLFS		indicates the *BSD dialect has log-structured
+			file system support.
+
+    HAS_LGRP_ROOT_CONFLICT
+			indicates the Solaris 9 or Solaris 10 system has 
+			a conflict over the lgrp_root symbol in the
+			<sys/lgrp.h> and <sys/lgrp_user.h> header files.
+
+    HAS_LIBCTF		indicates the Solaris 10 and above system has
+			the CTF library.
+
+    HAS_LOCKF_ENTRY	indicates the FreeBSD version has a lockf_entry
+			structure in its <sys/lockf.h> header file.
+
+    HAS_LWP_H		is defined for BSD dialects that have the
+			<sys/lwp.h> header file.
+
+    HASMOPT		enables/disables the ability to read kernel
+			memory from a file -- e.g., from a crash
+			dump file.
+
+    HASMSDOSFS		enables MS-DOS file system support in a
+			BSD dialect.
+
+    HASMNTSTAT          indicates the dialect has a stat(2) status
+			element in its mounts structure.
+
+    HASMNTSUP		indicates the dialect supports the mount supplement
+			option.
+
+    HASNAMECACHE	indicates the FreeBSD dialect has a namecache
+			structure definition in <sys/namei.h>.
+
+    HASNCACHE		enables the probing of the kernel's name cache
+			to obtain path name components.  A value
+			of 1 directs printname() to prefix the
+			cache value with the file system directory
+			name; 2, avoid the prefix.
+
+    HASNCVPID           The *BSD dialect namecache struct has an
+			nc_vpid member.
+
+    HASNETDEVICE_H	indicates the Linux version has a netdevice.h
+			header file.
+
+    HAS_NFS		enables NFS support for the dialect.
+
+    HASNFSKNC		indicates the LINUX version has a separate
+			NFS name cache.
+
+    HASNFSPROTO         indicates the NetBSD or OpenBSD version
+			has the nfsproto.h header file.
+
+    HASNFSVATTRP	indicates the n_vattr member of the nfsnode of
+			the *BSD dialect is a pointer.
+
+    HASNLIST		enables/disables nlist() function support.
+			(See NLIST_TYPE.)
+
+    HASNOFSADDR		is defined if the dialect has no file structure
+			addresses.  (HASFSTRUCT must be defined.)
+
+    HASNOFSCOUNT	is defined if the dialect has no file structure counts.
+			(HASFSTRUCT must be defined.)
+
+    HASNOFSFLAGS	is defined if the dialect has no file structure flags.
+			(HASFSTRUCT must be defined.)
+
+    HASNOFSNADDR	is defined if the dialect has no file structure node
+			addresses.  (HASFSTRUCT must be defined.)
+
+    HAS_NO_6PORT	is defined if the FreeBSD in_pcb.h has no in6p_.port
+			definitions.
+
+    HAS_NO_6PPCB	is defined if the FreeBSD in_pcb.h has no in6p_ppcb
+			definition.
+
+    HAS_NO_IDEV		indicates the FreeBSD system's inode has no i_dev
+			member.
+
+    HAS_NO_ISO_DEV	indicates the FreeBSD 6 and higher system has
+			no i_dev member in its iso_node structure.
+
+    HAS_NO_LONG_LONG	indicates the dialect has no support for the C
+			long long type.  This definition is used by
+			the built-in snprintf() support of lib/snpf.c.
+
+    HASNORPC_H		indicates the dialect has no /usr/include/rpc/rpc.h
+			header file.
+
+    HAS_NO_SI_UDEV	indicates the FreeBSD 6 and higher system has
+			no si_udev member in its cdev structure.
+
+    HASNOSOCKSECURITY   enables the listing of open socket files,
+			even when HASSECURITY restricts listing of
+			open files to the UID of the user who is
+			running lsof, provided socket file listing
+			is selected with the "-i" option.  This
+			definition is only effective when HASSECURITY
+			is also defined.
+
+    HASNULLFS           indicates the dialect (usually *BSD) has a
+			null file system.
+
+    HASOBJFS            indicates the Pyramid version has OBJFS
+			support.
+
+    HASONLINEJFS	indicates the HP-UX 11 dialect has the optional
+			OnlineJFS package installed.
+
+    HAS_PC_DIRENTPERSEC
+			indicates the Solaris 10 system's <sys/fs/pc_node.h>
+			header file has the pc_direntpersec() macro.
+
+    HAS_PAD_MUTEX	indicates the Solaris 11 system has the pad_mutex_t
+			typedef in its <sys/mutex.h> header file.
+
+    HASPERSDC           enables the use of a personal device cache
+			file path and specifies a format by which
+			it is constructed.  See the 00DCACHE file
+			of the lsof distribution for more information
+			on the format.
+
+    HASPERSDCPATH       enables the use of a modified personal
+			device cache file path and specifies the
+			name of the environment variable from which
+			its component may be taken.  See the 00DCACHE
+			file of the lsof distribution for more
+			information on the modified personal device
+			cache file path.
+
+    HASPINODEN		declares that the inode number of a /proc file
+			should be stored in its procfsid structure.
+
+    HASPIPEFN           defines the function that processes DTYPE_PIPE
+			file structures.  It's used in the prfp.c
+			library source file.  See the FreeBSD
+			dialect source for an example.
+
+    HASPIPENODE		enables/disables readpipenode() in node.c.
+
+    HASPMAPENABLED      enables the automatic reporting of portmapper
+			registration information for TCP and UDP
+			ports that have been registered.
+
+    HASPPID		indicates the dialect has parent PID support.
+
+    HASPR_LDT		indicates the Solaris dialect has a pr_ldt
+			member in the pronodetype enum.
+
+    HASPR_GWINDOWS	indicates the Solaris dialect has a pr_windows
+			member in the pronodetype enum.
+
+    HASPRINTDEV         this value defines a private function for
+			printing the dialect's device number.  Used
+			by print.c/print_file().  Takes one argument:
+
+			char *HASPRINTDEV(struct lfile *)
+
+    HASPRINTINO         this value names a private function for
+			printing the dialect's inode number.  Used
+			by print.c/print_file(). Takes one argument:
+
+			char *HASPRINTINO(struct lfile *)
+
+    HASPRINTNM          this value names a private function for
+			printing the dialect's file name.  Used by
+			print.c/print_file().  Takes one argument:
+
+			void HASPRINTNM(struct lfile *)
+
+    HASPRINTOFF         this value names a private function for
+			printing the dialect's file offset.  Used
+			by print.c/print_file().  Takes two arguments:
+
+			char *HASPRINTOFF(struct lfile *, int ty)
+
+			Where ty == 0 if the offset is to be printed
+			in 0t<decimal> format; 1, 0x<hexadecimal>.
+
+    HASPRINTSZ		this value names a private function for
+			printing the dialect's file size.  Used
+			by print.c/print_file(). Takes one argument:
+
+			char *HASPRINTSZ(struct lfile *)
+
+			void HASPRINTNM(struct lfile *)
+
+    HASPRIVFILETYPE     enables processing of the private file
+			type, whose number (from f_type of the file
+			struct) is defined by PRIVFILETYPE.
+			HASPRIVFILETYPE defines the function that
+			processes the file struct's f_data member.
+			Processing is initiated from the process_file()
+			function of the prfp.c library source file
+			or from the dialect's own process_file()
+			function.
+
+    HASPRIVNMCACHE      enables printing of a file path from a
+			private name cache.  HASPRIVNMCACHE defines
+			the name of the printing function.  The
+			function takes one argument, a struct lfile
+			pointer to the file, and returns non-zero
+			if it prints a cached name to stdout.
+
+    HASPRIVPRIPP        is defined for dialects that have a private
+			function for printing the IP protocol name.
+			When this is not defined, the function to
+			do that defaults to printiproto().
+
+    HASPROCFS		defines the name (if any) of the process file
+			system -- e.g., /proc.
+
+    HASPROCFS_PFSROOT	indicates PFSroot is in the BSD dialect's
+			<miscfs/procfs/procfs.h>.
+
+    HASPSEUDOFS         indicates the FreeBSD dialect has pseudofs
+			file system support.
+
+    HASPSXSEM		indicates the dialect has support for the POSIX
+			semaphore file type.
+
+    HASPSXSHM		indicates the dialect has support for the POSIX
+			shared memory file type.
+
+    HASPTSFN		indicates the dialect has a DNODE_PTS file descriptor
+			type and defines the function that processes it.
+
+    HASPTYFS		indicates the *BSD dialect has a ptyfs file system.
+
+    HASRNODE		enables/disables readrnode() in node.c.
+
+    HASRNODE3		indicates the HPUX 10.20 or lower dialect has NFS3
+			support with a modified rnode structure.
+
+    HASRPCV2H		The FreeBSD dialect has <nfs/rpcv2.h>.
+
+    HAS_SANFS           indicates the AIX system has SANFS file system
+			support.
+
+    HAS_SB_CC		indicates the FreeBSD system's sockbuf structure has
+			the sb_ccc member, rather than the sb_cc member.
+
+    HASSBSTATE          indicates the dialect has socket buffer state
+			information (e.g., SBS_* symbols) available.
+
+    HASSECURITY         enables/disables restricting open file
+			information access.  (Also see HASNOSOCKSECURITY.)
+
+    HASSELINUX          indicates the Linux dialect has SELinux security
+			context support available.
+
+    HASSETLOCALE	is defined if the dialect has <locale.h> and
+			setlocale().
+
+    HAS_SI_PRIV         indicates the FreeBSD 6.0 and higher cdev
+			structure has an si_priv member.
+
+    HAS_SOCKET_PROTO_H	indicates the Solaris 10 system has the header file
+			<sys/socket_proto.h>.
+
+    HASSOUXSOUA		indicates that the Solaris <sys/socketvar.h> has
+			soua_* members in its so_ux_addr structure.
+
+    HASSPECDEVD		indicates the dialect has a special device
+			directory and defines the name of a function
+			that processes the results of a successful
+			stat(2) of a file in that directory.
+
+    HASSPECNODE         indicates the DEC OSF/1, or Digital UNIX,
+			or Tru64 UNIX <sys/specdev.h> has a spec_node
+			structure definition.
+
+    HASSNODE		indicates the dialect has snode support.
+
+    HAS_SOCKET_SK	indicates that the Linux socket structure
+			has the ``struct sock *sk'' member.
+
+    HASSOOPT            indicates the dialect has socket option
+			information (e.g., SO_* symbols) available.
+
+    HASSOSTATE          indicates the dialect has socket state
+			information (e.g., SS_* symbols) available.
+
+    HASSTATVFS          indicates the NetBSD dialect has a statvfs
+			struct definition.
+
+    HASSTAT64		indicates the dialect's <sys/stat.h> contains
+			stat64.
+
+    HAS_STD_CLONE	indicates the dialect uses a standard clone
+			device structure that can be used in common
+			library function clone processing.  If the
+			value is 1, the clone table will be built
+			by readdev() and cached when HASDCACHE is
+			defined; if the value is 2, it is assumed
+			the clone table is built independently.
+			(Also see CLONEMAJ and HAVECLONEMAJ.)
+
+    HASSTREAMS          enables/disables streams.  CAUTION, requires
+			specific support code in the dialect sources.
+
+    HAS_STRFTIME	indicates the dialect has the gmtime() and
+			strftime() C library functions that support
+			the -r marker format option.  Configure tests
+			for the functions and defines this symbol.
+
+    HASSYSDC            enables the use of a system-wide device
+			cache file and defines its path.  See the
+			00DCACHE file of the lsof distribution for
+			more information on the system-wide device
+			cache file path option.
+
+    HAS_SYS_PIPEH	indicates the dialect has a <sys/pipe.h>
+			header file.
+
+    HAS_SYS_SX_H	indicates the FreeBSD 7.0 and higher system has
+			a <sys/sx.h> header file.
+
+    HASTAGTOPATH        indicates the DEC OSF/1, Digital UNIX, or
+			Tru64 UNIX dialect has a libmsfs.so,
+			containing tag_to_path().
+
+    HAS_TMPFS		indicates the FreeBSD system has the <fs/tmpfs.h>
+			header file.
+
+    HASTMPNODE		enables/disables readtnode() in node.c.
+
+    HASTCPOPT           indicates the dialect has TCP option
+			information (i.e., from TF_* symbols)
+			available.
+
+    HASTCPTPIQ          is defined when the dialect can duplicate
+			the receive and send queue sizes reported
+			by netstat.
+
+    HASTCPTPIW          is defined when the dialect can duplicate
+			the receive and send window sizes reported
+			by netstat.
+
+    HASTCPUDPSTATE	is defined when the dialect has support for
+			TCP and UDP state, including the "-s p:s"
+			option and associated speed ehancements.
+
+    HASTFS		indicates that the Pyramid dialect has TFS
+			file system support.
+
+    HAS_UFS1_2		indicates the FreeBSD 6 and higher system has
+			UFS1 and UFS2 members in its inode structure.
+
+    HAS_UM_UFS		indicates the OpenBSD version has UM_UFS[12]
+			definitions.
+
+    HASUNMINSOCK	indicates the Linux version has a user name
+			element in the socket structure; a value of
+			0 says there is no unix_address member; 1,
+			there is.
+
+    HASUINT16TYPE	is defined when the dialect has a typedef
+			for u_int16 that may conflict with some other
+			header file's redefinition (e.g., <afs/std.h>).
+
+    HASUXSOCKEPT	indicates the Linux version has support for the
+			UNIX socket endpoint option.
+
+    HASUTMPX		indicates the dialect has a <utmpx.h> header
+			file.
+
+    HAS_UVM_INCL	indicates the NetBSD or OpenBSD dialect has
+			a <uvm> include directory.
+
+    HAS_UW_CFS      	indicates the UnixWare 7.1.1 or above dialect
+			has CFS file system support.
+
+    HAS_UW_NSC		indicates the UnixWare 7.1.1 or above dialect
+			has a NonStop Cluster (NSC) kernel.
+
+    HAS_V_LOCKF		indicates the FreeBSD version has a v_lockf
+			member in the vode structure, defined in
+			<sys/vnode.h>.
+
+    HAS_VM_MEMATTR_T	indicates the FreeBSD <sys/conf.h> uses the
+			vm_memattr_t typedef.
+
+    HASVMLOCKH		indicates the FreeBSD dialect has <vm/lock.h>.
+
+    HASVNODE		enables/disables readvnode() function in node.c.
+
+    HAS_V_PATH          indicates the dialect's vnode structure has a
+			v_path member.
+
+    HAS_VSOCK		indicates that the Solaris version has a VSOCK
+			member in the vtype enum
+
+    HASVXFS		enables Veritas VxFS file system support for
+			the dialect.  CAUTION, the dialect sources
+			must have the necessary support code.
+
+    HASVXFSDNLC         indicates the VxFS file system has its own
+			name cache.
+
+    HASVXFS_FS_H	indicates <sys/fs/vx_fs.h> exists.
+
+    HASVXFS_MACHDEP_H	indicates <sys/fs/vx_machdep.h> exists.
+
+    HASVXFS_OFF64_T	indicates <sys/fs/vx_solaris.h> exists and
+			has an off64_t typedef.
+
+    HASXVFSRNL		indicates the dialect has VxFS Reverse Name
+			Lookup (RNL) support.
+
+    HASVXFS_SOL_H	indicates <sys/fs/vx_sol.h> exists.
+
+    HASVXFS_SOLARIS_H	indicates <sys/fs/vx_solaris.h> exists.
+
+    HASVXFS_U64_T       if HASVXFS_SOLARIS_H is defined, this
+			variable indicates that <sys/fs/vx_solaris.h>
+			has a vx_u64_t typedef.
+
+    HASVXFSUTIL         indicates the Solaris dialect has VxFS 3.4
+			or higher and has the utility libraries,
+			libvxfsutil.a (32 bit) and libvxfsutil64.a
+			(64 bit).
+
+    HASVXFS_VX_INODE    indicates that <sys/fs/vx_inode.h> contains
+			a vx_inode structure.
+
+    HASWCTYPE_H		indicates the FreeBSD version has wide-character
+			support and the <wctype.h> header file.  Note:
+			the HASWIDECHAR #define will also be set.
+
+    HASWIDECHAR         indicates the dialect has the wide-character
+			support functions iswprint(), mblen() and mbtowc().
+
+    HASXNAMNODE         indicates the OSR dialect has <sys/fs/xnamnode.h>.
+
+    HASXOPT		defines help text for dialect-specific X option
+			and enables X option processing in usage.c and
+			main.c.
+
+    HASXOPT_ROOT        when defined, restricts the dialect-specific
+			X option to processes whose real user ID
+			is root.
+
+    HASXOPT_VALUE	defines the default binary value for the X option
+			in store.c.
+
+    HAS_ZFS		indicates the dialect has support for the ZFS file
+			system.
+
+    HASZONES		the Solaris dialect has zones.
+
+    HAVECLONEMAJ        defines the name of the status variable
+			that indicates a clone major device number
+			is available in CLONEMAJ.  (Also see CLONEMAJ
+			and HAS_STD_CLONE.)
+
+    HPUX_KERNBITS	defines the number of bits in the HP-UX 10.30
+			and above kernel "basic" word: 32 or 64.
+
+    KA_T		defines the type cast required to assign
+			space to kernel pointers.  When not defined
+			by a dialect header file, KA_T defaults to
+			unsigned long.
+
+    KA_T_FMT_X          defines the printf format for printing a
+			KA_T -- the default is "%#lx" for the
+			default unsigned long KA_T cast.
+
+    LSOF_ARCH		See 00XCONFIG.
+
+    LSOF_BLDCMT		See 00XCONFIG.
+
+    LSOF_CC		See 00XCONFIG.
+
+    LSOF_CCV		See 00XCONFIG.
+
+    LSOF_HOST		See 00XCONFIG.
+
+    LSOF_INCLUDE	See 00XCONFIG.
+
+    LSOF_LOGNAME	See 00XCONFIG.
+
+    LSOF_MKC		See the "The Mksrc Shell Script" section of
+			this file.
+
+    LSOF_SYSINFO	See 00XCONFIG.
+
+    LSOF_USER		See 00XCONFIG.
+
+    LSOF_VERS		See 00XCONFIG.
+
+    LSOF_VSTR		See 00XCONFIG.
+
+    MACH		defines a MACH system.
+
+    N_UNIXV		defines an alternate value for the N_UNIV symbol.
+
+    NCACHELDPFX		defines C code to be executed before calling
+			ncache_load().
+
+    NCACHELDSFX		defines C code to be executed after calling
+			ncache_load().
+
+    NEEDS_BOOL_TYPEDEF	indicates the FreeBSD 10 system, being built on an
+			i386 architecture systemn, needs typdef bool.
+
+    NEEDS_BOOLEAN_T	indicates the FreeBSD 9 and above system needs a
+			boolean_t definition for <sys/conf.h>.
+
+    NEEDS_MACH_PORT_T	is defined for Darwin versions that need the inclusion
+			of the header file <device/device_types.h>.
+
+    NEEDS_NETINET_TCPH	is defined when the Linux version needs to #include
+			<netinet/tcp.h> in place of <linux/tcp.h> in order to
+			have access to the TCP_* definitions.
+
+    NEVER_HASDCACHE	keeps the Customize script from offering to
+			change HASDCACHE by its presence anywhere
+			in a dialect's machine.h header file --
+			e.g., in a comment.  See the Customize
+			script or machine.h in dialects/linux/proc.
+
+    NEVER_WARNDEVACCESS	keeps the Customize script from offering to
+			change WARNDEVACCESS by its presence anywhere
+			in a dialect's machine.h header file --
+			including in a comment.  See the Customize
+			script or machine.h in dialects/linux/proc.
+
+    NLIST_TYPE		is the type of the nlist table, Nl[], if it is
+			not nlist.  HASNLIST must be set for this
+			definition to be effective.
+
+    NOWARNBLKDEV        specifies that no warning is to be issued
+			when no block devices are found.  This
+			definiton is used only when HASBLKDEV is
+			also defined.
+
+    OFFDECDIG           specifies how many decimal digits will be
+			printed for the file offset in a 0t form
+			before switching to a 0x form.  The count
+			includes the "0t".  A count of zero means
+			the size is unlimited.
+
+    PRIVFILETYPE        is the number of a private file type, found
+			in the f_type member of the file struct, to
+			be processed by the HASPRIVFILETYPE function.
+			See the AIX dialect sources for an example.
+
+    _PSTAT_STREAM_GET_XPORT
+			indicates the HP-UX PSTAT header files require
+			this symbol to be defined for proper handling of
+			stream export data.
+
+    SAVE_MP_IN_SFILE	indicates the dialect needs to have the mounts
+			structure pointer for a file system search argument
+			recorded in the dialect's sfile structure.  This
+			definition is made in the dialect's dlsof.h header
+			file within the sfile structure.
+
+    TIMEVAL_LSOF        defines the name of the timeval structure.
+			The default is timeval.  /dev/kmem-based
+			Linux lsof redefines timeval with this
+			symbol to avoid conflicts between glibc
+			and kernel definitions.
+
+    TYPELOGSECSHIFT     defines the type of the cdfs_LogSecShift
+			member of the cdfs structure for UnixWare
+			7 and higher.
+
+    UID_ARG_T           defines the cast on a User ID when passed
+			as a function argument.
+
+    USE_LIB_COMPLETEVFS
+			selects the use of the completevfs() function
+			in lsof4/lib/cvfs.c.
+
+    USE_LIB_FIND_CH_INO
+			selects the use of the find_ch_ino() inode
+			function in lsof4/lib/fino.c.
+
+			Note: HASBLKDEV selects the has_bl_ino()
+			function.
+
+    USE_LIB_IS_FILE_NAMED
+			selects the use of the is_file_named() function
+			in lsof4/lib/isfn.c.
+
+    USE_LIB_LKUPDEV	selects the use of the lkupdev() function
+			in lsof4/lib/lkud.c.
+
+			Note: HASBLKDEV selects the lkupbdev() function.
+
+    USE_LIB_PRINTDEVNAME
+			selects the use of the printdevname() function
+			in lsof4/lib/pdvn.c.
+
+			Note: HASBLKDEV selects the printbdevname()
+			function.
+
+    USE_LIB_PRINT_TCPTPI
+			selects the use of the print_tcptpi() function
+			in lsof4/lib/ptti.c.
+
+    USE_LIB_PROCESS_FILE
+			selects the use of the process_file() function
+			in lsof4/lib/prfp.c.
+
+    USE_LIB_READDEV	selects the use of the readdev() and stkdir()
+			functions in lsof4/lib/rdev.c.
+
+    USE_LIB_READMNT	selects the use of the readmnt() function
+			in lsof4/lib/rmnt.c.
+
+    USE_LIB_RNAM	selects the use of the device cache functions
+			in lsof4/lib/rnam.c.
+
+			Note: HASNCACHE must also be defined.
+
+    USE_LIB_RNCH	selects the use of the device cache functions
+			in lsof4/lib/rnch.c.
+
+			Note: HASNCACHE must also be defined.
+
+    USE_STAT            is defined for those dialects that must
+			use the stat(2) function instead of lstat(2)
+			to scan /dev -- i.e., in the readdev()
+			function.
+
+    VNODE_VFLAG		is an alternate name for the vnode structure's
+			v_flag member.
+
+    WARNDEVACCESS	enables the issuing of a warning message when
+			lsof is unable to access /dev (or /device)
+			or one of its subdirectories, or stat(2)
+			a file in them. Some dialects (e.g., HP-UX)
+			have many inaccessible subdirectories and
+			it is appropriate to inhibit the warning
+			for them with WARNDEVACCESS.  The -w option
+			will also inhibit these warnings.
+
+    WARNINGSTATE        when defined, disables the default issuing
+			of warning messages.  WARNINGSTATE is
+			undefined by default for all dialects in
+			the lsof distribution.
+
+    WIDECHARINCL        defines the header file to be included (if any)
+			when wide-character support is enabled with
+			HASWIDECHAR.
+
+    zeromem()		defines a macro to zero memory -- e.g., using
+			bzero() or memset().
+
+Any dialect's machine.h file and Configure stanza can serve as a
+template for building your own.  All machine.h files usually have
+all definitions, disabling some (with comment prefix and suffix)
+and enabling others.
+
+
+Options: Common and Special
+---------------------------
+
+All but one lsof option is common; the specific option is ``-X''.
+If a dialect does not support a common option, the related #define
+in machine.h -- e.g., HASCOPT -- should be deselected.
+
+The specific option, ``-X'', may be used by any dialect for its
+own purpose.  Right now (May 30, 1995) the ``-X'' option is binary
+(i.e., it's not allowed arguments of its own, and its value must
+be 0 or 1) but that could be changed should the need arise.  The
+option is enabled with the HASXOPT definition in machine.h; its
+default value is defined by HASXOPT_VALUE.
+
+The value of HASXOPT should be the text displayed for ``-X'' by
+the usage() function in usage.c.  HASXOPT_VALUE should be the
+default value, 0 or 1.
+
+AIX for the IBM RICS System/6000 defines the ``-X'' option to
+control readx() usage, since there is a bug in AIX kernels that
+readx() can expose for other processes.
+
+
+Defining Dialect-Specific Symbols and Global Storage
+----------------------------------------------------
+
+A dialect's dlsof.h and dstore.c files contain dialect-specific
+symbol and global storage definitions.  There are symbol definitions,
+for example, for function and data casts, and for file paths.
+Dslof.h defines lookup names the nlist() table -- X_* symbols --
+when nlist() is being used.
+
+Global storage definitions include such things as structures for
+local Virtual File System (vfs) information; mount information;
+search file information; and kernel memory file descriptors --
+e.g., Kmem for /dev/kmem, Mem for /dev/mem, Swap for /dev/drum.
+
+
+Coding Dialect-specific Functions
+---------------------------------
+
+Each supported dialect must have some basic functions that the
+common functions of the top level may call.  Some of them may be
+obtained from the library in lsof4/lib, selected and customized by
+#define's in the dialect machine.h header file.  Others may have
+to be coded specifically for the dialect.
+
+Each supported dialect usually has private functions, too.  Those
+are wholly determined by the needs of the dialect's data organization
+and access.
+
+These are some of the basic functions that each dialect must supply
+-- they're all defined in proto.h:
+
+    initialize()		function to initialize the dialect
+
+    is_file_named()		function to check if a file was named
+				by an optional file name argument
+				(lsof4/lib/isfn.c)
+
+    gather_proc_info()		function to gather process table
+				and related information and cache it
+
+    printchdevname()		function to locate and optionally
+				print the name of a character device
+				(lsof4/lib/pdvn.c)
+
+    print_tcptpistate()         function to print the TCP or TPI
+				state for a TCP or UDP socket file,
+				if the one in lib/ptti.c isn't
+				suitable (define USE_LIB_PRINT_TCPTPI
+				to activate lib/ptti.c)
+
+    process_file()		function to process an open file
+				structure (lsof4/lib/prfp.c)
+
+    process_node()		function to process a primary node
+
+    process_socket()		function to process a socket
+
+    readdev() and stkdir()	functions to read and cache device
+				information (lsof4/lib/rdev.c)
+
+    readmnt()			function to read mount table information
+				(lsof4/lib/rmnt.c)
+
+Other common functions may be needed, and might be obtained from
+lsof4/lib, depending on the needs of the dialect's node and socket
+file processing functions.
+
+Check the functions in lsof4/lib and specific lsof4/dialects/*
+files for examples.
+
+As you build these functions you will probably have to add #include's
+to dlsof.h.
+
+
+Function Prototype Definitions and the _PROTOTYPE Macro
+-------------------------------------------------------
+
+Once you've defined your dialect-specific definitions, you should
+define their prototypes in dproto.h or locally in the file where
+they occur and are used.  Do this even if your compiler is not ANSI
+compliant -- the _PROTOTYPE macro knows how to cope with that and
+will avoid creating prototypes that will confuse your compiler.
+
+
+The Makefile
+------------
+
+Here are some general rules for constructing the dialect Makefile.
+
+    *  Use an existing dialect's Makefile as a template.
+
+    *  Make sure the echo actions of the install rule are appropriate.
+
+    *  Use the DEBUG string to set debugging options, like ``-g''.
+       You may also need to use the -O option when forking and
+       SIGCHLD signals defeat your debugger.
+
+    *  Don't put ``\"'' in a compiler flags -D<symbol>=<string>
+       clause in your Makefile.  Leave off the ``\"'' even though
+       you want <string> to be a string literal and instead adapt
+       the N_UNIX* macros you'll find in Makefiles for FreeBSD
+       and Linux.  That will allow the Makefile's version.h rule
+       to put CFLAGS into version.h without having to worry about
+       the ``\"'' sequences.
+
+    *  Finally, remember that strings can be passed from the top
+       level's Configure shell script.  That's an appropriate way
+       to handle options, especially if there are multiple versions
+       of the Unix dialect to which you are porting lsof 4.
+
+
+The Mksrc Shell Script
+----------------------
+
+Pattern your Mksrc shell script after an existing one from another
+dialect.  Change the D shell variable to the name of your dialect's
+subdirectory in lsof4/dialects.  Adjust any other shell variable
+to your local conditions.  (Probably that won't be necessary.)
+
+Note that, if using symbolic links from the top level to your
+dialect subdirectory is impossible or impractical, you can set the
+LSOF_MKC shell variable in Configure to something other than
+"ln -s" -- e.g., "cp," and Configure will pass it to the Mksrc
+shell script in the M environment variable.
+
+
+The MkKernOpts Shell Script
+---------------------------
+
+The MkKernOptrs shell script is used by some dialects -- e.g.,
+Pyramid DC/OSx and Reliant UNIX -- to determine the compile-time
+options used to build the current kernel that affect kernel structure
+definitions, so those same options can be used to build lsof.
+Configure calls MkKernOpts for the selected dialects.
+
+If your kernel is built with options that affect structure definitions.
+-- most commonly affected are the proc structure from <sys/proc.h>
+and the user structure from <sys/user.h> -- check the MkKernOpts
+in lsof4/dialects/irix for a comprehensive example.
+
+
+Testing and the Lsof Test Suite
+-------------------------------
+
+Once you have managed to create a port, here are some tips for
+testing it.
+
+*  First look at the test suite in the tests/ sub-directory of the
+   lsof distribution.  While it will need to be customized to be
+   usable with a new port, it should provide ideas on things to
+   test.  Look for more information about the test suite in the
+   00TEST file.
+
+*  Pick a simple process whose open files you are likely to
+   know and see if the lsof output agrees with what you know.
+   (Hint: select the process with `lsof -p <process_PID>`.)
+
+   Are the device numbers and device names correct?
+
+   Are the file system names and mount points correct?
+
+   Are inode numbers and sizes correct?
+
+   Are command names, file descriptor numbers, UIDs, PIDs, PGIDs,
+   and PPIDs correct?
+
+   A simple tool that does a stat(2) of the files being examined
+   and reports the stat struct contents can provide a reference for
+   some values; so can `ls -l /dev/<device>`.
+
+*  Let lsof list information about all open files and ask the
+   same questions.  Look also for error messages about not being
+   able to read a node or structure.
+
+*  Pick a file that you know is open -- open it and hold it
+   that way with a C program (not vi), if you must.  Ask lsof to
+   find the file's open instance by specifying its path to lsof.
+
+*  Create a C program that opens a large number of files and holds
+   them open.  Background the test process and ask lsof to list
+   its files.
+
+*  Generate some locks -- you may need to write a C program to
+   do this, hold the locked file open, and see if lsof can identify
+   the lock properly.  You may need to write several C programs
+   if your dialect supports different lock functions -- fnctl(),
+   flock(), lockf(), locking().
+
+*  Identify a process with known Internet file usage -- inetd
+   is a good one -- and ask lsof to list its open files.  See if
+   protocols and service names are listed properly.
+
+   See if your lsof identifies Internet socket files properly for
+   rlogind or telnetd processes.
+
+*  Create a UNIX domain socket file, if your dialect allows it,
+   hold it open by backgrounding the process, and see if lsof can
+   identify the open UNIX domain socket file properly.
+
+*  Create a FIFO file and see what lsof says about it.
+
+*  Watch an open pipe -- `lsof -u <your_login>  | less` is a
+   good way to do this.
+
+*  See if lsof can identify NFS files and their devices properly.
+   Open and hold open an NFS file and see if lsof can find the open
+   instance by path.
+
+*  If your test system has CD-ROM and floppy disk devices, open
+   files on them and see if lsof reports their information correctly.
+   Such devices often have special kernel structures associated
+   with them and need special attention from lsof for their
+   identification.  Pay particular attention to the inode numbers
+   lsof reports for CD-ROM and floppy disk files -- often they are
+   calculated dynamically, rather than stored in a kernel node
+   structure.
+
+*  If your implementation can probe the kernel name cache, look
+   at some processes with open files whose paths you know to see
+   if lsof identifies any name components.  If it doesn't, make
+   sure the name components are in the name cache by accessing
+   the files yourself with ls or a similar tool.
+
+*  If your dialect supports the /proc file system, use a C program
+   to open files there, background a test process, and ask lsof to
+   report its open files.
+
+*  If your dialect supports fattach(), create a small test program
+   to use it, background a test process, and ask lsof to report
+   its open files.
+
+I can supply some quick-and-dirty tools for reporting stat buffer
+contents, holding files open, creating UNIX domain files, creating
+FIFOs, etc., if you need them.
+
+
+Where Next?
+-----------
+
+Is this document complete?  Certainly not!  One might wish that it
+were accompanied by man pages for all lsof functions, by free beer
+or chocolates, by ...  (You get the idea.)
+
+But those things are not likely to happen as long as lsof is a
+privately supported, one man operation.
+
+So, if you need more information on how lsof is constructed or
+works in order to do a port of your own, you'll have to read the
+lsof source code.  You can also ask me questions via email, but
+keep in mind the private, one-man nature of current lsof support.
+
+
+Vic Abell <abe@purdue.edu>
+??? ???, 2016
diff --git a/OLD/Configure b/OLD/Configure
new file mode 100755
index 0000000000000000000000000000000000000000..43d43ecdf1bda78d5a97e7d5af8d47f114836a74
--- /dev/null
+++ b/OLD/Configure
@@ -0,0 +1,5777 @@
+#!/bin/sh 
+#
+# Configure -- configure lsof
+#
+# See the LSOF_HLP here document for usage.
+#
+# See the lsof distribution file 00XCONFIG for information on setting
+# environment variables for cross-configuring lsof -- e.g., for configuring
+# for Linux 2.3 on a machine running 2.4.  Marty Leisner suggested this
+# support and provided the Linux Configure stanza modifications.
+#
+# When configuring for a particular dialect, <target-dialect>, this script
+# requires that the subdirectory ./dialects/<target-dialect> contain a
+# shell script, named $LSOF_MK, that places its source modules in this
+# directory.
+#
+# $Id: Configure,v 1.164 2015/07/07 20:16:58 abe Exp abe $
+
+# LSOF_CFLAGS_OVERRIDE=1 may be introduced through the environment to cause
+#	the library Makefile's CFLAGS definition to override any in the
+#	environment.
+
+# LSOF_DISTRIBKVM may be introduced through the environment to specify the
+#	Sun4 kernel virtual memory type of distrib.cf
+
+LSOF_F="ddev.c dfile.c dlsof.h dmnt.c dnode*.c dproc.c dproto.h dsock.c dstore.c dzfs.h kernelbase.h machine.h machine.h.old new_machine.h __lseek.s"
+LSOF_HLP_BASE=./cfghlp.
+LSOF_HLP=${LSOF_HLP_BASE}$$
+
+# LSOF_LOCALSUFFIX may be introduced through the environment to select a local
+#	version of a Makefile.  It is used as a suffix to $LSOF_MKF.
+
+# LSOF_MAKE may be introduced through the environment to specify a path to the
+#	make command.   It defaults to `which make`, if that is non-NULL;
+#	otherwise to the string "make".
+
+if test "X$LSOF_MAKE" = "X"	# {
+then
+  LSOF_MAKE=`which make`
+  if test "X$LSOF_MAKE" = "X"	# {
+  then
+    LSOF_MAKE=make
+  fi	# }
+fi	# }
+
+LSOF_MK=Mksrc
+
+# LSOF_MKC is the dialect's Mksrc create command -- default "ln -s".
+
+# LSOF_MKFC may be introduced though the environment to change the name
+# used for the created make file.
+
+if test "X$LSOF_MKFC" = "X"	# {
+then
+  LSOF_MKFC=Makefile
+fi	# }
+
+LSOF_LIB=lib
+LSOF_MKF=Makefile
+LSOF_LIBMKF=Makefile
+LSOF_LIBMKFSKEL=Makefile.skel
+
+LSOF_VF=version
+
+# Make sure no other variable important to Makefile construction is
+# already set in the environment.
+#
+#	$AFS_VICE	    locatiion of AFS VICE directory
+#				(default = /usr/vice)
+#	$LSOF_AFS	    AFS temporary
+#	$LSOF_AFS_NQ	    AFS-not-qualified flag
+#	$LSOF_AFSV	    AFS version
+#	$LSOF_AR	    archive command and its arguments for making the
+#			    lsof library
+#	$LSOF_ARCH	    Unix dialect architecture as a string (may be
+#			    supplied externally)
+#	$LSOF_CC	    C compiler name (may be supplied externally)
+#	$LSOF_CCV	    C compiler version (may be supplied externally)
+#	$LSOF_CDIR	    configuration directory
+#	$LSOF_CFGD	    depend options
+#	$LSOF_CFGDN	    depend file name
+#	$LSOF_CFGF	    C flags -- e.g., -D's
+#	$LSOF_CFGL	    last lsof library loader flags -- e.g., -l's
+#	$LSOF_CINFO	    Configure information for LSOF_CINFO in version.h
+#	$LSOF_CTFH	    Solaris 10 and above libctf.h status
+#	$LSOF_CTFL	    Solaris 10 and above -lctf status
+#	$LSOF_DEBUG	    Makefile's DEBUG string
+#	$LSOF_DINC	    include flags -- -I's
+#	$LSOF_DINC_ADD	    include flags status
+#	$LSOF_DOC	    special document (man page) directory path
+#	$LSOF_ERR	    internal error flag
+#	$LSOF_FCFGL	    first lsof library loader flags -- e.g., -l's
+#			    that must precede $LSOF_LIB
+#	$LSOF_FBSD_ZFS      FreeBSD $LSOF_FBSD_ZFS_MKF status
+#	$LSOF_FBSD_ZFS_CFGF FreeBSD ZFS configure flags
+#	$LSOF_FBSD_ZFS_MKF  FreeBSD ZFS Makefile name
+#	$LSOF_FBSD_ZFS_SYS  FreeBSD ZFS system sources location
+#	$LSOF_HOST	    host name (e.g., from uname -n)
+#	$LSOF_INCLUDE	    directory where header files are found
+#			    (default = /usr/include)
+#	$LSOF_LD	    loader name if not $LSOF_CC
+#	$LSOF_LIB_NO	    if "N" don't configure the lsof library
+#	$LSOF_LOCALSUFFIX   local suffix for Makefile
+#	$LSOF_NBSD_BUFQH    NetBSD <sys/bufq.h> copy status
+#	$LSOF_NBSD_PTYFS    NetBSD ${NETBSD_SYS}/sys/fs/ptyfs/ copy status
+#	$LSOF_N_UNIXV	    *BSD system's kernel file
+#	$LSOF_OPINC	    supplies additional -I/path arguments for the
+#			    Makefile's CFLAGS.
+#	$LSOF_PL	    patch level
+#	$LSOF_RANLIB	    randomizing command for the lsof library
+#	$LSOF_RANLIB_SUP    if non-NULL $LSOF_RANLIB was supplied
+#	$LSOF_SCRIPT_CALL   Customize and Inventory scripts call status
+#	$LSOF_SPMKF	    Special Makefile name
+#	$LSOF_TGT	    canonical target abbreviation (shortest)
+#	$LSOF_TMP	    internal temporary
+#	$LSOF_TMP1	    internal temporary
+#	$LSOF_TMP2	    internal temporary
+#	$LSOF_TMP3	    internal temporary
+#	$LSOF_TMP4	    internal temporary
+#	$LSOF_TMP5	    internal temporary
+#	$LSOF_TMP6	    internal temporary
+#	$LSOF_TMPC_BASE	    base name for $LSOF_TMPC
+#	$LSOF_TMPC	    temporary C source file base name
+#	$LSOF_TSTBIGF	    big file capability (for $LSOF_TSTCFLG)
+#	$LSOF_TSTCC	    tests CC file
+#	$LSOF_TSTCFLG	    tests CFLAGS file
+#	$LSOF_TSTDFLG	    dialect-specific values for $LSOF_TSTCFLG
+#	$LSOF_TSTK64	    status of 64 bit kernel (for $LSOF_TSTCFLG)
+#	$LSOF_TSTKMEM	    /dev/kmem usage status (for $LSOF_TSTCFLG)
+#	$LSOF_TSTLFF	    tests LDFLAGS file
+#	$LSOF_TSTLFLG	    tests LDFLAGS values
+#	$LSOF_TSTSUBD	    test subdirectory
+#	$LSOF_TSTVPATH	    test v_path state (for $LSOF_TSTCFLG)
+#	$LSOF_TSTXO	    test extra objects (for $LSOF_TSTXOC)
+#	$LSOF_TSTXOC	    test extra objects file
+#	$LSOF_UNSUP	    Lsof is unsupported on this dialect
+#	$LSOF_UNSUP2	    Second message about lack of support
+#	$LSOF_VERS	    Unix dialect version as a decimal number (may
+#			    be supplied externally)
+#	$LSOF_VSTR	    Unix dialect version as a string -- may be supplied
+#			    externally
+
+if test "X$AFS_VICE" = "X"	# {
+then
+  AFS_VICE="/usr/vice"
+fi	# }
+LSOF_AFS=""
+LSOF_AFS_NQ=""
+LSOF_AFSV=""
+if test "X$LSOF_ARCH" = "X"	# {
+then
+  LSOF_ARCH=""
+fi	# }
+LSOF_CDIR=""
+LSOF_CFGD=""
+LSOF_CFGDN=""
+LSOF_CINFO=""
+LSOF_CTFH=0
+LSOF_CTFL=0
+LSOF_DEBUG=""
+LSOF_DOC=""
+LSOF_ERR=""
+LSOF_FCFGL=""
+LSOF_FBSD_ZFS=0
+LSOF_FBSD_ZFS_CFGF=""
+LSOF_FBSD_ZFS_MKF="Makefile.zfs"
+LSOF_FBSD_ZFS_SYS=""
+LSOF_HOST=""
+if test "X$LSOF_INCLUDE" = "X"	# {
+then
+  LSOF_DINC=""
+  LSOF_INCLUDE="/usr/include"
+else
+  LSOF_DINC="-I$LSOF_INCLUDE"
+fi	# }
+LSOF_LD=""
+LSOF_LIB_NO=""
+LSOF_PL=""
+if test "X$LSOF_RANLIB" = "X"	# {
+then
+  LSOF_RANLIB="ranlib"
+  LSOF_RANLIB_SUP=""
+else
+  LSOF_RANLIB_SUP="Y"
+fi	# }
+LSOF_SCRIPT_CALL="yes"
+LSOF_SPMKF=""
+LSOF_TMP1=""
+LSOF_TMP2=""
+LSOF_TMPC_BASE=./lsof_Configure_tmp_
+LSOF_TMPC=${LSOF_TMPC_BASE}$$
+LSOF_TSTBIGF=""
+LSOF_TSTSUBD="./tests"
+LSOF_TSTCC="${LSOF_TSTSUBD}/config.cc"
+LSOF_TSTCFLG="${LSOF_TSTSUBD}/config.cflags"
+LSOF_TSTDFLG=""
+LSOF_TSTK64=0
+LSOF_TSTKMEM=1
+LSOF_TSTLFF="${LSOF_TSTSUBD}/config.ldflags"
+LSOF_TSTLFLG=""
+LSOF_TSTVPATH=0
+LSOF_TSTXO=""
+LSOF_TSTXOC="${LSOF_TSTSUBD}/config.xobj"
+LSOF_UNSUP="WARNING: unsupported dialect or version"
+LSOF_UNSUP2=""
+if test "X$LSOF_VERS" = "X"	# {
+then
+  LSOF_VERS=""
+fi	# }
+if test "X$LSOF_VSTR" = "X"	# {
+then
+  LSOF_VSTR=""
+fi	# }
+
+# Establish echo type -- Berkeley or SYSV.
+
+j=`echo -n ""`
+if test "X$j" = "X-n "
+then
+  EC="\c"
+  EO=""
+else
+  EC=""
+  EO="-n"
+fi
+
+# Make sure temporary files are removed before an abnormal exit.
+
+trap 'rm -f ${LSOF_HLP_BASE}* ${LSOF_TMPC_BASE}*; exit 1' 1 2 3 15
+
+rm -f $LSOF_HLP
+cat > $LSOF_HLP << LSOF_HLP
+Usage: Configure <options> <target-dialect>
+  <options>:  -clean        : clean up previous configuration
+              -d|-dialects  : display a list of supported dialect versions
+              -h|-help      : display help information
+              -n            : avoid AFS, customization, and inventory checks
+  <target-dialect> (****USE -d TO GET TESTED DIALECT VERSION NUMBERS****):
+    aix|aixgcc              : IBM AIX xlc (aix) or gcc (aixgcc)
+    darwin                  : Apple Darwin
+    decosf                  : DEC OSF/1
+    digital_unix|du         : Digital UNIX
+    freebsd                 : FreeBSD
+    hpux|hpuxgcc            : HP-UX cc (hpux) or gcc (hpuxgcc)
+    linux                   : Linux
+    netbsd                  : NetBSD
+    nextstep|next|ns|nxt    : NEXTSTEP
+    openbsd                 : OpenBSD
+    openstep|os             : OPENSTEP
+    osr|sco                 : SCO OpenServer < 6.0.0, SCO devloper's compiler
+    osrgcc|scogcc           : SCO OpenServer < 6.0.0, gcc compiler
+    osr6                    : SCO OpenServer 6.0.0, SCO compiler
+    solaris|solariscc       : Solaris gcc (solaris) or cc (solariscc)
+    tru64		    : Tru64 UNIX
+    unixware|uw             : SCO|Caldera UnixWare
+LSOF_HLP
+
+LSOF_TGT="no-target"
+
+args=$#
+while test $args -gt 0	# {
+do
+  case $1 in	# {
+    -clean)
+      if test -r $LSOF_MKFC	# {
+      then
+	echo "$LSOF_MAKE -f $LSOF_MKFC clean"
+	$LSOF_MAKE -f $LSOF_MKFC clean
+      else
+	if test -r ${LSOF_LIB}/${LSOF_LIBMKF}	# {
+	then
+	  echo "(cd ${LSOF_LIB}; $LSOF_MAKE -f ${LSOF_LIBMKF} clean)"
+	  (cd ${LSOF_LIB}; $LSOF_MAKE -f ${LSOF_LIBMKF} clean)
+	else
+	  if test -r ${LSOF_LIB}/${LSOF_LIBMKF}.skel	# {
+	  then
+	    echo "(cd ${LSOF_LIB}; $LSOF_MAKE -f ${LSOF_LIBMKF}.skel clean)"
+	    (cd ${LSOF_LIB}; $LSOF_MAKE -f ${LSOF_LIBMKF}.skel clean)
+	  fi	# }
+	fi	# }
+      fi	# }
+      if test -r ${LSOF_TSTSUBD}/Makefile	# {
+      then
+	echo "(cd ${LSOF_TSTSUBD}; $LSOF_MAKE spotless)"
+	(cd ${LSOF_TSTSUBD}; $LSOF_MAKE spotless)
+      else
+	echo '(cd ${LSOF_TSTSUBD}; rm *.o config.*)'
+	(cd ${LSOF_TSTSUBD}; rm *.o config.*)
+      fi	# }
+      rm -f $LSOF_F $LSOF_MKFC $LSOF_FBSD_ZFS_MKF ${LSOF_TMPC_BASE}*
+      echo rm -f $LSOF_F $LSOF_MKFC $LSOF_FBSD_ZFS_MKF ${LSOF_TMPC_BASE}*
+      rm -rf AFSHeaders AFSVersion solaris11 version.h vnode_if.h
+      echo "rm -rf AFSHeaders AFSVersion solaris11 version.h vnode_if.h"
+      rm -f ${LSOF_HLP_BASE}* cd9660_node.h lockf_owner.h fbsd_minor.h
+      echo "rm -f ${LSOF_HLP_BASE}* cd9660_node.h lockf_owner.h fbsd_minor.h"
+      rm -f opt_kdtrace.h opt_random.h
+      echo "rm -f opt_kdtrace.h opt_random.h"
+      rm -f dialects/aix/aix5/j2/j2_snapshot.h
+      echo "rm -f dialects/aix/aix5/j2/j2_snapshot.h"
+      rm -f dialects/sun/solaris10	# DEBUG -- for s10_44
+      echo "rm -f dialects/sun/solaris10"	# DEBUG -- for s10_44
+      rm -f dialects/du/du5_sys_malloc.h
+      echo "rm -f dialects/du/du5_sys_malloc.h"
+      rm -f dialects/hpux/kmem/hpux_mount.h
+      echo "rm -f dialects/hpux/kmem/hpux_mount.h"
+      rm -rf dialects/n+obsd/include
+      echo "rm -rf dialects/n+obsd/include"
+      rm -f dialects/uw/uw7/vm/swap.h
+      echo "rm -f dialects/uw/uw7/vm/swap.h"
+      rm -f ${LSOF_LIB}/${LSOF_LIBMKF}
+      echo "rm -f ${LSOF_LIB}/${LSOF_LIBMKF}"
+      exit 0
+      ;;
+ 
+    -d|-dialects)
+      if test -r ./00DIALECTS -a -r ./version	# {
+      then
+	V=`sed '/VN/s/.ds VN \(.*\)/\1/' version`
+	echo "lsof $V has been *tested* on these UNIX dialect versions:"
+	cat 00DIALECTS
+	echo Although "$V hasn't been tested on other versions of these dialects,"
+	echo "it may work.  Try \`Configure <dialect>\` and \`make\` to see."
+	rm -f $LSOF_HLP
+	exit 0
+      else
+	echo "Can't display UNIX dialect version information:"
+	if test ! -r ./00DIALECTS	# {
+	then
+	  echo "	./00DIALECTS is inaccessible."
+	fi	# }
+	if test ! -r ./version	# {
+	then
+	  echo "	./version is inaccessible."
+	fi	# }
+	rm -f $LSOF_HLP
+	exit 1
+      fi	# }
+      ;;
+
+    -h|-help) cat $LSOF_HLP
+      rm -f $LSOF_HLP
+      exit 0
+      ;;
+
+    -n*)
+      LSOF_SCRIPT_CALL="no"
+      ;;
+
+    *)
+      if test "X$LSOF_TGT" != "Xno-target"	# {
+      then
+	echo "Only one dialect may be configured at a time."
+	echo 'Both "$LSOF_TGT" and "$1" were specified.'
+	cat $LSOF_HLP
+	rm -f $LSOF_HLP
+	exit 1
+      else
+	LSOF_TGT=$1
+      fi	# }
+      ;;
+  esac	# }
+  shift
+  args=`expr $args - 1`
+done	# }
+
+case $LSOF_TGT in	# {
+ no-target)
+   echo "No target dialect was specified."
+   cat $LSOF_HLP
+   rm -f $LSOF_HLP
+   exit 1
+   ;;
+
+# Configure for AIX xlc and AIX gcc.
+
+  aix|aixgcc)
+
+  # AIXA stands for AIX architecture.  It is assigned these values in this
+  # stanza:
+  #
+  #    0	The AIX version is < 5.0, or the AIX 5.0 architecture is
+  #		Power and the kernel bit size is 32.
+  #
+  #    1	The AIX version is >= 5.0, the AIX architecture is Power,
+  #		and the kernel bit size is 64.
+  #
+  #    2	The AIX version is >= 5.0 and the architecture is IA64.
+
+    if test "X$LSOF_RANLIB_SUP" = "X"	# {
+    then
+      LSOF_RANLIB="@echo \\\\\\\\c"    # AIX make doesn't like a null ${RANLIB}.
+    fi	# }
+    if test "X$LSOF_VSTR" = "X"	# {
+    then
+
+      # If the AIX version isn't pre-defined, determine it.
+
+      LSOF_TMP1=`uname -v`
+      if test "X$LSOF_TMP1" = "X5"	# {
+      then
+
+	# If the AIX version is 5, build the version string with `uname -rv`
+	# output.
+
+	  LSOF_VSTR=`uname -r | awk '{printf "5.%d.0.0\n",\$1}'`
+	  echo "Uname reports the version is $LSOF_VSTR."
+      else
+
+	# See if oslevel can determine the version.
+
+	LSOF_TMP1=/usr/bin/oslevel
+	if test -x $LSOF_TMP1	# {
+	then
+	  echo "Determining AIX version with $LSOF_TMP1."
+	  echo "This may take a while, depending on your maintenance level."
+	  LSOF_VSTR=`$LSOF_TMP1 | sed 's/[^0-9]*\([0-9\.]*\).*/\1/'`
+	  echo "$LSOF_TMP1 reports the version is $LSOF_VSTR."
+	else
+
+	  # If oslevel can't be used, build the version string with
+	  # `uname -rv` and issue a warning.
+
+	  LSOF_VSTR=`uname -rv | awk '{printf "%d.%d.0.0\n",\$2,\$1}'`
+	  echo "WARNING: can't execute $LSOF_TMP1; uname -rv reports"
+	  echo "         the version is $LSOF_VSTR; edit CFGF in Makefile and"
+	  echo "         lib/Makefile to refine AIXV and LSOF_VSTR."
+	fi	# }
+      fi	# }
+    fi	# }
+    if test "X$LSOF_VERS" = "X"	# {
+    then
+      LSOF_VERS=`echo $LSOF_VSTR | sed 's/\.//g'`
+    fi	# }
+    if test $LSOF_VERS -ge 4320	# {
+    then
+      LSOF_TSTBIGF=" "
+    fi	# }
+    if test "X$LSOF_CC" = "X"	# {
+    then
+      if test "X$LSOF_TGT" = "Xaixgcc"	# {
+      then
+	LSOF_CC=gcc
+	LSOF_CCV=`$LSOF_CC -v 2>&1 | sed -n 's/.*version \(.*\)/\1/p'`
+      else
+	LSOF_CC=cc
+      fi	# }
+    fi	# }
+    LSOF_TGT="aix"
+    echo $LSOF_CC | grep gcc > /dev/null
+    if test $? -eq 0	# {
+    then
+
+    # Prevent use of gcc for AIX below 4.1.
+
+      if test $LSOF_VERS -lt 4100	# {
+      then
+	echo "********************************************************"
+	echo "* Sorry, but gcc can't be used to compile lsof for AIX *"
+	echo "* versions less than 4.1, because of possible kernel   *"
+	echo "* structure alignment differences between it and xlc.  *"
+	echo "********************************************************"
+	rm -f $LSOF_HLP
+	exit 1
+      fi	# }
+    fi	# }
+
+    # Test for AFS.
+
+    if test "X$AIX_HAS_AFS" != "X"	# {
+    then
+      LSOF_AFS=$AIX_HAS_AFS
+    fi	# }
+    if test "X$LSOF_AFS" != "Xno"	# {
+    then
+      if test "X$LSOF_AFS" = "Xyes" -o -r ${AFS_VICE}/etc/ThisCell	# {
+      then
+	if test "X$LSOF_AFS" != "Xyes"	# {
+	then
+	  if test "X$LSOF_SCRIPT_CALL" = "Xno"	# {
+	  then
+	    if test -r ./AFSHeaders -a -r ./AFSVersion	# {
+	    then
+	      LSOF_AFS="yes"
+	    fi	# }
+	  else
+	    if test ! -x ./AFSConfig	# {
+	    then
+	      echo "Can't find or execute the AFSConfig script"
+	      rm -f $LSOF_HLP
+	      exit 1
+	    fi	# }
+	    ./AFSConfig
+	    if test $? -eq 0 -a -r ./AFSHeaders -a -r ./AFSVersion	# {
+	    then
+	      LSOF_AFS="yes"
+	    fi	# }
+	  fi	# }
+	fi	# }
+	if test "X$LSOF_AFS" = "Xyes"	# {
+	then
+	  if test "X$LSOF_AFSV" = "X"	# {
+	  then
+	    if test -r ./AFSVersion	# {
+	    then
+	      LSOF_AFSV=`cat ./AFSVersion | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1 \2/' | awk '{printf "%d%02d\n",\$1,\$2}'`
+	    else
+	      echo "!!!FATAL: no ./AFSVersion file.  It should have been"
+	      echo "          created by a previous AFS configuration run."
+	      rm -f $LSOF_HLP
+	      exit 1
+	    fi	# }
+	  fi	# }
+	  if test $LSOF_VERS -gt 4330 -o LSOF_AFSV -gt 305	# {
+	  then
+	    echo "!!!FATAL: Lsof does not support AFS on this combination of"
+	    echo "          AIX ($LSOF_VERS) and AFS ($LSOF_AFSV) versions."
+	    echo "          To disable AFS, set the value of the AIX_HAS_AFS"
+	    echo "          environment variable to \"no\"."
+	    rm -f $LSOF_HLP
+	    exit 1
+	  else
+	    LSOF_CFGF="$LSOF_CFGF -DHAS_AFS=$LSOF_AFSV"
+	    LSOF_DINC="$LSOF_DINC -I`cat ./AFSHeaders`"
+	    if test -r ${LSOF_INCLUDE}/sys/inttypes.h  # {
+	    then
+	      grep "^typedef.*int16;" ${LSOF_INCLUDE}/sys/inttypes.h > /dev/null
+	      if test $? -eq 0      # {
+	      then
+		LSOF_CFGF="$LSOF_CFGF -DHASINT16TYPE"
+	      fi    # }
+	      grep "^typedef.*u_int32;" ${LSOF_INCLUDE}/sys/inttypes.h > /dev/null
+	      if test $? -eq 0      # {
+	      then
+		LSOF_CFGF="$LSOF_CFGF -DHASUINT16TYPE"
+	      fi    # }
+	      grep "^typedef.*int32;" ${LSOF_INCLUDE}/sys/inttypes.h > /dev/null
+	      if test $? -eq 0      # {
+	      then
+		LSOF_CFGF="$LSOF_CFGF -DHASINT32TYPE"
+	      fi    # }
+	    fi	# }
+	  fi      # }
+	fi	# }
+      fi	# }
+    fi	# }
+
+    # Miscellaneous AIX tests
+
+    if test -d ${LSOF_INCLUDE}/nfs	# {
+    then
+      LSOF_CFGF="$LSOF_CFGF -DHAS_NFS"
+    fi	# }
+    echo $LSOF_CC | grep cc | grep -v gcc > /dev/null
+    if test $? -eq 0 -a $LSOF_VERS -ge 4140 -a $LSOF_VERS -lt 5000	# {
+    then
+      LSOF_CFGL="$LSOF_CFGL -bnolibpath"
+    fi	# }
+    if test -r ${LSOF_INCLUDE}/sys/socket.h	# {
+    then
+      grep AF_INET6 ${LSOF_INCLUDE}/sys/socket.h > /dev/null
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
+      fi	# }
+    fi	# }
+    if test -r ${LSOF_INCLUDE}/sys/stat.h	# {
+    then
+      grep stat64 ${LSOF_INCLUDE}/sys/stat.h > /dev/null
+      if test $? -eq 0 # {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASSTAT64"
+      fi	# }
+    fi	# }
+#DEBUG SANFS    if test -r ${LSOF_INCLUDE}/sys/sanfs/sanfsnode.h???	# {
+#DEBUG SANFS    then
+#DEBUG SANFS      LSOF_CFGF="$LSOF_CFGF -DHAS_SANFS"
+#DEBUG SANFS    fi	# }
+    if test $LSOF_VERS -ge 5000	# {
+    then
+
+    # This is AIX 5 or greater.
+
+      if test -d ${LSOF_INCLUDE}/j2	# {
+      then
+
+      # The AIX > 5.0 system has jfs2 support.  Make the necesssary definitions
+      # and adjustments.
+
+	rm -f dialects/aix/aix5/j2/j2_snapshot.h
+	(cd dialects/aix/aix5/j2; ln -s private_j2_snapshot.h j2_snapshot.h)
+	LSOF_CFGF="$LSOF_CFGF -DHAS_JFS2"
+	LSOF_CFGF="$LSOF_CFGF -I`pwd`/dialects/aix/aix5"
+	if test $LSOF_VERS -ge 5200	# {
+	then
+	  if test -r ${LSOF_INCLUDE}/j2/j2_snapshot.h	# {
+	  then
+
+	  # The system has its own j2_snapshot.h, so make sure the
+	  # private lsof copy is discarded.
+
+	    rm -f dialects/aix/aix5/j2/j2_snapshot.h
+	  fi	# }
+	  echo $LSOF_CC | grep gcc > /dev/null
+	  if test $? -eq 0	# {
+	  then
+
+	  # Test gcc version for AIX 5.2.
+
+	    LSOF_TMP1=`echo $LSOF_CCV | awk -F . '{printf "%d%02d",$1,$2}'`
+	    if test $LSOF_TMP1 -ge 303	# {
+	    then
+
+	    # Add gcc >= 3.3 option to handle use of i_dev from the wInode
+	    # anonymous structure reference in the JFS2 inode structure of
+	    # <j2/j2_inode.h>.
+
+	      LSOF_CFGF="$LSOF_CFGF -fms-extensions"
+	    fi	# }
+	  fi	#}
+	fi	# }
+      fi	# }
+
+      # Determine the AIX architecture type and set AIXA accordingly.
+
+      if test "X$AIX_ARCH" = "X"	# {
+      then
+	uname -a | grep -i ia64 > /dev/null
+	if test $? -eq 0	# {
+	then
+	  AIX_ARCH="ia64"
+	else
+	  AIX_ARCH=""
+	fi	# }
+      fi	# }
+      if test "X$AIX_ARCH" = "Xia64"	# {
+      then
+
+      # This is AIX >= 5 on ia64.
+
+	LSOF_TSTK64=1
+	echo $LSOF_CC | grep gcc > /dev/null
+	if test $? -eq 0	# {
+	then
+
+	# Quit if gcc was specified as the compiler, since the gcc options to
+	# do an ia64 lsof compilation are unknown.
+
+	  echo "*************************************************************"
+	  echo "*                                                           *"
+	  echo "* !!!!!!!!!!!!!!!!!!!!! FATAL ERROR !!!!!!!!!!!!!!!!!!!!!!! *"
+	  echo "*                                                           *"
+	  echo "* Gcc can't be used to compile lsof for AIX 5 and above on  *"
+	  echo "* the ia64 architecture.  Consult lsof's FAQ (in the file   *"
+	  echo "* 00FAQ) for more information.                              *"
+	  echo "*                                                           *"
+	  echo "*************************************************************"
+	  rm -f $LSOF_HLP
+	  exit 1
+	fi	# }
+	LSOF_TMP1=2
+	if test "X$LSOF_AR" = "X"	# {
+	then
+	  LSOF_AR="/usr/bin/ar cr"
+	fi	# }
+	LSOF_CFGF="$LSOF_CFGF -q64"
+	LSOF_CFGL="$LSOF_CFGL -lelf"
+      else
+
+      # This is AIX >= 5 on Power architecture.
+
+	echo $LSOF_CC | grep cc | grep -v gcc > /dev/null
+	if test $? -eq 0	# {
+	then
+	  LSOF_CFGL="$LSOF_CFGL -bnolibpath"
+	fi	# }
+	if test "X$AIX_KERNBITS" = "X"	# {
+	then
+
+	# The kernel bit size wasn't predefined.  Determine it by compiling
+	# and executing a test program.
+
+	  rm -f ${LSOF_TMPC}.*
+	  echo "#include <sys/systemcfg.h>" > ${LSOF_TMPC}.c
+	  echo 'main(){ if (__KERNEL_32()) printf("32\\n");' >> ${LSOF_TMPC}.c
+	  echo 'else if (__KERNEL_64()) printf("64\\n");' >> ${LSOF_TMPC}.c
+	  echo 'else printf("0\\n");' >> ${LSOF_TMPC}.c
+	  echo "return(0); }" >> ${LSOF_TMPC}.c
+	  echo "Testing kernel bit size with $LSOF_CC"
+	  $LSOF_CC ${LSOF_TMPC}.c -o ${LSOF_TMPC}.x
+	  if test ! -x ${LSOF_TMPC}.x	# {
+	  then
+	    echo "!!!FATAL: can't compile test program, ${LSOF_TMPC}.c."
+	    rm -f $LSOF_HLP rm -f ${LSOF_TMPC}.*
+	    exit 1
+	  fi	# }
+	  AIX_KERNBITS=`./${LSOF_TMPC}.x`
+	  rm -f ${LSOF_TMPC}.*
+	fi	# }
+
+      # Use the kernel bit size specification to select archiver and compiler
+      # options, and to update AIXA.
+
+	case $AIX_KERNBITS in	# {
+	32)
+	  if test "X$LSOF_AR" = "X"	# {
+	  then
+	    LSOF_AR="/usr/bin/ar cr"
+	  fi	# }
+	  LSOF_TMP1=0
+	  ;;
+	64)
+	  if test "X$LSOF_AR" = "X"	# {
+	  then
+	    LSOF_AR="/usr/bin/ar -X 64 -v -q"
+	  fi	# }
+	  LSOF_TSTK64=1
+	  LSOF_TMP1=1
+	  echo $LSOF_CC | grep gcc > /dev/null
+	  if test $? -eq 0	# {
+	  then
+	    LSOF_CFGF="$LSOF_CFGF -maix64"
+	  else
+	    LSOF_CFGF="$LSOF_CFGF -q64"
+	  fi	# }
+	  ;;
+	*)
+	  echo "!!!FATAL: unrecognized kernel bit size: $AIX_KERNBITS"
+	  rm -f $LSOF_HLP
+	  exit 1
+	esac	# }
+
+      # Put kernel bit size information in $LSOF_CINFO and $LSOF_CFGF.
+
+	echo "Kernel bit size: $AIX_KERNBITS"
+	LSOF_TMP2="${AIX_KERNBITS} bit kernel"
+	if test "X$LSOF_CINFO" != "X"	# {
+	then
+	  LSOF_CINFO="${LSOF_CINFO}  ${LSOF_TMP2}"
+	else
+	  LSOF_CINFO="${LSOF_TMP2}"
+	fi	# }
+	LSOF_CFGF="$LSOF_CFGF -DAIX_KERNBITS=${AIX_KERNBITS}"
+      fi	# }
+      LSOF_CFGF="$LSOF_CFGF -DAIXA=$LSOF_TMP1"
+      if test "X$LSOF_TSTDFLG" = "X"	# {
+      then
+	LSOF_TSTDFLG="-DLT_AIXA=$LSOF_TMP1"
+      else
+	LSOF_TSTDFLG="$LSOF_TSTDFLG -DLT_AIXA=$LSOF_TMP1"
+      fi	# }
+    else
+
+    # AIX is < 5, so set AIXA accordingly.
+
+      LSOF_CFGF="$LSOF_CFGF -DAIXA=0"
+      if test "X$LSOF_TSTDFLG" = "X"	# {
+      then
+	LSOF_TSTDFLG="-DLT_AIXA=0"
+      else
+	LSOF_TSTDFLG="$LSOF_TSTDFLG -DLT_AIXA=0"
+      fi	# }
+    fi	#}
+    LSOF_CFGF="$LSOF_CFGF -DAIXV=$LSOF_VERS"
+    LSOF_DIALECT_DIR=aix
+    echo $LSOF_CC | grep gcc > /dev/null
+    if test $? -eq 0 	# {
+    then
+
+    # Do gcc tests.
+
+      if test $LSOF_VERS -ge 4100 -a $LSOF_VERS -lt 4200	# {
+      then
+	if test "X$AIX_USHACK" = "X"	# {
+	then
+
+	  # Compile and run a gcc test program to evaluate the user structure.
+
+	  rm -f ${LSOF_TMPC}.*
+	  echo "#include <stddef.h>" > ${LSOF_TMPC}.c
+	  echo "#include <sys/user.h>" >> ${LSOF_TMPC}.c
+	  echo "main(){exit((offsetof(struct user, U_irss) & 0x7) ? 1 : 0);}" >>${LSOF_TMPC}.c
+	  echo "Testing user.h with $LSOF_CC"
+	  $LSOF_CC ${LSOF_TMPC}.c -o ${LSOF_TMPC}.x
+	  if ! ${LSOF_TMPC}.x	# {
+	  then
+	    LSOF_TMP1=1
+	  else
+	    LSOF_TMP1=0
+	  fi	# }
+	  rm -f ${LSOF_TMPC}.*
+	else
+	  if test "$AIX_USHACK" = "Y" -o "$AIX_USHACK" = "y"	# {
+	  then
+	    LSOF_TMP1=1
+	  else
+	    LSOF_TMP1=0
+	  fi	# }
+	fi	# }
+	if test ${LSOF_TMP1} -eq 1	# {
+	then
+	  echo "Applying gcc AIX 4.1+ user struct alignment hack"
+	  rm -rf ./dialects/aix/aix$LSOF_VERS
+	  mkdir ./dialects/aix/aix$LSOF_VERS
+	  mkdir ./dialects/aix/aix${LSOF_VERS}/sys
+	    sed 's/U_irss\[/dummy_for_alignment, U_irss\[/' < ${LSOF_INCLUDE}/sys/user.h > ./dialects/aix/aix${LSOF_VERS}/sys/user.h
+	    LSOF_CFGF="$LSOF_CFGF -U_LONG_LONG -I`pwd`/dialects/aix/aix$LSOF_VERS"
+	fi	# }
+      fi	# }
+    else
+
+      # Get xlc version number
+
+      rm -f ${LSOF_TMPC}.*
+      echo "main(){}" > ${LSOF_TMPC}.c
+      echo "Getting version number of ${LSOF_CC}."
+      $LSOF_CC -c ${LSOF_TMPC}.c -I${LSOF_INCLUDE} -o ${LSOF_TMPC}.o -qlist > /dev/null 2>&1
+      LSOF_CCV=`head -1 ${LSOF_TMPC}.lst | sed 's/\(.*\) ---.*/\1/'`
+      rm ${LSOF_TMPC}.*
+      echo "The version is \"${LSOF_CCV}\"."
+      echo $LSOF_CCV | grep "Version [0-9]" > /dev/null
+      if test $? -eq 0	# {
+      then
+	LSOF_TMP=`echo $LSOF_CCV | sed 's/.*Version \([0-9]*\).*/\1/'`
+	if test "X$LSOF_TMP" != "X" -a $LSOF_TMP -ge 4    # {
+	then
+	  if test $LSOF_TMP -ge 6	# {
+	  then
+	    LSOF_CFGF="$LSOF_CFGF -qmaxmem=-1"
+	  else
+	    LSOF_CFGF="$LSOF_CFGF -qmaxmem=16384"
+	  fi	# }
+	fi	# }
+      fi	# }
+    fi	# }
+    if test $LSOF_VERS -ge 5300	# {
+    then
+      LSOF_UNSUP=""
+    fi	# }
+    ;;
+
+# Configure for Apple Darwin.
+
+  darwin)
+    if test "X$LSOF_CC" = "X"	# {
+    then
+      LSOF_CC=cc
+      LSOF_CCV=`$LSOF_CC -v 2>&1 | sed -n 's/.*version \(.*\)/\1/p'`
+    fi	# }
+    if test "X$LSOF_VSTR" = "X"	# {
+    then
+      LSOF_VSTR=`uname -r`
+    fi	# }
+    if test "X$LSOF_VERS" = "X"	# {
+    then
+
+    # If the Darwin / Mac OS X version isn't pre-defined, determine it.
+
+      case $LSOF_VSTR in	# {
+      1.2*)
+	LSOF_VERS=120
+	;;
+      1.3*)
+	LSOF_VERS=130
+	;;
+      1.4*)
+	LSOF_VERS=140
+	;;
+      5.[012]*)
+	LSOF_VERS=500
+	;;
+      5.[3-9]*)
+	LSOF_VERS=530
+	;;
+      6.*)
+	LSOF_VERS=600
+	;;
+      7.*)			# Mac OS X 10.3 (Panther)
+	LSOF_VERS=700
+	;;
+      8.*)			# Mac OS X 10.4 (Tiger)
+	LSOF_VERS=800
+	;;
+      9.*)			# Mac OS X 10.5 (Leopard)
+	LSOF_VERS=900
+ 	;;
+      10.*)			# Mac OS X 10.6 (SnowLeopard)
+ 	LSOF_VERS=1000
+ 	;;
+      11.*)			# Mac OS X 10.7 (Lion)
+ 	LSOF_VERS=1100
+ 	;;
+      12.*)			# Mac OS X 10.8 (Mountain Lion)
+ 	LSOF_VERS=1200
+ 	;;
+      13.*)			# Next Mac OS X
+	LSOF_VERS=1300
+	;;
+      *)
+	echo Unknown Darwin release: `uname -r`
+	echo Assuming Darwin 12.0
+	LSOF_VERS=1200
+	;;
+      esac	# }
+    fi	# }
+
+    # Do Darwin version-specific stuff.
+
+    case $LSOF_VERS in	# {
+    120|130)
+      LSOF_TMP1="hfs/hfs.h hfs/hfs_macos_defs.h miscfs/devfs/devfsdefs.h miscfs/devfs/devfs_proto.h miscfs/fdesc/fdesc.h"
+      ;;
+    140|500)
+      LSOF_TMP1="hfs/hfs.h hfs/hfs_macos_defs.h hfs/rangelist.h miscfs/devfs/devfsdefs.h miscfs/devfs/devfs_proto.h miscfs/fdesc/fdesc.h"
+      ;;
+    530)
+      LSOF_TMP1="hfs/hfs.h hfs/hfs_macos_defs.h hfs/rangelist.h miscfs/devfs/devfsdefs.h miscfs/devfs/devfs_proto.h miscfs/fdesc/fdesc.h net/ndrv.h net/ndrv_var.h"
+      ;;
+    600)
+      LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
+      LSOF_TMP1="hfs/hfs.h hfs/hfs_catalog.h hfs/hfs_cnode.h hfs/hfs_macos_defs.h hfs/rangelist.h miscfs/devfs/devfsdefs.h miscfs/devfs/devfs_proto.h miscfs/fdesc/fdesc.h net/ndrv_var.h net/raw_cb.h netinet/ip_var.h netinet/tcp_var.h"
+      ;;
+    700)
+      LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
+      LSOF_TMP1="hfs/hfs.h hfs/hfs_catalog.h hfs/hfs_cnode.h hfs/hfs_macos_defs.h hfs/rangelist.h miscfs/devfs/devfsdefs.h miscfs/devfs/devfs_proto.h miscfs/fdesc/fdesc.h net/ndrv_var.h net/raw_cb.h netinet/ip_var.h netinet/tcp_var.h sys/eventvar.h"
+      ;;
+    800)
+      LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
+      LSOF_TMP1="net/ndrv_var.h net/raw_cb.h netinet/ip_var.h netinet/tcp_var.h sys/eventvar.h sys/file_internal.h sys/mount_internal.h sys/proc_internal.h sys/vnode_internal.h"
+      ;;
+    900|1000|1100|1200)
+      LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
+      LSOF_TMP1=""
+      LSOF_UNSUP=""
+      LSOF_TSTBIGF=" "			# enable LTbigf test
+      if test $LSOF_VERS -eq 900	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DNEEDS_MACH_PORT_T"
+      fi	# }
+      ;;
+    1300)
+      LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
+      LSOF_TMP1=""
+      ;;
+    *)
+      echo "Unsupported Darwin version: $LSOF_VERS"
+      rm -f $LSOF_HLP
+      exit 1
+      ;;
+    esac	# }
+    LSOF_TMP2=""
+    LSOF_TMP3=""
+    LSOF_TMP4=""
+    LSOF_CFGF="$LSOF_CFGF -mdynamic-no-pic"
+    LSOF_CFGL="$LSOF_CFGL -lcurses"
+
+    if test "X$DARWIN_XNUDIR" != "X"	# {
+    then
+      LSOF_TMP2="${DARWIN_XNUDIR}/bsd"
+      LSOF_TMP3="${DARWIN_XNUDIR}/osfmk"
+      LSOF_TMP4=""
+    else
+      LSOF_TMP2="${DARWIN_XNU_HEADERS}/System/Library/Frameworks/Kernel.framework/Versions/A/PrivateHeaders"
+      LSOF_TMP3="${DARWIN_XNU_HEADERS}/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders"
+      LSOF_TMP4=""
+      if test "X$DARWIN_XNU_HEADERS" != "X"	# {
+      then
+	LSOF_TMP4="${DARWIN_XNU_HEADERS}/usr/include"
+      fi	# }
+    fi	# }
+
+    # Test Darwin base.
+
+    if test "X$DARWIN_BASE" = "X" -o "X$DARWIN_BASE" = "Xlibproc"	# {
+    then
+      LSOF_TMP5=""
+      if test $LSOF_VERS -ge 800 -o "X$DARWIN_BASE" = "Xlibproc"	# {
+      then
+	if test -r ${LSOF_INCLUDE}/libproc.h	# {
+	then
+	    DARWIN_BASE="libproc"
+	else
+	  if test -r ${LSOF_INCLUDE}/../local/include/libproc.h	# {
+	  then
+	    DARWIN_BASE="libproc"
+	    LSOF_TMP5="-I${LSOF_INCLUDE}/../local/include"
+	  else
+	    echo "FATAL: can't find libproc.h"
+	    rm -f $LSOF_HLP
+	    exit 1
+	  fi	# }
+	fi	# }
+      else
+
+      # The default Darwin base is /dev/kmem.
+
+	DARWIN_BASE="/dev/kmem"
+      fi	# }
+    fi	# }
+    if test "X$DARWIN_BASE" = "Xlibproc"	# {
+    then
+
+    # Configure for libproc-based Darwin lsof.
+
+      echo "Configuring libproc-based Darwin lsof"
+      LSOF_CINFO="libproc-based"
+      LSOF_DIALECT_DIR=darwin/libproc
+      if test $LSOF_VERS -lt 1000 	# {
+      then
+	LSOF_CFGL="$LSOF_CFGL -lproc"
+      fi	# }
+      LSOF_TSTKMEM=0
+      LSOF_DINC="$LSOF_DINC $LSOF_TMP5"
+      if test ! -r ${LSOF_INCLUDE}/sys/proc_info.h	# {
+      then
+	if test "X$LSOF_TMP5" = "X" -o ! -r ${LSOF_TMP5}/sys/proc_info.h # {
+	then
+	  echo "FATAL: can't find sys/proc_info.h"
+	  rm -f $LSOF_HLP
+	  exit 1
+	fi	# }
+      fi	# }
+
+    # Add header file paths for libproc-based Darwin lsof.
+
+      for i in $LSOF_TMP3 $LSOF_TMP4 $LSOF_INCLUDE	# {
+      do
+	if test -d $i -a "X$i" != "X/usr/include"	# {
+	then
+	  LSOF_DINC="$LSOF_DINC -I${i}"
+	fi	# }
+      done	# }
+
+    # Do other libproc-based Darwin lsof setups.
+      
+      if test -r ${LSOF_INCLUDE}/utmpx.h	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASUTMPX"
+      fi	# }
+    else
+      if test "X$DARWIN_BASE" != "X/dev/kmem"	# {
+      then
+	echo "Darwin base unrecognized: $DARWIN_BASE"
+	rm -f $LSOF_HLP
+	exit 1
+      fi	# }
+    
+    # Configure for /dev/kmem-based Darwin lsof.
+
+      echo "Configuring /dev/kmem-based Darwin lsof"
+      LSOF_CINFO="/dev/kmem-based"
+      LSOF_DIALECT_DIR=darwin/kmem
+
+    # Make sure needed /dev/kmem-base XNU Darwin kernel header files are
+    # present.
+
+      LSOF_TMP5=""
+      for i in $LSOF_TMP1	# {
+      do
+	LSOF_TMP6=0
+	for j in $LSOF_TMP2 $LSOF_TMP3 $LSOF_TMP4 $LSOF_INCLUDE	# {
+	do
+	  if test "X${j}" != "X" -a -r ${j}/${i}  # {
+	  then
+	    LSOF_TMP6=1
+	    break
+	  fi	# }
+	done	# }
+	if test $LSOF_TMP6 -ne 1	# {
+	then
+	  if test "X$LSOF_TMP5" = "X"	# {
+	  then
+	    LSOF_TMP5=$i
+	  else
+	    LSOF_TMP5="$LSOF_TMP5 $i"
+	  fi	# }
+	fi			# }
+      done	# }
+      if test "X$LSOF_TMP5" != "X"	# {
+      then
+
+      # If any Darwin XNU kernel header files are missing, call the
+      # get-hdr-loc.sh script to find the path.
+
+	LSOF_TMP6=`pwd`/dialects/darwin/get-hdr-loc.sh
+	if test ! -x $LSOF_TMP6	# {
+	then
+	  echo "FATAL: can't execute: $LSOF_TMP6"
+	  rm -f $LSOF_HLP
+	  exit 1
+	fi	# }
+	DARWIN_XNUDIR=`$LSOF_TMP6 $LSOF_TMP5`
+	if test $? -ne 0	# {
+	then
+	  echo "FATAL: $LSOF_TMP6 returns: $DARWIN_XNUDIR"
+	  rm -f $LSOF_HLP
+	  exit 1
+	fi	# }
+	LSOF_TMP2="${DARWIN_XNUDIR}/bsd"
+	LSOF_TMP3="${DARWIN_XNUDIR}/osfmk"
+	LSOF_TMP4=""
+      fi	# }
+
+    # Add header file paths for /dev/kmem-based Darwin lsof.
+
+      for i in $LSOF_TMP2 $LSOF_TMP3 $LSOF_TMP4 $LSOF_INCLUDE	# {
+      do
+	if test -d $i -a "X$i" != "X/usr/include"	# {
+	then
+	  LSOF_DINC="$LSOF_DINC -I${i}"
+	fi	# }
+      done	# }
+
+    # Make conditional feature definitions for /dev/kmem-based Darwin lsof.
+
+      for i in $LSOF_TMP2 $LSOF_TMP3 $LSOF_TMP4 $LSOF_INCLUDE      # {
+      do
+	if test "X${i}" != "X" -a -r ${i}/sys/namei.h	# {
+	then
+	  grep -q nc_vpid ${i}/sys/namei.h
+	  if test $? -eq 0	# {
+	  then
+	    LSOF_CFGF="$LSOF_CFGF -DHASNCVPID"
+	  fi	# }
+	  break
+	fi	# }
+      done	# }
+      for i in $LSOF_TMP2 $LSOF_TMP3 $LSOF_TMP4 $LSOF_INCLUDE	# {
+      do
+	if test "X${i}" != "X"	# {
+	then
+	  if test $LSOF_VERS -ge 800	# {
+	  then
+	    if test -r ${i}/sys/file_internal.h	# {
+	    then
+	      grep -q DTYPE_KQUEUE ${i}/sys/file_internal.h
+	      if test $? -eq 0	# {
+	      then
+	        LSOF_CFGF="$LSOF_CFGF -DHASKQUEUE"
+	      fi	# }
+	      break
+	    fi	# }
+	  else
+	    if test $LSOF_VERS -ge 700	# {
+	    then
+	      if test -r ${i}/sys/file.h	# {
+	      then
+	        grep -q DTYPE_KQUEUE ${i}/sys/file.h
+	        if test $? -eq 0	# {
+	        then
+	          LSOF_CFGF="$LSOF_CFGF -DHASKQUEUE"
+	        fi	# }
+	      fi	# }
+	      break
+	    fi	# }
+	  fi	# }
+	fi	# }
+      done	# }
+      LSOF_CFGF="$LSOF_CFGF -DHAS9660FS"
+    fi	# }
+    LSOF_CFGF="$LSOF_CFGF -DDARWINV=$LSOF_VERS"
+    LSOF_CFLAGS_OVERRIDE=1
+    ;;
+
+# Configure for DEC OSF/1, Digital UNIX, or Tru64 UNIX.
+
+  digital_unix|du|decosf|tru64)
+    LSOF_TGT="du"
+    LSOF_TSTBIGF=" "
+    LSOF_TSTK64=1
+    if test "X$LSOF_DINC" = "X"	# {
+    then
+      LSOF_DINC="-I/usr/include"
+    fi	# }
+    if test "X$LSOF_VSTR" = "X"	# {
+    then
+      LSOF_VSTR=`uname -r`
+    fi	# }
+    if test "X$LSOF_VERS" = "X"	# {
+    then
+
+      # If the DEC OSF/1, Digital UNIX, or Tru64 UNIX version isn't
+      # predefined, determine it.
+
+      case $LSOF_VSTR in	# {
+      V2.0)
+	LSOF_VERS=20000
+	;;
+      V3.0)
+	LSOF_VERS=30000
+	;;
+      V3.2)
+	LSOF_VERS=30200
+	;;
+      ?4.0)
+	LSOF_TSTXO="../lib/snpf.o"
+	LSOF_VERS=40000
+	;;
+      ?5.0)
+	LSOF_VERS=50000
+	;;
+      ?5.1)
+	LSOF_VERS=50100
+	;;
+      *)
+	echo "WARNING: unknown version; assuming version is 2.0"
+	LSOF_VERS=20000
+	;;
+      esac	# }
+    fi	# }
+
+    # Do DEC OSF/1, Digital UNIX, or Tru64 UNIX version specific stuff.
+
+    case $LSOF_VERS in	# {
+      20000)
+	LSOF_CFGF="$LSOF_CFGF -Olimit 1024"
+	LSOF_TMP1="/sys"
+	;;
+      30000)
+	LSOF_CFGF="$LSOF_CFGF -Olimit 1024"
+	LSOF_TMP1="/sys"
+	LSOF_TMP2=-DUSELOCALREADDIR
+	;;
+      30200)
+	LSOF_CFGF="$LSOF_CFGF -Olimit 1024"
+	LSOF_TMP1="/sys"
+	LSOF_TMP2=-DUSELOCALREADDIR
+	;;
+      40000)
+	LSOF_TMP1="/usr/sys"
+	;;
+      50000|50100)
+	LSOF_CFGF="$LSOF_CFGF -DUSE_STAT"
+	LSOF_TMP1="/usr/sys"
+	;;
+      *)
+	echo "WARNING: unknown version: $LSOF_VERS"
+	rm -f $LSOF_HLP
+	exit 1
+	;;
+    esac	# }
+    if test "X$DU_SYSDIR" = "X"	# {
+    then
+      DU_SYSDIR=$LSOF_TMP1
+    fi	# }
+    LSOF_HOST=`uname -n`
+    if test "X$DU_CDIR" = "X"	# {
+    then
+      LSOF_CDIR=`expr $LSOF_HOST : '\([^\.]*\)\..*$'`
+      if test "X$LSOF_CDIR" = "X"	# {
+      then
+	LSOF_CDIR=$LSOF_HOST
+      fi	# }
+      LSOF_CDIR=`echo $LSOF_CDIR | tr a-z A-Z`
+    else
+      LSOF_CDIR=$DU_CDIR
+    fi	# }
+    LSOF_LOOP=1
+    while test $LSOF_LOOP = 1	# {
+    do
+      if test -d ${DU_SYSDIR}/$LSOF_CDIR	# {
+      then
+	echo "Using header files in ${DU_SYSDIR}/$LSOF_CDIR"
+	LSOF_LOOP=0
+      else
+	cat << .CAT_MARK
+
+Please enter the name of the subdirectory in $DU_SYSDIR that contains the
+configuration files for this host.  Usually its name would be $LSOF_CDIR, but
+that subdirectory doesn't seem to exist.  The lsof compilation needs header
+files specific to this machine's configuration found in that directory.
+
+If you can't specify the appropriate configuration subdirectory, quit this
+Configure step now and generate a proper configuration subdirectory with the
+kernel generation process.
+
+.CAT_MARK
+
+	echo "$DU_SYSDIR contains:"
+	echo ""
+	ls -CF $DU_SYSDIR
+	echo ""
+	echo -n "Configuration subdirectory name? "
+	read LSOF_CDIR LSOF_EXCESS
+	if test "X$LSOF_CDIR" = "X" -o ! -d ${DU_SYSDIR}/$LSOF_CDIR	# {
+	then
+	  echo ""
+	  echo Cannot access directory ${DU_SYSDIR}/$LSOF_CDIR.
+	fi	# }
+      fi	# }
+    done	# }
+
+    # Determine the ADVFS file system version.
+
+    if test "X$DU_ADVFSV" = "X"	# {
+    then
+      echo "Determining the ADVFS version -- this will take a while."
+      LSOF_ADVFSV=`/usr/sbin/setld -i | grep "^OSFADVFSBIN[0-9]" | sed 's/\([^ ]*\).*/\1/' | sort -u | tail -1 | sed 's/OSFADVFSBIN//'`
+    else
+      LSOF_ADVFSV=$DU_ADVFSV
+    fi	# }
+    case $LSOF_ADVFSV in	# {
+    1*)
+      LSOF_ADVFSV=100
+      echo "The ADVFS version is 1."
+      ;;
+    2*)
+      LSOF_ADVFSV=200
+      echo "The ADVFS version is 2."
+      ;;
+    3*)
+      LSOF_ADVFSV=300
+      echo "The ADVFS version is 3."
+      ;;
+    4*)
+      LSOF_ADVFSV=400
+      echo "The ADVFS version is 4."
+      ;;
+    5*)
+      LSOF_ADVFSV=500
+      echo "The ADVFS version is 5."
+      ;;
+    *)
+      echo "The ADVFS version is unknown; it will be assumed to be 1."
+      LSOF_ADVFSV=100
+      ;;
+    esac	# }
+    LSOF_CFGF="$LSOF_CFGF -DDUV=$LSOF_VERS -DADVFSV=$LSOF_ADVFSV $LSOF_TMP2"
+    if test "X$DU_SYSINC" = "X"	# {
+    then
+      DU_SYSINC="/usr/sys/include"
+    fi	# }
+    LSOF_DINC="$LSOF_DINC -I${DU_SYSDIR}/$LSOF_CDIR -I$DU_SYSINC"
+    LSOF_CFGL="$LSOF_CFGL -lmld"
+    if test "X${DU_SHLIB}" = "X"	# {
+    then
+      DU_SHLIB=/usr/shlib
+    fi	# }
+    if test -r ${DU_SHLIB}/libmsfs.so	# {
+    then
+      nm ${DU_SHLIB}/libmsfs.so | grep tag_to_path > /dev/null 2>&1
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASTAGTOPATH"
+	LSOF_CFGL="$LSOF_CFGL -lmsfs"
+      fi	# }
+    fi	# }
+    grep "^struct spec_node {" ${DU_SYSDIR}/include/sys/specdev.h > /dev/null 2>&1
+    if test $? -eq 0	# {
+    then
+      LSOF_CFGF="$LSOF_CFGF -DHASSPECNODE"
+    fi	# }
+    if test $LSOF_VERS -ge 50000	# {
+    then
+
+    # Make du5_sys_malloc.h for DU 5.0 and above.  Enable strict ANSI checking
+    # on 5.0 and 5.1A, but not 5.1B.  Enable IPv6 handling.
+
+      LSOF_TMP1="-std1"
+      if test $LSOF_VERS -ge 50100	# {
+      then
+	LSOF_TMP1="-std"
+	if test -x /usr/sbin/sizer	# {
+	then
+	  /usr/sbin/sizer -v | grep -q 5.1A
+	  if test $? -eq 0	# {
+	  then
+	    LSOF_TMP1="-std1"
+	  fi	# }
+	fi	# }
+      fi	# }
+      LSOF_CFGF="$LSOF_CFGF $LSOF_TMP1"
+      LSOF_TMP1=${LSOF_INCLUDE}/sys/malloc.h
+      if test -r $LSOF_TMP1	# {
+      then
+	LSOF_TMP2=dialects/du/du5_sys_malloc.h
+	rm -f $LSOF_TMP2
+	echo "#if !defined(MANUFACTURED_DU5_SYS_MALLOC_H)" > $LSOF_TMP2
+	echo "/* By lsof Configure:" `date` " */" >> $LSOF_TMP2
+	echo "#define MANUFACTURED_DU5_SYS_MALLOC_H" >> $LSOF_TMP2
+	grep "^#define[ 	]MALLOC_NUM_BUCKETS" $LSOF_TMP1 >> $LSOF_TMP2
+	echo "struct percpukmembuckets {" >> $LSOF_TMP2
+	sed '1,/^struct percpukmembuckets/d' $LSOF_TMP1 | sed -n '1,/^};/p' >> $LSOF_TMP2
+	echo "#endif" >> $LSOF_TMP2
+	LSOF_CFGF="$LSOF_CFGF -I`pwd`/dialects/du"
+      fi	# }
+
+    # Enable IPv6 for Tru64 UNIX 5.0 and above.
+
+      LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
+    fi	# }
+    if test -r ${LSOF_INCLUDE}/sys/namei.h
+    then
+      grep -q nc_vpid ${LSOF_INCLUDE}/sys/namei.h
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASNCVPID"
+      fi	# }
+    fi	# }
+    LSOF_DIALECT_DIR=du
+    ;;
+
+# Configure for FreeBSD.
+
+  freebsd)
+    LSOF_FBSD_ZFS=0
+    if test "X$LSOF_CC" = "X"	# {
+    then
+      LSOF_CC=cc
+      LSOF_CCV=`$LSOF_CC -v 2>&1 | sed -n 's/.*version \(.*\)/\1/p'`
+    fi	# }
+    if test "X$LSOF_VSTR" = "X"	# {
+    then
+      LSOF_VSTR=`uname -r`
+    fi	# }
+    if test "X$LSOF_VERS" = "X"	# {
+    then
+
+    # If the FreeBSD version isn't pre-defined, determine it.
+
+      case $LSOF_VSTR in	# {
+      1.*)
+	LSOF_VERS=1000
+	;;
+      2.0-*)
+	LSOF_VERS=2000
+	;;
+      2.0.5-*)
+	LSOF_VERS=2005
+	;;
+      2.1*)
+	LSOF_VERS=2010
+	;;
+      2.2*)
+	LSOF_VERS=2020
+	;;
+      3.0*)
+	LSOF_VERS=3000
+	;;
+      3.1*)
+	LSOF_VERS=3010
+	;;
+      3.2*)
+	LSOF_VERS=3020
+	;;
+      3.3*)
+	LSOF_VERS=3030
+	;;
+      3.4*)
+	LSOF_VERS=3040
+	;;
+      3.5*)
+	LSOF_VERS=3050
+	;;
+      3*)
+	LSOF_VERS=3050
+	echo "!!!WARNING!!!  Unsupported FreeBSD version: $LSOF_VSTR"
+	echo "!!!WARNING!!!  Configuring for FreeBSD 3.5"
+	;;
+      4.0*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=4000
+	;;
+      4.1-*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=4010
+	;;
+      4.2*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=4020
+	;;
+      4.3*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=4030
+	;;
+      4.4*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=4040
+	;;
+      4.5*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=4050
+	;;
+      4.6*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=4060
+	;;
+      4.7*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=4070
+	;;
+      4.8*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=4080
+	;;
+      4.9*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=4090
+	;;
+      4.10*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=4100
+	;;
+      4.11*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=4110
+	;;
+      4*)
+	LSOF_VERS=4100
+	echo "!!!WARNING!!!  Unsupported FreeBSD version: $LSOF_VSTR"
+	echo "!!!WARNING!!!  Configuring for FreeBSD 4.10"
+	;;
+      5.0*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=5000
+	;;
+      5.1*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=5010
+	;;
+      5.2*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=5020
+	;;
+      5.3*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=5030
+	;;
+      5.4*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=5040
+	;;
+      5.5*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=5050
+	;;
+      5*)
+	LSOF_VERS=5050
+	echo "!!!WARNING!!!  Unsupported FreeBSD version: $LSOF_VSTR"
+	echo "!!!WARNING!!!  Configuring for FreeBSD 5.5"
+	;;
+      6.0*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=6000
+	;;
+      6.1*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=6010
+	;;
+      6.2*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=6020
+	;;
+      6.3*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=6030
+	;;
+      6.4*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=6040
+	;;
+      6*)
+	LSOF_VERS=6000
+	echo "!!!WARNING!!!  Unsupported FreeBSD version: $LSOF_VSTR"
+	echo "!!!WARNING!!!  Configuring for FreeBSD 6.0"
+	;;
+      7.0*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=7000
+	;;
+      7.1*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=7010
+	;;
+      7.2*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=7020
+	;;
+      7.3*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=7030
+	;;
+      7.4*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=7040
+	;;
+      7*)
+	LSOF_VERS=7000
+	echo "!!!WARNING!!!  Unsupported FreeBSD version: $LSOF_VSTR"
+	echo "!!!WARNING!!!  Configuring for FreeBSD 7.0"
+	;;
+      8.0*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=8000
+	;;
+      8.1*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=8010
+	;;
+      8.2*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=8020
+	;;
+      8.3*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=8030
+	;;
+      8.4*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=8040
+	;;
+      9*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=9000
+	;;
+      10*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=10000
+	;;
+      11*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=11000
+	;;
+      12*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=12000
+	;;
+      *)
+	echo Unknown FreeBSD release: `uname -r`
+	rm -f $LSOF_HLP
+	exit 1
+	;;
+      esac	# }
+    fi	# }
+
+    # Clear LSOF_UNSUP message for supported versions of FreeBSD.
+    
+    case $LSOF_VERS in  # {
+    4090|8020|8030|8040|9000|10000|11000|12000)
+      LSOF_UNSUP=""
+      ;;
+    esac	# }
+
+    # Get system CFLAGS, if possible.
+
+    LSOF_TMP1=`echo "all:\n.include <bsd.prog.mk>" | $LSOF_MAKE -f- -VCFLAGS`
+    LSOF_TMP=1
+    while test $LSOF_TMP -eq 1	# {
+    do
+      echo $LSOF_TMP1 | grep -q -e '-O'
+      if test $? -eq 0	# {
+      then
+	if test "X$LSOF_DEBUG" = "X"
+	  then	# {
+	    LSOF_DEBUG=`echo $LSOF_TMP1 | sed 's/.*\(-O[^ $]*\).*/\1/'`
+	 fi	# }
+	LSOF_TMP1=`echo $LSOF_TMP1 | sed 's/\(.*\)-O[^ $]*\(.*\)/\1 \2/' | sed 's/^  *//g' | sed 's/  */ /g' | sed 's/  *$//'`
+      else
+	LSOF_TMP=0
+      fi	# }
+      LSOF_FBSD_ZFS_CFGF="$LSOF_CFGF $LSOF_TMP1"
+    done	# }
+    LSOF_CFGF="$LSOF_CFGF $LSOF_TMP1"
+    echo $LSOF_CFGF | grep -q NEEDS_BOOL_TYPEDEF
+    if test $? -ne 0
+    then	# {
+      LSOF_CFGF="$LSOF_CFGF -DNEEDS_BOOL_TYPEDEF"
+      LSOF_FBSD_ZFS_CFGF="$LSOF_FBSD_ZFS_CFGF -DNEEDS_BOOL_TYPEDEF"
+    fi	# }
+
+    # Determine path to FreeBSD sources.
+
+    LSOF_DINC_ADD=0
+    if test "X$FREEBSD_SYS" = "X"	# {
+    then
+      if test -d /usr/src/sys	# {
+      then
+	FREEBSD_SYS=/usr/src/sys
+      else
+	if test -d /sys	# {
+	then
+	  FREEBSD_SYS="/sys"
+	else
+	  echo "!!!WARNING!!!  No kernel sources in /usr/src/sys or /sys"
+	fi	# }
+      fi	# }
+    fi	# }
+
+    # Test for thread (task) support.
+
+    if test -r ${LSOF_INCLUDE}/sys/user.h	# {
+    then
+      grep -q ki_numthreads ${LSOF_INCLUDE}/sys/user.h
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASTASKS"
+      fi	# }
+    else
+      echo "FATAL: can't find sys/user.h"
+      rm -f $LSOF_HLP
+      exit 1
+    fi	# }
+
+    # Test pause() status in system.h.
+
+    if test -r ${FREEBSD_SYS}/sys/systm.h	# {
+    then
+      grep -q pause_sbt ${FREEBSD_SYS}/sys/systm.h
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHAS_PAUSE_SBT"
+      fi	# }
+    fi	# }
+
+    # Check the C library for closefrom and dup2.
+
+      if test -r /usr/lib/libc.a	# {
+      then
+	nm /usr/lib/libc.a | grep -q "W dup2"
+	if test $? -eq 0	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DHAS_DUP2"
+	fi	# }
+	nm /usr/lib/libc.a | grep -q "W closefrom"
+	if test $? -eq 0	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DHAS_CLOSEFROM"
+	fi	# }
+      fi	# }
+
+    # Do FreeBSD version-specific stuff.
+
+    case $LSOF_VERS in	# {
+    1000)
+      LSOF_CFGF="$LSOF_CFGF -DHASPROCFS"
+      LSOF_CFGL="$LSOF_CFGL -lutil"
+      LSOF_DINC="$LSOF_DINC -I`pwd`/dialects/freebsd/include"
+      if test "X$FREEBSD_KERNEL" = "X"	# {
+      then
+	LSOF_N_UNIXV="/386bsd"
+      else
+	LSOF_N_UNIXV=$FREEBSD_KERNEL
+      fi	# }
+      ;;
+    2000|2005|2010)
+      LSOF_CFGL="$LSOF_CFGL -lkvm"
+      ;;
+    2020)
+      LSOF_CFGL="$LSOF_CFGL -lkvm"
+      if test -r ${LSOF_INCLUDE}/vm/lock.h	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASVMLOCKH"
+      fi	# }
+      ;;
+    3000|3010|3020|3030|3040|3050)
+      LSOF_CFGL="$LSOF_CFGL -lkvm"
+      if test -r ${LSOF_INCLUDE}/nfs/rpcv2.h	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASRPCV2H"
+      fi	# }
+      if test -r ${LSOF_INCLUDE}/vm/lock.h	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASVMLOCKH"
+      fi	# }
+      ;;
+    *)
+      if test -r ${LSOF_INCLUDE}/nfs/rpcv2.h	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASRPCV2H"
+      fi	# }
+      if test -r ${LSOF_INCLUDE}/sys/namei.h	# {
+      then
+	grep -q "^struct[ 	]*namecache[ 	]*{" ${LSOF_INCLUDE}/sys/namei.h
+	if test $? -eq 0	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DHASNAMECACHE"
+	fi	# }
+      fi	# }
+      if test -r ${LSOF_INCLUDE}/ufs/ufs/inode.h	# {
+      then
+	grep -q i_effnlink ${LSOF_INCLUDE}/ufs/ufs/inode.h
+	if test $? -eq 0	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DHASEFFNLINK=i_effnlink"
+	fi	# }
+      fi	# }
+      if test -r ${LSOF_INCLUDE}/sys/file.h	# {
+      then
+	grep -q f_vnode ${LSOF_INCLUDE}/sys/file.h
+	if test $? -eq 0	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DHASF_VNODE"
+	fi	# }
+      fi	# }
+      LSOF_CFGL="$LSOF_CFGL -lkvm"
+      if test $LSOF_VERS -ge 5000	# {
+      then
+
+      # Do FreeBSD 5 and higher version-specific stuff.
+
+	if test -r ${LSOF_INCLUDE}/sys/vnode.h	# {
+	then
+	  grep VT_FDESC ${LSOF_INCLUDE}/sys/vnode.h > /dev/null 2>&1
+	  if test $? -eq 0	# {
+	  then
+	    if test ! -r ${LSOF_INCLUDE}/fs/devfs/devfs.h	# {
+	    then
+	      if test -r ${FREEBSD_SYS}/fs/devfs/devfs.h	# {
+	      then
+		LSOF_DINC_ADD=1
+	      else
+		echo "!!!FATAL: lsof cannot locate the devfs.h header file"
+		echo "          in ${LSOF_INCLUDE}/fs/devfs/devfs.h or"
+		echo "          ${FREEBSD_SYS}/fs/devfs/devfs.h.  Consult"
+		echo "          00FAQ for an explanation."
+		rm -f $LSOF_HLP
+		exit 1
+	      fi	# }
+	    fi	# }
+	  fi	# }
+	fi	# }
+	if test -r ${FREEBSD_SYS}/sys/filedesc.h	# {
+	then
+	  grep -q filedescent ${FREEBSD_SYS}/sys/filedesc.h
+	  if test $? -eq 0	# {
+	  then
+	    LSOF_CFGF="$LSOF_CFGF -DHAS_FILEDESCENT"
+	  fi	# }
+	fi	# }
+	if test -r ${FREEBSD_SYS}/fs/tmpfs/tmpfs.h	# {
+	then
+	    LSOF_CFGF="$LSOF_CFGF -DHAS_TMPFS"
+	fi	#}
+
+      # Do FreeBSD 5.2 and higher version-specific stuff.
+
+	if test -r ${LSOF_INCLUDE}/wctype.h	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DHASWCTYPE_H"
+	fi	# }
+	if test $LSOF_VERS -ge 5020	# {
+	then
+
+	# Determine the status of the cpumask_t typedef.
+
+	  rm -f ${LSOF_TMPC}.*
+	  cat > ${LSOF_TMPC}.c << .LSOF_END_HERE_DOC3
+#undef _KERNEL
+#include <sys/types.h>
+main() {
+cpumask_t c;
+}
+.LSOF_END_HERE_DOC3
+	  $LSOF_CC ${LSOF_TMPC}.c -o ${LSOF_TMPC}.x > /dev/null 2>&1
+	  LSOF_TMP1=$?
+	  rm -f ${LSOF_TMPC}.*
+	  if test $LSOF_TMP1 -ne 0	# {
+	  then
+
+	  # The cpumask_t typedef is unknown when _KERNEL is not defined.
+
+	    if test -r ${LSOF_INCLUDE}/sys/types.h \
+		    -a -r ${LSOF_INCLUDE}/machine/_types.h	# {
+	    then
+	      grep -q cpumask_t ${LSOF_INCLUDE}/sys/types.h
+	      if test $? -eq 0	# {
+	      then
+	        grep -q __cpumask_t ${LSOF_INCLUDE}/machine/_types.h
+	        if test $? -eq 0	# {
+	        then
+		  LSOF_CFGF="$LSOF_CFGF -DHASCPUMASK_T"
+	        else
+		  $LSOF_CC -E ${LSOF_INCLUDE}/machine/_types.h 2>/dev/null | grep -q __cpumask_t
+		  if test $? -eq 0  # {
+		  then
+		    LSOF_CFGF="$LSOF_CFGF -DHASCPUMASK_T"
+		  fi	# }
+	        fi	# }
+	      fi	# }
+	    fi	# }
+	  fi	# }
+	  if test -r ${LSOF_INCLUDE}/sys/socketvar.h	# {
+	  then
+	    grep -q SBS_CANT ${LSOF_INCLUDE}/sys/socketvar.h
+	    if test $? -eq 0	# {
+	    then
+		LSOF_CFGF="$LSOF_CFGF -DHASSBSTATE"
+	    fi	# }
+	  fi	# }
+	fi	# }
+	if test $LSOF_VERS -ge 5030	# {
+	then
+
+	# Do FreeBSD 5.3 and higher version-specific stuff.
+
+	  if test -r ${LSOF_INCLUDE}/sys/vnode.h	# {
+	  then
+	    grep -q "defined(_KVM_VNODE)" ${LSOF_INCLUDE}/sys/vnode.h
+	    if test $? -eq 0	# {
+	    then
+		LSOF_CFGF="$LSOF_CFGF -DHAS_KVM_VNODE"
+	    fi	#}
+	  fi	# }
+	fi	# }
+	if test $LSOF_VERS -ge 6000	# {
+	then
+
+	# Do FreeBSD 6.0 and higher version-specific stuff.
+
+	  if test -r ${LSOF_INCLUDE}/sys/_types.h	# {
+	  then
+	    grep __dev_t ${LSOF_INCLUDE}/sys/_types.h | grep -q 64
+	    if test $? -eq 0	# {
+	    then
+	      if test "X$LSOF_TSTDFLG" = "X"	# {
+	      then
+		LSOF_TSTDFLG="-DLT_DEV64"
+	      else
+		LSOF_TSTDFLG="$LSOF_TSTDFLG -DLT_DEV64"
+	      fi	# }
+	    fi	# }
+	  fi	# }
+	  if test -r ${LSOF_INCLUDE}/ufs/ufs/inode.h	# {
+	  then
+	    grep -q i_din2 ${LSOF_INCLUDE}/ufs/ufs/inode.h
+	    if test $? -eq 0	# {
+	    then
+	      LSOF_CFGF="$LSOF_CFGF -DHAS_UFS1_2"
+	    fi	# }
+	    grep -q i_dev ${LSOF_INCLUDE}/ufs/ufs/inode.h
+	    if test $? -ne 0	# {
+	    then
+	      LSOF_CFGF="$LSOF_CFGF -DHAS_NO_IDEV"
+	    fi	# }
+	  fi	# }
+	  if test -r ${LSOF_INCLUDE}/sys/conf.h	# {
+	  then
+	    grep -q vm_memattr_t ${LSOF_INCLUDE}/sys/conf.h
+	    if test $? -eq 0	#{
+	    then
+	      LSOF_CFGF="$LSOF_CFGF -DHAS_VM_MEMATTR_T"
+	    fi	# }
+	    grep -q "^#define	minor(" ${LSOF_INCLUDE}/sys/conf.h
+	    if test $? -eq 0	# {
+	    then
+	      LSOF_CFGF="$LSOF_CFGF -DHAS_CONF_MINOR"
+	      rm -f fbsd_minor.h
+	      if test -r ${LSOF_INCLUDE}/sys/types.h	# {
+	      then
+		LSOF_TMP1=`grep "^#define[ 	]minor(" ${LSOF_INCLUDE}/sys/types.h`
+		if test "X$LSOF_TMP1" != "X"	# {
+		then
+		  echo "Creating fbsd_minor.h"
+		  cat > fbsd_minor.h << FBSD_MINOR1
+/*
+ * fbsd_minor.h -- created by lsof Configure script on
+FBSD_MINOR1
+		  echo $EO " * $EC" >> ./fbsd_minor.h
+		  date >> ./fbsd_minor.h
+		  cat >> ./fbsd_minor.h << FBSD_MINOR2
+ */
+
+#if	!defined(FBSD_MINOR_H)
+#define	FBSD_MINOR_H
+
+FBSD_MINOR2
+		  echo $EO "${LSOF_TMP1}${EC}" >> fbsd_minor.h
+		  cat >> ./fbsd_minor.h << FBSD_MINOR3
+
+#endif	/* defined(FBSD_MINOR_H) */
+FBSD_MINOR3
+		fi	# }
+	      fi	# }
+	    else
+	      if test -r ${FREEBSD_SYS}/fs/devfs/devfs_int.h	# {
+	      then
+		grep -q cdev2priv ${FREEBSD_SYS}/fs/devfs/devfs_int.h
+		if test $? -eq 0	# {
+		then
+		  LSOF_CFGF="$LSOF_CFGF -DHAS_CDEV2PRIV"
+		fi	# }
+	      fi	# }
+	    fi	# }
+	    grep -q "si_udev;" ${LSOF_INCLUDE}/sys/conf.h
+	    if test $? -ne 0	# {
+	    then
+	      LSOF_CFGF="$LSOF_CFGF -DHAS_NO_SI_UDEV"
+	    fi	# }
+	    grep -q si_priv ${LSOF_INCLUDE}/sys/conf.h
+	    if test $? -eq 0	# {
+	    then
+	      LSOF_CFGF="$LSOF_CFGF -DHAS_SI_PRIV"
+	    fi	# }
+	  fi	# }
+	  if test -r ${LSOF_INCLUDE}/sys/sx.h	# {
+	  then
+	    LSOF_CFGF="$LSOF_CFGF -DHAS_SYS_SX_H"
+	  fi	# }
+
+	# Do FUSE file system test,
+
+	  if test -r ${FREEBSD_SYS}/fs/fuse/fuse_node.h	# {
+	  then
+	    LSOF_CFGF="$LSOF_CFGF -DHASFUSEFS"
+	  fi	# }
+	# Do ZFS test.  Try for the newer OpenSolaris files first -- i.e.,
+	# the ones in ${FREEBSD_SYS}/cddl/contrib/opensolaris.  If that fails,
+	# try for the older ones in ${FREEBSD}/contrib/opensolaris.
+
+	  LSOF_FBSD_ZFS_SYS=${FREEBSD_SYS}/cddl
+	  if test ! -r ${LSOF_FBSD_ZFS_SYS}/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h	# {
+	  then
+	    LSOF_FBSD_ZFS_SYS=${FREEBSD_SYS}
+	    if test ! -r ${LSOF_FBSD_ZFS_SYS}/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h	# {
+	    then
+	      LSOF_FBSD_ZFS_SYS=""
+	    fi	# }
+	  fi	# }
+	  if test "X$LSOF_FBSD_ZFS_SYS" != "X"	# {
+	  then
+	    LSOF_CFGF="$LSOF_CFGF -DHAS_ZFS"
+	    LSOF_FBSD_ZFS=1
+	    LSOF_FBSD_ZFS_CFGF="$LSOF_FBSD_ZFS_CFGF -DFREEBSDV=$LSOF_VERS"
+	    LSOF_FBSD_ZFS_CFGF="$LSOF_FBSD_ZFS_CFGF -DHAS_ZFS"
+	    grep -q z_phys ${LSOF_FBSD_ZFS_SYS}/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h
+	    if test $? -eq 0	# {
+	    then
+	      LSOF_FBSD_ZFS_CFGF="$LSOF_FBSD_ZFS_CFGF -DHAS_Z_PHYS"
+	    fi	# }
+	    if test -r ${LSOF_FBSD_ZFS_SYS}/compat/opensolaris/sys/sdt.h  #{
+	    then
+	      grep -q opt_kdtrace.h ${LSOF_FBSD_ZFS_SYS}/compat/opensolaris/sys/sdt.h
+	      if test $? -eq 0	# {
+	      then
+		rm -f opt_kdtrace.h
+		touch opt_kdtrace.h
+	      fi	# }
+	    fi	# }
+	    if test -r ${LSOF_FBSD_ZFS_SYS}/compat/opensolaris/sys/kcondvar.h #{
+	    then
+		grep -q cv_timedwait_sbt ${LSOF_FBSD_ZFS_SYS}/compat/opensolaris/sys/kcondvar.h
+		if test $? -eq 0	# {
+		then
+		  LSOF_FBSD_ZFS_CFGF="$LSOF_FBSD_ZFS_CFGF -DHAS_CV_TIMEDWAIT_SBT"
+		fi	# }
+	    fi	#}
+	    if test -r /usr/include/sys/random.h	# {
+	    then
+	      grep -q opt_random.h /usr/include/sys/random.h
+	      if test $? -eq 0	# {
+	      then
+		rm -f opt_random.h
+		touch opt_random.h
+	      fi	# }
+	    fi	# }
+	  fi	# }
+	  if test -r ${LSOF_INCLUDE}/sys/vnode.h	# {
+	  then
+
+	  # See if the vnode contains the byte level lock pointer.
+
+	    grep -q v_lockf ${LSOF_INCLUDE}/sys/vnode.h
+	    if test $? -eq 0	# {
+	    then
+	      LSOF_CFGF="$LSOF_CFGF -DHAS_V_LOCKF"
+	      if test $LSOF_FBSD_ZFS -eq 1	# {
+	      then
+	        LSOF_FBSD_ZFS_CFGF="$LSOF_FBSD_ZFS_CFGF -DHAS_V_LOCKF"
+	      fi	# }
+	    fi	# }
+	  fi	# }
+	  if test -r ${LSOF_INCLUDE}/sys/lockf.h	# {
+	  then
+
+	  # Determine the type of locking structure to which the inode or
+	  # vnode points.
+
+	    grep -q "^struct lockf_entry" ${LSOF_INCLUDE}/sys/lockf.h
+	    if test $? -eq 0	# {
+	    then
+
+	    # Build the ./lockf_owner.h header file.
+
+	      LSOF_TMP1=""
+	      LSOF_TMP2=0
+	      echo "Creating ./lockf_owner.h from ${FREEBSD_SYS}/kern/kern_lockf.c"
+	      rm -f ./lockf_owner.h
+	      if test -r ${FREEBSD_SYS}/kern/kern_lockf.c	# {
+	      then
+		LSOF_TMP1=`grep -n "^struct lock_owner" ${FREEBSD_SYS}/kern/kern_lockf.c | sed 's/\([0-9]*\):.*$/\1/'`
+		if test "X$LSOF_TMP1" != "X"	# {
+		then
+		  LSOF_TMP2=0
+		  for i in `grep -n "};" ${FREEBSD_SYS}/kern/kern_lockf.c | sed 's/\([0-9]*\):.*$/\1/'` # {
+		  do
+		    if test $LSOF_TMP2 -eq 0 -a $i -gt $LSOF_TMP1	# {
+		    then
+		      LSOF_TMP2=$i
+		    fi	# }
+		  done	# }
+		  if test $LSOF_TMP2 -eq 0	# {
+		  then
+		    LSOF_TMP1=""
+		  else
+		    cat > ./lockf_owner.h << LOCKF_OWNER1
+/*
+ * lockf_owner.h -- created by lsof Configure script on
+LOCKF_OWNER1
+		    echo $EO " * $EC" >> ./lockf_owner.h
+		    date >> ./lockf_owner.h
+		    cat >> ./lockf_owner.h << LOCKF_OWNER2
+ */
+
+#if	!defined(LOCKF_OWNER_H)
+#define	LOCKF_OWNER_H
+
+LOCKF_OWNER2
+		    ed -s ${FREEBSD_SYS}/kern/kern_lockf.c >> ./lockf_owner.h << LOCKF_OWNER3
+${LSOF_TMP1},${LSOF_TMP2}p
+LOCKF_OWNER3
+		    if test $? -ne 0	# {
+		    then
+		      LSOF_TMP1=""
+		    else
+		      cat >> ./lockf_owner.h << LOCKF_OWNER4
+
+#endif	/* defined(LOCKF_OWNER_H) */
+LOCKF_OWNER4
+		    fi	# }
+		  fi	# }
+		fi	# }
+	      else
+		echo "FATAL ERROR: can't read ${FREEBSD_SYS}/kern/kern_lockf.c"
+	      fi	# }
+	      if test "X$LSOF_TMP1" != "X" -a "X$LSOF_TMP2" != "X0" # {
+	      then
+		echo "./lockf_owner.h creation succeeded."
+	        LSOF_CFGF="$LSOF_CFGF -DHAS_LOCKF_ENTRY"
+	      else
+		echo "FATAL ERROR: ./lockf_owner.h creation failed (see 00FAQ)"
+		rm -f $LSOF_HLP
+		exit 1
+	      fi	# }
+	    fi	# }
+
+	  # Test for in6p_.port in inpcb structure.
+
+	    if test -r ${LSOF_INCLUDE}/netinet/in_pcb.h	# {
+	    then
+	      grep -q 'in6p_.port' ${LSOF_INCLUDE}/netinet/in_pcb.h
+	      if test $? -ne 0	# {
+	      then
+		LSOF_CFGF="$LSOF_CFGF -DHAS_NO_6PORT"
+	      fi	# }
+	    fi	# }
+
+	  # Test for in6p_ppcb in inpcb structure.
+
+	    if test -r ${LSOF_INCLUDE}/netinet/in_pcb.h	# {
+	    then
+	      grep -q 'in6p_ppcb' ${LSOF_INCLUDE}/netinet/in_pcb.h
+	      if test $? -ne 0	# {
+	      then
+		LSOF_CFGF="$LSOF_CFGF -DHAS_NO_6PPCB"
+	      fi	# }
+	    fi	# }
+	    if test -r ${LSOF_INCLUDE}/sys/conf.h	# {
+	    then
+	      grep -q 'doadump(boolean_t)' ${LSOF_INCLUDE}/sys/conf.h
+	      if test $? -eq 0	# {
+	      then
+		LSOF_CFGF="$LSOF_CFGF -DNEEDS_BOOLEAN_T"
+	      fi	# }
+	    fi	# }
+	    if test -r ${LSOF_INCLUDE}/sys/sockbuf.h	# {
+	    then
+	      grep -q 'u_int	sb_ccc;' ${LSOF_INCLUDE}/sys/sockbuf.h
+	      if test $? -eq 0	# {
+	      then
+		LSOF_CFGF="$LSOF_CFGF -DHAS_SB_CCC"
+	      fi	# }
+	    fi	# }
+	    if test -r ${LSOF_INCLUDE}/sys/filedesc.h	# {
+	    then
+	      grep -q '^struct fdescenttbl {' ${LSOF_INCLUDE}/sys/filedesc.h
+	      if test $? -eq 0	# {
+	      then
+		LSOF_CFGF="$LSOF_CFGF -DHAS_FDESCENTTBL"
+	      fi	# }
+	    fi	# }
+	  fi	# }
+	fi	# }
+      fi	# }
+      if test $LSOF_VERS -eq 10000	# {
+      then
+
+      # Do specific FreeBSD 10 version-specific stuff.
+
+	LSOF_TMP1=`uname -m`
+	if test "X$LSOF_TMP1" = "Xi386"	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DNEEDS_BOOL_TYPEDEF"
+	fi	# }
+      fi	# }
+      ;;
+    esac	# }
+    LSOF_CFGF="$LSOF_CFGF -DFREEBSDV=$LSOF_VERS"
+    if test $LSOF_VERS -lt 2000 -a "X$FREEBSD_KERNEL" = "X"	# {
+    then
+      if test ! -x $LSOF_N_UNIXV	# {
+      then
+	echo "Hmmm -- $LSOF_N_UNIXV doesn't appear to be your kernel file."
+	echo "Please enter the name of the file in / that contains"
+	echo "the kernel for this host.  It must be a regular file,"
+	echo "not a directory, and must be executable."
+	LSOF_LOOP=1
+	while test $LSOF_LOOP = 1	# {
+	do
+	  echo ""
+	  echo "/ contains:"
+	  echo ""
+	  ls -CF /
+	  echo ""
+	  echo -n "Kernel file name? "
+	  read LSOF_N_UNIXV LSOF_EXCESS
+	  LSOF_N_UNIXV="/$LSOF_N_UNIXV"
+	  if test ! -d $LSOF_N_UNIXV -a -x $LSOF_N_UNIXV	# {
+	  then
+	    LSOF_LOOP=0
+	  else
+	    echo ""
+	    echo $LSOF_N_UNIXV is not a regular executable file.
+	  fi	# }
+	done	# }
+      fi	# }
+      LSOF_N_UNIXV=`echo $LSOF_N_UNIXV | sed 's#^/*#/#'`
+      LSOF_CFGF="$LSOF_CFGF -DN_UNIXV=$LSOF_N_UNIXV"
+    fi	# }
+    if test -r ${FREEBSD_SYS}/miscfs/fdesc/fdesc.h	# {
+    then
+      LSOF_TMP1=${FREEBSD_SYS}/miscfs/fdesc/fdesc.h
+    else
+      if test $LSOF_VERS -ge 5000 -a -r ${LSOF_INCLUDE}/fs/fdescfs/fdesc.h  # {
+      then
+	LSOF_TMP1=${LSOF_INCLUDE}/fs/fdescfs/fdesc.h
+      else
+	LSOF_TMP1=""
+      fi	# }
+    fi	# }
+    if test "X$LSOF_TMP1" != "X"	# {
+    then
+      grep -q Fctty $LSOF_TMP1
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASFDESCFS=1"
+      else
+	LSOF_CFGF="$LSOF_CFGF -DHASFDESCFS=2"
+      fi	# }
+      grep -q fd_link $LSOF_TMP1
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASFDLINK"
+      fi	# }
+      LSOF_DINC_ADD=1
+    fi	# }
+    if test $LSOF_VERS -ge 5000	# {
+    then
+      LSOF_TMP1="fs"
+    else
+      LSOF_TMP1="miscfs"
+    fi	# }
+    if test $LSOF_VERS -lt 5000	# {
+      then
+      if test -d ${FREEBSD_SYS}/${LSOF_TMP1}/procfs	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASPROCFS"
+	LSOF_DINC_ADD=1
+      fi	# }
+    else
+      if test -d ${FREEBSD_SYS}/${LSOF_TMP1}/pseudofs	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASPSEUDOFS"
+	LSOF_DINC_ADD=1
+      fi	# }
+    fi	# }
+    if test -r ${LSOF_INCLUDE}/${LSOF_TMP1}/nullfs/null.h	# {
+    then
+      LSOF_CFGF="$LSOF_CFGF -DHASNULLFS"
+    else
+      if test -r ${FREEBSD_SYS}/${LSOF_TMP1}/nullfs/null.h	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASNULLFS"
+	LSOF_DINC_ADD=1
+      fi	# }
+    fi	# }
+    if test -r ${FREEBSD_SYS}/isofs/cd9660/cd9660_node.h	# {
+    then
+      rm -f cd9660_node.h
+      grep -q "^#ifdef [_]*KERNEL" ${FREEBSD_SYS}/isofs/cd9660/cd9660_node.h
+      if test $? -eq 0	# {
+      then
+	ln -s ${FREEBSD_SYS}/isofs/cd9660/cd9660_node.h cd9660_node.h
+      else
+	sed -e '/^ \* Prototypes for ISOFS vnode operations/,$c\
+	\ The ISOFS prototypes were removed by Configure. */' \
+	< ${FREEBSD_SYS}/isofs/cd9660/cd9660_node.h > cd9660_node.h
+	echo "" >> cd9660_node.h
+      fi	# }
+      LSOF_CFGF="$LSOF_CFGF -DHAS9660FS"
+      if test $LSOF_VERS -ge 6000	# {
+      then
+	grep -q "i_dev;" cd9660_node.h
+	if test $? -ne 0	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DHAS_NO_ISO_DEV"
+	fi	# }
+      fi	# }
+    fi	# }
+    if test -r ${LSOF_INCLUDE}/sys/namei.h
+    then
+      grep -q nc_vpid ${LSOF_INCLUDE}/sys/namei.h
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASNCVPID"
+      fi	# }
+    fi	# }
+    if test $LSOF_DINC_ADD -eq 1	# {
+    then
+      if test "X$LSOF_DINC" = "X"	# {
+      then
+	LSOF_DINC="-I${FREEBSD_SYS}"
+      else
+	LSOF_DINC="$LSOF_DINC -I${LSOF_INCLUDE} -I${FREEBSD_SYS}"
+      fi	# }
+    fi	# }
+    if test -r ${LSOF_INCLUDE}/netinet/in.h	# {
+    then
+      grep IPV6_INRIA_VERSION ${LSOF_INCLUDE}/netinet/in.h > /dev/null
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASIPv6 -DHASINRIAIPv6"
+      fi	# }
+    fi	# }
+    echo $CFGF | grep HASIPv6 > /dev/null
+    if test $? -ne 0 -a -r ${LSOF_INCLUDE}/netinet6/in6.h	# {
+    then
+      LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
+    fi	# }
+    if test -r ${LSOF_INCLUDE}/utmpx.h # {
+    then
+      LSOF_CFGF="$LSOF_CFGF -DHASUTMPX"
+    fi	# }
+    LSOF_DIALECT_DIR=freebsd
+    ;;
+
+# Configure for HP-UX and HP-UX gcc.
+
+  hpux|hpuxgcc)
+    if test "X$LSOF_RANLIB_SUP" = "X"	# {
+    then
+      LSOF_RANLIB=""
+    fi	# }
+    if test "X$LSOF_VSTR" = "X"	# {
+    then
+      LSOF_VSTR=`uname -r`
+    fi	# }
+    if test "X$LSOF_VERS" = "X"	# {
+    then
+
+      # If the HP-UX version isn't pre-defined, determine it.
+
+      LSOF_VERS=`echo $LSOF_VSTR | awk -F. '{printf "%d%02d",\$2,\$3}'`
+    fi	# }
+    if test $LSOF_VERS -ge 1020	# {
+    then
+      LSOF_TSTBIGF="-D_LARGEFILE64_SOURCE"
+    fi	# }
+
+    # Determine compiler.
+
+    if test "X$LSOF_CC" = "X"	# {
+    then
+      if test "X$LSOF_TGT" = "Xhpuxgcc"	# {
+      then
+	LSOF_CC=gcc
+      else
+	if test "X$HPUX_CCDIR1" = "X"	# {
+	then
+	  HPUX_CCDIR1="/bin"
+	fi	# }
+	if test "X$HPUX_CCDIR2" = "X"	# {
+	then
+	  HPUX_CCDIR2="/usr/ccs/bin"
+	fi	# }
+	if test -x ${HPUX_CCDIR1}/cc	# {
+	then
+	  LSOF_CC=${HPUX_CCDIR1}/cc
+	else
+	  if test -x ${HPUX_CCDIR2}/cc	# {
+	  then
+	    LSOF_CC=${HPUX_CCDIR2}/cc
+	  else
+	    echo "No executable cc in $HPUX_CCDIR1 or $HPUX_CCDIR2"
+	    rm -f $LSOF_HLP
+	    exit 1
+	  fi	# }
+	fi	# }
+	$LSOF_CC -O < /dev/null 2>&1 | grep -q Bundled
+	if test $? -eq 0	# {
+	then
+	  LSOF_DEBUG="No-O"			# to disable -O
+	  if test "X$HPUX_LIBC1" = "X"	# {
+	  then
+	    HPUX_LIBC1="/usr/lib"
+	  fi	# }
+	  if test -r ${HPUX_LIBC1}/libc.sl	# {
+	  then
+	    LSOF_FCFGL="-L$HPUX_LIBC -lc"
+	  else
+	    if test "X$HPUX_LIBC2" = "X"	# {
+	    then
+	      HPUX_LIBC2="/usr/lib"
+	    fi	# }
+	    if test -r ${HPUX_LIBC2}/libc.sl	# {
+	    then
+	      LSOF_FCFGL="-L$HPUX_LIBC2 -lc"
+	    fi	# }
+	  fi	# }
+	fi	# }
+      fi	# }
+    fi	# }
+    echo $LSOF_CC | grep gcc > /dev/null
+    if test $? -eq 0	# {
+    then
+      LSOF_CCV=`$LSOF_CC -v 2>&1 | sed -n 's/.*version \(.*\)/\1/p'`
+    else
+      $LSOF_CC -O < /dev/null 2>&1 | grep -q Bundled
+      if test $? -eq 0	# {
+      then
+	LSOF_DEBUG="No-O"			# to disable -O
+      fi	# }
+    fi	# }
+    LSOF_TGT=hpux
+
+    # Test for "const void" support.
+
+    rm -f ${LSOF_TMPC}.*
+    echo "main() { const void *x; return(0); }" >> $LSOF_TMPC.c
+    $LSOF_CC $LSOF_TMPC.c -o $LSOF_TMPC.x > /dev/null 2>&1
+    if test $? -eq 0	# {
+    then
+      LSOF_CFGF="$LSOF_CFGF -DHAS_CONST"
+    fi	# }
+    rm -f ${LSOF_TMPC}.*
+
+    # Test HP-UX base.
+
+    if test "X$HPUX_BASE" = "X"	# {
+    then
+      if test -d $LSOF_INCLUDE/sys/pstat -a $LSOF_VERS -ge 1111 	# {
+      then
+	HPUX_BASE="pstat"
+      else
+	HPUX_BASE="/dev/kmem"
+      fi	# }
+    fi	# }
+    if test "X$HPUX_BASE" = "Xpstat"	# {
+    then
+
+      # Configure for pstat-based HP-UX lsof.
+
+      LSOF_CINFO="PSTAT-based"
+      echo "Configuring PSTAT-based HP-UX lsof"
+      LSOF_DIALECT_DIR=hpux/pstat
+      LSOF_CFGF="$LSOF_CFGF -DHPUXV=$LSOF_VERS -D_PSTAT64"
+      LSOF_CFGL="$LSOF_CFGL -lnsl"
+      LSOF_TSTKMEM=0
+      LSOF_TSTK64=1
+      ls -l $LSOF_CC | grep -q ansic
+      LSOF_TMP1=$?
+      ls -l $LSOF_CC | grep -q aCC
+      if test $? -eq 0 -o $LSOF_TMP1 -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -Ae +DD32"
+      else
+	echo $LSOF_CC | grep -q gcc
+	if test $? -ne 0	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF +DD32"
+	fi	# }
+      fi	# }
+      if test -r ${LSOF_INCLUDE}/netinet/in6.h	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
+      fi	# }
+      if test -r ${LSOF_INCLUDE}/sys/pstat/stream_pstat_body.h	# {
+      then
+	grep -q PS_STR_XPORT_DATA ${LSOF_INCLUDE}/sys/pstat/stream_pstat_body.h
+	if test $? -eq 0	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -D_PSTAT_STREAM_GET_XPORT"
+	fi	# }
+      fi	# }
+      if test $LSOF_VERS -ge 1123	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -D_LARGEFILE64_SOURCE"
+      fi	# }
+    else
+      if test "X$HPUX_BASE" = "X/dev/kmem"	# {
+      then
+    
+	# Configure for /dev/kmem-based HP-UX lsof.
+
+	if test "X$HPUX_BOOTFILE" = "X"	# {
+	then
+	  HPUX_BOOTFILE="/stand/vmunix"
+	fi	# }
+	if test $LSOF_VERS -gt 1100	# {
+	then
+	  echo ""
+	  echo "************************************************"
+	  echo "*                                              *"
+	  echo "* !!!!!!!!!!!!!!! FATAL ERROR !!!!!!!!!!!!!!!! *"
+	  echo "*                                              *"
+	  echo "* LSOF DOES NOT SUPPORT THIS VERSION OF HP-UX. *"
+	  echo "*                                              *"
+	  echo "************************************************"
+	  echo ""
+	  rm -f $LSOF_HLP
+	  exit 1
+	fi	# }
+	LSOF_CFGF="$LSOF_CFGF -DHPUXV=$LSOF_VERS"
+	LSOF_CINFO="/dev/kmem-based"
+	LSOF_DIALECT_DIR=hpux/kmem
+	echo "Configuring /dev/kmem-based HP-UX lsof"
+	if test $LSOF_VERS -lt 1000	# {
+	then
+	  if test "X$HPUX_X25DIR" = "X"	# {
+	  then
+	    HPUX_X25DIR="/etc/conf"
+	  else
+	    HPUX_X25DIR=$HPUX_X25DIR
+	  fi	# }
+	  if test -r ${HPUX_X25DIR}/x25/x25addrstr.h	# {
+	  then
+	    LSOF_CFGF="$LSOF_CFGF -DHPUX_CCITT"
+	    LSOF_DINC="$LSOF_DINC -I$HPUX_X25DIR"
+	  fi	# }
+	fi	# }
+	if test -r ${LSOF_INCLUDE}/sys/fs/vx_inode.h -a -r ${LSOF_INCLUDE}/sys/fs/vx_hpux.h	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DHASVXFS"
+	fi	# }
+	if test $LSOF_VERS -ge 1030	# {
+	then
+	  if test "X$HPUX_KERNBITS" = "X"	# {
+	  then
+	    HPUX_KERNBITS=`getconf _SC_KERNEL_BITS`
+	  fi	# }
+	  LSOF_CFGF="$LSOF_CFGF -DHPUXKERNBITS=${HPUX_KERNBITS} -I`pwd`/dialects/hpux/kmem/hpux11"
+	  if test $HPUX_KERNBITS -eq 64	# {
+	  then
+	    LSOF_TSTK64=1
+	    echo ""
+	    echo "*****************************************"
+	    echo "*                                       *"
+	    echo "* NOTICE!  Configuring for 64 bit HP-UX *"
+	    echo "*                                       *"
+	    echo "*****************************************"
+	    echo $LSOF_CC | grep gcc > /dev/null
+	    if test $? -eq 0	# {
+	    then
+
+	    # Test gcc for 64 bit support, trying gcc with no options, then
+	    # with -mlp64, testing the result with file.
+
+	      echo ""
+	      echo "Testing $LSOF_CC for 64 bit support"
+	      rm -f ${LSOF_TMPC}.*
+	      echo "main(){}" > ${LSOF_TMPC}.c
+	      LSOF_TMP1=""
+	      $LSOF_CC ${LSOF_TMPC}.c -o ${LSOF_TMPC}.x > /dev/null 2>&1
+	      if test $? -eq 0	# {
+	      then
+		/bin/file ${LSOF_TMPC}.x | /bin/grep 64 > /dev/null
+		if test $? -eq 0	# {
+		then
+		    LSOF_TMP1=" "
+		fi	# }
+	      fi	# }
+	      if test "X$LSOF_TMP1" = "X"	# {
+	      then
+		rm -f ${LSOF_TMPC}.x
+		$LSOF_CC ${LSOF_TMPC}.c -mlp64 -o ${LSOF_TMPC}.x > /dev/null 2>&1
+		if test $? -eq 0	# {
+		then
+		  /bin/file ${LSOF_TMPC}.x | /bin/grep 64 > /dev/null
+		  if test $? -eq 0	# {
+		  then
+		      LSOF_TMP1="-mlp64"
+		  fi	# }
+		fi	# }
+	      fi	# }
+	      rm -f ${LSOF_TMPC}.*
+	      if test "X$LSOF_TMP1" = "X"	# {
+	      then
+		echo ""
+		echo "***************************************************"
+		echo "*                                                 *"
+		echo "* !!!!!!!!!!!!!!!!! FATAL ERROR !!!!!!!!!!!!!!!!! *"
+		echo "*                                                 *"
+		echo "* APPARENTLY GCC CANNOT BUILD 64 BIT EXECUTABLES. *"
+		echo "* A COMPILER MUST BE USED THAT CAN.  SEE 00FAQ    *"
+		echo "* FOR MORE INFORMATION.                           *"
+		echo "*                                                 *"
+		echo "***************************************************"
+		echo ""
+		rm -f $LSOF_HLP
+		exit 1
+	      else
+		if test "X$LSOF_TMP1" != "X "	# {
+		then
+		  LSOF_CFGF="$LSOF_CFGF $LSOF_TMP1"
+		fi	# }
+		LSOF_CFGL="$LSOF_CFGL -lelf"
+		LSOF_CINFO="${LSOF_CINFO}, 64 bit HP-UX"
+	      fi	# }
+	    else
+
+	    # Set options for the HP-UX compiler.
+
+	      LSOF_CFGF="$LSOF_CFGF +DD64"
+	      LSOF_CFGL="$LSOF_CFGL -lelf"
+	      LSOF_CINFO="${LSOF_CINFO}, 64 bit HP-UX"
+	    fi	# }
+	  else
+	    LSOF_CFGF="$LSOF_CFGF -D_FILE_OFFSET_BITS=64"
+	    LSOF_CINFO="${LSOF_CINFO}, 32 bit HP-UX"
+	    echo $LSOF_CC | grep gcc > /dev/null
+	    if test $? -ne 0	# {
+	    then
+	      LSOF_CFGF="$LSOF_CFGF +DAportable"
+	    fi	# }
+	  fi	# }
+	  LSOF_CFGL="$LSOF_CFGL -lnsl"
+	else
+
+	# When HP-UX is less than 10.30, but greater than or equal to 10,
+	# check NFS3 rnode status.
+
+	  if test $LSOF_VERS -ge 1000	# {
+	  then
+	    LSOF_TMP1=0
+	    if test "X$HPUX_RNODE3" = "X"	# {
+	    then
+	      nm -x $HPUX_BOOTFILE | grep -q nfs_vnodeops3
+	      if test $? -eq 0	# {
+	      then
+		if test -r ${LSOF_INCLUDE}/nfs/rnode.h	# {
+		then
+		  grep -q r_fh3 ${LSOF_INCLUDE}/nfs/rnode.h
+		  if test $? -ne 0	# {
+		  then
+		    LSOF_TMP1=1
+		  fi	# }
+		fi	# }
+	      fi	# }
+	    else
+	      if test "X$HPUX_RNODE3" = "X1"	# {
+	      then
+		LSOF_TMP1=1
+	      fi	# }
+	    fi	# }
+	    if test $LSOF_TMP1 -eq 1	# {
+	    then
+	      LSOF_CFGF="$LSOF_CFGF -DHASRNODE3"
+	    fi	# }
+	  fi # }
+	fi	# }
+	if test $LSOF_VERS -eq 1100	# {
+	then
+
+	# Test for the ipis_s structure.  If it is present, set HAS_IPC_S_PATCH.
+
+	  if test "X$HPUX_IPC_S_PATCH" = "X"	# {
+	  then
+	    if test -x /usr/contrib/Q4/bin/q4exe	# {
+	    then
+	      LSOF_TMP=/usr/contrib/Q4/bin/q4exe
+	    else
+	      LSOF_TMP=/usr/contrib/bin/q4
+	    fi	# }
+	    if test -x $LSOF_TMP	# {
+	    then
+	      rm -f ${LSOF_TMPC}.out
+	      echo ""
+	      echo $EO "Looking in $HPUX_BOOTFILE for ipis_s with $LSOF_TMP ... $EC"
+	      echo "yes\\nfields -c struct ipis_s" | $LSOF_TMP $HPUX_BOOTFILE > ${LSOF_TMPC}.out 2>&1
+	      if test $? -ne 0	# {
+	      then
+		echo ""
+		echo ""
+		echo "!!!ERROR!!! $LSOF_TMP failed and produced the following output."
+		echo ""
+		cat ${LSOF_TMPC}.out
+		HPUX_IPC_S_PATCH=fail
+	      else
+		grep ipis_s ${LSOF_TMPC}.out > /dev/null 2>&1
+		if test $? -eq 0	# {
+		then
+		  echo "ipis_s exists."
+
+		# See if ipis_msgsqueued is present.
+
+		  grep ipis_msgsqueued ${LSOF_TMPC}.out > /dev/null 2>&1
+		  if test $? -eq 0	# {
+		  then
+		    HPUX_IPC_S_PATCH=2
+		  else
+		    HPUX_IPC_S_PATCH=1
+		  fi	# }
+		else
+		  echo "ipis_s doesn't exist."
+		  HPUX_IPC_S_PATCH=N
+		fi	# }
+	      fi	# }
+	      rm -f ${LSOF_TMPC}.out
+	    else
+	      echo "Can't locate or execute $LSOF_TMP"
+	      echo $EO "ls says: $EC"
+	      ls -ld $LSOF_TMP
+	      HPUX_IPC_S_PATCH=fail
+	    fi	# }
+	  fi	# }
+	  if test "X$HPUX_IPC_S_PATCH" = "Xfail"	# {
+	  then
+	    echo ""
+	    echo "!!!ERROR!!!     !!!ERROR!!!     !!!ERROR!!!     !!!ERROR!!!"
+	    echo "Configure can't use $LSOF_TMP to examine the ipis_s"
+	    echo "structure.  You must do that yourself, report the result in"
+	    echo "the HPUX_IPC_S_PATCH environment variable, then repeat the"
+	    echo "Configure step.  Consult the Configure script's use of"
+	    echo "$LSOF_TMP and the 00XCONFIG file for information"
+	    echo "on ipis_s testing and the setting of HPUX_IPC_S_PATCH."
+	    echo "!!!ERROR!!!     !!!ERROR!!!     !!!ERROR!!!     !!!ERROR!!!"
+	    echo ""
+	    rm -f $LSOF_HLP
+	    exit 1
+	  fi	# }
+	  if test "X$HPUX_IPC_S_PATCH" = "X1" -o "X$HPUX_IPC_S_PATCH" = "X2" # {
+	  then
+	    LSOF_CFGF="$LSOF_CFGF -DHAS_IPC_S_PATCH=$HPUX_IPC_S_PATCH"
+	  else
+	    if test "X$HPUX_IPC_S_PATCH" != "Xn" -a "X$HPUX_IPC_S_PATCH" != "XN" # {
+	    then
+	      echo "Illegal value for HPUX_IPC_S_PATCH: $HPUX_IPC_S_PATCH"
+	      rm -f $LSOF_HLP
+	      exit 1
+	    fi	# }
+	  fi	# }
+	fi	#}
+
+	# Manufacture an hpux_mount.h header file with a mount struct in it, as
+	# required.
+
+	if test -r ${LSOF_INCLUDE}/sys/mount.h	# {
+	then
+	  LSOF_TMP1="dialects/${LSOF_DIALECT_DIR}/hpux_mount.h"
+	  rm -f $LSOF_TMP1
+	  echo "#if !defined(MANUFACTURED_HPUX_SYS_MOUNT_H)" > $LSOF_TMP1
+	  echo "#define MANUFACTURED_HPUX_SYS_MOUNT_H" >> $LSOF_TMP1
+	  echo "/* By lsof Configure:" `date` " */" >> $LSOF_TMP1
+	  echo "struct mount" >> $LSOF_TMP1
+	  sed '1,/struct mount/d' ${LSOF_INCLUDE}/sys/mount.h | sed -n '1,/m_dev/p' >> $LSOF_TMP1
+	  echo "};" >> $LSOF_TMP1
+	  echo "#endif" >> $LSOF_TMP1
+	  LSOF_CFGF="$LSOF_CFGF -I`pwd`/dialects/${LSOF_DIALECT_DIR}"
+	fi	# }
+
+	# Test for OnlineJFS.
+
+	if test $LSOF_VERS -ge 1100	# {
+	then
+	  if test "X$HPUX_HASONLINEJFS" = "X" -a -x /sbin/fs/vxfs/subtype  # {
+	  then
+	    LSOF_TMP1=`/sbin/fs/vxfs/subtype`
+	    if test "X$LSOF_TMP1" = "Xvxfs3.3"
+	    then
+	      HPUX_HASONLINEJFS="Y"
+	    fi	# }
+	  fi	# }
+	  if test "X$HPUX_HASONLINEJFS" = "XY" -o "X$HPUX_HASONLINEJFS" = "Xy"
+	  # {
+	  then
+	    LSOF_CFGF="$LSOF_CFGF -DHASONLINEJFS"
+	  fi	# }
+	fi	# }
+
+	# Test for AFS.
+
+	if test -r ${AFS_VICE}/etc/ThisCell	# {
+	then
+	  if test "X$LSOF_SCRIPT_CALL" = "Xno"	# {
+	  then
+	    if test -r ./AFSHeaders -a -r ./AFSVersion	# {
+	    then
+	      LSOF_AFS="yes"
+	    fi	# }
+	  else
+	    if test ! -x ./AFSConfig	# {
+	    then
+	      echo "Can't find or execute the AFSConfig script"
+	      rm -f $LSOF_HLP
+	      exit 1
+	    fi	# }
+	    ./AFSConfig
+	    if test $? -eq 0 -a -r ./AFSHeaders -a -r ./AFSVersion	# {
+	    then
+	      LSOF_AFS="yes"
+	    fi	# }
+	  fi	# }
+	  if test "X$LSOF_AFS" = "Xyes"	# {
+	  then
+	    LSOF_AFSV=`cat ./AFSVersion | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1 \2/' | awk '{printf "%d%02d\n",\$1,\$2}'`
+	    LSOF_CFGF="$LSOF_CFGF -DHAS_AFS=$LSOF_AFSV"
+	    LSOF_DINC="$LSOF_DINC -I`cat ./AFSHeaders`"
+	  fi	# }
+	fi	# }
+      else
+	echo "HP-UX base unrecognized: $HPUX_BASE"
+	rm -f $LSOF_HLP
+	exit 1
+      fi	# }
+    fi	# }
+    ;;
+
+# Configure for Linux.
+
+  linux)
+    LSOF_TSTBIGF="-D_FILE_OFFSET_BITS=64"
+    LSOF_TSTKMEM=0
+    if test "X$LSOF_CC" = "X"	# {
+    then
+      LSOF_CC=cc
+      LSOF_CCV=`$LSOF_CC -v 2>&1 | sed -n 's/.*version \(.*\)/\1/p'`
+    fi	# }
+    if test "X$LINUX_CONF_CC" = "X"	# {
+    then
+      LINUX_CONF_CC=$LSOF_CC
+    fi	#}
+    LSOF_DIALECT_DIR=""
+    if test "X$LINUX_INCL" = "X" # {
+    then
+      LINUX_INCL=/usr/include
+    else
+      LSOF_DINC="$LSOF_DINC -I${LINUX_INCL}"
+    fi	# }
+    if test "X$LINUX_VERSION_CODE" = "X" # {
+    then
+      if test -r "$LINUX_INCL/linux/version.h" # {
+      then
+        LINUX_VERSION_CODE=`cat $LINUX_INCL/linux/version.h | sed -n 's/.\+LINUX_VERSION_CODE \([[:digit:]]\+\)$/\1/p'`
+      fi # }
+    fi # }
+    LSOF_VSTR=`echo $LINUX_VERSION_CODE | perl -e '$version=<STDIN>; chomp($version); printf("%d.%d.%d\n", ($version >> 16) & 0xFF, ($version >> 8) & 0xFF, $version & 0xFF);'`
+    if test "X$LSOF_VSTR" = "X"	# {
+    then
+      LSOF_VSTR=`uname -r`
+    fi	# }
+    if test "X$LSOF_VERS" = "X"	# {
+    then
+
+      # If the Linux version isn't predefined, determine it.
+
+      LSOF_VERS=`echo $LSOF_VSTR | sed 's/\./ /g' | awk '{printf "%d%d%03d",\$1,\$2,\$3}'`
+    fi	# }
+    LSOF_CFGF="$LSOF_CFGF -DLINUXV=$LSOF_VERS"
+    if test $LSOF_VERS -lt 21072	# {
+    then
+      echo ""
+	echo "!!!WARNING!!!==!!!WARNING!!!==!!!WARNING!!!==!!!WARNING!!!"
+	echo "!                                                        !"
+	echo "! THE /PROC-BASED LSOF SOURCES HAVE NOT BEEN TESTED ON   !"
+	echo "! LINUX KERNELS BELOW 2.1.72, AND MAY NOT WORK ON THIS   !"
+	echo "! KERNEL.  IT SHOULD USE A /DEV/KMEM-BASED LSOF.         !"
+	echo "!                                                        !"
+	echo "!!!WARNING!!!==!!!WARNING!!!==!!!WARNING!!!==!!!WARNING!!!"
+	echo ""
+    else
+      LSOF_UNSUP=""
+    fi	# }
+
+    # If the Linux C library type isn't predefined, determine it.
+
+    if test "X$LINUX_CLIB" = "X"	# {
+    then
+      echo -n "Testing C library type with $LINUX_CONF_CC ... "
+      rm -f ${LSOF_TMPC}.*
+      cat > $LSOF_TMPC.c << .LSOF_END_HERE_DOC1
+#include <features.h>
+main() {
+#if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
+printf("-DGLIBCV=%d\n",__GLIBC__*100+__GLIBC_MINOR__);
+#elif defined(__GLIBC__)
+printf("-DGLIBCV=%d00\n",__GLIBC__);
+#else
+printf("\n");
+#endif
+return(0); }
+.LSOF_END_HERE_DOC1
+      $LINUX_CONF_CC ${LSOF_TMPC}.c -I$LSOF_INCLUDE -o ${LSOF_TMPC}.x > /dev/null 2>&1
+      if test -x ${LSOF_TMPC}.x	# {
+      then
+	LINUX_CLIB=`${LSOF_TMPC}.x`
+	LSOF_TMP=$?
+      else
+	LINUX_CLIB=""
+	LSOF_TMP=1
+      fi	# }
+      rm -f ${LSOF_TMPC}.*
+      echo "done"
+      if test $LSOF_TMP -ne 0	# {
+      then
+	echo "Cannot determine C library type; assuming it is not glibc."
+	LINUX_CLIB=""
+      else
+	if test "X$LINUX_CLIB" = "X"	# {
+	then
+	  echo "The C library type is not glibc."
+	else
+	  echo "The C library type is glibc, version \"$LINUX_CLIB\"."
+	fi	# }
+      fi	# }
+    fi	# }
+    if test "X$LINUX_CLIB" != "X"	# {
+    then
+      LSOF_CFGF="$LSOF_CFGF $LINUX_CLIB"
+    fi	# }
+
+    # Test for IPv6 support.
+
+    if test -r ${LSOF_INCLUDE}/netinet/ip6.h	# {
+    then
+      LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
+    fi	# }
+
+    # Test for <rpc/rpc.h>.
+
+    if ! test -r ${LSOF_INCLUDE}/rpc/rpc.h	# {
+    then
+      LSOF_CFGF="$LSOF_CFGF -DHASNORPC_H"
+    fi	# }
+
+    # Test for TCP_* symbols.
+
+    if test -r ${LSOF_INCLUDE}/netinet/tcp.h	# (
+    then
+      grep -q TCP_ESTABLISHED ${LSOF_INCLUDE}/netinet/tcp.h
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DNEEDS_NETINET_TCPH"
+      fi	#}
+    fi	# }
+
+    # Test for SELinux support.
+
+    LSOF_TMP1=0
+    if test "X$LINUX_HASSELINUX" = "X"	# {
+    then
+      if test -r ${LSOF_INCLUDE}/selinux/selinux.h	# {
+      then
+	LSOF_TMP1=1
+      fi	# }
+    else
+      if test "X$LINUX_HASSELINUX" = "XY" -o "X$LINUX_HASSELINUX" = "Xy" # {
+      then
+	LSOF_TMP1=1
+      fi	# }
+    fi	# }
+    if test $LSOF_TMP1 -eq 1	# {
+    then
+      LSOF_CFGF="$LSOF_CFGF -DHASSELINUX"
+      LSOF_CFGL="$LSOF_CFGL -lselinux"
+    fi	# }
+
+  # Test for UNIX socket endpoint support.
+
+    if test -r ${LSOF_INCLUDE}/linux/sock_diag.h -a -r ${LSOF_INCLUDE}/linux/unix_diag.h  # {
+    then
+      LSOF_CFGF="$LSOF_CFGF -DHASUXSOCKEPT"
+    fi	# }
+    LSOF_DIALECT_DIR="linux"
+    LSOF_CFGF="$LSOF_CFGF -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE"
+    ;;
+
+# Configure for NetBSD.
+
+  netbsd)
+    if test "X$LSOF_CC" = "X"	# {
+    then
+      LSOF_CC=cc
+      LSOF_CCV=`$LSOF_CC -v 2>&1 | sed -n 's/.*version \(.*\)/\1/p'`
+    fi	# }
+    if test "X$LSOF_VSTR" = "X"	# {
+    then
+      LSOF_VSTR=`uname -r`
+    fi	# }
+    if test "X$LSOF_VERS" = "X"	# {
+    then
+      
+      # Validate the NetBSD version.
+
+      case $LSOF_VSTR in	# {
+      1.2*)
+	LSOF_VERS="1002000"
+	;;
+      1.3*)
+	LSOF_VERS="1003000"
+	;;
+      1.4*)
+	LSOF_VERS="1004000"
+	;;
+      1.5*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS="1005000"
+	;;
+      1.6*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS="1006000"
+	;;
+      1*)
+	LSOF_VERS="1006000"
+	echo "!!!WARNING!!!  Unsupported NetBSD version: $LSOF_VSTR"
+	echo "!!!WARNING!!!  Configuring for NetBSD 1.6"
+	;;
+      2.0*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS="2000000"
+	;;
+      2.99.9)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS="2099009"
+	;;
+      2.99.10)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS="2099010"
+	;;
+      2.99.*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS="2099010"
+	;;
+      2*)
+	LSOF_VERS="2000000"
+	echo "!!!WARNING!!!  Unsupported NetBSD version: $LSOF_VSTR"
+	echo "!!!WARNING!!!  Configuring for NetBSD 2.0"
+	;;
+      3.0*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS="3000000"
+	;;
+      3.99.*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS="3099000"
+	;;
+      3*)
+	LSOF_VERS="3000000"
+	echo "!!!WARNING!!!  Unsupported NetBSD version: $LSOF_VSTR"
+	echo "!!!WARNING!!!  Configuring for NetBSD 3.0"
+	;;
+      *)
+	echo "Unknown NetBSD release: $LSOF_VSTR"
+	echo Assuming NetBSD 1.6
+	LSOF_VERS="1006000"
+	;;
+      esac	# }
+    fi	# }
+
+    # Test for legal NetBSD version.
+
+    case $LSOF_VERS in	# {
+    1002000|1003000|1004000|1005000|1006000)
+      ;;
+    2000000|2099009|2099010)
+      ;;
+    3000000|3099000)
+      ;;
+    *)
+      echo "Unknown NetBSD version: $LSOF_VERS"
+      rm -f $LSOF_HLP
+      exit 1
+      ;;
+    esac	# }
+    LSOF_CFGF="$LSOF_CFGF -DNETBSDV=$LSOF_VERS"
+    LSOF_TMP1="-DN_UNIXV=/netbsd"
+    if test -r ${LSOF_INCLUDE}/util.h	# {
+    then
+      grep -q getbootfile ${LSOF_INCLUDE}/util.h
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGL="$LSOF_CFGL -lutil"
+	LSOF_TMP1="-DHASGETBOOTFILE"
+      fi	# }
+    fi	# }
+    LSOF_CFGF="$LSOF_CFGF $LSOF_TMP1"
+    if test -r ${LSOF_INCLUDE}/kvm.h	# {
+    then
+      grep -q kvm_getproc2 ${LSOF_INCLUDE}/kvm.h
+      if test $? -eq 0	# {
+      then
+	  LSOF_CFGF="$LSOF_CFGF -DHASKVMGETPROC2"
+      fi	# }
+    fi	# }
+
+  # Here begin the dual tests on header files that may be in $LSOF_INCLUDE
+  # or $NETBSD_SYS.
+  #
+  # Note that $LSOF_TMP1 holds an indicator of the need for -I$NETBSD_SYS.
+  # LSOF_TMP4 contains a temporary indicator of the use of $NETBSD_SYS.
+
+    LSOF_TMP1=0
+    if test "X$NETBSD_SYS" = "X"	# {
+    then
+      if test -d /usr/src	# {
+      then
+	NETBSD_SYS="/usr/src/sys"
+      else
+	NETBSD_SYS=$LSOF_INCLUDE
+      fi	# }
+    fi	# }
+    LSOF_TMP2="nfs/nfsproto.h"
+    if test -r ${LSOF_INCLUDE}/$LSOF_TMP2	# {
+    then
+      LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
+      LSOF_TMP4=0
+    else
+      if test -r ${NETBSD_SYS}/$LSOF_TMP2	# {
+      then
+	LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
+	LSOF_TMP4=1
+      else
+	LSOF_TMP3=""
+      fi	# }
+    fi	# }
+    if test "X$LSOF_TMP3" != "X"	# {
+    then
+      LSOF_CFGF="$LSOF_CFGF -DHASNFSPROTO"
+      if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1	# {
+      then
+	LSOF_TMP1=1
+      fi	# }
+    fi	# }
+    LSOF_TMP2="netinet/ip6.h"
+    if test -r ${LSOF_INCLUDE}/$LSOF_TMP2	# {
+    then
+      LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
+      LSOF_TMP4=0
+    else
+      if test -r ${NETBSD_SYS}/$LSOF_TMP2	# {
+      then
+	LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
+	LSOF_TMP4=1
+      else
+	LSOF_TMP3=""
+      fi	# }
+    fi	# }
+    if test "X$LSOF_TMP3" != "X"	# {
+    then
+      LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
+      if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1	# {
+      then
+	LSOF_TMP1=1
+      fi	# }
+    else
+      LSOF_TMP2="netinet/in.h"
+      if test -r ${LSOF_INCLUDE}/$LSOF_TMP2	# {
+      then
+	LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
+	LSOF_TMP4=0
+      else
+	if test -r ${NETBSD_SYS}/$LSOF_TMP2	# {
+	then
+	  LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
+	  LSOF_TMP4=1
+	else
+	  LSOF_TMP3=""
+	fi	# }
+      fi	# }
+      if test "X$LSOF_TMP3" != "X"	# {
+      then
+	grep -q IPV6_INRIA_VERSION $LSOF_TMP3
+	if test $? -eq 0	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DHASIPv6 -DHASINRIAIPv6"
+	  if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1	# {
+	  then
+	    LSOF_TMP1=1
+	  fi	# }
+	fi	# }
+      fi # }
+    fi	# }
+    LSOF_TMP2="miscfs/fdesc/fdesc.h"
+    if test -r ${LSOF_INCLUDE}/$LSOF_TMP2	# {
+    then
+      LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
+    else
+      if test -r ${NETBSD_SYS}/$LSOF_TMP2	# {
+      then
+	LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
+	LSOF_TMP4=1
+      else
+	LSOF_TMP3=""
+      fi	# }
+    fi	# }
+    if test "X$LSOF_TMP3" != "X"	# {
+    then
+      grep -q Fctty $LSOF_TMP3
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASFDESCFS=1"
+      else
+	LSOF_CFGF="$LSOF_CFGF -DHASFDESCFS=2"
+      fi	# }
+      grep -q fd_link $LSOF_TMP3
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASFDLINK"
+      fi	# }
+      if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1	# {
+      then
+	LSOF_TMP1=1
+      fi	# }
+    fi	# }
+    LSOF_TMP2="miscfs/nullfs/null.h"
+    if test -r ${LSOF_INCLUDE}/$LSOF_TMP2	# {
+    then
+      LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
+      LSOF_TMP4=0
+    else
+      if test -r ${NETBSD_SYS}/$LSOF_TMP2	# {
+      then
+	LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
+	LSOF_TMP4=1
+      else
+	LSOF_TMP3=""
+      fi	# }
+    fi	# }
+    if test "X$LSOF_TMP3" != "X"	# {
+    then
+      LSOF_CFGF="$LSOF_CFGF -DHASNULLFS"
+      if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1	# {
+      then
+	LSOF_TMP1=1
+      fi	# }
+    fi	# }
+    LSOF_TMP2="miscfs/procfs"
+    if test -d ${LSOF_INCLUDE}/$LSOF_TMP2	# {
+    then
+      LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
+      LSOF_TMP4=0
+    else
+      if test -d ${NETBSD_SYS}/$LSOF_TMP2	# {
+      then
+	LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
+	LSOF_TMP4=1
+      else
+	LSOF_TMP3=""
+      fi	# }
+    fi	# }
+    if test "X$LSOF_TMP3" != "X"	# {
+    then
+      LSOF_CFGF="$LSOF_CFGF -DHASPROCFS"
+      if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1	# {
+      then
+	LSOF_TMP1=1
+      fi	# }
+      if test -r ${LSOF_TMP3}/procfs.h	# {
+      then
+	grep -q PFSroot ${LSOF_TMP3}/procfs.h
+	if test $? -eq 0	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DHASPROCFS_PFSROOT"
+	fi #	}
+      fi	# }
+    fi	# }
+    LSOF_TMP2="sys/bufq.h"
+    LSOF_NBSD_BUFQH=0
+    if test -r ${LSOF_INCLUDE}/$LSOF_TMP2	# {
+    then
+      LSOF_CFGF="$LSOF_CFGF -DHASBUFQ_H"
+    else
+      if test -r ${NETBSD_SYS}/$LSOF_TMP2	# {
+      then
+	if test $NETBSD_SYS != $LSOF_INCLUDE	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DHASBUFQ_H"
+	  LSOF_NBSD_BUFQH=1
+	fi	# }
+      fi	# }
+    fi	# }
+    LSOF_TMP2="isofs/cd9660"
+    if test -d ${LSOF_INCLUDE}/$LSOF_TMP2	# {
+    then
+      LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
+      LSOF_TMP4=0
+    else
+      if test -d ${NETBSD_SYS}/$LSOF_TMP2	# {
+      then
+	LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
+	LSOF_TMP4=1
+      else
+	LSOF_TMP3=""
+      fi	# }
+    fi	# }
+    if test "X$LSOF_TMP3" != "X"	# {
+    then
+      LSOF_CFGF="$LSOF_CFGF -DHAS9660FS=1"
+      if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1	# {
+      then
+	LSOF_TMP1=1
+      fi	# }
+    else
+      LSOF_TMP2="fs/cd9660"
+      if test -d ${LSOF_INCLUDE}/$LSOF_TMP2	# {
+      then
+	LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
+	LSOF_TMP4=0
+      else
+	if test -d ${NETBSD_SYS}/$LSOF_TMP2	# {
+	then
+	  LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
+	  LSOF_TMP4=1
+	else
+	  LSOF_TMP3=""
+	fi	# }
+      fi	# }
+      if test "X$LSOF_TMP3" != "X"	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHAS9660FS=1"
+	if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1	# {
+	then
+	  LSOF_TMP1=1
+	fi	# }
+      fi	# }
+    fi	# }
+    LSOF_TMP2="msdosfs"
+    if test -d ${LSOF_INCLUDE}/$LSOF_TMP2	# {
+    then
+      LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
+      LSOF_TMP4=0
+    else
+      if test -d ${NETBSD_SYS}/$LSOF_TMP2	# {
+      then
+	LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
+	LSOF_TMP4=1
+      else
+	LSOF_TMP3=""
+      fi	# }
+    fi	# }
+    if test "X$LSOF_TMP3" != "X"	# {
+    then
+      LSOF_CFGF="$LSOF_CFGF -DHASMSDOSFS=1"
+      if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1	# {
+      then
+	LSOF_TMP1=1
+      fi	# }
+    else
+      LSOF_TMP2="fs/msdosfs"
+      if test -d ${LSOF_INCLUDE}/$LSOF_TMP2	# {
+      then
+	LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
+	LSOF_TMP4=0
+      else
+	if test -d ${NETBSD_SYS}/$LSOF_TMP2	# {
+	then
+	  LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
+	  LSOF_TMP4=1
+	else
+	  LSOF_TMP3=""
+	fi	# }
+      fi	# }
+      if test "X$LSOF_TMP3" != "X"	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASMSDOSFS=2"
+	if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1	# {
+	then
+	  LSOF_TMP1=1
+	fi	# }
+      fi	# }
+    fi	# }
+    LSOF_TMP2="miscfs/kernfs/kernfs.h"
+    if test -r ${LSOF_INCLUDE}/$LSOF_TMP2	# {
+    then
+      LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
+      LSOF_TMP4=0
+    else
+      if test -r ${NETBSD_SYS}/$LSOF_TMP2	# {
+      then
+	LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
+	LSOF_TMP4=1
+      else
+	LSOF_TMP3=""
+      fi	# }
+    fi	# }
+    if test "X$LSOF_TMP3" != "X"	# {
+    then
+      grep -q "kt_name;" $LSOF_TMP3
+      if test $? -eq 0	# {
+	then
+ 	  LSOF_CFGF="$LSOF_CFGF -DHASKERNFS"
+	  if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1	# {
+	  then
+	    LSOF_TMP1=1
+	  fi	# }
+	  grep -q "*kfs_kt;" $LSOF_TMP3
+	  if test $? -eq 0      # {
+	  then
+	    LSOF_CFGF="$LSOF_CFGF -DHASKERNFS_KFS_KT"
+	  fi	# }
+      fi	# }
+    fi	# }
+    LSOF_TMP2="sys/namei.h"
+    if test -r ${LSOF_INCLUDE}/$LSOF_TMP2	# {
+    then
+      LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
+      LSOF_TMP4=0
+    else
+      if test -r ${NETBSD_SYS}/$LSOF_TMP2	# {
+      then
+	LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
+	LSOF_TMP4=1
+      else
+	LSOF_TMP3=""
+      fi	# }
+    fi	# }
+    if test "X$LSOF_TMP3" != "X"	# {
+    then
+      grep -q nc_vpid $LSOF_TMP3
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASNCVPID"
+	if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1	# {
+	then
+	  LSOF_TMP1=1
+	fi	# }
+      fi	# }
+    fi	# }
+    LSOF_TMP2="ufs/ufs/inode.h"
+    if test -r ${LSOF_INCLUDE}/$LSOF_TMP2	# {
+    then
+      LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
+      LSOF_TMP4=0
+    else
+      if test -r ${NETBSD_SYS}/$LSOF_TMP2	# {
+      then
+	LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
+	LSOF_TMP4=1
+      else
+	LSOF_TMP3=""
+      fi	# }
+    fi	# }
+    if test "X$LSOF_TMP3" != "X"	# {
+    then
+      grep -q i_ffs_size $LSOF_TMP3
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASI_FFS"
+	if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1	# {
+	then
+	  LSOF_TMP1=1
+	fi	# }
+      else
+	grep -q i_ffs1_size $LSOF_TMP3
+	if test $? -eq 0	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DHASI_FFS1"
+	  if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1	# {
+	  then
+	    LSOF_TMP1=1
+	  fi	# }
+	fi	# }
+      fi	# }
+      grep -q i_ffs_effnlink $LSOF_TMP3
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASEFFNLINK=i_ffs_effnlink"
+	if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1	# {
+	then
+	  LSOF_TMP1=1
+	fi	# }
+      fi	# }
+    fi	# }
+    LSOF_TMP2="sys/vnode.h"
+    LSOF_NBSD_PTYFS=0
+    if test -r ${LSOF_INCLUDE}/$LSOF_TMP2	# {
+    then
+      LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
+      LSOF_TMP4=0
+    else
+      if test -r ${NETBSD_SYS}/$LSOF_TMP2	# {
+      then
+	LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
+	LSOF_TMP4=1
+      else
+	LSOF_TMP3=""
+      fi	# }
+    fi	# }
+    if test "XLSOF_TMP3" != "X"	# {
+    then
+      grep -q VT_EXT2FS $LSOF_TMP3
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASEXT2FS"
+	if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1	# {
+	then
+	  LSOF_TMP1=1
+	fi	# }
+	LSOF_TMP2="ufs/ufs/inode.h"
+	if test -r ${LSOF_INCLUDE}/$LSOF_TMP2	# {
+	then
+	  LSOF_TMP5="${LSOF_INCLUDE}/$LSOF_TMP2"
+	  LSOF_TMP6=0
+	else
+	  if test -r ${NETBSD_SYS}/$LSOF_TMP2	# {
+	  then
+	    LSOF_TMP5="${NETBSD_SYS}/$LSOF_TMP2"
+	    LSOF_TMP6=1
+	  else
+	    LSOF_TMP5=""
+	  fi	# }
+	fi	# }
+	if test "X$LSOF_TMP5" != "X"	# {
+	then
+	  grep -q "*e2fs_din" $LSOF_TMP5
+	  if test $? -eq 0	# {
+	  then
+	    LSOF_CFGF="$LSOF_CFGF -DHASI_E2FS_PTR"
+	    if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1	# {
+	    then
+	      LSOF_TMP1=$LSOF_TMP6
+	    fi	# }
+	  fi	# }
+	fi	# }
+      fi	# }
+      grep -q VT_LFS $LSOF_TMP3
+      if test $? -eq 0   # {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASLFS"
+	if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1	# {
+	then
+	  LSOF_TMP1=1
+	fi	# }
+      fi	# }
+      grep -q VT_PTYFS $LSOF_TMP3
+      if test $? -eq 0   # {
+      then
+	LSOF_TMP2="fs/ptyfs/ptyfs.h"
+	if test -r ${LSOF_INCLUDE}/$LSOF_TMP2	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DHASPTYFS"
+	else
+	  if test -r ${NETBSD_SYS}/$LSOF_TMP2	# {
+	  then
+	    if test $NETBSD_SYS != $LSOF_INCLUDE	# {
+	    then
+	      LSOF_CFGF="$LSOF_CFGF -DHASPTYFS"
+	      LSOF_NBSD_PTYFS=1
+	    fi	# }
+	  fi	# }
+	fi	# }
+      fi	# }
+      if test "X$NETBSD_UVM" = "X"	# {
+      then
+	grep -q UVM $LSOF_TMP3
+	if test $? -ne 0	# {
+	then
+	  egrep -q "v_uvm;|v_uobj;" $LSOF_TMP3
+	  if test $? -eq 0	# {
+	  then
+	    NETBSD_UVM="Y"
+	  fi	# }
+	fi	# }
+      fi	# }
+    fi	# }
+    LSOF_TMP2="nfs/nfsnode.h"
+    if test -r ${LSOF_INCLUDE}/$LSOF_TMP2	# {
+    then
+      LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
+      LSOF_TMP4=0
+    else
+      if test -r ${NETBSD_SYS}/$LSOF_TMP2	# {
+      then
+	LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
+	LSOF_TMP4=1
+      else
+	LSOF_TMP3=""
+      fi	# }
+    fi	# }
+    if test "X$LSOF_TMP3" != "X"	# {
+    then
+      grep -q "*n_vattr" $LSOF_TMP3
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASNFSVATTRP"
+	if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1	# {
+	then
+	  LSOF_TMP1=1
+	fi	# }
+      fi	# }
+    fi	# }
+    LSOF_TMP2="sys/lockf.h"
+    if test -r ${LSOF_INCLUDE}/$LSOF_TMP2	# {
+    then
+      LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
+      LSOF_TMP4=0
+    else
+      if test -r ${NETBSD_SYS}/$LSOF_TMP2	# {
+      then
+	LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
+	LSOF_TMP4=1
+      else
+	LSOF_TMP3=""
+      fi	# }
+    fi	# }
+    if test "X$LSOF_TMP3" != "X"	# {
+    then
+      grep -q vop_advlock_args $LSOF_TMP3
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHAS_ADVLOCK_ARGS"
+	if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1	# {
+	then
+	  LSOF_TMP1=1
+	fi	# }
+      fi	# }
+      grep -q lf_lwp $LSOF_TMP3
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHAS_LF_LWP"
+	if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1	# {
+	then
+	  LSOF_TMP1=1
+	fi	# }
+      fi	# }
+    fi	# }
+    LSOF_TMP2="sys/lwp.h"
+    if test -r ${LSOF_INCLUDE}/$LSOF_TMP2	# {
+    then
+      LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
+      LSOF_TMP4=0
+    else
+      if test -r ${NETBSD_SYS}/$LSOF_TMP2	# {
+      then
+	LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
+	LSOF_TMP4=1
+      else
+	LSOF_TMP3=""
+      fi	# }
+    fi	# }
+    if test "X$LSOF_TMP3" != "X"	# {
+    then
+      LSOF_CFGF="$LSOF_CFGF -DHAS_LWP_H"
+      if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1	# {
+      then
+	LSOF_TMP1=1
+      fi	# }
+    fi	# }
+    LSOF_TMP2="sys/filedesc.h"
+    if test -r ${LSOF_INCLUDE}/$LSOF_TMP2	# {
+    then
+      LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
+      LSOF_TMP4=0
+    else
+      if test -r ${NETBSD_SYS}/$LSOF_TMP2	# {
+      then
+	LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
+	LSOF_TMP4=1
+      else
+	LSOF_TMP3=""
+      fi	# }
+    fi	# }
+    if test "X$LSOF_TMP3" != "X"	# {
+    then
+      grep -q "^struct cwdinfo {" $LSOF_TMP3
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASCWDINFO"
+	if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1	# {
+	then
+	  LSOF_TMP1=1
+	fi	# }
+      fi	# }
+    fi	# }
+    LSOF_TMP2="sys/pipe.h"
+    if test -r ${LSOF_INCLUDE}/$LSOF_TMP2	# {
+    then
+      LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
+      LSOF_TMP4=0
+    else
+      if test -r ${NETBSD_SYS}/$LSOF_TMP2	# {
+      then
+	LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
+	LSOF_TMP4=1
+      else
+	LSOF_TMP3=""
+      fi	# }
+    fi	# }
+    if test "X$LSOF_TMP3" != "X"	# {
+    then
+      LSOF_CFGF="$LSOF_CFGF -DHAS_SYS_PIPEH"
+      if test $LSOF_TMP1 -eq 0 -a $LSOF_TMP4 -eq 1	# {
+      then
+	LSOF_TMP1=1
+      fi	# }
+    fi	# }
+    if test -r ${LSOF_INCLUDE}/sys/statvfs.h 	# {
+    then
+      grep -q '^struct statvfs {' ${LSOF_INCLUDE}/sys/statvfs.h
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASSTATVFS"
+      fi	# }
+    fi	# }
+
+  # Here end the dual NetBSD tests for header files in $LSOF_INCLUDE or
+  # NETBSD_SYS.
+  #
+  # After this LSOF_TMP1 may be reused.
+
+    if test $LSOF_TMP1 -eq 1	# {
+    then
+      LSOF_DINC="-I$LSOF_INCLUDE -I$NETBSD_SYS"
+    fi	# }
+
+  # Build special header files, as required.
+
+    rm -rf dialects/n+obsd/include
+    if test "X$NETBSD_UVM" = "XY" -o "X$NETBSD_UVM" = "Xy"	# {
+    then
+      mkdir dialects/n+obsd/include
+      touch dialects/n+obsd/include/opt_uvmhist.h
+      touch dialects/n+obsd/include/opt_lockdebug.h
+      LSOF_CFGF="$LSOF_CFGF -DUVM -I`pwd`/dialects/n+obsd/include"
+      if test -d ${LSOF_INCLUDE}/uvm	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHAS_UVM_INCL"
+      fi	# }
+    fi	# }
+    LSOF_TMP2="sys/mount.h"
+    if test -r ${LSOF_INCLUDE}/$LSOF_TMP2	# {
+    then
+      LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
+    else
+      if test -r ${NETBSD_SYS}/$LSOF_TMP2	# {
+      then
+	LSOF_TMP3="${NETBSD_SYS}/$LSOF_TMP2"
+      else
+	LSOF_TMP3=""
+      fi	# }
+    fi	# }
+    if test "X$LSOF_TMP3" != "X"	# {
+    then
+
+      # Build a local NetBSD netexport.h header file for possible use by
+      # <msdosfs/msdosfsmount.h>.  Make sure CFGL contains a -I for it.
+
+      LSOF_TMP1=${LSOF_TMPC}.edscr
+      LSOF_TMP2=${LSOF_TMPC}.netcred
+      LSOF_TMP3=${LSOF_TMPC}.netexport
+      LSOF_TMP4=dialects/n+obsd/include/netexport.h
+      if test ! -d dialects/n+obsd/include	# {
+      then
+	mkdir dialects/n+obsd/include
+      fi	# }
+      rm -f $LSOF_TMP1 $LSOF_TMP2 $LSOF_TMP3 $LSOF_TMP4 
+      echo "/^struct netcred" > $LSOF_TMP1
+      echo "1,.-1d" >> $LSOF_TMP1
+      echo "/^};" >> $LSOF_TMP1
+      echo "1,.w $LSOF_TMP2" >> $LSOF_TMP1
+      ed ${LSOF_INCLUDE}/sys/mount.h < $LSOF_TMP1 > /dev/null 2>&1
+      rm -f $LSOF_TMP1
+      echo "/^struct netexport" > $LSOF_TMP1
+      echo "1,.-1d" >> $LSOF_TMP1
+      echo "/^};" >> $LSOF_TMP1
+      echo "1,.w $LSOF_TMP3" >> $LSOF_TMP1
+      ed ${LSOF_INCLUDE}/sys/mount.h < $LSOF_TMP1 > /dev/null 2>&1
+      echo "/*" > $LSOF_TMP4
+      echo " * netexport.h" >> $LSOF_TMP4
+      echo -n " * Created by Configure: " >> $LSOF_TMP4
+      echo `date` >> $LSOF_TMP4
+      echo " */" >> $LSOF_TMP4
+      echo "" >> $LSOF_TMP4
+      echo "#if	!defined(NETEXPORT_H)" >> $LSOF_TMP4
+      echo "#define	NETEXPORT_H" >> $LSOF_TMP4
+      echo "" >> $LSOF_TMP4
+      echo "#include <net/radix.h>" >> $LSOF_TMP4
+      echo "" >> $LSOF_TMP4
+      if test -r $LSOF_TMP2	# {
+      then
+	cat $LSOF_TMP2 >> $LSOF_TMP4
+	echo "" >> $LSOF_TMP4
+      fi	# }
+      if test -r $LSOF_TMP3	# {
+      then
+	cat $LSOF_TMP3 >> $LSOF_TMP4
+      fi	# }
+      echo "#endif	/* !defined(NETEXPORT_H) */" >> $LSOF_TMP4
+      rm -f $LSOF_TMP1 $LSOF_TMP2 $LSOF_TMP3
+      echo $LSOF_CFGF | grep /dialects/n+obsd/include > /dev/null 2>&1
+      if test $? -ne 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -I`pwd`/dialects/n+obsd/include"
+      fi	# }
+    fi	# }
+    if test $LSOF_NBSD_BUFQH -eq 1	# {
+    then
+
+    # Make a local copy of $NETBSD_SYS/sys/bufq.h.
+
+      if test ! -d dialects/n+obsd/include	# {
+      then
+	mkdir dialects/n+obsd/include
+      fi	# }
+      if test ! -d dialects/n+obsd/include/sys	# {
+      then
+	mkdir dialects/n+obsd/include/sys
+      fi	# }
+      cp $NETBSD_SYS/sys/bufq.h dialects/n+obsd/include/sys
+      echo $LSOF_CFGF | grep /dialects/n+obsd/include > /dev/null 2>&1
+      if test $? -ne 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -I`pwd`/dialects/n+obsd/include"
+      fi	# }
+    fi	# }
+    if test $LSOF_NBSD_PTYFS -eq 1	# {
+    then
+
+    # Make a local copy of $NETBSD_SYS/sys/fs/ptyfs/.
+
+      if test ! -d dialects/n+obsd/include	# {
+      then
+	mkdir dialects/n+obsd/include
+      fi	# }
+      if test ! -d dialects/n+obsd/include/fs	# {
+      then
+	mkdir dialects/n+obsd/include/fs
+      fi	# }
+      rm -rf dialects/n+obsd/include/fs/ptyfs
+      mkdir dialects/n+obsd/include/fs/ptyfs
+      cp $NETBSD_SYS/fs/ptyfs/*.h dialects/n+obsd/include/fs/ptyfs
+      echo $LSOF_CFGF | grep /dialects/n+obsd/include > /dev/null 2>&1
+      if test $? -ne 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -I`pwd`/dialects/n+obsd/include"
+      fi	# }
+    fi	# }
+    LSOF_CFGL="$LSOF_CFGL -lkvm"
+    LSOF_DIALECT_DIR=n+obsd
+    ;;
+
+# Configure for NeXTSTEP or OPENSTEP.
+
+  nextstep|next|ns|nxt|openstep|os)
+    LSOF_TGT="ns"
+    LSOF_TSTXO="../lib/snpf.o"
+    if test "X$LSOF_AR" = "X"	# {
+    then
+      LSOF_AR="rm -f \${LIB}; ar cr"
+    fi	# }
+    if test "X$LSOF_VSTR" = "X"	# {
+    then
+      LSOF_VSTR=`hostinfo | sed -n 's/.*NeXT Mach \([0-9\.]*\).*/\1/p'`
+    fi	# }
+    if test "X$LSOF_VERS" = "X"	# {
+    then
+
+      # If the NeXSTEP version isn't predefined, determine it.
+
+      LSOF_VERS=`echo $LSOF_VSTR | sed -n 's/\([0-9]*\)\.\([0-9]*\)/\1\2/p'`
+    fi	# }
+    if test "X$LSOF_CC" = "X"	# {
+    then
+      if test -x /usr/local/bin/gcc	# {
+      then
+	LSOF_CC=/usr/local/bin/gcc
+	LSOF_CCV=`$LSOF_CC -v 2>&1 | sed -n 's/.*version \(.*\)/\1/p'`
+      else
+	LSOF_CC=cc
+	LSOF_CCV=`$LSOF_CC -v 2>&1 | sed -n 's/.*version \(.*\)/\1/p'`
+      fi	# }
+    fi	# }
+    echo $LSOF_CC | grep gcc > /dev/null
+    if test $? -eq 0	# {
+    then
+      LSOF_CFGL="$LSOF_CFGL -w"
+      LSOF_DEBUG="-pedantic -O"
+    fi	# }
+    LSOF_CFGF="$LSOF_CFGF -DSTEPV=$LSOF_VERS"
+    LSOF_DIALECT_DIR=n+os
+
+    # Test for AFS.
+
+    if test -r ${AFS_VICE}/etc/ThisCell	# {
+    then
+      if test "X$LSOF_SCRIPT_CALL" = "Xno"	# {
+      then
+	if test -r ./AFSHeaders -a -r ./AFSVersion	# {
+	then
+	  LSOF_AFS="yes"
+	fi	# }
+      else
+	if test ! -x ./AFSConfig	# {
+	then
+	  echo "Can't find or execute the AFSConfig script"
+	  rm -f $LSOF_HLP
+	  exit 1
+	fi	# }
+	./AFSConfig
+	if test $? -eq 0 -a -r ./AFSHeaders -a -r ./AFSVersion	# {
+	then
+	    LSOF_AFS="yes"
+	fi	# }
+      fi	# }
+      if test "X$LSOF_AFS" = "Xyes"	# {
+      then
+	LSOF_AFSV=`cat ./AFSVersion | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1 \2/' | awk '{printf "%d%02d\n",\$1,\$2}'`
+	LSOF_CFGF="$LSOF_CFGF -DHAS_AFS=$LSOF_AFSV"
+	LSOF_DINC="$LSOF_DINC -I`cat ./AFSHeaders`"
+      fi	# }
+    fi	# }
+    ;;
+
+# Configure for OpenBSD.  (OpenBSD uses NetBSD dialect sources and version
+# numbering.
+
+  openbsd)
+    if test "X$LSOF_CC" = "X"	# {
+    then
+      LSOF_CC=cc
+      LSOF_CCV=`$LSOF_CC -v 2>&1 | sed -n 's/.*version \(.*\)/\1/p'`
+    fi	# }
+    if test "X$LSOF_VSTR" = "X"	# {
+    then
+      LSOF_VSTR=`uname -r`
+    fi	# }
+    if test "X$LSOF_VERS" = "X"	# {
+    then
+
+      # If the OpenBSD version isn't pre-defined, determine it.
+
+      case $LSOF_VSTR in	# {
+      1*)
+	LSOF_VERS=1020
+	echo "!!!WARNING!!!  Unsupported OpenBSD 1.x version: $LSOF_VSTR"
+	echo "!!!WARNING!!!  Configuring for OpenBSD 1.2"
+	;;
+      2.5*)
+	LSOF_VERS=2050
+	;;
+      2.6*)
+	LSOF_VERS=2060
+	;;
+      2.7*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=2070
+	;;
+      2.8*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=2080
+	;;
+      2.9*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=2090
+	;;
+      2*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=2090
+	echo "!!!WARNING!!!  Unsupported OpenBSD 2.x version: $LSOF_VSTR"
+	echo "!!!WARNING!!!  Configuring for OpenBSD 2.9"
+	;;
+      3.0*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=3000
+	;;
+      3.1*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=3010
+	;;
+      3.2*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=3020
+	;;
+      3.3*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=3030
+	;;
+      3.4*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=3040
+	;;
+      3.5*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=3050
+	;;
+      3.6*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=3060
+	;;
+      3.7*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=3070
+	;;
+      3.8*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=3080
+	;;
+      3.9*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=3090
+	;;
+      3*)
+	LSOF_TSTBIGF=" "
+	LSOF_VERS=3090
+	echo "!!!WARNING!!!  Unsupported OpenBSD 3.x version: $LSOF_VSTR"
+	echo "!!!WARNING!!!  Configuring for OpenBSD 3.9"
+	;;
+      *)
+	echo "Unknown OpenBSD release: $LSOF_VSTR"
+	echo Assuming OpenBSD 3.9
+	LSOF_VERS=3090
+	;;
+      esac	# }
+    fi	# }
+
+    # Test for legal OpenBSD version.
+
+    case $LSOF_VERS in	# {
+    1020|2050|2060|2070|2080|2090|3000|3010|3020|3030|3040|3050|3060|3070|3080|3090)
+      ;;
+    *)
+      echo "Unknown OpenBSD version: $LSOF_VERS"
+      rm -f $LSOF_HLP
+      exit 1
+      ;;
+    esac	# }
+    LSOF_CFGF="$LSOF_CFGF -DOPENBSDV=$LSOF_VERS"
+    if test -r /dev/ksyms	# {
+    then
+      LSOF_CFGF="$LSOF_CFGF -DN_UNIXV=/dev/ksyms"
+    else
+      LSOF_CFGF="$LSOF_CFGF -DN_UNIXV=/bsd"
+    fi
+    if test -r ${LSOF_INCLUDE}/nfs/nfsproto.h	# {
+    then
+      LSOF_CFGF="$LSOF_CFGF -DHASNFSPROTO"
+    fi	# }
+    if test -r ${LSOF_INCLUDE}/netinet6/in6.h	# {
+    then
+      LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
+    fi	# }
+    LSOF_TMP1=0
+    if test "X$OPENBSD_SYS" = "X"	# {
+    then
+      OPENBSD_SYS="/sys"
+    fi	# }
+    if test -r ${OPENBSD_SYS}/miscfs/fdesc/fdesc.h	# {
+    then
+      grep -q Fctty ${OPENBSD_SYS}/miscfs/fdesc/fdesc.h
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASFDESCFS=1"
+      else
+	LSOF_CFGF="$LSOF_CFGF -DHASFDESCFS=2"
+      fi	# }
+      grep -q fd_link ${OPENBSD_SYS}/miscfs/fdesc/fdesc.h
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASFDLINK"
+      fi	# }
+      LSOF_TMP1=1
+    fi	# }
+    if test -r ${LSOF_INCLUDE}/sys/vnode.h	# {
+    then
+      grep -q VT_LFS ${LSOF_INCLUDE}/sys/vnode.h
+      if test $? -eq 0   # {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASLFS"
+      fi	# }
+    fi	# }
+    if test -r ${LSOF_INCLUDE}/miscfs/nullfs/null.h	# {
+    then
+      LSOF_CFGF="$LSOF_CFGF -DHASNULLFS"
+    else
+      if test -r ${OPENBSD_SYS}/miscfs/nullfs/null.h	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASNULLFS"
+	LSOF_TMP1=1
+      fi	# }
+    fi	# }
+    if test -d ${OPENBSD_SYS}/miscfs/procfs	# {
+    then
+      LSOF_CFGF="$LSOF_CFGF -DHASPROCFS"
+      LSOF_TMP1=1
+    fi	# }
+    if test -d ${OPENBSD_SYS}/isofs/cd9660	# {
+    then
+      LSOF_CFGF="$LSOF_CFGF -DHAS9660FS=1"
+      LSOF_TMP1=1
+    else
+      if test -d ${OPENBSD_SYS}/fs/cd9660	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHAS9660FS=2"
+	LSOF_TMP1=1
+      fi	# }
+    fi	# }
+    if test -d ${OPENBSD_SYS}/msdosfs	# {
+    then
+      LSOF_CFGF="$LSOF_CFGF -DHASMSDOSFS=1"
+      LSOF_TMP1=1
+    else
+      if test -d ${OPENBSD_SYS}/fs/msdosfs	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASMSDOSFS=2"
+	LSOF_TMP1=1
+      fi	# }
+    fi	# }
+    if test -r ${OPENBSD_SYS}/miscfs/kernfs/kernfs.h	# {
+    then
+      grep -q "kt_name;" ${OPENBSD_SYS}/miscfs/kernfs/kernfs.h
+      if test $? -eq 0	# {
+	then
+ 	  LSOF_CFGF="$LSOF_CFGF -DHASKERNFS"
+	  LSOF_TMP1=1
+      fi	# }
+    fi	# }
+    if test $LSOF_TMP1 -eq 1 -a "X$LSOF_INCLUDE" != "X$OPENBSD_SYS"	# {
+    then
+      LSOF_DINC="-I$LSOF_INCLUDE -I$OPENBSD_SYS"
+    fi	# }
+    grep -q VT_EXT2FS ${LSOF_INCLUDE}/sys/vnode.h
+    if test $? -eq 0	# {
+    then
+      LSOF_TMP1=1
+      if test -r ${LSOF_INCLUDE}/ufs/ufs/inode.h	# {
+      then
+	grep -q "*e2fs_din" ${LSOF_INCLUDE}/ufs/ufs/inode.h
+	if test $? -eq 0	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DHASI_E2FS_PTR"
+	fi	# }
+	grep -q "^#define[ 	]i_e2din" ${LSOF_INCLUDE}/ufs/ufs/inode.h
+	if test $? -eq 0	# {
+	then
+	  LSOF_TMP1=2
+	fi	# }
+      fi	# }
+      LSOF_CFGF="$LSOF_CFGF -DHASEXT2FS=$LSOF_TMP1"
+    fi	# }
+    if test -r ${LSOF_INCLUDE}/ufs/ufs/inode.h	# {
+    then
+      grep -q i_effnlink ${LSOF_INCLUDE}/ufs/ufs/inode.h
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASEFFNLINK=i_effnlink"
+      fi	# }
+      grep -q dinode_u ${LSOF_INCLUDE}/ufs/ufs/inode.h
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHAS_DINODE_U"
+      fi	# }
+      grep -q i_ffs1_size ${LSOF_INCLUDE}/ufs/ufs/inode.h
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASI_FFS1"
+      fi	# }
+      grep -q UM_UFS ${LSOF_INCLUDE}/ufs/ufs/inode.h
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHAS_UM_UFS"
+      fi	# }
+    fi	# }
+    if test -r ${LSOF_INCLUDE}/sys/namei.h
+    then
+      grep -q nc_vpid ${LSOF_INCLUDE}/sys/namei.h
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASNCVPID"
+      fi	# }
+    fi	# }
+    if test "X$OPENBSD_UVM" = "X"	# {
+    then
+      if test -r ${LSOF_INCLUDE}/sys/vnode.h	# {
+      then
+	grep -q UVM ${LSOF_INCLUDE}/sys/vnode.h
+	if test $? -ne 0	# {
+	then
+	  egrep -q "v_uvm;|v_uobj;" ${LSOF_INCLUDE}/sys/vnode.h
+	  if test $? -eq 0	# {
+	  then
+	    OPENBSD_UVM="Y"
+	  fi	# }
+	fi	# }
+      fi	# }
+    fi	# }
+    if test "X$OPENBSD_UVM" = "XY" -o "X$OPENBSD_UVM" = "Xy"	# {
+    then
+      LSOF_CFGF="$LSOF_CFGF -DUVM"
+      if test -d ${LSOF_INCLUDE}/uvm	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHAS_UVM_INCL"
+      fi	# }
+    fi	# }
+    if test -r ${LSOF_INCLUDE}/sys/mount.h -a $LSOF_VERS -lt 3030	# {
+    then
+
+      # Build a local OpenBSD netexport.h header file for possible use by
+      # <msdosfs/msdosfsmount.h>.  Make sure CFGL contains a -I for it.
+
+      LSOF_TMP1=${LSOF_TMPC}.edscr
+      LSOF_TMP2=${LSOF_TMPC}.netcred
+      LSOF_TMP3=${LSOF_TMPC}.netexport
+      LSOF_TMP4=dialects/n+obsd/include/netexport.h
+      if test ! -d dialects/n+obsd/include	# {
+      then
+	mkdir dialects/n+obsd/include
+      fi	# }
+      rm -f $LSOF_TMP1 $LSOF_TMP2 $LSOF_TMP3 $LSOF_TMP4 
+      echo "/^struct netcred" > $LSOF_TMP1
+      echo "1,.-1d" >> $LSOF_TMP1
+      echo "/^};" >> $LSOF_TMP1
+      echo "1,.w $LSOF_TMP2" >> $LSOF_TMP1
+      ed ${LSOF_INCLUDE}/sys/mount.h < $LSOF_TMP1 > /dev/null 2>&1
+      rm -f $LSOF_TMP1
+      echo "/^struct netexport" > $LSOF_TMP1
+      echo "1,.-1d" >> $LSOF_TMP1
+      echo "/^};" >> $LSOF_TMP1
+      echo "1,.w $LSOF_TMP3" >> $LSOF_TMP1
+      ed ${LSOF_INCLUDE}/sys/mount.h < $LSOF_TMP1 > /dev/null 2>&1
+      echo "/*" > $LSOF_TMP4
+      echo " * netexport.h" >> $LSOF_TMP4
+      echo -n " * Created by Configure: " >> $LSOF_TMP4
+      echo `date` >> $LSOF_TMP4
+      echo " */" >> $LSOF_TMP4
+      echo "" >> $LSOF_TMP4
+      echo "#if	!defined(NETEXPORT_H)" >> $LSOF_TMP4
+      echo "#define	NETEXPORT_H" >> $LSOF_TMP4
+      echo "" >> $LSOF_TMP4
+      echo "#include <net/radix.h>" >> $LSOF_TMP4
+      echo "" >> $LSOF_TMP4
+      if test -r $LSOF_TMP2	# {
+      then
+	cat $LSOF_TMP2 >> $LSOF_TMP4
+	echo "" >> $LSOF_TMP4
+      fi	# }
+      if test -r $LSOF_TMP3	# {
+      then
+	cat $LSOF_TMP3 >> $LSOF_TMP4
+      fi	# }
+      echo "#endif	/* !defined(NETEXPORT_H) */" >> $LSOF_TMP4
+      rm -f $LSOF_TMP1 $LSOF_TMP2 $LSOF_TMP3
+      echo $LSOF_CFGF | grep /dialects/n+obsd/include > /dev/null 2>&1
+      if test $? -ne 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -I`pwd`/dialects/n+obsd/include"
+      fi	# }
+    fi	# }
+    if test -r ${LSOF_INCLUDE}/sys/lockf.h	# {
+    then
+      grep vop_advlock_args ${LSOF_INCLUDE}/sys/lockf.h > /dev/null
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHAS_ADVLOCK_ARGS"
+      fi	# }
+    fi	# }
+    if test -r ${LSOF_INCLUDE}/sys/pipe.h	# {
+    then
+      LSOF_CFGF="$LSOF_CFGF -DHAS_SYS_PIPEH"
+    fi	# }
+    LSOF_CFGL="$LSOF_CFGL -lkvm"
+    LSOF_DIALECT_DIR=n+obsd
+    ;;
+
+# Configure for SCO OpenServer.
+
+  osr|osrgcc|sco|scogcc)
+    if test "X$LSOF_RANLIB_SUP" = "X"	# {
+    then
+      LSOF_RANLIB=""
+    fi	# }
+    if test "X$OSR_CFGF" != "X"	# {
+    then
+
+    # Adopt LSOF_CFGF from OSR_CFGF in environment.
+
+      LSOF_CFGF=$OSR_CFGF
+    fi	# }
+    if test "X$OSR_CFGL" != "X"	# {
+    then
+
+    # Adopt LSOF_CFGL from OSR_CFGL in environment.
+
+      LSOF_CFGL=$OSR_CFGL
+    fi	# }
+
+  # Evaluate compiler specification.
+
+    if test "X$LSOF_CC" = "X"	# {
+    then
+      if test "X$LSOF_TGT" = "Xosr" -o "X$LSOF_TGT" = "Xsco"	# {
+      then
+	LSOF_CC=cc
+	LSOF_TMP1=1
+      else
+	LSOF_CC=gcc
+	LSOF_CCV=`$LSOF_CC -v 2>&1 | sed -n 's/.*version \(.*\)/\1/p'`
+	LSOF_TMP1=2
+      fi	# }
+    else
+	LSOF_TMP1=0
+    fi	# }
+    LSOF_TGT="osr"
+
+  # Determine version.
+
+    if test "X$LSOF_VSTR" = "X"	# {
+    then
+      LSOF_VSTR="`LANG=C_C.C /bin/uname -X 2>/dev/null | grep Release | sed 's/Release = \(.*\)/\1/'`"
+    fi	# }
+    if test "X$LSOF_VERS" = "X"	# {
+    then
+
+      # If the SCO OpenServer release version isn't predefined, determine it.
+
+      case $LSOF_VSTR in	# {
+      3.2v2.0)
+	LSOF_VERS="20"
+	;;
+      3.2v2.1)
+	LSOF_VERS="21"
+	;;
+      3.2v4.0)
+	LSOF_VERS="40"
+	;;
+      3.2v4.1)
+	LSOF_VERS="41"
+	;;
+      3.2v4.2)
+	LSOF_VERS="42"
+	;;
+      3.2v5.*)
+	LSOF_TSTLFLG="-lsocket"
+	LSOF_VERS="`echo $LSOF_VSTR | sed 's/3\.2v//; s/\.//g'`"
+	;;
+      *)
+	echo Unknown SCO OpenServer release: $LSOF_VSTR
+	echo Assuming 3.2.0 or 3.2.1
+	LSOF_VERS="0"
+	;;
+      esac	# }
+    fi	# }
+
+    # Do SCO OpenServer specific stuff.
+
+    case $LSOF_VERS in	# {
+    0)
+      if test $LSOF_TMP1 -eq 1	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -nointl"
+	LSOF_DEBUG="-Ox"
+      fi	# }
+      LSOF_CFGL="$LSOF_CFGL -lrpc -lsocket -lc_s"
+      LSOF_MKC="cp"
+      ;;
+    20)
+      if test $LSOF_TMP1 -eq 1	# {
+      then
+	LSOF_DEBUG="-Ox"
+      fi	# }
+      LSOF_CFGL="$LSOF_CFGL -lrpc -lsocket -lc_s"
+      LSOF_MKC="cp"
+      ;;
+    21)
+      if test $LSOF_TMP1 -eq 1	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -nointl"
+	LSOF_DEBUG="-Ox"
+      fi	# }
+      LSOF_CFGL="$LSOF_CFGL -lrpc -lsocket -lc_s"
+      LSOF_MKC="cp"
+      ;;
+    40)
+      if test $LSOF_TMP1 -eq 1	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -nointl"
+	LSOF_DEBUG="-Ox"
+      fi	# }
+      LSOF_CFGL="$LSOF_CFGL -lrpc -lsocket -lc_s"
+      ;;
+    41)
+      if test $LSOF_TMP1 -eq 1	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -nointl"
+	LSOF_DEBUG="-Ox"
+      fi	# }
+      LSOF_CFGL="$LSOF_CFGL -lrpc -lsocket -lc_s"
+      ;;
+    42)
+      if test $LSOF_TMP1 -eq 1	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -nointl"
+	LSOF_DEBUG="-Ox"
+      fi	# }
+      LSOF_CFGL="$LSOF_CFGL -lrpc -lsocket -lc_s"
+      ;;
+    5*)
+      if test $LSOF_TMP1 -eq 1	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -belf"
+	LSOF_DEBUG="-O3 -Kspace"
+      fi	# }
+      LSOF_CFGL="$LSOF_CFGL -lsocket"
+      ;;
+    *)
+      echo "Unsupported SCO OpenServer release: $LSOF_VERS"
+      rm -f $LSOF_HLP
+      exit 1
+      ;;
+    esac	# }
+    LSOF_CFGF="$LSOF_CFGF -DOSRV=$LSOF_VERS"
+    if test "X$OSR_STATLSTAT" = "X"	# {
+    then
+      echo "Testing libc.a for statlstat"
+      /bin/nm /lib/libc.a | grep statlstat > /dev/null 2>&1
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHAS_STATLSTAT"
+      fi	# }
+    else
+      if test "X$OSR_STATLSTAT" = "XY" -o "X$OSR_STATLSTAT" = "Xy"	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHAS_STATLSTAT"
+      fi	# }
+    fi	# }
+    if test -r ${LSOF_INCLUDE}/sys/fs/nfs/rnode.h	# {
+    then
+      LSOF_CFGF="$LSOF_CFGF -DHAS_NFS"
+    fi	# }
+    if test ! -r ${LSOF_INCLUDE}/netdb.h	# {
+    then
+      LSOF_DINC="$LSOF_DINC -I`pwd`/dialects/osr/include"
+    fi	# }
+    LSOF_DIALECT_DIR=osr
+    ;;
+
+# Configure for Sun Solaris, SunPro C and gcc.
+
+  solaris|solariscc)
+    if test "X$LSOF_RANLIB_SUP" = "X"	# {
+    then
+      LSOF_RANLIB=""
+    fi	# }
+    if test "X$LSOF_CC" = "X"	# {
+    then
+      if test "X$LSOF_TGT" = "Xsolariscc"	# {
+      then
+	if test "X$SOLARIS_CCDIR" = "X"	# {
+	then
+	  SOLARIS_CCDIR="/opt/SUNWspro/bin"
+	fi	# }
+	if test -x ${SOLARIS_CCDIR}/cc	# {
+	then
+	  LSOF_CC=${SOLARIS_CCDIR}/cc
+	else
+	  if test -x /opt/SunStudioExpress/bin/cc	# {
+	  then
+	    LSOF_CC=/opt/SunStudioExpress/bin/cc
+	  else
+	    echo "WARNING: no cc in ${SOLARIS_CCDIR}; using cc without path."
+	    LSOF_CC=cc
+	  fi	# }
+	fi	# }
+	LSOF_CCV=`$LSOF_CC -V 2>&1 | sed -n 's/^cc: \(.*\)/\1/p'`
+      else
+	LSOF_CC=gcc
+	LSOF_CCV=`$LSOF_CC -v 2>&1 | sed -n 's/.*version \(.*\)/\1/p'`
+      fi	# }
+    fi	# }
+    LSOF_TGT="solaris"
+    if test "X$LSOF_VSTR" = "X"	# {
+    then
+      LSOF_VSTR=`uname -r`
+    fi	# }
+    if test "X$LSOF_VERS" = "X"	# {
+    then
+
+      # If the Solaris version isn't predefined, determine it.
+
+      case $LSOF_VSTR in	# {
+      5.[0-2])
+	LSOF_VERS="20300"
+	;;
+      5.3)
+	LSOF_VERS="20300"
+	;;
+      5.4)
+	LSOF_VERS="20400"
+	;;
+      5.5)
+	LSOF_VERS="20500"
+	;;
+      5.5.1)
+	LSOF_VERS="20501"
+	;;
+      5.6*)
+	LSOF_TSTLFLG="-lsocket -lnsl"
+	LSOF_VERS="20600"
+	;;
+      5.7*)
+	LSOF_TSTBIGF=" "
+	LSOF_TSTLFLG="-lsocket -lnsl"
+	LSOF_VERS="70000"
+	;;
+      5.8*)
+	LSOF_TSTBIGF=" "
+	LSOF_TSTLFLG="-lsocket -lnsl"
+	LSOF_VERS="80000"
+	;;
+      5.9*)
+	LSOF_TSTBIGF=" "
+	LSOF_TSTLFLG="-lsocket -lnsl"
+	LSOF_VERS="90000"
+	;;
+      5.10*)
+	LSOF_TSTBIGF=" "
+	LSOF_TSTLFLG="-lsocket -lnsl"
+	LSOF_VERS="100000"
+	;;
+      5.11*)
+	LSOF_TSTBIGF=" "
+	LSOF_TSTLFLG="-lsocket -lnsl"
+	LSOF_VERS="110000"
+	;;
+      *)
+	echo Unknown Solaris version: $LSOF_VSTR
+	rm -f $LSOF_HLP
+	exit 1
+      esac	# }
+    fi	# }
+
+    # Clear LSOF_UNSUP message for selected Solaris versions.
+
+    case $LSOF_VERS in	# {
+    90000|100000|110000)
+      LSOF_UNSUP=""
+      ;;
+    esac	# }
+
+    # Do Solaris version-specific stuff.
+
+    case $LSOF_VERS in	# {
+    20300)
+
+      # Solaris patch 101318-32 creates a longer kernel tcp_s structure,
+      # and 101318-45 changes the way the vnode's v_filocks member is
+      # handled.  The following code creates a symbol definition for
+      # patch 101318 whose value is the patch level.  No symbol is defined
+      # if the patch level is not greater than zero.
+
+      if test "X$SOLARIS_23P101318" = "X"	# {
+      then
+	LSOF_PL=`grep -h SUNW_PATCHID=101318 /var/sadm/pkg/SUNWcar*/pkginfo | sed 's/.*-//' | sort -u | tail -1`
+	if test "X$LSOF_PL" = "X"	# {
+	then
+	  LSOF_PL=0
+	fi	# }
+      else
+	LSOF_PL=$SOLARIS_23P101318
+      fi	# }
+      if test $LSOF_PL -gt 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DP101318=$LSOF_PL"
+      fi	# }
+      ;;
+    20400)
+      if test "X$SOLARIS_24P101945" = "X"	# {
+      then
+	LSOF_PL=`grep -h SUNW_PATCHID=101945 /var/sadm/pkg/SUNWcar*/pkginfo | sed 's/.*-//' | sort -u | tail -1`
+	if test "X$LSOF_PL" = "X"	# {
+	then
+	  LSOF_PL=0
+	fi	# }
+      else
+	LSOF_PL=$SOLARIS_24P101945
+      fi	# }
+      if test $LSOF_PL -ge 32	# {
+      then
+	if test "X$SOLARIS_24P102303" = "X"	# {
+	then
+	  LSOF_PL=`grep -h SUNW_PATCHID=102303 /var/sadm/pkg/SUNWhea*/pkginfo | sed 's/.*-//' | sort -u | tail -1`
+	  if test "X$LSOF_PL" = "X"	# {
+	  then
+	    LSOF_PL=0
+	  fi	# }
+	else
+	  LSOF_PL=$SOLARIS_24P102303
+	fi	# }
+	if test $LSOF_PL -ge 2	# {
+	then
+	  echo "WARNING: your Solaris 2.4 system appears to have patches 101945-32 and 102303-2"
+	  echo "         installed.  This probably means the NUM_*_VECTORS definitions in"
+	  echo "         <sys/auxv.h> don't match the ones used to build your kernel.  Consult"
+	  echo "         the Sun Problems section of the 00FAQ file of the lsof distribution"
+	  echo "         for more information on how to work around the problem."
+	fi	# }
+      fi	# }
+      ;;
+    20500|20501)
+      ;;
+    20600|70000|80000|90000|100000|110000)
+      if test "X$SOLARIS_26PR_GWINDOWS" = "X"	# {
+      then
+	rm -f ${LSOF_TMPC}.*
+	echo "#define _KMEMUSER" > ${LSOF_TMPC}.c
+	echo "#include <sys/proc/prdata.h>" >> ${LSOF_TMPC}.c
+	echo "main(){" >> ${LSOF_TMPC}.c
+	echo "enum prnodetype p=PR_GWINDOWS;}" >> ${LSOF_TMPC}.c
+	echo "Testing prdata.h for PR_GWINDOWS, using $LSOF_CC"
+	echo $LSOF_CC | grep gcc > /dev/null
+	if test $? -eq 0	# {
+	then
+	  $LSOF_CC ${LSOF_TMPC}.c -o ${LSOF_TMPC}.x  > /dev/null 2>&1
+	else
+	  $LSOF_CC ${LSOF_TMPC}.c -I$LSOF_INCLUDE -o ${LSOF_TMPC}.x  > /dev/null 2>&1
+	fi	# }
+	if test $? -eq 0	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DHASPR_GWINDOWS"
+	fi	# }
+      else
+	if test "X$SOLARIS_26PR_GWINDOWS" = "XY" -o "X$SOLARIS_26PR_GWINDOWS" = "Xy"	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DHASPR_GWINDOWS"
+	fi	# }
+      fi	# }
+      if test "X$SOLARIS_26PR_LDT" = "X"	# {
+      then
+	rm -f ${LSOF_TMPC}.*
+	echo "#define _KMEMUSER" > ${LSOF_TMPC}.c
+	echo "#include <sys/proc/prdata.h>" >> ${LSOF_TMPC}.c
+	echo "main(){" >> ${LSOF_TMPC}.c
+	echo "enum prnodetype p=PR_LDT;}" >> ${LSOF_TMPC}.c
+	echo "Testing prdata.h for PR_LDT, using $LSOF_CC"
+	echo $LSOF_CC | grep gcc > /dev/null
+	if test $? -eq 0	# {
+	then
+	  $LSOF_CC ${LSOF_TMPC}.c -o ${LSOF_TMPC}.x > /dev/null 2>&1
+	else
+	  $LSOF_CC ${LSOF_TMPC}.c -I$LSOF_INCLUDE -o ${LSOF_TMPC}.x > /dev/null 2>&1
+	fi	# }
+	if test $? -eq 0	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DHASPR_LDT"
+	fi	# }
+	rm -f ${LSOF_TMPC}.*
+      else
+	if test "X$SOLARIS_26PR_LDT" = "XY" -o "X$SOLARIS_26PR_LDT" = "Xy"	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DHASPR_LDT"
+	fi	# }
+      fi	# }
+      if test $LSOF_VERS -ge 70000	# {
+      then
+
+      # Do tests for Solaris 7 and above.
+
+	if test "X$SOLARIS_KERNBITS" = "X"	# {
+	then
+	  SOLARIS_KERNBITS=`/bin/isainfo -kv`
+	fi	# }
+	if test "X$SOLARIS_INSTR" = "X"	# {
+	then
+	  SOLARIS_INSTR=`/bin/isainfo -k`
+	fi	#}
+	echo $SOLARIS_KERNBITS | grep 64 > /dev/null
+	if test $? -eq 0	# {
+	then
+	  echo $LSOF_CC | grep gcc > /dev/null
+	  if test $? -eq 0	# {
+	  then
+
+	# Test gcc for 64 bit support.
+
+	    echo "Testing $LSOF_CC for 64 bit support"
+	    rm -f ${LSOF_TMPC}.*
+	    echo "main(){}" > ${LSOF_TMPC}.c
+	    LSOF_TMP1=""
+
+	# First try gcc's -m64 option -- it's the most current possibility.
+
+	    $LSOF_CC ${LSOF_TMPC}.c -m64 -o ${LSOF_TMPC}.x > /dev/null 2>&1
+	    if test $? -eq 0	# {
+	    then
+	      /bin/file ${LSOF_TMPC}.x | /bin/grep 64 > /dev/null 
+	      if test $? -eq 0	# {
+	      then
+		LSOF_TMP1="-m64"
+	      fi	# }
+	    fi	# }
+	    rm -f ${LSOF_TMPC}.*
+	    if test "X$LSOF_TMP1" = "X"	# {
+	    then
+
+	    # Try using the older -mcpu=v9 option with gcc instead of -m64.
+
+	      echo "main(){}" > ${LSOF_TMPC}.c
+	      $LSOF_CC ${LSOF_TMPC}.c -mcpu=v9 -o ${LSOF_TMPC}.x > /dev/null 2>&1
+	      if test $? -eq 0	# {
+	      then
+		/bin/file ${LSOF_TMPC}.x | /bin/grep 64 > /dev/null 
+		if test $? -eq 0	# {
+		then
+		  LSOF_TMP1="-mcpu=v9"
+		fi	# }
+	      fi	# }
+	      rm -f ${LSOF_TMPC}.*
+	    fi	# }
+	    if test "X$LSOF_TMP1" = "X"	# {
+	    then
+	      echo ""
+	      echo "!!!WARNING!!!=========!!!WARNING!!!=========!!!WARNING!!!"
+	      echo "!                                                       !"
+	      echo "! LSOF NEEDS TO BE CONFIGURED FOR A 64 BIT KERNEL, BUT  !"
+	      echo "! THIS GCC DOESN'T SUPPORT THE BUILDING OF 64 BIT       !"
+	      echo "! SOLARIS EXECUTABLES.  LSOF WILL BE CONFIGURED FOR A   !"
+	      echo "! 32 BIT KERNEL.                                        !"
+	      echo "!                                                       !"
+	      echo "!!!WARNING!!!=========!!!WARNING!!!=========!!!WARNING!!!"
+	      echo ""
+	    else
+	      echo ""
+	      echo "*********************************"
+	      echo "* Configuring for 64 bit kernel *"
+	      echo "*********************************"
+	      echo ""
+	      LSOF_CFGF="$LSOF_CFGF $LSOF_TMP1"
+	      LSOF_CINFO="64 bit kernel"
+	      LSOF_TSTK64=1
+	    fi	# }
+	  else
+
+	  # Test Sun compiler for 64 bit support.
+
+	    case $SOLARIS_INSTR in	# {
+	    amd64*)
+	      LSOF_TMP1="amd64"
+	      LSOF_TMP2="amd64"
+	      ;;
+	    sparc*)
+	      LSOF_TMP1="v9"
+	      LSOF_TMP2="sparcv9"
+	      ;;
+	    *)
+	      LSOF_TMP1=""
+	      ;;
+	    esac	# }
+	    if test "X$LSOF_TMP1" != "X"	# {
+	    then
+	      echo "Testing $LSOF_CC for 64 bit $LSOF_TMP2 support"
+	      rm -f ${LSOF_TMPC}.*
+	      LSOF_TMP3="-xarch=$LSOF_TMP1"
+	      echo "main(){}" > ${LSOF_TMPC}.c
+	      LSOF_TMP4=`$LSOF_CC ${LSOF_TMPC}.c $LSOF_TMP3 -o ${LSOF_TMPC}.x 2>&1`
+	      if test $? -eq 0	# {
+	      then
+		/bin/file ${LSOF_TMPC}.x | /bin/grep 64 > /dev/null 
+		if test $? -ne 0	# {
+		then
+		  LSOF_TMP3=""
+		else
+		  echo "X$LSOF_TMP4" | grep "use -m64" > /dev/null 2>&1
+		  if test $? -eq 0	# {
+		  then
+		    LSOF_TMP3=-m64
+		  fi	# }
+		fi	# }
+	      fi	# }
+	      rm -f ${LSOF_TMPC}.*
+	    else
+	      LSOF_TMP3=""
+	    fi	# }
+	    if test "X$LSOF_TMP3" != "X"	# {
+	    then
+	      echo ""
+	      echo "*********************************"
+	      echo "* Configuring for 64 bit kernel *"
+	      echo "*********************************"
+	      echo ""
+	      LSOF_CFGF="$LSOF_CFGF $LSOF_TMP3"
+	      LSOF_CINFO="64 bit kernel"
+	      LSOF_TSTK64=1
+	    else
+	      echo ""
+	      echo "!!!WARNING!!!==========!!!WARNING!!!==========!!!WARNING!!!"
+	      echo "!"
+	      echo "! LSOF NEEDS TO BE CONFIGURED FOR A 64 BIT KERNEL, BUT"
+	      echo "! THE VERSION OF SUN C AVAILABLE DOESN'T SUPPORT THE"
+	      echo "! \"$LSOF_TMP2\" INSTRUCTION SET."
+	      echo "!"
+	      echo "! LSOF WILL BE CONFIGURED FOR A 32 BIT KERNEL."
+	      echo "!"
+	      echo "!!!WARNING!!!==========!!!WARNING!!!==========!!!WARNING!!!"
+	      echo ""
+	    fi	# }
+	  fi	# }
+	else
+	  echo ""
+	  echo "*********************************"
+	  echo "* Configuring for 32 bit kernel *"
+	  echo "*********************************"
+	  echo ""
+	  LSOF_CINFO="32 bit kernel"
+	fi	# }
+      fi	# }
+
+      # Do tests specific to Solaris 8 and above.
+
+      if test $LSOF_VERS -ge 80000	# {
+      then
+	if test -r ${LSOF_INCLUDE}/netinet/ip6.h	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
+	fi	# }
+      fi	# }
+
+      # Do tests specific to Solaris 9 and above.
+
+      if test $LSOF_VERS -ge 90000	# {
+      then
+	if test -r ${LSOF_INCLUDE}/sys/socketvar.h	# {
+	then
+	  grep soua_vp ${LSOF_INCLUDE}/sys/socketvar.h > /dev/null 2>&1
+	  if test $? -eq 0	# {
+	  then
+	    LSOF_CFGF="$LSOF_CFGF -DHASSOUXSOUA"
+	  fi	# }
+	fi	# }
+	if test $LSOF_VERS -lt 110000	# {
+	then
+
+	# Do tests specific to Solaris 9 and 10.
+
+	  if test -r ${LSOF_INCLUDE}/sys/lgrp_user.h      # {
+	  then
+	    if test -r ${LSOF_INCLUDE}/sys/lgrp.h      # {
+	    then
+	      grep lgrp_root ${LSOF_INCLUDE}/sys/lgrp_user.h > /dev/null 2>&1
+	      if test $? -eq 0	# {
+	      then
+		grep lgrp_root ${LSOF_INCLUDE}/sys/lgrp.h > /dev/null 2>&1
+		if test $? -eq 0
+		then
+		  LSOF_CFGF="$LSOF_CFGF -DHAS_LGRP_ROOT_CONFLICT"
+		fi	# }
+	      fi	# }
+	    fi	# }
+	  fi	# }
+	fi	# }
+      fi	# }
+
+      # Do tests specific to Solaris 10 and above.
+
+      if test $LSOF_VERS -eq 100000	# {
+      then
+	if test -r ${LSOF_INCLUDE}/sys/socket_proto.h	# {
+	then
+	    LSOF_CFGF="$LSOF_CFGF -DHAS_SOCKET_PROTO_H"
+	fi	# }
+      fi	# }
+      if test $LSOF_VERS -ge 100000	# {
+      then
+	if test -r ${LSOF_INCLUDE}/inet/ipclassifier.h	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DHAS_IPCLASSIFIER_H"
+	  grep conn_ixa ${LSOF_INCLUDE}/inet/ipclassifier.h > /dev/null 2>&1
+	  if test $? -eq 0	# {
+	  then
+	    LSOF_CFGF="$LSOF_CFGF -DHAS_CONN_NEW"
+	  fi	#}
+	fi	# }
+	if test -r ${LSOF_INCLUDE}/sys/cred_impl.h	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DHAS_CRED_IMPL_H"
+
+	  # DEBUG -- Begin temporary hack for Solaris 10, build s10_44.
+
+	  grep "c2/audit.h" ${LSOF_INCLUDE}/sys/cred_impl.h > /dev/null
+	  if test $? -eq 0	# {
+	  then
+	    rm -rf `pwd`/dialects/sun/solaris10
+	    mkdir `pwd`/dialects/sun/solaris10
+	    mkdir `pwd`/dialects/sun/solaris10/c2
+	    touch `pwd`/dialects/sun/solaris10/c2/audit.h
+	    LSOF_CFGF="$LSOF_CFGF -I`pwd`/dialects/sun/solaris10"
+	  fi	# }
+
+	  # DEBUG -- End temporary hack for Solaris 10, build s10_44.
+
+	fi	# }
+	if test -r ${LSOF_INCLUDE}/sys/vnode.h	# {
+	then
+	  grep v_path ${LSOF_INCLUDE}/sys/vnode.h > /dev/null 2>&1
+	  if test $? -eq 0	# {
+	  then
+	    LSOF_CFGF="$LSOF_CFGF -DHAS_V_PATH"
+	    LSOF_TSTVPATH=1
+	  fi	# }
+	fi	# }
+	if test -r ${LSOF_INCLUDE}/sys/fs/pc_fs.h	# {
+	then
+	  grep pc_direntpersec ${LSOF_INCLUDE}/sys/fs/pc_fs.h > /dev/null 2>&1
+	  if test $? -eq 0	# {
+	  then
+	    LSOF_CFGF="$LSOF_CFGF -DHAS_PC_DIRENTPERSEC"
+	  fi	# }
+	fi	# }
+	if test -r ${LSOF_INCLUDE}/sys/aio_req.h	# {
+	then
+	  grep "struct[ 	]aio_req" ${LSOF_INCLUDE}/sys/aio_req.h > /dev/null 2>&1
+	  if test $? -eq 0	# {
+	  then
+	    LSOF_CFGF="$LSOF_CFGF -DHAS_AIO_REQ_STRUCT"
+	  fi	# }
+	fi	# }
+      fi	# }
+      if test -r ${LSOF_INCLUDE}/sys/zone.h	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASZONES"
+      fi	# }
+
+      # Check for Solaris 10 or higher CTF library and things that depend
+      # on it.
+
+      if test -r ${LSOF_INCLUDE}/libctf.h	# {
+      then
+	LSOF_CTFH=1
+      fi	# }
+      if test -r ${LSOF_INCLUDE}/sys/fs/zfs.h	# {
+      then
+	if test $LSOF_CTFH -eq 1	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DHAS_ZFS"
+	  LSOF_CTFL=1
+	else
+	  echo "WARNING: ZFS support not enabled; libctf.h missing."
+	fi	# }
+      fi	# }
+      if test $LSOF_VERS -ge 110000	# {
+      then
+
+      # Do things specific to Solaris 11 and above.
+
+	if test $LSOF_CTFH -eq 1	# {
+	then
+	  LSOF_CTFL=1
+	else
+	  echo "WARNING: socket support not enabled; libctf.h missing."
+	fi	# }
+	rm -rf ./solaris11
+	mkdir ./solaris11
+	mkdir ./solaris11/sys
+	touch ./solaris11/sys/extdirent.h
+	echo "./solaris11/sys/extdirent.h created"
+	LSOF_CFGF="$LSOF_CFGF -I`pwd`/solaris11"
+	if test -r ${LSOF_INCLUDE}/sys/mutex.h	# {
+	then
+
+	# Check <sys/mutex.h> 'for pad_mutex_t;'.
+
+	  grep 'pad_mutex_t;' ${LSOF_INCLUDE}/sys/mutex.h > /dev/null 2>&1
+	  if test $? -eq 0	# {
+	  then
+	    LSOF_CFGF="$LSOF_CFGF -DHAS_PAD_MUTEX"
+	  fi	# }
+	fi	# )
+      fi	# }
+
+      # If -lctf was added to LSOF_CFGL, define HAS_LIBCTF.
+
+      if test $LSOF_CTFL -eq 1	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHAS_LIBCTF"
+	LSOF_CFGL="$LSOF_CFGL -lctf"
+      fi	# }
+      ;;
+    *)
+      echo "Unsupported Solaris version: $LSOF_VERS"
+      rm -f $LSOF_HLP
+      exit 1
+      ;;
+    esac	# }
+    LSOF_CFGF="$LSOF_CFGF -Dsolaris=$LSOF_VERS"
+
+    # Test for <sys/fs/cachefs_fs.h>.
+
+    if test -r ${LSOF_INCLUDE}/sys/fs/cachefs_fs.h	# {
+    then
+      LSOF_CFGF="$LSOF_CFGF -DHASCACHEFS"
+    fi	# }
+
+    # Test for <utmpx.h>
+
+    if test -r ${LSOF_INCLUDE}/utmpx.h	# {
+    then
+      LSOF_CFGF="$LSOF_CFGF -DHASUTMPX"
+    fi	# }
+
+    # Test for VSOCK.
+
+    if test "X$SOLARIS_VSOCK" = "X"	# {
+    then
+      rm -f ${LSOF_TMPC}.*
+      echo "#include <sys/vnode.h>" > ${LSOF_TMPC}.c
+      echo "main(){" >> ${LSOF_TMPC}.c
+      echo "enum vtype p=VSOCK;}" >> ${LSOF_TMPC}.c
+      echo "Testing vnode.h for VSOCK, using $LSOF_CC"
+      echo $LSOF_CC | grep gcc > /dev/null
+      if test $? -eq 0	# {
+      then
+	$LSOF_CC ${LSOF_TMPC}.c -o ${LSOF_TMPC}.x > /dev/null 2>&1
+      else
+	$LSOF_CC ${LSOF_TMPC}.c -I$LSOF_INCLUDE -o ${LSOF_TMPC}.x > /dev/null 2>&1
+      fi	# }
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHAS_VSOCK"
+      fi	# }
+      rm -f ${LSOF_TMPC}.*
+    else
+      if test "X$SOLARIS_VSOCK" = "XY" -o "X$SOLARIS_VSOCK" = "Xy"	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHAS_VSOCK"
+      fi	# }
+    fi	# }
+
+    # Test for AFS.
+
+    if test -r ${AFS_VICE}/etc/ThisCell	# {
+    then
+      if test "X$LSOF_SCRIPT_CALL" = "Xno"	# {
+      then
+	if test -r ./AFSHeaders -a -r ./AFSVersion	# {
+	then
+	  LSOF_AFS="yes"
+	fi	# }
+      else
+	if test ! -x ./AFSConfig	# {
+	then
+	  echo "Can't find or execute the AFSConfig script"
+	  rm -f $LSOF_HLP
+	  exit 1
+	fi	# }
+	./AFSConfig
+	if test $? -eq 0 -a -r ./AFSHeaders -a -r ./AFSVersion	# {
+	then
+	    LSOF_AFS="yes"
+	fi	# }
+      fi	# }
+      if test "X$LSOF_AFS" = "Xyes"	# {
+      then
+	if test "X$SUN_AFSAPATHDEF" = "X"	# {
+	then
+	  ls /usr/vice/etc/modload/libafs > /dev/null 2>&1
+	  if test $? -ne 0	# {
+	  then
+	    LSOF_TMP1=`ls /usr/vice/etc/modload/libafs* 2>/dev/null | wc -l`
+	    if test $LSOF_TMP1 -ne 0	# {
+	    then
+	      SUN_AFSAPATHDEF=`ls -t /usr/vice/etc/modload/libafs* | head -1`
+	    fi	# }
+	  fi	# }
+	fi	# }
+	if test "X$SUN_AFSAPATHDEF" != "X"	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DAFSAPATHDEF=\\\"$SUN_AFSAPATHDEF\\\""
+	fi	# }
+	LSOF_AFSV=`cat ./AFSVersion | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1 \2/' | awk '{printf "%d%02d\n",\$1,\$2}'`
+	LSOF_CFGF="$LSOF_CFGF -DHAS_AFS=$LSOF_AFSV"
+	LSOF_DINC="$LSOF_DINC -I`cat ./AFSHeaders`"
+      fi	# }
+    fi	# }
+
+    # Test for VxFS.
+    #
+    # If the location of the VxFS header files hasn't been defined in the
+    # environment, establish their likely locations.
+
+    LSOF_TMP2=$SOLARIS_VXFSINCL
+    if test -d /opt/VRTS/include	# {
+    then
+      LSOF_TMP2="$LSOF_TMP2 /opt/VRTS/include"
+    fi	# }
+    if test -d /opt/VRTSvxfs/include	# {
+    then
+      LSOF_TMP2="$LSOF_TMP2 /opt/VRTSvxfs/include"
+    fi	# }
+    LSOF_TMP1=0
+    for i in $LSOF_TMP2	# {
+    do
+      if test -r ${i}/vxfsutil.h	# {
+      then
+	LSOF_TMP1=1
+	SOLARIS_VXFSINCL=$i
+	break
+      fi	# }
+    done	# }
+    if test $LSOF_TMP1 -eq 1	# {
+    then
+
+    # Warn that VxFS is unsupported.
+
+      LSOF_UNSUP2="WARNING: VxFS is no longer supported by Solaris lsof."
+
+    # The VxFS header files are for VxFS version 3.4 or above.  Enable VxFS
+    # for those versions.
+
+      LSOF_CFGF="$LSOF_CFGF -DHASVXFS -DHASVXFSUTIL -I$SOLARIS_VXFSINCL"
+
+    # Determine which libvxfsutil.a is required -- 32 or 64 bit.
+
+      LSOF_TMP2=""			# assume 32 bit
+      echo "X$LSOF_CINFO" | grep "^X64" > /dev/null 2>&1
+      if test $? -eq 0-a "X$SOLARIS_INSTR" != "X"	# {
+      then
+	case $SOLARIS_INSTR in	# {
+	amd64*)
+	  LSOF_TMP2="/amd64"
+	  ;;
+	sparcv9*)
+	  LSOF_TMP2="/sparcv9"
+	  ;;
+	esac	# }
+      fi	# }
+
+    # See if the correct library has been specified and exists.
+
+      if test "X$SOLARIS_VXFSLIB" = "X"	# {
+      then
+	SOLARIS_VXFSLIB=`dirname $SOLARIS_VXFSINCL`/lib
+      fi	# }
+      LSOF_TMP3="${SOLARIS_VXFSLIB}${LSOF_TMP2}/libvxfsutil.a"
+      if test ! -r $LSOF_TMP3	# {
+      then
+	echo "!!!FATAL: no VxFS $LSOF_TMP3"
+	exit 1
+      fi	# }
+      LSOF_CFGL="$LSOF_CFGL -L$SOLARIS_VXFSLIB${LSOF_TMP2} -lvxfsutil -ldl"
+
+    # See if the library has the Reverse Name Lookup (RNL) function.
+
+      nm $LSOF_TMP3 | grep vxfs_inotopath > /dev/null 2>&1
+      if test $? -eq 0	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASVXFSRNL -DHASVXFSDNLC"
+      fi	# }
+    else
+
+    # See if there are VxFS header files for VxFS versions below 3.4.
+
+      if test -r ${LSOF_INCLUDE}/sys/fs/vx_inode.h	# {
+      then
+
+      # Define VxFS for VxFS versions below 3.4.  Make additional header
+      # file tests.
+
+	LSOF_CFGF="$LSOF_CFGF -DHASVXFS"
+	if test -r ${LSOF_INCLUDE}/sys/fs/vx_fs.h	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DHASVXFS_FS_H"
+	fi	# }
+	if test -r ${LSOF_INCLUDE}/sys/fs/vx_sol.h	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DHASVXFS_SOL_H"
+	fi	# }
+	if test -r ${LSOF_INCLUDE}/sys/fs/vx_machdep.h	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DHASVXFS_MACHDEP_H"
+	fi	# }
+	if test -r ${LSOF_INCLUDE}/sys/fs/vx_solaris.h	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DHASVXFS_SOLARIS_H"
+	  grep "off32_t;" ${LSOF_INCLUDE}/sys/fs/vx_machdep.h > /dev/null
+	  if test $? -eq 0	# {
+	  then
+	    LSOF_CFGF="$LSOF_CFGF -DHASVXFS_OFF32_T"
+	  fi	# }
+	  grep "off64_t;" ${LSOF_INCLUDE}/sys/fs/vx_solaris.h > /dev/null
+	  if test $? -eq 0	# {
+	  then
+	    LSOF_CFGF="$LSOF_CFGF -DHASVXFS_OFF64_T"
+	  fi	# }
+	  grep "vx_u64_t;" ${LSOF_INCLUDE}/sys/fs/vx_solaris.h > /dev/null
+	  if test $? -eq 0	# {
+	  then
+	    LSOF_CFGF="$LSOF_CFGF -DHASVXFS_U64_T"
+	  fi	# }
+	fi	# }
+	egrep "struct[ 	]vx_inode[ 	]\{" ${LSOF_INCLUDE}/sys/fs/vx_inode.h > /dev/null
+	# } (dummy '}' to match '{' in above egrep)
+	if test $? -eq 0	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DHASVXFS_VX_INODE"
+	fi	# }
+      fi	# }
+    fi	# }
+
+    # Set libraries and dialect subdirectory.
+
+    LSOF_CFGL="$LSOF_CFGL -lkvm -lelf -lsocket -lnsl"
+    LSOF_DIALECT_DIR=sun
+
+    # Set local-specific stuff.
+
+    if test "X$LSOF_LOCALSUFFIX" = "XLOCAL"	# {
+    then
+      LSOF_DOC="\${DESTDIR}/usr/local/man"
+    fi	# }
+    ;;
+
+# Configure for SCO|Caldera OpenServer Release 6.0.0 and UnixWare.
+
+  osr6|unixware|uw)
+    LSOF_TMP1=$LSOF_TGT
+    LSOF_TGT="uw"
+    if test "X$LSOF_RANLIB_SUP" = "X"	# {
+    then
+      LSOF_RANLIB=""
+    fi	# }
+    if test "X$LSOF_VSTR" = "X"	# {
+    then
+      LSOF_VSTR=`uname -v`
+    fi	# }
+    if test "X$LSOF_VERS" = "X"	# {
+    then
+
+      # If the Openserver Release 6.0.0 or UnixWare version isn't pre-defined,
+      # determine it.
+
+      LSOF_VERS=`echo $LSOF_VSTR | sed 's/\([0-9\.]*\).*/\1/; s/\./ /g' | awk '{printf "%d%02d%02d\n", $1, $2, $3;}'`
+    fi	# }
+    if test $LSOF_TMP1 = "osr6"	# {
+    then
+      LSOF_CINFO="OSR6 support via UnixWare sources"
+
+    # Convert the OpenServer Release 6.0.0 version number to a UnixWare one.
+
+      case $LSOF_VERS in	# {
+      60000)
+	LSOF_VERS=70104
+	;;
+      *)
+	echo "Unknown OpenServer Release version: $LSOF_VERS"
+	rm -f $LSOF_HLP
+	exit 1
+      esac	# }
+    fi	# }
+    LSOF_CFGF="$LSOF_CFGF -DUNIXWAREV=$LSOF_VERS"
+
+    # Do OpenServer Release 6.0.0 and UnixWare version-specific stuff.
+
+    case $LSOF_VERS in	# {
+    20100|20101|20102|20103)
+      if test -r ${LSOF_INCLUDE}/sys/fs/vx_inode.h	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASVXFS"
+      fi	# }
+      LSOF_CFGL="$LSOF_CFGL -lsocket -lnsl -lelf -lgen"
+      ;;
+    70000|70001|70100|70101|70103|70104)
+      LSOF_TSTBIGF=" "
+      LSOF_TSTLFLG="-lsocket -lnsl"
+      if test $LSOF_VERS -lt 70103	# {
+      then
+	LSOF_DINC="$LSOF_DINC -I`pwd`/dialects/uw/uw7"
+      else	# $LSOF_VERS -ge 70103
+
+      # Process 7.1.3 and above.
+
+	if test -r ${LSOF_INCLUDE}/netinet/in6.h	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
+	fi	# }
+	if test $LSOF_VERS -ge 70104	# {
+	then
+
+	# Process 7.1.4 and above.
+
+	  LSOF_TMP1=0
+	  if test -r ${LSOF_INCLUDE}/netinet/in_pcb.h	# {
+	  then
+	    grep INKERNEL ${LSOF_INCLUDE}/netinet/in_pcb.h > /dev/null 2>&1
+	    if test $? -eq 0	# {
+	    then
+	      LSOF_TMP1=1
+	    fi	# }
+	  fi	# }
+	  if test $LSOF_TMP1 -eq 0 -a -r ${LSOF_INCLUDE}/netinet/tcp_var.h   # {
+	  then
+	    grep INKERNEL ${LSOF_INCLUDE}/netinet/tcp_var.h > /dev/null 2>&1
+	    if test $? -eq 0	# {
+	    then
+	      LSOF_TMP1=1
+	    fi	# }
+	  fi	# }
+	  if test $LSOF_TMP1 -eq 1	# {
+	  then
+	    LSOF_CFGF="$LSOF_CFGF -DHAS_INKERNEL"
+	  fi	# }
+	fi	# }
+      fi	# }
+      if test ! -r ${LSOF_INCLUDE}/vm/swap.h -a -r ${LSOF_INCLUDE}/sys/swap.h	# {
+      then
+	(cd ./dialects/uw/uw7/vm; rm -f swap.h; ln -s ${LSOF_INCLUDE}/sys/swap.h swap.h)
+      fi	# }
+      if test -r ${LSOF_INCLUDE}/sys/fs/vx_gemini.h	# {
+      then
+	LSOF_CFGF="$LSOF_CFGF -DHASVXFS"
+      fi	# }
+      LSOF_CFGL="$LSOF_CFGL -lsocket -lnsl -lelf -lgen"
+      /bin/pkginfo 2> /dev/null | grep -i patch | grep -i ptf7038 > /dev/null
+      if test -r ${LSOF_INCLUDE}/sys/file.h	# {
+      then
+	grep f_open ${LSOF_INCLUDE}/sys/file.h > /dev/null
+	if test $? -eq 0	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DHAS_F_OPEN"
+	fi	# }
+      fi	# }
+      if test -r ${LSOF_INCLUDE}/sys/fs/cdfs_fs.h	# {
+      then
+	grep "cdfs_LogSecShift;" ${LSOF_INCLUDE}/sys/fs/cdfs_fs.h > /dev/null 2>&1
+	if test $? -eq 0	# {
+	then
+	  LSOF_TMP=`grep "cdfs_LogSecShift;" ${LSOF_INCLUDE}/sys/fs/cdfs_fs.h | sed 's/^[ 	]*\([^ 	]*\).*/\1/'`
+	  if test "X$LSOF_TMP" != "X"	# {
+	  then
+	    LSOF_CFGF="$LSOF_CFGF -DTYPELOGSECSHIFT=$LSOF_TMP"
+	  fi	# }
+	fi	# }
+      fi	# }
+      if test -r ${LSOF_INCLUDE}/sys/proc.h	# {
+      then
+	grep p_pgid ${LSOF_INCLUDE}/sys/proc.h > /dev/null
+	if test $? -eq 0	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DHAS_P_PGID"
+	fi	# }
+      fi	# }
+      if test $LSOF_VERS -ge 70101	# {
+      then
+
+	# Do OpenServer Release 6.0.0 and UnixWare 7.1.1 and above tests, as
+	# required.
+
+	if test "X$UW_HAS_NSC" = "X"	# {
+	then
+	  UW_HAS_NSC=N
+	  if test -x /bin/node_self	# {
+	  then
+	    /bin/node_self > /dev/null 2>&1
+	    if test $? -eq 0	# {
+	    then
+	      UW_HAS_NSC=Y
+	    fi	# }
+	  fi	# }
+	fi	# }
+	if test "X$UW_HAS_NSC" = "XY" -o "X$UW_HAS_NSC" = "Xy" 	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DHAS_UW_NSC"
+	  LSOF_CFGL="$LSOF_CFGL -lcluster"
+	fi	# }
+	if test -r ${LSOF_INCLUDE}/sys/nsc_synch.h	# {
+	then
+	  LSOF_CFGF="$LSOF_CFGF -DHAS_UW_CFS"
+	fi	# }
+      fi	# }
+      ;;
+    *)
+      echo Unsupported UnixWare version: `uname -v`
+      rm -f $LSOF_HLP
+      exit 1
+      ;;
+    esac	# }
+    if test -r ${LSOF_INCLUDE}/sys/fs/xnamnode.h	# {
+    then
+      LSOF_CFGF="$LSOF_CFGF -DHASXNAMNODE"
+    fi	# }
+    LSOF_DIALECT_DIR=uw
+    ;;
+
+# Handle unknown abbreviation.
+
+  *) 
+    echo "Can't configure for $LSOF_TGT."
+    cat $LSOF_HLP
+    rm -f $LSOF_HLP
+    exit 1
+    ;;
+
+# End of LSOF_TGT cases
+
+esac	# }
+
+# Do an inventory of the distribution, as required.
+
+if test "X$LSOF_SCRIPT_CALL" = "Xyes" -a ! -r ./.neverInv	# {
+then
+  if test ! -f ./Inventory	# Want -x, but Ultrix doesn't grok it.	# {
+  then
+    echo "Can't find Inventory script."
+    rm -f $LSOF_HLP
+    exit 1
+  fi	# }
+  ./Inventory
+fi	# }
+
+# Make sure target directory exists.
+
+if test ! -d ./dialects/$LSOF_DIALECT_DIR	# {
+then
+  echo "Can't configure for $LSOF_TGT -- ./dialects/$LSOF_DIALECT_DIR doesn't exist."
+  rm -f $LSOF_HLP
+  exit 1
+fi	# }
+
+# Make sure $LSOF_MK exists in the target directory.
+
+if test ! -r ./dialects/$LSOF_DIALECT_DIR/$LSOF_MK	# {
+then
+  echo "Can't configure for $LSOF_TGT -- ./dialects/$LSOF_DIALECT_DIR/$LSOF_MK doesn't exist."
+  rm -f $LSOF_HLP
+  exit 1
+fi	# }
+
+# Make sure $LSOF_MKF, $LSOF_SPMKF, or $LSOF_MKF.$LSOF_LOCALSUFFIX) exists
+# in the target directory.
+
+if test "X$LSOF_SPMKF" != "X"	# {
+then
+  LSOF_TMP1=$LSOF_SPMKF
+else
+  LSOF_TMP1=$LSOF_MKF
+fi	# }
+if test "X$LSOF_LOCALSUFFIX" != "X"	# {
+then
+  LSOF_REST=$LSOF_TMP1.$LSOF_LOCALSUFFIX
+else
+  LSOF_REST=$LSOF_TMP1
+fi	# }
+if test ! -r ./dialects/$LSOF_DIALECT_DIR/$LSOF_REST	# {
+then
+  echo "Can't configure for $LSOF_TGT -- ./dialects/$LSOF_DIALECT_DIR/$LSOF_REST doesn't exist."
+  rm -f $LSOF_HLP
+  exit 1
+fi	# }
+
+# If this is FreeBSD, make sure $LSOF_FBSD_ZFS_MKF exists.
+
+if test $LSOF_FBSD_ZFS -eq 1	# {
+then
+  if test ! ./dialects/$LSOF_DIALECT_DIR/$LSOF_FBSD_ZFS_MKF	# {
+  then
+    echo "Can't configure for $LSOF_TGT -- ./dialects/$LSOF_DIALECT_DIR/$LSOF_FBSD_ZFS_MKF doesn't exist."
+    rm -f $LSOF_HLP
+    exit 1
+  fi	# }
+fi	# }}
+
+# Make sure $LSOF_VF exists.  Extract the version number from it.
+
+if test ! -r $LSOF_VF	# {
+then
+  echo "Version number file, ./$LSOF_VF, doesn't exist."
+  rm -f $LSOF_HLP
+  exit 1
+else
+  LSOF_VN=`sed "s/.ds VN \(.*\)/\1/" < $LSOF_VF`
+fi	# }
+
+# Clean up in advance.
+
+rm -f $LSOF_F $LSOF_MKFC $LSOF_FBSD_ZFS_MKF $LSOF_TSTCFLG $LSOF_TSTCC
+rm -f $LSOF_TSTXOC $LSOF_TSTLFF
+echo "rm -f $LSOF_F $LSOF_MKFC $LSOF_FBSD_ZFS_MKF $LSOF_TSTCFLG"
+echo "rm -f $LSOF_TSTCC $LSOF_TSTXOC $LSOF_TSTLFF"
+
+# Make sure there's a C compiler name.
+
+if test "X$LSOF_CC" = "X"	# {
+then
+  LSOF_CC=cc
+fi	# }
+
+# Do common feature analyses.
+
+# Check for localtime(3) and strftime(3).
+
+rm -f ${LSOF_TMPC}.*
+cat > $LSOF_TMPC.c << .LSOF_END_HERE_DOC2
+#include <time.h>
+main(){
+  time_t cl;
+  struct tm *ts;
+  char bf[32];
+  if ((cl = time(NULL)) == (time_t)-1)
+    return(1);
+  ts = localtime(&cl);
+  if (strftime(bf, sizeof(bf), "%D", ts) != 8)
+    return(1);
+  if ((bf[2] != '/') || (bf[5] != '/'))
+    return (1);
+  return(0);
+}
+.LSOF_END_HERE_DOC2
+echo $EO "Testing C library for localtime() and strftime(), using $LSOF_CC ... $EC"
+$LSOF_CC ${LSOF_TMPC}.c -o ${LSOF_TMPC}.x > /dev/null 2>&1
+if test -x ${LSOF_TMPC}.x	# {
+then
+  ./${LSOF_TMPC}.x
+  if test $? -eq 0	# }
+  then
+    LSOF_CFGF="$LSOF_CFGF -DHAS_STRFTIME"
+    echo "present"
+  else
+    echo "unusable"
+  fi	# }
+else
+  echo "missing"
+fi	# }
+rm -f ${LSOF_TMPC}.[cox]
+
+# Make the dialect sources.
+
+if test "X$LSOF_MKC" = "X"	# {
+then
+  LSOF_MKC="ln -s"
+fi	# }
+LSOF_MKC=$LSOF_MKC ./dialects/$LSOF_DIALECT_DIR/$LSOF_MK $LSOF_TGT $LSOF_VERS
+
+# Make $LSOF_MKFC and ${LSOF_LIB}/$LSOF_LIBMKF.
+
+echo "# $LSOF_TGT Makefile for lsof revision $LSOF_VN" > $LSOF_MKFC
+echo "" >> $LSOF_MKFC
+echo "CC=	$LSOF_CC" >> $LSOF_MKFC
+if test "X$LSOF_CCV" != "X"	# {
+then
+  echo "" >> $LSOF_MKFC
+  echo "CCV=	$LSOF_CCV" >> $LSOF_MKFC
+fi	# }
+if test "X$LSOF_LIB_NO" = "X"	# {
+then
+  echo "" >> $LSOF_MKFC
+  echo "LIB=	${LSOF_LIB}/liblsof.a" >> $LSOF_MKFC
+fi	# }
+if test "X$LSOF_LD" != "X"	# {
+then
+  echo "" >> $LSOF_MKFC
+  echo "LD=	$LSOF_LD" >> $LSOF_MKFC
+fi	# }
+if test "X$LSOF_CINFO" != "X"	# {
+then
+  echo "" >> $LSOF_MKFC
+  echo "CINFO=	$LSOF_CINFO" >> $LSOF_MKFC
+fi	# }
+if test "X$LSOF_CFGD" != "X"	# {
+then
+  echo "CFGD=	$LSOF_CFGD" >> $LSOF_MKFC
+fi	# }
+if test "X$LSOF_CFGDN" != "X"	# {
+then
+  echo "CFGDN=	$LSOF_CFGDN" >> $LSOF_MKFC
+fi	# }
+if test "X$LSOF_ARCH" != "X"	# {
+then
+  LSOF_CFGF="$LSOF_CFGF -DLSOF_ARCH=\\\"$LSOF_ARCH\\\""
+fi	# }
+if test "X$LSOF_VSTR" != "X"	# {
+then
+  LSOF_TMP=`echo $LSOF_VSTR | sed 's/(/\\\\(/g' | sed 's/)/\\\\)/g'`
+  LSOF_CFGF="$LSOF_CFGF -DLSOF_VSTR=\\\"$LSOF_TMP\\\""
+fi	# }
+echo "" >> $LSOF_MKFC
+echo "CFGF=	$LSOF_CFGF" >> $LSOF_MKFC
+if test "X$LSOF_LIB_NO" = "X"	# {
+then
+  echo "" >> $LSOF_MKFC
+  echo "CFGL=	$LSOF_FCFGL -L./$LSOF_LIB -llsof $LSOF_CFGL" >> $LSOF_MKFC
+fi	# }
+echo "" >> $LSOF_MKFC
+if test "X$LSOF_DEBUG" = "X"	# {
+then
+  LSOF_DEBUG="-O"
+else
+  if test "X$LSOF_DEBUG" = "XNo-O"	# {
+  then
+    LSOF_DEBUG=""
+  fi	# }
+fi	# }
+echo "DEBUG=	$LSOF_DEBUG" >> $LSOF_MKFC
+if test "X$LSOF_OPINC" != "X"	# {
+then
+  LSOF_DINC="$LSOF_DINC $LSOF_OPINC"
+fi	# }
+if test "X$LSOF_DINC" != "X"	# {
+then
+  echo "" >> $LSOF_MKFC
+  echo "DINC=	$LSOF_DINC" >> $LSOF_MKFC
+fi	# }
+if test "X$LSOF_DOC" != "X"	# {
+then
+  echo "" >> $LSOF_MKFC
+  echo "DOC=$LSOF_DOC" >> $LSOF_MKFC
+fi	# }
+if test "X$LSOF_DISTRIBKVM" != "X" -a "X$LSOF_DISTRIBKVM" != "XKVM"	# {
+then
+  echo "" >> $LSOF_MKFC
+  echo "KVM=	$LSOF_DISTRIBKVM" >> $LSOF_MKFC
+fi	# }
+rm -f ${LSOF_LIB}/$LSOF_LIBMKF
+if test "X$LSOF_LIB_NO" = "X"	# {
+then
+  cp $LSOF_MKFC ${LSOF_LIB}/$LSOF_LIBMKF
+fi	# }
+cat ./dialects/$LSOF_DIALECT_DIR/$LSOF_REST >> $LSOF_MKFC
+if test "X$LSOF_LIB_NO" = "X"	# {
+then
+
+  # Put archiving and optional randomizing strings in ${LSOF_LIB}/$LSOF_LIBMKF.
+  #
+  # Process optional CFLAGS override.
+  #
+  # Add the library Makefile skeleton section.
+
+  echo "" >> ${LSOF_LIB}/$LSOF_LIBMKF
+  if test "X$LSOF_AR" = "X"	# {
+  then
+    echo "AR=	ar cr \${LIB} \${OBJ}" >> ${LSOF_LIB}/$LSOF_LIBMKF
+  else
+    echo "AR=	$LSOF_AR \${LIB} \${OBJ}" >> ${LSOF_LIB}/$LSOF_LIBMKF
+  fi	# }
+  if test "X$LSOF_RANLIB" != "X"	# {
+  then
+    echo "" >> ${LSOF_LIB}/$LSOF_LIBMKF
+    echo "RANLIB=	$LSOF_RANLIB \${LIB}" >> ${LSOF_LIB}/$LSOF_LIBMKF
+  fi	# }
+  echo "" >> ${LSOF_LIB}/$LSOF_LIBMKF
+  if test "X$LSOF_CFLAGS_OVERRIDE" = "X"	# {
+  then
+    echo "CFLAGS=	\${CDEFS} \${INCL} \${DEBUG}" >> ${LSOF_LIB}/$LSOF_LIBMKF
+  else
+    echo "override CFLAGS=\${CDEFS} \${INCL} \${DEBUG}" >> ${LSOF_LIB}/$LSOF_LIBMKF
+  fi	# }
+  echo "" >> ${LSOF_LIB}/$LSOF_LIBMKF
+  cat ${LSOF_LIB}/$LSOF_LIBMKFSKEL >> ${LSOF_LIB}/$LSOF_LIBMKF
+  echo $LSOF_MKFC and ${LSOF_LIB}/$LSOF_LIBMKF created.
+else
+  echo $LSOF_MKFC created.
+fi	# }
+
+# If this is FreeBSD, create $LSOF_FBSD_ZFS_MKF.
+
+if test $LSOF_FBSD_ZFS -eq 1	# {
+then
+  rm -f $LSOF_FBSD_ZFS_MKF
+  echo "# $LSOF_TGT ZFS Makefile for lsof revision $LSOF_VN" > $LSOF_FBSD_ZFS_MKF
+  echo "" >> $LSOF_FBSD_ZFS_MKF
+  echo "CC=		$LSOF_CC" >> $LSOF_FBSD_ZFS_MKF
+  echo "" >> $LSOF_FBSD_ZFS_MKF
+  echo "CFLAGS=	$LSOF_FBSD_ZFS_CFGF" >> $LSOF_FBSD_ZFS_MKF
+  echo "" >> $LSOF_FBSD_ZFS_MKF
+  if test "X$LSOF_DEBUG" = "X"	# {
+  then
+    LSOF_DEBUG="-O"
+  else
+    if test "X$LSOF_DEBUG" = "XNo-O"	# {
+    then
+      LSOF_DEBUG=""
+    fi	# }
+  fi	# }
+  echo "DEBUG=	$LSOF_DEBUG" >> $LSOF_FBSD_ZFS_MKF
+  echo "" >> $LSOF_FBSD_ZFS_MKF
+  echo "OPENSOLARIS=	$LSOF_FBSD_ZFS_SYS" >> $LSOF_FBSD_ZFS_MKF
+  echo "" >> $LSOF_FBSD_ZFS_MKF
+  cat ./dialects/$LSOF_DIALECT_DIR/$LSOF_FBSD_ZFS_MKF >> $LSOF_FBSD_ZFS_MKF
+  echo $LSOF_FBSD_ZFS_MKF created.
+fi	# }
+
+# Create test cc file.
+
+echo "$LSOF_CC" > $LSOF_TSTCC
+echo "$LSOF_TSTCC created"
+
+# Create test cflags file.
+
+echo "-DLT_DIAL_$LSOF_TGT" > $LSOF_TSTCFLG
+if test "X$LSOF_TSTBIGF" != "X"	# {
+then
+  echo "-DLT_BIGF" >> $LSOF_TSTCFLG
+  if test "X$LSOF_TSTBIGF" != "X "	# {
+  then
+    for i in $LSOF_TSTBIGF	# {
+    do
+      echo "$i" >> $LSOF_TSTCFLG
+    done	# }
+  fi	# }
+fi	# }
+if test "X$LSOF_TSTDFLG" != "X"	# {
+then
+  for i in $LSOF_TSTDFLG	# {
+  do
+    echo "$i" >> $LSOF_TSTCFLG
+  done	# }
+fi	# }
+echo $LSOF_CC | grep gcc > /dev/null 2>&1
+if test $? -eq 0	# {
+then
+  echo "-DLT_GCC" >> $LSOF_TSTCFLG
+else
+  echo "-DLT_CC" >> $LSOF_TSTCFLG
+fi	# r}
+if test $LSOF_TSTKMEM -eq 1	# {
+then
+  echo "-DLT_KMEM" >> $LSOF_TSTCFLG
+fi	# }
+if test $LSOF_TSTK64 -eq 1	# {
+then
+  echo "-DLT_K64" >> $LSOF_TSTCFLG
+fi	# }
+echo "-DLT_VERS=$LSOF_VERS" >> $LSOF_TSTCFLG
+if test $LSOF_TSTVPATH -eq 1	# {
+then
+  echo "-DLT_VPATH" >> $LSOF_TSTCFLG
+fi	# }
+echo "$LSOF_TSTCFLG created"
+
+# Create tests loader flags file.
+
+echo $LSOF_TSTLFLG > $LSOF_TSTLFF
+echo "$LSOF_TSTLFF created"
+
+# Create test extra objects file.
+
+echo "$LSOF_TSTXO" > $LSOF_TSTXOC
+echo "$LSOF_TSTXOC created"
+
+rm -f $LSOF_HLP
+
+# Call Customize, as required.
+
+if test "X$LSOF_SCRIPT_CALL" = "Xyes" -a ! -r ./.neverCust	# {
+then
+  if test ! -f ./Customize	# {  Want -x, but Ultrix doesn't grok it.
+  then
+    echo "Can't find Customize script."
+    exit 1
+  fi	# }
+  ./Customize $LSOF_DIALECT_DIR
+fi	# }
+
+# Issue unsupported warnings, as appropriate.
+
+if test "X$LSOF_UNSUP" != "X"	# {
+then
+  echo "$LSOF_UNSUP"
+fi	#}
+if test "X$LSOF_UNSUP2" != "X"	# {
+then
+  echo "$LSOF_UNSUP2"
+fi	#}
+exit 0
diff --git a/OLD/HOSTCC_00DIST b/OLD/HOSTCC_00DIST
new file mode 100644
index 0000000000000000000000000000000000000000..81717907ac02e300c67dc711207deba1253bb415
--- /dev/null
+++ b/OLD/HOSTCC_00DIST
@@ -0,0 +1,5 @@
+This patch adds support for cross-compilation by adding the notion of an 
+LSOF_HOSTCC and by auto-detecting the C library and Linux kernel version 
+from project-local sources and opposed to those from the build machine.
+
+Grant Erickson [erick205@umn.edu]
diff --git a/OLD/HOSTCC_patch b/OLD/HOSTCC_patch
new file mode 100644
index 0000000000000000000000000000000000000000..44444185d9c007724246425f79e88d98df5300ed
--- /dev/null
+++ b/OLD/HOSTCC_patch
@@ -0,0 +1,69 @@
+diff -aruN a/lsof_4.84_src/Configure b/lsof_4.84_src/Configure
+--- a/lsof_4.84_src/Configure	2010-07-29 08:59:32.000000000 -0700
++++ b/lsof_4.84_src/Configure	2010-09-08 12:30:24.000000000 -0700
+@@ -96,6 +96,7 @@
+ #	$LSOF_FBSD_ZFS_MKF  FreeBSD ZFS Makefile name
+ #	$LSOF_FBSD_ZFS_SYS  FreeBSD ZFS system sources location
+ #	$LSOF_HOST	    host name (e.g., from uname -n)
++#	$LSOF_HOSTCC	    Host C compiler name (may be supplied externally)
+ #	$LSOF_INCLUDE	    directory where header files are found
+ #			    (default = /usr/include)
+ #	$LSOF_LD	    loader name if not $LSOF_CC
+@@ -174,7 +175,6 @@
+ fi	# }
+ LSOF_LD=""
+ LSOF_LIB_NO=""
+-LSOF_LINUX_INCL=""
+ LSOF_PL=""
+ if test "X$LSOF_RANLIB" = "X"	# {
+ then
+@@ -2653,12 +2653,30 @@
+   linux)
+     LSOF_TSTBIGF="-D_FILE_OFFSET_BITS=64"
+     LSOF_TSTKMEM=0
++    if test "X$LSOF_HOSTCC" = "X"	# {
++    then
++      LSOF_HOSTCC=cc
++    fi	# }
+     if test "X$LSOF_CC" = "X"	# {
+     then
+       LSOF_CC=cc
+       LSOF_CCV=`$LSOF_CC -v 2>&1 | sed -n 's/.*version \(.*\)/\1/p'`
+     fi	# }
+     LSOF_DIALECT_DIR=""
++    if test "X$LSOF_LINUX_INCL" = "X" # {
++    then
++	LSOF_LINUX_INCL=/usr/include
++    else
++	LSOF_DINC="$LSOF_DINC -I${LSOF_LINUX_INCL}"
++    fi	# }
++    if test "X$LINUX_VERSION_CODE" = "X" # {
++    then
++      if test -r "$LSOF_LINUX_INCL/linux/version.h" # {
++      then
++        LINUX_VERSION_CODE=`cat $LSOF_LINUX_INCL/linux/version.h | sed -n 's/.\+LINUX_VERSION_CODE \([[:digit:]]\+\)$/\1/p'`
++      fi # }
++    fi # }
++    LSOF_VSTR=`echo $LINUX_VERSION_CODE | perl -e '$version=<STDIN>; chomp($version); printf("%d.%d.%d\n", ($version >> 16) & 0xFF, ($version >> 8) & 0xFF, $version & 0xFF);'`
+     if test "X$LSOF_VSTR" = "X"	# {
+     then
+       LSOF_VSTR=`uname -r`
+@@ -2690,7 +2708,7 @@
+ 
+     if test "X$LINUX_CLIB" = "X"	# {
+     then
+-      echo -n "Testing C library type with $LSOF_CC ... "
++      echo -n "Testing C library type with $LSOF_HOSTCC ... "
+       rm -f ${LSOF_TMPC}.*
+       cat > $LSOF_TMPC.c << .LSOF_END_HERE_DOC1
+ #include <features.h>
+@@ -2704,7 +2722,7 @@
+ #endif
+ return(0); }
+ .LSOF_END_HERE_DOC1
+-      $LSOF_CC ${LSOF_TMPC}.c -I$LSOF_INCLUDE -o ${LSOF_TMPC}.x > /dev/null 2>&1
++      $LSOF_HOSTCC ${LSOF_TMPC}.c -I$LSOF_INCLUDE -o ${LSOF_TMPC}.x > /dev/null 2>&1
+       if test -x ${LSOF_TMPC}.x	# {
+       then
+ 	LINUX_CLIB=`${LSOF_TMPC}.x`
+
diff --git a/OLD/Lsof.8 b/OLD/Lsof.8
new file mode 100644
index 0000000000000000000000000000000000000000..3b68f3eb4c5f98f0051b323384422ef349c6c993
--- /dev/null
+++ b/OLD/Lsof.8
@@ -0,0 +1,4512 @@
+.so ./version
+.TH LSOF 8 Revision-\*(VN
+\" Register )P is used neither by this file nor any groff macro.  However,
+\" some versions of nroff require it.
+.if !\n(.g \{\
+.   if !\n()P .nr )P 1v
+.\}
+.SH NAME
+lsof \- list open files
+.SH SYNOPSIS
+.B lsof
+[
+.B \-?abChlnNOPRtUvVX
+] [
+.BI -A " A"
+] [
+.BI \-c " c"
+] [
+.BI +c " c"
+] [
+.BI +|\-d " d"
+] [
+.BI +|\-D " D"
+] [
+.BI +|\-e " s"
+] [
+.B +|-E
+] [
+.B +|\-f [cfgGn]
+] [
+.BI \-F " [f]"
+] [
+.BI \-g " [s]"
+] [
+.BI \-i " [i]"
+] [
+.BI \-k " k"
+] [
+.BI \-K " k"
+] [
+.BI +|\-L " [l]"
+] [
+.BI +|\-m " m"
+] [
+.B +|\-M
+] [
+.BI \-o " [o]"
+] [
+.BI \-p " s"
+] [
+.BI +|\-r " [t[m<fmt>]]"
+] [
+.BI \-s " [p:s]"
+] [
+.BI \-S " [t]"
+] [
+.BI \-T " [t]"
+] [
+.BI \-u " s"
+] [
+.B +|\-w
+] [
+.BI \-x " [fl]"
+] [
+.BI \-z " [z]"
+] [
+.BI \-Z " [Z]"
+] [
+.B --
+] [\fInames\fP]
+.SH DESCRIPTION
+.I Lsof
+revision \*(VN lists on its standard output file information about files
+opened by processes for the following UNIX dialects:
+.PP
+.nf
+.so ./00DIALECTS
+.fi
+.PP
+(See the
+.B DISTRIBUTION
+section of this manual page for information on how to obtain the
+latest
+.I lsof
+revision.)
+.PP
+An open file may be a regular file, a directory, a block special file,
+a character special file, an executing text reference, a library,
+a stream or a network file (Internet socket, NFS file or UNIX domain socket.)
+A specific file or all the files in a file system may be selected by path.
+.PP
+Instead of a formatted display,
+.I lsof
+will produce output that can be parsed by other programs.
+See the
+.BR \-F ,
+option description, and the
+.B "OUTPUT FOR OTHER PROGRAMS"
+section for more information.
+.PP
+In addition to producing a single output list,
+.I lsof
+will run in repeat mode.
+In repeat mode it will produce output, delay, then repeat the output
+operation until stopped with an interrupt or quit signal.
+See the
+.BI +|\-r " [t[m<fmt>]]"
+option description for more information.
+.SH OPTIONS
+In the absence of any options,
+.I lsof
+lists all open files belonging to all active processes.
+.PP
+If any list request option is specified, other list requests must be
+specifically requested \- e.g., if
+.B \-U
+is specified for the listing of UNIX socket files, NFS files won't be
+listed unless
+.B \-N
+is also specified;
+or if a user list is specified with the
+.B \-u
+option, UNIX domain socket files, belonging to users not in the list,
+won't be listed unless the
+.B \-U
+option is also specified.
+.PP
+Normally list options that are specifically stated are ORed \- i.e.,
+specifying the
+.B \-i
+option without an address and the \fB\-u\fPfoo option produces a
+listing of all network files OR files belonging to processes owned
+by user ``foo''.
+The exceptions are:
+.TP \w'1)\ 'u
+1)
+the `^' (negated) login name or user ID (UID), specified with the
+.B \-u
+option;
+.TP \w'1)\ 'u
+2)
+the `^' (negated) process ID (PID), specified with the
+.B \-p
+option;
+.TP \w'1)\ 'u
+3)
+the `^' (negated) process group ID (PGID), specified with the
+.B \-g
+option;
+.TP \w'1)\ 'u
+4)
+the `^' (negated) command, specified with the
+.B \-c
+option;
+.TP \w'1)\ 'u
+5)
+the (`^') negated TCP or UDP protocol state names, specified with the
+.BI \-s " [p:s]"
+option.
+.PP
+Since they represent exclusions, they are applied without ORing or ANDing
+and take effect before any other selection criteria are applied.
+.PP
+The
+.B \-a
+option may be used to AND the selections.
+For example, specifying
+.BR \-a ,
+.BR \-U ,
+and \fB\-u\fPfoo produces a listing of only UNIX socket files that
+belong to processes owned by user ``foo''.
+.PP
+Caution: the
+.B \-a
+option causes all list selection options to be ANDed; it can't
+be used to cause ANDing of selected pairs of selection options
+by placing it between them, even though its placement there is
+acceptable.
+Wherever
+.B \-a
+is placed, it causes the ANDing of all selection options.
+.PP
+Items of the same selection set \- command names, file descriptors,
+network addresses, process identifiers, user identifiers, zone names,
+security contexts \- are joined in a single ORed set and applied
+before the result participates in ANDing.
+Thus, for example, specifying \fB\-i\fP@aaa.bbb, \fB\-i\fP@ccc.ddd,
+.BR \-a ,
+and \fB\-u\fPfff,ggg will select the listing of files that belong to
+either login ``fff'' OR ``ggg'' AND have network connections to either
+host aaa.bbb OR ccc.ddd.
+.PP
+Options may be grouped together following a single prefix -- e.g.,
+the option set ``\fB\-a \-b \-C\fP'' may be stated as
+.BR \-abC .
+However, since values are optional following
+.BR +|\-f ,
+.BR \-F ,
+.BR \-g ,
+.BR \-i ,
+.BR +|\-L ,
+.BR \-o ,
+.BR +|\-r ,
+.BR \-s ,
+.BR \-S ,
+.BR \-T ,
+.B \-x
+and
+.BR \-z .
+when you have no values for them be careful that the
+following character isn't ambiguous.
+For example,
+.B \-Fn
+might represent the
+.B \-F
+and
+.B \-n
+options, or it might represent the
+.B n
+field identifier character following the
+.B \-F
+option.
+When ambiguity is possible, start a new option with a `-'
+character \- e.g., ``\fB\-F \-n\fP''.
+If the next option is a file name, follow the possibly ambiguous
+option with ``--'' \- e.g., ``\fB\-F -- \fIname\fR''.
+.PP
+Either the `+' or the `\-' prefix may be applied to a group of options.
+Options that don't take on separate meanings for each
+prefix \- e.g., \fB\-i\fP \- may be grouped under either prefix.
+Thus, for example, ``+M -i'' may be stated as ``+Mi'' and the group
+means the same as the separate options.
+Be careful of prefix grouping when one or more options in the group
+does take on separate meanings under different prefixes \-
+e.g., \fB+|\-M\fP; ``-iM'' is not the same request as ``\-i +M''.
+When in doubt, use separate options with appropriate prefixes.
+.TP \w'names'u+4
+.B \-? \-h
+These two equivalent options select a usage (help) output list.
+.I Lsof
+displays a shortened form of this output when it detects an error
+in the options supplied to it, after it has displayed messages
+explaining each error.
+(Escape the `?' character as your shell requires.)
+.TP \w'names'u+4
+.B \-a
+causes list selection options to be ANDed, as described above.
+.TP \w'names'u+4
+.BI \-A " A"
+is available on systems configured for AFS whose AFS
+kernel code is implemented via dynamic modules.
+It allows the
+.I lsof
+user to specify
+.I A
+as an alternate name list file where the kernel addresses of the dynamic
+modules might be found.
+See the
+.I lsof
+FAQ (The \fBFAQ\fP section gives its location.)
+for more information about dynamic modules, their
+symbols, and how they affect
+.IR lsof .
+.TP \w'names'u+4
+.B \-b
+causes
+.I lsof
+to avoid kernel functions that might block \-
+.IR lstat (2),
+.IR readlink (2),
+and
+.IR stat (2).
+.IP
+See the
+.B "BLOCKS AND TIMEOUTS"
+and
+.B "AVOIDING KERNEL BLOCKS"
+sections for information on using this option.
+.TP \w'names'u+4
+.BI \-c " c"
+selects the listing of files for processes executing the
+command that begins with the characters of
+.IR c .
+Multiple commands may be specified, using multiple
+.B \-c
+options.
+They are joined in a single ORed set before participating in
+AND option selection.
+.IP
+If
+.I c
+begins with a `^', then the following characters specify a command
+name whose processes are to be ignored (excluded.)
+.IP
+If
+.I c
+begins and ends with a slash ('/'), the characters between the slashes
+are interpreted as a regular expression.
+Shell meta\-characters in the regular expression must be quoted to prevent
+their interpretation by the shell.
+The closing slash may be followed by these modifiers:
+.IP
+.nf
+	b	the regular expression is a basic one.
+.br
+	i	ignore the case of letters.
+.br
+	x	the regular expression is an extended one
+.br
+		(default).
+.fi
+.IP
+See the
+.I lsof
+FAQ (The \fBFAQ\fP section gives its location.)
+for more information on basic and extended regular
+expressions.
+.IP
+The simple command specification is tested first.
+If that test fails, the command regular expression is applied.
+If the simple command test succeeds, the command regular expression
+test isn't made.
+This may result in ``no command found for regex:'' messages
+when lsof's
+.B \-V
+option is specified.
+.TP \w'names'u+4
+.BI +c " w"
+defines the maximum number of initial characters of the name,
+supplied by the UNIX dialect, of the UNIX command associated with a process
+to be printed in the COMMAND column.
+(The
+.I lsof
+default is nine.)
+.IP
+Note that many UNIX dialects do not supply all command name characters
+to
+.I lsof
+in the files and structures from which
+.I lsof
+obtains command name.
+Often dialects limit the number of characters supplied in those sources.
+For example, Linux 2.4.27 and Solaris 9 both limit command name length to
+16 characters.
+.IP
+If
+.I w
+is zero ('0'), all command characters supplied to
+.I lsof
+by the UNIX dialect will be printed.
+.IP
+If
+.I w
+is less than the length of the column title, ``COMMAND'', it will
+be raised to that length.
+.TP \w'names'u+4
+.B \-C
+disables the reporting of any path name
+components from the kernel's name cache.
+See the
+.B "KERNEL NAME CACHE"
+section for more information.
+.TP \w'names'u+4
+.BI +d " s"
+causes
+.I lsof
+to search for all open instances of directory
+.I s
+and the files and directories it contains at its top level.
+.B +d
+does NOT descend the directory tree, rooted at
+.IR s .
+The
+.BI +D " D"
+option may be used to request a full\-descent directory tree search,
+rooted at directory
+.IR D .
+.IP
+Processing of the
+.B +d
+option does not follow symbolic links within
+.I s
+unless the
+.B \-x
+or
+.B \-x " l"
+option is also specified.
+Nor does it
+search for open files on file system mount points on subdirectories of
+.I s
+unless the
+.B \-x
+or
+.B \-x " f"
+option is also specified.
+.IP
+Note: the authority of the user of this option limits it to searching for
+files that the user has permission to examine with the system
+.IR stat (2)
+function.
+.TP \w'names'u+4
+.BI \-d " s"
+specifies a list of file descriptors (FDs) to exclude from
+or include in the output listing.
+The file descriptors are specified in the comma\-separated set
+.I s
+\&\- e.g., ``cwd,1,3'', ``^6,^2''.
+(There should be no spaces in the set.)
+.IP
+The list is an exclusion list if all entries of the set begin with `^'.
+It is an inclusion list if no entry begins with `^'.
+Mixed lists are not permitted.
+.IP
+A file descriptor number range may be in the set as long as
+neither member is empty, both members are numbers, and the ending
+member is larger than the starting one \- e.g., ``0-7'' or ``3-10''.
+Ranges may be specified for exclusion if they have the `^' prefix \-
+e.g., ``^0-7'' excludes all file descriptors 0 through 7.
+.IP
+Multiple file descriptor numbers are joined in a single ORed set before
+participating in AND option selection.
+.IP
+When there are exclusion and inclusion members in the set,
+.I lsof
+reports them as errors and exits with a non\-zero return code.
+.IP
+See the description of File Descriptor (FD) output values in the
+.B OUTPUT
+section for more information on file descriptor names.
+.TP \w'names'u+4
+.BI +D " D"
+causes
+.I lsof
+to search for all open instances of directory
+.I D
+and all the files and directories it contains to its complete depth.
+.IP
+Processing of the
+.B +D
+option does not follow symbolic links within
+.I D
+unless the
+.B \-x
+or
+.B \-x " l"
+option is also specified.
+Nor does it
+search for open files on file system mount points on subdirectories of
+.I D
+unless the
+.B \-x
+or
+.B \-x " f"
+option is also specified.
+.IP
+Note: the authority of the user of this option limits it to searching for
+files that the user has permission to examine with the system
+.IR stat (2)
+function.
+.IP
+Further note:
+.I lsof
+may process this option slowly and require a large amount of dynamic memory
+to do it.
+This is because it must descend the entire directory tree, rooted at
+.IR D ,
+calling
+.IR stat (2)
+for each file and directory, building a list of all the files it finds, and
+searching that list for a match with every open file.
+When directory
+.I D
+is large, these steps can take a long time, so use this option prudently.
+.TP \w'names'u+4
+.BI \-D " D"
+directs
+.I lsof's
+use of the device cache file.
+The use of this option is sometimes restricted.
+See the
+.B "DEVICE CACHE FILE"
+section and the sections that follow it for more information on this
+option.
+.IP
+.B -D
+must be followed by a function letter; the function letter may optionally
+be followed by a path name.
+.I Lsof
+recognizes these function letters:
+.IP
+.nf
+	\fB?\fP \- report device cache file paths
+	\fBb\fP \- build the device cache file
+	\fBi\fP \- ignore the device cache file
+	\fBr\fP \- read the device cache file
+	\fBu\fP \- read and update the device cache file
+.fi
+.IP
+The
+.BR b ,
+.BR r ,
+and
+.B u
+functions, accompanied by a path name, are sometimes restricted.
+When these functions are restricted, they will not appear in
+the description of the
+.B \-D
+option that accompanies
+.B \-h
+or
+.B \-?
+option output.
+See the
+.B "DEVICE CACHE FILE"
+section and the sections that follow it for more information on these
+functions and when they're restricted.
+.IP
+The
+.B ?
+function reports the read\-only and write paths that lsof can
+use for the device cache file,
+the names of any environment variables whose values
+.I lsof
+will examine when forming the device cache file path,
+and the format for the personal device cache file path.
+(Escape the `?' character as your shell requires.)
+.IP
+When available, the
+.BR b ,
+.BR r ,
+and
+.B u
+functions may be followed by the device cache file's path.
+The standard default is
+.I .lsof_hostname
+in the home directory of the real user ID that executes
+.IR lsof ,
+but this could have been changed when
+.I lsof
+was configured and compiled.
+(The output of the
+.B \-h
+and
+.B \-?
+options show the current default prefix \- e.g., ``.lsof''.)
+The suffix,
+.IR hostname ,
+is the first component of the host's name returned by
+.IR gethostname (2).
+.IP
+When available, the
+.B b
+function directs
+.I lsof
+to build a new device cache file at the default or specified path.
+.IP
+The
+.B i
+function directs
+.I lsof
+to ignore the default device cache file and obtain its information
+about devices via direct calls to the kernel.
+.IP
+The
+.B r
+function directs
+.I lsof
+to read the device cache at the default or specified path, but
+prevents it from creating a new device cache file when none
+exists or the existing one is improperly structured.
+The
+.B r
+function, when specified without a path name, prevents
+.I lsof
+from updating an incorrect or outdated device cache file,
+or creating a new one in its place.
+The
+.B r
+function is always available when it is specified without a
+path name argument; it may be restricted by the permissions of the
+.I lsof
+process.
+.IP
+When available, the
+.B u
+function directs
+.I lsof
+to read the device cache file at the default or specified path,
+if possible, and to rebuild it, if necessary.
+This is the default device cache file function when no
+.B \-D
+option has been specified.
+.TP \w'names'u+4
+.BI +|\-e " s"
+exempts the file system whose path name is
+.I s
+from being subjected to kernel function calls that might block.
+The
+.B +e
+option exempts
+.IR stat (2),
+.IR lstat (2)
+and most
+.IR readlink (2)
+kernel function calls.
+The
+.B \-e
+option exempts only
+.IR stat(2)
+and
+.IR lstat (2)
+kernel function calls.
+Multiple file systems may be specified with separate
+.B +|\-e
+specifications and each may have
+.IR readlink (2)
+calls exempted or not.
+.IP
+This option is currently implemented only for Linux.
+.IP
+.B CAUTION:
+this option can easily be mis\-applied to other than
+the file system of interest, because it uses path name rather
+than the more reliable device and inode numbers.
+(Device and inode numbers are acquired via the potentially blocking
+.IR stat (2)
+kernel call and are thus not available, but see the
+.BI +|\-m " m"
+option as a possible alternative way to supply device numbers.)
+\fBUse this option with great care and fully specify the path name of the
+file system to be exempted.\fP
+.IP
+When open files on exempted file systems are reported, it may not be
+possible to obtain all their information.
+Therefore, some information columns will be blank, the characters ``UNKN''
+preface the values in the TYPE column, and the applicable exemption option
+is added in parentheses to the end of the NAME column.
+(Some device number information might be made available via the
+.BI +|\-m " m"
+option.)
+.TP \w'names'u+4
+.B +|-E
+.B +E
+specifies that Linux pipe and Linux UNIX socket files should be displayed with
+endpoint information and the files of the endpoints should also be
+displayed.
+Note: UNIX socket file endpoint information is available only when the
+compile flags line of
+.B \-v
+output contains HASUXSOCKEPT.
+.IP
+Pipe endpoint information is displayed in the NAME column in the
+form ``\fIPID,cmd,FDmode\fP'', where
+.I PID
+is the endpoint process ID;
+.I cmd
+is the endpoint process command;
+.I FD
+is the endpoint file's descriptor; and
+.I mode
+is the endpoint file's access mode.
+.IP
+UNIX socket file endpoint information is displayed in the NAME column
+in the form
+.br
+``type=\fITYPE\fP\ ->INO=\fIINODE\fP\ \fIPID,cmd,FDmode\fP'', where
+.I TYPE
+is the socket type;
+.I INODE
+is the i-node number of the connected socket;
+and
+.I "PID, cmd, FD,"
+and
+.I mode
+are the same as with pipe endpoint information.
+Note: UNIX socket file endpoint information is available only when the
+compile flags line of
+.B \-v
+output contains HASUXSOCKEPT.
+.IP
+Multiple occurrences of this information can appear in a file's
+NAME column.
+.IP
+.B -E
+specfies that Linux pipe and Linux UNIX socket files should be displayed
+with endpoint information, but not the files of the endpoints.
+.TP \w'names'u+4
+.B +|\-f [cfgGn]
+.B f
+by itself clarifies how path name arguments are to be interpreted.
+When followed by
+.BR c ,
+.BR f ,
+.BR g ,
+.BR G ,
+or
+.B n
+in any combination it specifies
+that the listing of kernel file structure information is to be enabled
+(`+') or inhibited (`\-').
+.IP
+Normally a path name argument is taken to be a file system name if
+it matches a mounted\-on directory name reported by
+.IR mount (8),
+or if it represents a block device, named in the
+.I mount
+output and associated with a mounted directory name.
+When
+.B +f
+is specified, all path name arguments will be taken to be file
+system names, and
+.I lsof
+will complain if any are not.
+This can be useful, for example, when the file system name
+(mounted\-on device) isn't a block device.
+This happens for some CD-ROM file systems.
+.IP
+When
+.B \-f
+is specified by itself, all path name arguments will be taken to be
+simple files.
+Thus, for example, the ``\fB\-f\fP\ -- /'' arguments direct lsof to search
+for open files with a `/' path name, not all open files in the `/'
+(root) file system.
+.IP
+Be careful to make sure
+.B +f
+and
+.B \-f
+are properly terminated and aren't followed by a character (e.g., of
+the file or file system name) that might be taken as a parameter.
+For example, use ``--'' after
+.B +f
+and
+.B \-f
+as in these examples.
+.IP
+.nf
+	$ lsof +f -- /file/system/name
+	$ lsof -f -- /file/name
+.fi
+.IP
+The listing of information from kernel file structures, requested with the
+.B +f [cfgGn]
+option form, is normally
+inhibited, and is not available in whole or part for some dialects \- e.g.,
+/proc\-based Linux kernels below 2.6.22.
+When the prefix to
+.B f
+is a plus sign (`+'), these characters request file structure information:
+.IP
+.nf
+	\fBc\fR	file structure use count (not Linux)
+	\fBf\fR	file structure address (not Linux)
+	\fBg\fR	file flag abbreviations (Linux 2.6.22 and up)
+	\fBG\fR	file flags in hexadecimal (Linux 2.6.22 and up)
+	\fBn\fR	file structure node address (not Linux)
+.fi
+.IP
+When the prefix is minus (`\-') the same characters disable the
+listing of the indicated values.
+.IP
+File structure addresses, use counts, flags, and node addresses may be
+used to detect more readily identical files inherited by child
+processes and identical files in use by different processes.
+.I Lsof
+column output can be sorted by output columns holding the values
+and listed to identify identical file use, or
+.I lsof
+field output can be parsed by an AWK or Perl post\-filter script,
+or by a C program.
+.TP \w'names'u+4
+.BI \-F " f"
+specifies a character list,
+.IR f ,
+that selects the fields to be output for processing by another program,
+and the character that terminates each output field.
+Each field to be output is specified with a single character in
+.IR f .
+The field terminator defaults to NL, but may be changed to NUL (000).
+See the
+.B "OUTPUT FOR OTHER PROGRAMS"
+section for a description of the field identification characters and
+the field output process.
+.IP
+When the field selection character list is empty, all standard fields are
+selected (except the raw device field, security context and zone field for
+compatibility reasons)
+and the NL field terminator is used.
+.IP
+When the field selection character list contains only a zero (`0'),
+all fields are selected (except the raw device field for compatibility
+reasons) and the NUL terminator character is used.
+.IP
+Other combinations of fields and their associated field terminator
+character must be set with explicit entries in
+.IR f ,
+as described in the
+.B "OUTPUT FOR OTHER PROGRAMS"
+section.
+.IP
+When a field selection character identifies an item
+.I lsof
+does not normally list \- e.g., PPID, selected with
+.BR \-R " \-"
+specification of the field character \- e.g., ``\fB\-FR\fP'' \-
+also selects the listing of the item.
+.IP
+When the field selection character list contains the single
+character `?',
+.I lsof
+will display a help list of the field identification characters.
+(Escape the `?' character as your shell requires.)
+.TP \w'names'u+4
+.BI \-g " [s]"
+excludes or selects the listing of files for the processes
+whose optional process group IDentification (PGID) numbers are in the
+comma\-separated set
+.I s
+\&\- e.g., ``123'' or ``123,^456''.
+(There should be no spaces in the set.)
+.IP
+PGID numbers that begin with `^' (negation) represent exclusions.
+.IP
+Multiple PGID numbers are joined in a single ORed set before participating
+in AND option selection.
+However, PGID exclusions are applied without ORing or ANDing
+and take effect before other selection criteria are applied.
+.IP
+The
+.B \-g
+option also enables the output display of PGID numbers.
+When specified without a PGID set that's all it does.
+.TP \w'names'u+4
+.BI \-i " [i]"
+selects the listing of files any of whose Internet address
+matches the address specified in \fIi\fP.
+If no address is specified, this option selects the listing of all
+Internet and x.25 (HP\-UX) network files.
+.IP
+If
+.BI \-i 4
+or
+.BI \-i 6
+is specified with no following address, only files of the indicated
+IP version, IPv4 or IPv6, are displayed.
+(An IPv6 specification may be used only if the dialects supports IPv6,
+as indicated by ``[46]'' and ``IPv[46]'' in
+.I lsof's
+.B \-h
+or
+.B \-?
+output.)
+Sequentially specifying
+.BR \-i 4,
+followed by
+.BR \-i 6
+is the same as specifying
+.BR \-i ,
+and vice-versa.
+Specifying
+.BR \-i 4,
+or
+.BR \-i 6
+after
+.B \-i
+is the same as specifying
+.BR \-i 4
+or
+.BR \-i 6
+by itself.
+.IP
+Multiple addresses (up to a limit of 100) may be specified with multiple
+.B \-i
+options.
+(A port number or service name range is counted as one address.)
+They are joined in a single ORed set before participating in
+AND option selection.
+.IP
+An Internet address is specified in the form (Items in square
+brackets are optional.):
+.IP
+.ie !\n(.g \{
+[\fI46\fP][\fIprotocol\fP][@\fIhostname\fP\||\|\fIhostaddr\fP][:\fIservice\fP\||\|\fIport\fP]
+\}
+.el \{
+.RI [ 46 ][ protocol ][@ hostname \||\| hostaddr ][: service \||\| port ]
+\}
+.IP
+where:
+.nf
+.br
+	\fI46\fP specifies the IP version, IPv4 or IPv6
+.br
+		that applies to the following address.
+.br
+		'6' may be be specified only if the UNIX
+.br
+		dialect supports IPv6.  If neither '4' nor
+.br
+		'6' is specified, the following address
+.br
+		applies to all IP versions.
+.br
+	\fIprotocol\fP is a protocol name \- \fBTCP\fP, \fBUDP\fP
+.br		or \fBUDPLITE\fP.
+.br
+	\fIhostname\fP is an Internet host name.  Unless a
+.br
+		specific IP version is specified, open
+.br
+		network files associated with host names
+.br
+		of all versions will be selected.
+.br
+	\fIhostaddr\fP is a numeric Internet IPv4 address in
+.br
+		dot form; or an IPv6 numeric address in
+.br
+		colon form, enclosed in brackets, if the
+.br
+		UNIX dialect supports IPv6.  When an IP
+.br
+		version is selected, only its numeric
+.br
+		addresses may be specified.
+.br
+	\fIservice\fP is an \fI/etc/services\fP name \- e.g., \fBsmtp\fP \-
+		or a list of them.
+.br
+	\fIport\fP is a port number, or a list of them.
+.fi
+.IP
+IPv6 options may be used only if the UNIX dialect supports IPv6.
+To see if the dialect supports IPv6, run
+.I lsof
+and specify the
+.B \-h
+or
+.B \-?
+(help) option.
+If the displayed description of the
+.B \-i
+option contains ``[46]'' and ``IPv[46]'', IPv6 is supported.
+.IP
+IPv4 host names and addresses may not be specified if network file selection
+is limited to IPv6 with
+.BR \-i " 6."
+IPv6 host names and addresses may not be specified if network file selection
+is limited to IPv4 with
+.BR \-i " 4."
+When an open IPv4 network file's address is mapped in an IPv6 address,
+the open file's type will be IPv6, not IPv4, and its display will be
+selected by '6', not '4'.
+.IP
+At least one address component \-
+.BR 4,
+.BR 6,
+.IR protocol ,
+.IR hostname ,
+.IR hostaddr ,
+or
+.I service
+\&\- must be supplied.
+The `@' character, leading the host specification, is always required;
+as is the `:', leading the port specification.
+Specify either
+.I hostname
+or
+.IR hostaddr .
+Specify either
+.I service
+name list or
+.I port
+number list.
+If a
+.I service
+name list is specified, the
+.I protocol
+may also need to be specified if the TCP, UDP and UDPLITE port numbers for
+the service name are different.
+Use any case \- lower or upper \- for
+.IR protocol .
+.IP
+.I Service
+names and
+.I port
+numbers may be combined in a list whose entries are separated by commas
+and whose numeric range entries are separated by minus signs.
+There may be no embedded spaces, and all service names must belong to
+the specified
+.IR protocol .
+Since service names may contain embedded minus signs, the starting entry
+of a range can't be a service name; it can be a port number, however.
+.IP
+Here are some sample addresses:
+.nf
+
+.br
+	-i6 \- IPv6 only
+.br
+	TCP:25 \- TCP and port 25
+.br
+	@1.2.3.4 \- Internet IPv4 host address 1.2.3.4
+.br
+	@[3ffe:1ebc::1]:1234 \- Internet IPv6 host address
+		3ffe:1ebc::1, port 1234
+.br
+	UDP:who \- UDP who service port
+.br
+	TCP@lsof.itap:513 \- TCP, port 513 and host name lsof.itap
+.br
+	tcp@foo:1-10,smtp,99 \- TCP, ports 1 through 10,
+		service name \fIsmtp\fP, port 99, host name foo
+.br
+	tcp@bar:1-smtp \- TCP, ports 1 through \fIsmtp\fP, host bar
+.br
+	:time \- either TCP, UDP or UDPLITE time service port
+.fi
+.TP \w'names'u+4
+.BI \-K " k"
+selects the listing of tasks (threads) of processes, on dialects
+where task (thread) reporting is supported.
+(If help output \- i.e., the output of the
+.B \-h
+or
+.B \-?
+options \- shows this option, then task (thread) reporting is
+supported by the dialect.)
+.IP
+If
+.B \-K
+is followed by a value,
+.IR k ,
+it must be ``i''.  That causes
+.I lsof
+to ignore tasks, particularly in the default, list\-everything case
+when no other options are specified.
+.IP
+When
+.B \-K
+and
+.B \-a
+are both specified on Linux, and the tasks of a main process are
+selected by other options, the main process will also be listed
+as though it were a task, but without a task ID.
+(See the description of the TID column in the
+.B OUTPUT
+section.)
+.IP
+Where the FreeBSD version supports threads, all threads will be
+listed with their IDs.
+.IP
+In general threads and tasks inherit the files of the caller, but
+may close some and open others, so
+.I lsof
+always reports all the open files of threads and tasks.
+.TP \w'names'u+4
+.BI \-k " k"
+specifies a kernel name list file,
+.IR k ,
+in place of /vmunix, /mach, etc.
+.B \-k
+is not available under AIX on the IBM RISC/System 6000.
+.TP \w'names'u+4
+.B \-l
+inhibits the conversion of user ID numbers to login names.
+It is also useful when login name lookup is working improperly or slowly.
+.TP \w'names'u+4
+.BI +|\-L " [l]"
+enables (`+') or disables (`-') the listing of file link
+counts, where they are available \- e.g., they aren't available
+for sockets, or most FIFOs and pipes.
+.IP
+When
+.B +L
+is specified without a following number, all link counts will be listed.
+When
+.B \-L
+is specified (the default), no link counts will be listed.
+.IP
+When
+.B +L
+is followed by a number, only files having a link count less than
+that number will be listed.
+(No number may follow
+.BR \-L .)
+A specification of the form ``\fB+L1\fP'' will select open files that
+have been unlinked.
+A specification of the form ``\fB+aL1\ \fI<file_system>\fR'' will select
+unlinked open files on the specified file system.
+.IP
+For other link count comparisons, use field output (\fB\-F\fP)
+and a post\-processing script or program.
+.TP \w'names'u+4
+.BI +|\-m " m"
+specifies an alternate kernel memory file or activates
+mount table supplement processing.
+.IP
+The option form
+.BI \-m " m"
+specifies a kernel memory file,
+.IR m ,
+in place of
+.I /dev/kmem
+or
+.I /dev/mem
+\&\- e.g., a crash dump file.
+.IP
+The option form
+.B +m
+requests that a mount supplement file be written to the standard output
+file.
+All other options are silently ignored.
+.IP
+There will be a line in the mount supplement file for each mounted file
+system, containing the mounted file system directory, followed by a single
+space, followed by the device number in hexadecimal "0x" format \- e.g.,
+.IP
+.nf
+	/ 0x801
+.fi
+.IP
+.I Lsof
+can use the mount supplement file to get device numbers for file systems
+when it can't get them via
+.IR stat (2)
+or
+.IR lstat (2).
+.IP
+The option form
+.BI +m " m"
+identifies
+.I m
+as a mount supplement file.
+.IP
+Note: the
+.B +m
+and
+.BI +m " m"
+options are not available for all supported dialects.
+Check the output of
+.I lsof's
+.B \-h
+or
+.B \-?
+options to see if the
+.B +m
+and
+.BI +m " m"
+options are available.
+.TP \w'names'u+4
+.B +|\-M
+Enables (\fB+\fP) or disables (\fB\-\fP) the
+reporting of portmapper registrations for local TCP, UDP and UDPLITE ports,
+where port mapping is supported.
+(See the last paragraph of this option description for information about
+where portmapper registration reporting is supported.)
+.IP
+The default reporting mode is set by the
+.I lsof
+builder with the HASPMAPENABLED #define in the dialect's machine.h
+header file;
+.I lsof
+is distributed with the HASPMAPENABLED #define deactivated, so
+portmapper reporting is disabled by default and must be requested
+with
+.BR +M .
+Specifying
+.I lsof's
+.B \-h
+or
+.B \-?
+option will report the default mode.
+Disabling portmapper registration when it is already disabled or
+enabling it when already enabled is acceptable.
+When portmapper registration reporting is enabled,
+.I lsof
+displays the portmapper registration (if any) for local TCP, UDP or
+UDPLITE ports
+in square brackets immediately following the port numbers or service
+names \- e.g., ``:1234[name]'' or ``:name[100083]''.
+The registration information may be a name or number, depending
+on what the registering program supplied to the portmapper when
+it registered the port.
+.IP
+When portmapper registration reporting is enabled,
+.I lsof
+may run a little more slowly or even become blocked when access to the
+portmapper becomes congested or stopped.
+Reverse the reporting mode to determine if portmapper registration
+reporting is slowing or blocking
+.IR lsof .
+.IP
+For purposes of portmapper registration reporting
+.I lsof
+considers a TCP, UDP or UDPLITE port local if: it is found in the local part
+of its containing kernel structure;
+or if it is located in the foreign part of its containing kernel
+structure and the local and foreign Internet addresses are the same;
+or if it is located in the foreign part of its containing kernel
+structure and the foreign Internet address is INADDR_LOOPBACK (127.0.0.1).
+This rule may make
+.I lsof
+ignore some foreign ports on machines with multiple interfaces
+when the foreign Internet address is on a different interface
+from the local one.
+.IP
+See the
+.I lsof
+FAQ (The \fBFAQ\fP section gives its location.)
+for further discussion of portmapper registration
+reporting issues.
+.IP
+Portmapper registration reporting is supported only on dialects that
+have RPC header files.
+(Some Linux distributions with GlibC 2.14 do not have them.)
+When portmapper registration reporting is supported, the
+.B \-h
+or
+.B \-?
+help output will show the
+.B +|\-M
+option.
+.TP \w'names'u+4
+.B \-n
+inhibits the conversion of network numbers to
+host names for network files.
+Inhibiting conversion may make
+.I lsof
+run faster.
+It is also useful when host name lookup is not working properly.
+.TP \w'names'u+4
+.B \-N
+selects the listing of NFS files.
+.TP \w'names'u+4
+.BI \-o
+directs
+.I lsof
+to display file offset at all times.
+It causes the SIZE/OFF output column title to be changed to OFFSET.
+Note: on some UNIX dialects
+.I lsof
+can't obtain accurate or consistent file offset information from its
+kernel data sources, sometimes just for particular kinds of files
+(e.g., socket files.)
+Consult the
+.I lsof
+FAQ (The \fBFAQ\fP section gives its location.)
+for more information.
+.IP
+The
+.B \-o
+and
+.B \-s
+options are mutually exclusive; they can't both be specified.
+When neither is specified,
+.I lsof
+displays whatever value \- size or offset \- is appropriate and
+available for the type of the file.
+.TP \w'names'u+4
+.BI \-o " o"
+defines the number of decimal digits (\fIo\fP) to be
+printed after the ``0t'' for a file offset before the form is switched
+to ``0x...''.
+An
+.I o
+value of zero (unlimited) directs
+.I lsof
+to use the ``0t'' form for all offset output.
+.IP
+This option does NOT direct
+.I lsof
+to display offset at all times; specify
+.B \-o
+(without a trailing number) to do that.
+.BI \-o " o"
+only specifies the number of digits after ``0t'' in
+either mixed size and offset or offset\-only output.
+Thus, for example, to direct
+.I lsof
+to display offset at all times with a decimal digit count of 10, use:
+.IP
+.nf
+	-o -o 10
+or
+	-oo10
+.fi
+.IP
+The default number of digits allowed after ``0t'' is normally 8,
+but may have been changed by the lsof builder.
+Consult the description of the
+.BI \-o " o"
+option in the output of the
+.B \-h
+or
+.B \-?
+option to determine the default that is in effect.
+.TP \w'names'u+4
+.B \-O
+directs
+.I lsof
+to bypass the strategy it uses to avoid being blocked by some
+kernel operations \- i.e., doing them in forked child processes.
+See the
+.B "BLOCKS AND TIMEOUTS"
+and
+.B "AVOIDING KERNEL BLOCKS"
+sections for more information on kernel operations that may block
+.IR lsof .
+.IP
+While use of this option will reduce
+.I lsof
+startup overhead, it may also cause
+.I lsof
+to hang when the kernel doesn't respond to a function.
+Use this option cautiously.
+.TP \w'names'u+4
+.BI \-p " s"
+excludes or selects the listing of files for the processes
+whose optional process IDentification (PID) numbers are in the
+comma\-separated set
+.I s
+\&\- e.g., ``123'' or ``123,^456''.
+(There should be no spaces in the set.)
+.IP
+PID numbers that begin with `^' (negation) represent exclusions.
+.IP
+Multiple process ID numbers are joined in a single ORed set before
+participating in AND option selection.
+However, PID exclusions are applied without ORing or ANDing
+and take effect before other selection criteria are applied.
+.TP \w'names'u+4
+.B \-P
+inhibits the conversion of port numbers to port
+names for network files.
+Inhibiting the conversion may make
+.I lsof
+run a little faster.
+It is also useful when port name lookup is not working properly.
+.TP \w'names'u+4
+.BI +|\-r " [t[m<fmt>]]"
+puts
+.I lsof
+in repeat mode.
+There
+.I lsof
+lists open files as selected by other options, delays
+.I t
+seconds (default fifteen), then repeats the listing, delaying
+and listing repetitively until stopped by a condition defined by
+the prefix to the option.
+.IP
+If the prefix is a `\-', repeat mode is endless.
+.I Lsof
+must be terminated with an interrupt or quit signal.
+.IP
+If the prefix is `+', repeat mode will end the first cycle no open files
+are listed \- and of course when
+.I lsof
+is stopped with an interrupt or quit signal.
+When repeat mode ends because no files are listed, the process exit code
+will be zero if any open files were ever listed; one, if none were ever
+listed.
+.IP
+.I Lsof
+marks the end of each listing:
+if field output is in progress (the
+.BR \-F ,
+option has been specified), the default marker is `m'; otherwise the
+default marker is ``========''.
+The marker is followed by a NL character.
+.IP
+The optional "m<fmt>" argument specifies a format for the marker line.
+The <fmt> characters following `m' are interpreted as a format
+specification to the
+.IR strftime (3)
+function, when both it and the
+.IR localtime (3)
+function are available in the dialect's C library.
+Consult the
+.IR strftime (3)
+documentation for what may appear in its format specification.
+Note that when field output is requested with the
+.B \-F
+option, <fmt> cannot contain the NL format, ``%n''.
+Note also that when <fmt> contains spaces or other characters that
+affect the shell's interpretation of arguments, <fmt> must be
+quoted appropriately.
+.IP
+Repeat mode reduces
+.I lsof
+startup overhead, so it is more efficient to use this mode
+than to call
+.I lsof
+repetitively from a shell script, for example.
+.IP
+To use repeat mode most efficiently, accompany
+.B +|\-r
+with specification of other
+.I lsof
+selection options, so the amount of kernel memory access
+.I lsof
+does will be kept to a minimum.
+Options that filter at the process level \- e.g.,
+.BR \-c ,
+.BR \-g ,
+.BR \-p ,
+.B \-u
+\&\- are the most efficient selectors.
+.IP
+Repeat mode is useful when coupled with field output (see the
+.BR \-F ,
+option description) and a supervising
+.I awk
+or
+.I Perl
+script, or a C program.
+.TP \w'names'u+4
+.B \-R
+directs lsof to list the Parent Process IDentification
+number in the PPID column.
+.TP \w'names'u+4
+.BI \-s " [p:s]"
+.B s
+alone directs
+.I lsof
+to display file size at all times.
+It causes the SIZE/OFF output column title to be changed to SIZE.
+If the file does not have a size, nothing is displayed.
+.IP
+The optional
+.BI \-s " p:s"
+form is available only for selected dialects, and only when the
+.B \-h
+or
+.B \-?
+help output lists it.
+.IP
+When the optional form is available, the
+.B s
+may be followed by a protocol name (\fIp\fR), either TCP or UDP,
+a colon (`:') and a comma\-separated protocol state name list,
+the option causes open TCP and UDP files to be excluded if their
+state name(s) are in the list (\fIs\fP) preceded by a `^'; or
+included if their name(s) are not preceded by a `^'.
+.IP
+Dialects that support this option may support only one protocol.
+When an unsupported protocol is specified, a message will be
+displayed indicating state names for the protocol are unavailable.
+.IP
+When an inclusion list is defined, only network files with state
+names in the list will be present in the
+.I lsof
+output.
+Thus, specifying one state name means that only network files
+with that lone state name will be listed.
+.IP
+Case is unimportant in the protocol or state names, but there may
+be no spaces and the colon (`:') separating the protocol
+name (\fIp\fP) and the state name list (\fIs\fP) is required.
+.IP
+If only TCP and UDP files are to be listed, as controlled by
+the specified exclusions and inclusions, the
+.B \-i
+option must be specified, too.
+If only a single protocol's files are to be listed, add its name
+as an argument to the
+.B \-i
+option.
+.IP
+For example, to list only network files with TCP state LISTEN, use:
+.IP
+.nf
+	\-iTCP \-sTCP:LISTEN
+.fi
+.IP
+Or, for example, to list network files with all UDP states except
+Idle, use:
+.IP
+.nf
+	\-iUDP -sUDP:Idle
+.fi
+.IP
+State names vary with UNIX dialects, so it's not possible to
+provide a complete list.  Some common TCP state names are:
+CLOSED, IDLE, BOUND, LISTEN, ESTABLISHED, SYN_SENT, SYN_RCDV,
+ESTABLISHED, CLOSE_WAIT, FIN_WAIT1, CLOSING, LAST_ACK, FIN_WAIT_2,
+and TIME_WAIT.
+Two common UDP state names are Unbound and Idle.
+.IP
+See the
+.I lsof
+FAQ (The \fBFAQ\fP section gives its location.)
+for more information on how to use protocol state exclusion and
+inclusion, including examples.
+.IP
+The
+.B \-o
+(without a following decimal digit count) and
+.B \-s
+option (without a following protocol and state name list)
+are mutually exclusive; they can't both be specified.
+When neither is specified,
+.I lsof
+displays whatever value \- size or offset \- is appropriate and
+available for the type of file.
+.IP
+Since some types of files don't have true sizes \- sockets, FIFOs,
+pipes, etc.\& \- lsof displays for their sizes the content amounts in
+their associated kernel buffers, if possible.
+.TP \w'names'u+4
+.BI \-S " [t]"
+specifies an optional time-out seconds value for kernel functions \-
+.IR lstat (2),
+.IR readlink (2),
+and
+.IR stat (2)
+\- that might otherwise deadlock.
+The minimum for
+.I t
+is two;
+the default, fifteen; when no value is specified, the default is used.
+.IP
+See the
+.B "BLOCKS AND TIMEOUTS"
+section for more information.
+.TP \w'names'u+4
+.BI \-T " [t]"
+controls the reporting of some TCP/TPI information, also
+reported by
+.IR netstat (1),
+following the network addresses.
+In normal output the information appears in parentheses, each item
+except TCP or TPI state name identified by a keyword, followed by `=',
+separated from others by a single space:
+.IP
+.nf
+	<TCP or TPI state name>
+	QR=<read queue length>
+	QS=<send queue length>
+	SO=<socket options and values>
+	SS=<socket states>
+	TF=<TCP flags and values>
+	WR=<window read length>
+	WW=<window write length>
+.fi
+.IP
+Not all values are reported for all UNIX dialects.
+Items values (when available) are reported after the item name and '='.
+.IP
+When the field output mode is in effect (See
+.BR "OUTPUT FOR OTHER PROGRAMS" .)
+each item appears as a field with a `T' leading character.
+.IP
+.B \-T
+with no following key characters disables TCP/TPI information reporting.
+.IP
+.B \-T
+with following characters selects the reporting of specific TCP/TPI
+information:
+.IP
+.nf
+	\fBf\fP	selects reporting of socket options,
+		states and values, and TCP flags and
+		values.
+	\fBq\fP	selects queue length reporting.
+	\fBs\fP	selects connection state reporting.
+	\fBw\fP	selects window size reporting.
+.fi
+.IP
+Not all selections are enabled for some UNIX dialects.
+State may be selected for all dialects and is reported by default.
+The
+.B \-h
+or
+.B \-?
+help output for the
+.B \-T
+option will show what selections may be used with the UNIX dialect.
+.IP
+When
+.B \-T
+is used to select information \- i.e., it is followed by one or more
+selection characters \- the displaying of state is disabled by default,
+and it must be explicitly selected again in the characters following
+.BR \-T .
+(In effect, then, the default is equivalent to
+.BR -Ts .)
+For example, if queue lengths and state are desired, use
+.BR \-Tqs .
+.IP
+Socket options, socket states, some socket values, TCP flags and
+one TCP value may be reported (when available in the UNIX dialect)
+in the form of the names that commonly appear after SO_, so_, SS_,
+TCP_  and TF_ in the dialect's header files \-
+most often <sys/socket.h>, <sys/socketvar.h> and <netinet/tcp_var.h>.
+Consult those header files for the meaning of the flags, options,
+states and values.
+.IP
+``SO='' precedes socket options and values; ``SS='', socket states;
+and ``TF='', TCP flags and values.
+.IP
+If a flag or option has a value, the value will follow an '=' and
+the name -- e.g., ``SO=LINGER=5'', ``SO=QLIM=5'', ``TF=MSS=512''.
+The following seven values may be reported:
+.IP
+.nf
+	Name
+	Reported	Description (Common Symbol)
+
+	KEEPALIVE	keep alive time (SO_KEEPALIVE)
+	LINGER	linger time (SO_LINGER)
+	MSS		maximum segment size (TCP_MAXSEG)
+	PQLEN		partial listen queue connections
+	QLEN		established listen queue connections
+	QLIM		established listen queue limit
+	RCVBUF	receive buffer length (SO_RCVBUF)
+	SNDBUF	send buffer length (SO_SNDBUF)
+.fi
+.IP
+Details on what socket options and values, socket states, and TCP flags
+and values may be displayed for particular UNIX dialects may be found in
+the answer to the ``Why doesn't lsof report socket options, socket states,
+and TCP flags and values for my dialect?'' and ``Why doesn't lsof report
+the partial listen queue connection count for my dialect?''
+questions in the
+.I lsof
+FAQ (The \fBFAQ\fP section gives its location.)
+.TP \w'names'u+4
+.B \-t
+specifies that
+.I lsof
+should produce terse output with process identifiers only and no header \-
+e.g., so that the output may be piped to
+.IR kill (1).
+.B \-t
+selects the
+.B \-w
+option.
+.TP \w'names'u+4
+.BI \-u " s"
+selects the listing of files for the user whose login names
+or user ID numbers are in the comma\-separated set
+.I s
+\&\- e.g., ``abe'',
+or ``548,root''.
+(There should be no spaces in the set.)
+.IP
+Multiple login names or user ID numbers are joined in a single ORed set
+before participating in AND option selection.
+.IP
+If a login name or user ID is preceded by a `^', it becomes a negation \-
+i.e., files of processes owned by the login name or user ID will never
+be listed.
+A negated login name or user ID selection is neither ANDed nor ORed
+with other selections; it is applied before all other selections and
+absolutely excludes the listing of the files of the process.
+For example, to direct
+.I lsof
+to exclude the listing of files belonging to root processes,
+specify ``\-u^root'' or ``\-u^0''.
+.TP \w'names'u+4
+.B \-U
+selects the listing of UNIX domain socket files.
+.TP \w'names'u+4
+.B \-v
+selects the listing of
+.I lsof
+version information, including: revision number;
+when the
+.I lsof
+binary was constructed;
+who constructed the binary and where;
+the name of the compiler used to construct the
+.I lsof binary;
+the version number of the compiler when readily available;
+the compiler and loader flags used to construct the
+.I lsof
+binary;
+and system information, typically the output of
+.IR uname 's
+.B \-a
+option.
+.TP \w'names'u+4
+.B \-V
+directs
+.I lsof
+to indicate the items it was asked to list and failed to find \- command
+names, file names, Internet addresses or files, login names, NFS files,
+PIDs, PGIDs, and UIDs.
+.IP
+When other options are ANDed to search options, or compile\-time
+options restrict the listing of some files,
+.I lsof
+may not report that it failed to find a search item when an ANDed
+option or compile\-time option prevents the listing of the open file
+containing the located search item.
+.IP
+For example, ``lsof -V -iTCP@foobar -a -d 999'' may not report a
+failure to locate open files at ``TCP@foobar'' and may not list
+any, if none have a file descriptor number of 999.
+A similar situation arises when HASSECURITY and HASNOSOCKSECURITY are
+defined at compile time and they prevent the listing of open files.
+.TP \w'names'u+4
+.B +|\-w
+Enables (\fB+\fP) or disables (\fB-\fP) the suppression of warning messages.
+.IP
+The
+.I lsof
+builder may choose to have warning messages disabled or enabled by
+default.
+The default warning message state is indicated in the output of the
+.B \-h
+or
+.B \-?
+option.
+Disabling warning messages when they are already disabled or enabling
+them when already enabled is acceptable.
+.IP
+The
+.B \-t
+option selects the
+.B \-w
+option.
+.TP \w'names'u+4
+.BI \-x " [fl]"
+may accompany the
+.B +d
+and
+.B +D
+options to direct their processing to cross over symbolic
+links and|or file system mount points encountered when
+scanning the directory (\fB+d\fP) or directory tree (\fB+D\fP).
+.IP
+If
+.B -x
+is specified by itself without a following parameter, cross\-over
+processing of both symbolic links and file system mount points is
+enabled.
+Note that when
+.B \-x
+is specified without a parameter, the next argument must begin with '-'
+or '+'.
+.IP
+The optional 'f' parameter enables file system mount point cross\-over
+processing; 'l', symbolic link cross\-over processing.
+.IP
+The
+.B \-x
+option may not be supplied without also supplying a
+.B +d
+or
+.B +D
+option.
+.TP \w'names'u+4
+.B \-X
+This is a dialect\-specific option.
+.HP \w'names'u+4
+\ \ \ \ AIX:
+.br
+This IBM AIX RISC/System 6000 option requests the reporting
+of executed text file and shared library references.
+.IP
+.B WARNING:
+because this option uses the kernel readx() function, its use on
+a busy AIX system might cause an application process to hang so
+completely that it can neither be killed nor stopped.
+I have never seen this happen or had a report of its happening,
+but I think there is a remote possibility it could happen.
+.IP
+By default use of readx() is disabled.
+On AIX 5L and above
+.I lsof
+may need setuid\-root permission to perform the actions this
+option requests.
+.IP
+The
+.I lsof
+builder may specify that the
+.B \-X
+option be restricted to processes whose real UID is root.
+If that has been done, the
+.B \-X
+option will not appear in the
+.B \-h
+or
+.B \-?
+help output unless the real UID of the
+.I lsof
+process is root.
+The default
+.I lsof
+distribution allows any UID to specify
+.BR \-X,
+so by default it will appear in the help output.
+.IP
+When AIX readx() use
+is disabled,
+.I lsof
+may not be able to report information for all text and loader file
+references, but it may also avoid exacerbating an AIX
+kernel directory search kernel error, known as the Stale Segment
+ID bug.
+.IP
+The readx() function, used by
+.I lsof
+or any other program to access some sections of kernel virtual
+memory, can trigger the Stale Segment ID bug.
+It can cause the kernel's dir_search() function to believe erroneously
+that part of an in\-memory copy of a file system directory has been
+zeroed.
+Another application process, distinct from
+.IR lsof ,
+asking the kernel to search the directory \- e.g., by using
+.IR open "(2) \-"
+can cause dir_search() to loop forever, thus hanging the application process.
+.IP
+Consult the
+.I lsof
+FAQ (The \fBFAQ\fP section gives its location.)
+and the
+.I 00README
+file of the
+.I lsof
+distribution for a more complete description of the Stale Segment ID bug,
+its APAR, and methods for defining readx() use when compiling
+.IR lsof .
+.HP \w'names'u+4
+\ \ \ \ Linux:
+.br
+This Linux option requests that
+.I lsof
+skip the reporting of information on all open TCP, UDP and UDPLITE IPv4
+and IPv6 files.
+.IP
+This Linux option is most useful when the system has an extremely
+large number of open TCP, UDP and UDPLITE files, the processing of whose
+information in the
+.I /proc/net/tcp*
+and
+.I /proc/net/udp*
+files would take
+.I lsof
+a long time, and whose reporting is not of interest.
+.IP
+Use this option with care and only when you are sure that the
+information you want
+.I lsof
+to display isn't associated with open TCP, UDP or UDPLITE socket files.
+.HP \w'names'u+4
+\ \ \ \ Solaris 10 and above:
+.br
+This Solaris 10 and above option requests the reporting of cached
+paths for files that have been deleted \- i.e., removed with
+.IR rm (1)
+or
+.IR unlink (2).
+.IP
+The cached path is followed by the string ``\ (deleted)'' to indicate
+that the path by which the file was opened has been deleted.
+.IP
+Because intervening changes made to the path \- i.e., renames with
+.IR mv (1)
+or
+.IR rename (2)
+\- are not recorded in the cached path, what
+.I lsof
+reports is only the path by which the file was opened, not its
+possibly different final path.
+.TP \w'names'u+4
+.BI \-z " [z]"
+specifies how Solaris 10 and higher zone information is to be handled.
+.IP
+Without a following argument \- e.g., NO
+.IR z " \-"
+the option specifies that zone names are to be listed in the ZONE
+output column.
+.IP
+The
+.B \-z
+option may be followed by a zone name,
+.BI z .
+That causes lsof to list only open files for processes in that zone.
+Multiple
+.BI \-z " z"
+option and argument pairs may be specified to form a list of named zones.
+Any open file of any process in any of the zones will be listed, subject
+to other conditions specified by other options and arguments.
+.TP \w'names'u+4
+.BI \-Z " [Z]"
+specifies how SELinux security contexts are to be handled.
+It and 'Z' field output character support are inhibited
+when SELinux is disabled in the running Linux kernel.
+See
+.B "OUTPUT FOR OTHER PROGRAMS"
+for more information on the 'Z' field output character.
+.IP
+Without a following argument \- e.g., NO
+.IR Z " \-"
+the option specifies that security contexts are to be listed in the
+SECURITY\-CONTEXT output column.
+.IP
+The
+.B \-Z
+option may be followed by a wildcard security context name,
+.BI Z .
+That causes lsof to list only open files for processes in that security
+context.
+Multiple
+.BI \-Z " Z"
+option and argument pairs may be specified to form a list of security
+contexts.
+Any open file of any process in any of the security contexts will be listed,
+subject to other conditions specified by other options and arguments.
+Note that
+.I Z
+can be A:B:C or *:B:C or A:B:* or *:*:C to match against the A:B:C context.
+.TP \w'names'u+4
+.B \-\-
+The double minus sign option is a marker that signals the end of
+the keyed options.
+It may be used, for example, when the first file name begins with
+a minus sign.
+It may also be used when the absence of a value for the last keyed
+option must be signified by the presence of a minus sign in the following
+option and before the start of the file names.
+.TP \w'names'u+4
+.I names
+These are path names of specific files to list.
+Symbolic links are resolved before use.
+The first name may be separated from the preceding options with
+the ``--'' option.
+.IP
+If a
+.I name
+is the mounted\-on directory of a file system or the device of the
+file system,
+.I lsof
+will list all the files open on the file system.
+To be considered a file system, the
+.I name
+must match a mounted\-on directory name in
+.IR mount (8)
+output, or match the name of a block device associated with a mounted\-on
+directory name.
+The
+.B +|\-f
+option may be used to force
+.I lsof
+to consider a
+.I name
+a file system identifier (\fB+f\fP) or a simple file (\fB\-f\fP).
+.IP
+If
+.I name
+is a path to a directory that is not the mounted\-on directory name of
+a file system, it is treated just as a regular file is treated \- i.e.,
+its listing is restricted to processes that have it open as a file or
+as a process\-specific directory, such as the root or current working
+directory.
+To request that
+.I lsof
+look for open files inside a directory name, use the
+.BI +d " s"
+and
+.BI +D " D"
+options.
+.IP
+If a
+.I name
+is the base name of a family of multiplexed files \- e.g, AIX's
+.IR /dev/pt[cs] " \-"
+.I lsof
+will list all the associated multiplexed files on the device that
+are open \- e.g.,
+.IR /dev/pt[cs]/1 ,
+.IR /dev/pt[cs]/2 ,
+etc.
+.IP
+If a
+.I name
+is a UNIX domain socket name,
+.I lsof
+will usually search for it by the characters of the name alone \- exactly as
+it is specified and is recorded in the kernel socket structure.
+(See the next paragraph for an exception to that rule for Linux.)
+Specifying a relative path \- e.g.,
+.I ./file
+\&\- in place of the
+file's absolute path \- e.g.,
+.I /tmp/file
+\&\- won't work because
+.I lsof
+must match the characters you specify with what it finds in the
+kernel UNIX domain socket structures.
+.IP
+If a
+.I name
+is a Linux UNIX domain socket name, in one case
+.I lsof
+is able to search for it by its device and inode number, allowing
+.I name
+to be a relative path.
+The case requires that the absolute path -- i.e., one beginning with a
+slash ('/') be used by the process that created the socket, and hence be
+stored in the
+.I /proc/net/unix
+file; and it requires that
+.I lsof
+be able to obtain the device and node numbers of both the absolute path in
+.I /proc/net/unix
+and
+.I name
+via successful
+.IR stat (2)
+system calls.
+When those conditions are met,
+.I lsof
+will be able to search for the UNIX domain socket when some path to it is
+is specified in
+.IR name .
+Thus, for example, if the path is
+.IR /dev/log ,
+and an
+.I lsof
+search is initiated when the working directory is
+.IR /dev ,
+then
+.I name
+could be
+.IR ./log .
+.IP
+If a
+.I name
+is none of the above,
+.I lsof
+will list any open files whose device and inode match that of the
+specified path
+.IR name .
+.IP
+If you have also specified the
+.B \-b
+option,
+the only
+.I names
+you may safely specify are file systems for which your mount table
+supplies alternate device numbers.
+See the
+.B "AVOIDING KERNEL BLOCKS"
+and
+.B "ALTERNATE DEVICE NUMBERS"
+sections for more information.
+.IP
+Multiple file names are joined in a single ORed set before
+participating in AND option selection.
+.SH AFS
+.I Lsof
+supports the recognition of AFS files for these dialects (and AFS
+versions):
+.PP
+.nf
+	AIX 4.1.4 (AFS 3.4a)
+	HP\-UX 9.0.5 (AFS 3.4a)
+	Linux 1.2.13 (AFS 3.3)
+	Solaris 2.[56] (AFS 3.4a)
+.fi
+.PP
+It may recognize AFS files on other versions of these dialects,
+but has not been tested there.
+Depending on how AFS is implemented,
+.I lsof
+may recognize AFS files in other dialects, or may have difficulties
+recognizing AFS files in the supported dialects.
+.PP
+.I Lsof
+may have trouble identifying all aspects of AFS files in
+supported dialects when AFS kernel support is implemented via
+dynamic modules whose addresses do not appear in the kernel's
+variable name list.
+In that case,
+.I lsof
+may have to guess at the identity of AFS files, and might not be able to
+obtain volume information from the kernel that is needed for calculating
+AFS volume node numbers.
+When
+.I lsof
+can't compute volume node numbers, it reports blank in the NODE column.
+.PP
+The
+.BI \-A " A"
+option is available in some dialect implementations of
+.I lsof
+for specifying the name list file where dynamic module kernel
+addresses may be found.
+When this option is available, it will be listed in the
+.I lsof
+help output, presented in response to the
+.B \-h
+or
+.B \-?
+.PP
+See the
+.I lsof
+FAQ (The \fBFAQ\fP section gives its location.)
+for more information about dynamic modules, their
+symbols, and how they affect
+.I lsof
+options.
+.PP
+Because AFS path lookups don't seem to participate in the
+kernel's name cache operations,
+.I lsof
+can't identify path name components for AFS files.
+.SH SECURITY
+.I Lsof
+has three features that may cause security concerns.
+First, its default compilation mode allows anyone to list all
+open files with it.
+Second, by default it creates a user\-readable and user\-writable device
+cache file in the home directory of the real user ID that executes
+.IR lsof .
+(The list\-all\-open\-files and device cache features may be disabled when
+.I lsof
+is compiled.)
+Third, its
+.B \-k
+and
+.B \-m
+options name alternate kernel name list or memory files.
+.PP
+Restricting the listing of all open files is controlled by the
+compile\-time HASSECURITY and HASNOSOCKSECURITY options.
+When HASSECURITY is defined,
+.I lsof
+will allow only the root user to list all open files.
+The non\-root user may list only open files of processes with the same user
+IDentification number as the real user ID number of the
+.I lsof
+process (the one that its user logged on with).
+.PP
+However, if HASSECURITY and HASNOSOCKSECURITY are both defined,
+anyone may list open socket files, provided they are selected
+with the
+.B \-i
+option.
+.PP
+When HASSECURITY is not defined, anyone may list all open files.
+.PP
+Help output, presented in response to the
+.B \-h
+or
+.B \-?
+option, gives the status of the HASSECURITY and HASNOSOCKSECURITY definitions.
+.PP
+See the
+.B Security
+section of the
+.I 00README
+file of the
+.I lsof
+distribution for information on building
+.I lsof
+with the HASSECURITY and HASNOSOCKSECURITY options enabled.
+.PP
+Creation and use of a user\-readable and user\-writable device
+cache file is controlled by the compile\-time HASDCACHE option.
+See the
+.B "DEVICE CACHE FILE"
+section and the sections that follow it for details on how its path
+is formed.
+For security considerations it is important to note that in the default
+.I lsof
+distribution, if the real user ID under which
+.I lsof
+is executed is root, the device cache file will be written in root's
+home directory \- e.g.,
+.I /
+or
+.IR /root .
+When HASDCACHE is not defined,
+.I lsof
+does not write or attempt to read a device cache file.
+.PP
+When HASDCACHE is defined, the
+.I lsof
+help output, presented in response to the
+.BR \-h ,
+.BR \-D? ,
+or
+.B \-?
+options, will provide device cache file handling information.
+When HASDCACHE is not defined, the
+.B \-h
+or
+.B \-?
+output will have no
+.B \-D
+option description.
+.PP
+Before you decide to disable the device cache file feature \- enabling
+it improves the performance of
+.I lsof
+by reducing the startup overhead of examining all the nodes in
+.I /dev
+(or
+.IR /devices )
+\&\- read the discussion of it in the
+.I 00DCACHE
+file of the
+.I lsof
+distribution and the
+.I lsof
+FAQ (The \fBFAQ\fP section gives its location.)
+.PP
+WHEN IN DOUBT, YOU CAN TEMPORARILY DISABLE THE USE OF THE DEVICE CACHE FILE
+WITH THE
+.B \-Di
+OPTION.
+.PP
+When
+.I lsof
+user declares alternate kernel name list or memory files with the
+.B \-k
+and
+.B \-m
+options,
+.I lsof
+checks the user's authority to read them with
+.IR access (2).
+This is intended to prevent whatever special power
+.I lsof's
+modes might confer on it from letting it read files not normally
+accessible via the authority of the real user ID.
+.SH OUTPUT
+This section describes the information
+.I lsof
+lists for each open file.
+See the
+.B "OUTPUT FOR OTHER PROGRAMS"
+section for additional information on output that can be processed
+by another program.
+.PP
+.I Lsof
+only outputs printable (declared so by
+.IR isprint (3))
+8 bit characters.
+Non\-printable characters are printed in one of three forms:
+the C ``\\[bfrnt]'' form;
+the control character `^' form (e.g., ``^@'');
+or hexadecimal leading ``\\x'' form (e.g., ``\\xab'').
+Space is non\-printable in the COMMAND column (``\\x20'')
+and printable elsewhere.
+.PP
+For some dialects \- if HASSETLOCALE is defined in the dialect's
+machine.h header file \-
+.I lsof
+will print the extended 8 bit characters of a language locale.
+The
+.I lsof
+process must be supplied a language locale environment variable
+(e.g., LANG) whose value represents a known language locale
+in which the extended characters are considered printable by
+.IR isprint (3).
+Otherwise
+.I lsof
+considers the extended characters non\-printable and prints them according
+to its rules for non\-printable characters, stated above.
+Consult your dialect's
+.IR setlocale (3)
+man page for the names of other environment variables that may
+be used in place of LANG \- e.g., LC_ALL, LC_CTYPE, etc.
+.PP
+.I Lsof's
+language locale support for a dialect also covers wide characters \- e.g.,
+UTF-8 \- when HASSETLOCALE and HASWIDECHAR are defined in the dialect's
+machine.h header file, and when a suitable language locale has been defined
+in the appropriate environment variable for the
+.I lsof
+process.
+Wide characters are printable under those conditions if
+.IR iswprint (3)
+reports them to be.
+If HASSETLOCALE, HASWIDECHAR and a suitable language locale aren't defined,
+or if
+.IR iswprint (3)
+reports wide characters that aren't printable,
+.I lsof
+considers the wide characters non\-printable and prints each of their
+8 bits according to its rules for non\-printable characters, stated above.
+.PP
+Consult the answers to the "Language locale support" questions in the
+lsof FAQ (The \fBFAQ\fP section gives its location.) for more information.
+.PP
+.I Lsof
+dynamically sizes the output columns each time it runs, guaranteeing
+that each column is a minimum size.
+It also guarantees that each column is separated from its predecessor
+by at least one space.
+.TP \w'COMMAND'u+4
+COMMAND
+contains the first nine characters of the name of the UNIX command
+associated with the process.
+If a non\-zero
+.I w
+value is specified to the
+.BI +c " w"
+option, the column contains the first
+.I w
+characters of the name of the UNIX command associated with the process
+up to the limit of characters supplied to
+.I lsof
+by the UNIX dialect.
+(See the description of the
+.BI +c " w"
+command or the
+.I lsof
+FAQ for more information.
+The \fBFAQ\fP section gives its location.)
+.IP
+If
+.I w
+is less than the length of the column title, ``COMMAND'', it will
+be raised to that length.
+.IP
+If a zero
+.I w
+value is specified to the
+.BI +c " w"
+option, the column contains all the characters of the name of the UNIX command
+associated with the process.
+.IP
+All command name characters maintained by the kernel in its structures
+are displayed in field output when the command name descriptor (`c')
+is specified.
+See the
+.B "OUTPUT FOR OTHER COMMANDS"
+section for information on selecting field output and the associated
+command name descriptor.
+.TP
+PID
+is the Process IDentification number of the process.
+.TP
+TID
+is the task (thread) IDentification number, if task (thread)
+reporting is supported by the dialect and a task (thread) is
+being listed.
+(If help output \- i.e., the output of the
+.B \-h
+or
+.B \-?
+options \- shows this option, then task (thread) reporting is
+supported by the dialect.)
+.IP
+A blank TID column in Linux indicates a process \- i.e., a non\-task.
+.TP
+TASKCMD
+is the task command name.
+Generally this will be the same as the process named in the COMMAND
+column, but some task implementations (e.g., Linux) permit a task to
+change its command name.
+.IP
+The TASKCMD column width is subject to the same size limitation as the
+COMMAND column.
+.TP
+ZONE
+is the Solaris 10 and higher zone name.
+This column must be selected with the
+.B \-z
+option.
+.TP
+SECURITY\-CONTEXT
+is the SELinux security context.
+This column must be selected with the
+.B -Z
+option.
+Note that the
+.B -Z
+option is inhibited when SELinux is disabled in the running Linux
+kernel.
+.TP
+PPID
+is the Parent Process IDentification number of the process.
+It is only displayed when the
+.B \-R
+option has been specified.
+.TP
+PGID
+is the process group IDentification number associated with
+the process.
+It is only displayed when the
+.B \-g
+option has been specified.
+.TP
+USER
+is the user ID number or login name of the user to whom
+the process belongs, usually the same as reported by
+.IR ps (1).
+However, on Linux USER is the user ID number or login that owns
+the directory in /proc where
+.I lsof
+finds information about the process.
+Usually that is the same value reported by
+.IR ps (1),
+but may differ when the process has changed its effective user ID.
+(See the
+.B \-l
+option description for information on when a user ID number or
+login name is displayed.)
+.TP
+FD
+is the File Descriptor number of the file or:
+.IP
+.nf
+	\fBcwd\fP	current working directory;
+.br
+	\fBL\fInn\fR	library references (AIX);
+.br
+	\fBerr\fR	FD information error (see NAME column);
+.br
+	\fBjld\fR	jail directory (FreeBSD);
+.br
+	\fBltx\fP	shared library text (code and data);
+.br
+	\fBMxx\fP	hex memory\-mapped type number xx.
+.br
+	\fBm86\fP	DOS Merge mapped file;
+.br
+	\fBmem\fP	memory\-mapped file;
+.br
+	\fBmmap\fP	memory\-mapped device;
+.br
+	\fBpd\fP	parent directory;
+.br
+	\fBrtd\fP	root directory;
+.br
+	\fBtr\fR	kernel trace file (OpenBSD);
+.br
+	\fBtxt\fP	program text (code and data);
+.br
+	\fBv86\fP	VP/ix mapped file;
+.fi
+.IP
+FD is followed by one of these characters, describing the mode under which
+the file is open:
+.IP
+	\fBr\fP for read access;
+.br
+	\fBw\fP for write access;
+.br
+	\fBu\fP for read and write access;
+.br
+	space if mode unknown and no lock
+.br
+		character follows;
+.br
+	`\-' if mode unknown and lock
+.br
+		character follows.
+.IP
+The mode character is followed by one of these lock characters, describing
+the type of lock applied to the file:
+.IP
+	\fBN\fP for a Solaris NFS lock of unknown type;
+.br
+	\fBr\fP for read lock on part of the file;
+.br
+	\fBR\fP for a read lock on the entire file;
+.br
+	\fBw\fP for a write lock on part of the file;
+.br
+	\fBW\fP for a write lock on the entire file;
+.br
+	\fBu\fP for a read and write lock of any length;
+.br
+	\fBU\fP for a lock of unknown type;
+.br
+	\fBx\fP for an SCO OpenServer Xenix lock on part
+	of the file;
+.br
+	\fBX\fP for an SCO OpenServer Xenix lock on the entire file;
+.br
+	space if there is no lock.
+.IP
+See the
+.B LOCKS
+section for more information on the lock information character.
+.IP
+The FD column contents constitutes a single field for parsing in
+post\-processing scripts.
+.TP
+TYPE
+is the type of the node associated with the file \- e.g., GDIR, GREG,
+VDIR, VREG, etc.
+.IP
+or ``IPv4'' for an IPv4 socket;
+.IP
+or ``IPv6'' for an open IPv6 network file \- even if its address is
+IPv4, mapped in an IPv6 address;
+.IP
+or ``ax25'' for a Linux AX.25 socket;
+.IP
+or ``inet'' for an Internet domain socket;
+.IP
+or ``lla'' for a HP\-UX link level access file;
+.IP
+or ``rte'' for an AF_ROUTE socket;
+.IP
+or ``sock'' for a socket of unknown domain;
+.IP
+or ``unix'' for a UNIX domain socket;
+.IP
+or ``x.25'' for an HP\-UX x.25 socket;
+.IP
+or ``BLK'' for a block special file;
+.IP
+or ``CHR'' for a character special file;
+.IP
+or ``DEL'' for a Linux map file that has been deleted;
+.IP
+or ``DIR'' for a directory;
+.IP
+or ``DOOR'' for a VDOOR file;
+.IP
+or ``FIFO'' for a FIFO special file;
+.IP
+or ``KQUEUE'' for a BSD style kernel event queue file;
+.IP
+or ``LINK'' for a symbolic link file;
+.IP
+or ``MPB'' for a multiplexed block file;
+.IP
+or ``MPC'' for a multiplexed character file;
+.IP
+or ``NOFD'' for a Linux /proc/<PID>/fd directory that can't be opened \--
+the directory path appears in the NAME column, followed by an error
+message;
+.IP
+or ``PAS'' for a
+.I /proc/as
+file;
+.IP
+or ``PAXV'' for a
+.I /proc/auxv
+file;
+.IP
+or ``PCRE'' for a
+.I /proc/cred
+file;
+.IP
+or ``PCTL'' for a
+.I /proc
+control file;
+.IP
+or ``PCUR'' for the current
+.I /proc
+process;
+.IP
+or ``PCWD'' for a
+.I /proc
+current working directory;
+.IP
+or ``PDIR'' for a
+.I /proc
+directory;
+.IP
+or ``PETY'' for a
+.I /proc
+executable type (\fIetype\fP);
+.IP
+or ``PFD'' for a
+.I /proc
+file descriptor;
+.IP
+or ``PFDR'' for a
+.I /proc
+file descriptor directory;
+.IP
+or ``PFIL'' for an executable
+.I /proc
+file;
+.IP
+or ``PFPR'' for a
+.I /proc
+FP register set;
+.IP
+or ``PGD'' for a
+.I /proc/pagedata
+file;
+.IP
+or ``PGID'' for a
+.I /proc
+group notifier file;
+.IP
+or ``PIPE'' for pipes;
+.IP
+or ``PLC'' for a
+.I /proc/lwpctl
+file;
+.IP
+or ``PLDR'' for a
+.I /proc/lpw
+directory;
+.IP
+or ``PLDT'' for a
+.I /proc/ldt
+file;
+.IP
+or ``PLPI'' for a
+.I /proc/lpsinfo
+file;
+.IP
+or ``PLST'' for a
+.I /proc/lstatus
+file;
+.IP
+or ``PLU'' for a
+.I /proc/lusage
+file;
+.IP
+or ``PLWG'' for a
+.I /proc/gwindows
+file;
+.IP
+or ``PLWI'' for a
+.I /proc/lwpsinfo
+file;
+.IP
+or ``PLWS'' for a
+.I /proc/lwpstatus
+file;
+.IP
+or ``PLWU'' for a
+.I /proc/lwpusage
+file;
+.IP
+or ``PLWX'' for a
+.I /proc/xregs
+file;
+.IP
+or ``PMAP'' for a
+.I /proc
+map file (\fImap\fP);
+.IP
+or ``PMEM'' for a
+.I /proc
+memory image file;
+.IP
+or ``PNTF'' for a
+.I /proc
+process notifier file;
+.IP
+or ``POBJ'' for a
+.I /proc/object
+file;
+.IP
+or ``PODR'' for a
+.I /proc/object
+directory;
+.IP
+or ``POLP'' for an old format
+.I /proc
+light weight process file;
+.IP
+or ``POPF'' for an old format
+.I /proc
+PID file;
+.IP
+or ``POPG'' for an old format
+.I /proc
+page data file;
+.IP
+or ``PORT'' for a SYSV named pipe;
+.IP
+or ``PREG'' for a
+.I /proc
+register file;
+.IP
+or ``PRMP'' for a
+.I /proc/rmap
+file;
+.IP
+or ``PRTD'' for a
+.I /proc
+root directory;
+.IP
+or ``PSGA'' for a
+.I /proc/sigact
+file;
+.IP
+or ``PSIN'' for a
+.I /proc/psinfo
+file;
+.IP
+or ``PSTA'' for a
+.I /proc
+status file;
+.IP
+or ``PSXSEM'' for a POSIX semaphore file;
+.IP
+or ``PSXSHM'' for a POSIX shared memory file;
+.IP
+or ``PTS'' for a
+.I /dev/pts
+file;
+.IP
+or ``PUSG'' for a
+.I /proc/usage
+file;
+.IP
+or ``PW'' for a
+.I /proc/watch
+file;
+.IP
+or ``PXMP'' for a
+.I /proc/xmap
+file;
+.IP
+or ``REG'' for a regular file;
+.IP
+or ``SMT'' for a shared memory transport file;
+.IP
+or ``STSO'' for a stream socket;
+.IP
+or ``UNNM'' for an unnamed type file;
+.IP
+or ``XNAM'' for an OpenServer Xenix special file of unknown type;
+.IP
+or ``XSEM'' for an OpenServer Xenix semaphore file;
+.IP
+or ``XSD'' for an OpenServer Xenix shared data file;
+.IP
+or the four type number octets if the corresponding name isn't known.
+.TP
+FILE\-ADDR
+contains the kernel file structure address when
+.B f
+has been specified to
+.BR +f ;
+.TP
+FCT
+contains the file reference count from the kernel file structure when
+.B c
+has been specified to
+.BR +f ;
+.TP
+FILE\-FLAG
+when
+.B g
+or
+.B G
+has been specified to
+.BR +f ,
+this field contains the contents of the f_flag[s] member of the kernel
+file structure and the kernel's per\-process open file flags (if available);
+\&`G' causes them to be displayed in hexadecimal;
+\&`g', as short\-hand names;
+two lists may be displayed with entries separated by commas, the
+lists separated by a semicolon (`;');
+the first list may contain short\-hand names for f_flag[s] values from
+the following table:
+.IP
+.nf
+	AIO		asynchronous I/O (e.g., FAIO)
+	AP		append
+	ASYN		asynchronous I/O (e.g., FASYNC)
+	BAS		block, test, and set in use
+	BKIU		block if in use
+	BL		use block offsets
+	BSK		block seek
+	CA		copy avoid
+	CIO		concurrent I/O
+	CLON		clone
+	CLRD		CL read
+	CR		create
+	DF		defer
+	DFI		defer IND
+	DFLU		data flush
+	DIR		direct
+	DLY		delay
+	DOCL		do clone
+	DSYN		data\-only integrity
+	DTY		must be a directory
+	EVO		event only
+	EX		open for exec
+	EXCL		exclusive open
+	FSYN		synchronous writes
+	GCDF		defer during unp_gc() (AIX)
+	GCMK		mark during unp_gc() (AIX)
+	GTTY		accessed via /dev/tty
+	HUP		HUP in progress
+	KERN		kernel
+	KIOC		kernel\-issued ioctl
+	LCK		has lock
+	LG		large file
+	MBLK		stream message block
+	MK		mark
+	MNT		mount
+	MSYN		multiplex synchronization
+	NATM		don't update atime
+	NB		non\-blocking I/O
+	NBDR		no BDRM check
+	NBIO		SYSV non\-blocking I/O
+	NBF		n\-buffering in effect
+	NC		no cache
+	ND		no delay
+	NDSY		no data synchronization
+	NET		network
+	NFLK		don't follow links
+	NMFS		NM file system
+	NOTO		disable background stop
+	NSH		no share
+	NTTY		no controlling TTY
+	OLRM		OLR mirror
+	PAIO		POSIX asynchronous I/O
+	PP		POSIX pipe
+	R		read
+	RC		file and record locking cache
+	REV		revoked
+	RSH		shared read
+	RSYN		read synchronization
+	RW		read and write access
+	SL		shared lock
+	SNAP		cooked snapshot
+	SOCK		socket
+	SQSH		Sequent shared set on open
+	SQSV		Sequent SVM set on open
+	SQR		Sequent set repair on open
+	SQS1		Sequent full shared open
+	SQS2		Sequent partial shared open
+	STPI		stop I/O
+	SWR		synchronous read
+	SYN		file integrity while writing
+	TCPM		avoid TCP collision
+	TR		truncate
+	W		write
+	WKUP		parallel I/O synchronization
+	WTG		parallel I/O synchronization
+	VH		vhangup pending
+	VTXT		virtual text
+	XL		exclusive lock
+.fi
+.IP
+this list of names was derived from F* #define's in dialect header files
+<fcntl.h>, <linux</fs.h>, <sys/fcntl.c>, <sys/fcntlcom.h>, and <sys/file.h>;
+see the lsof.h header file for a list showing the correspondence
+between the above short\-hand names and the header file definitions;
+.IP
+the second list (after the semicolon) may contain short\-hand names
+for kernel per\-process open file flags from this table:
+.IP
+.nf
+	ALLC		allocated
+	BR		the file has been read
+	BHUP		activity stopped by SIGHUP
+	BW		the file has been written
+	CLSG		closing
+	CX		close\-on-exec (see fcntl(F_SETFD))
+	LCK		lock was applied
+	MP		memory\-mapped
+	OPIP		open pending \- in progress
+	RSVW		reserved wait
+	SHMT		UF_FSHMAT set (AIX)
+	USE		in use (multi\-threaded)
+.fi
+.TP
+NODE\-ID
+(or INODE\-ADDR for some dialects)
+contains a unique identifier for the file node (usually the kernel
+vnode or inode address, but also occasionally a concatenation of
+device and node number) when
+.B n
+has been specified to
+.BR +f ;
+.TP
+DEVICE
+contains the device numbers, separated by commas, for a character special,
+block special, regular, directory or NFS file;
+.IP
+or ``memory'' for a memory file system node under Tru64 UNIX;
+.IP
+or the address of the private data area of a Solaris socket
+stream;
+.IP
+or a kernel reference address that identifies the file
+(The kernel reference address may be used for FIFO's, for example.);
+.IP
+or
+the base address or device name of a Linux AX.25 socket device.
+.IP
+Usually only the lower thirty two bits of Tru64 UNIX kernel addresses
+are displayed.
+.TP
+SIZE, SIZE/OFF, or OFFSET
+is the size of the file or the file offset in bytes.
+A value is displayed in this column only if it is available.
+.I Lsof
+displays whatever value \- size or offset \- is appropriate for the type
+of the file and the version of
+.IR lsof .
+.IP
+On some UNIX dialects
+.I lsof
+can't obtain accurate or consistent file offset information from its
+kernel data sources, sometimes just for particular kinds of files
+(e.g., socket files.)
+In other cases, files don't have true sizes \- e.g., sockets, FIFOs,
+pipes \- so
+.I lsof
+displays for their sizes the content amounts it finds in their kernel
+buffer descriptors (e.g., socket buffer size counts or TCP/IP window
+sizes.)
+Consult the
+.I lsof
+FAQ (The \fBFAQ\fP section gives its location.)
+for more information.
+.IP
+The file size is displayed in decimal;
+the offset is normally displayed in decimal with a leading ``0t'' if
+it contains 8 digits or less; in hexadecimal with a leading ``0x'' if
+it is longer than 8 digits.
+(Consult the
+.BI \-o " o"
+option description for information on when 8 might default to
+some other value.)
+.IP
+Thus the leading ``0t'' and ``0x'' identify an offset when the column
+may contain both a size and an offset (i.e., its title is SIZE/OFF).
+.IP
+If the
+.B \-o
+option is specified,
+.I lsof
+always displays the file offset (or nothing if no offset is available)
+and labels the column OFFSET.
+The offset always begins with ``0t'' or ``0x'' as described above.
+.IP
+The
+.I lsof
+user can control the switch from ``0t'' to ``0x'' with the
+.BI \-o " o"
+option.
+Consult its description for more information.
+.IP
+If the
+.B \-s
+option is specified,
+.I lsof
+always displays the file size (or nothing if no size is available)
+and labels the column SIZE.
+The
+.B \-o
+and
+.B \-s
+options are mutually exclusive; they can't both be specified.
+.IP
+For files that don't have a fixed size \- e.g., don't reside
+on a disk device \-
+.I lsof
+will display appropriate information about the current size or
+position of the file if it is available in the kernel structures
+that define the file.
+.TP
+NLINK
+contains the file link count when
+.B +L
+has been specified;
+.TP
+NODE
+is the node number of a local file;
+.IP
+or the inode number of an NFS file in the server host;
+.IP
+or the Internet protocol type \- e.g, ``TCP'';
+.IP
+or ``STR'' for a stream;
+.IP
+or ``CCITT'' for an HP\-UX x.25 socket;
+.IP
+or the IRQ or inode number of a Linux AX.25 socket device.
+.TP
+NAME
+is the name of the mount point and file system on which the file resides;
+.IP
+or the name of a file specified in the
+.I names
+option (after any symbolic links have been resolved);
+.IP
+or the name of a character special or block special device;
+.IP
+or the local and remote Internet addresses of a network file;
+the local host name or IP number is followed by a colon (':'), the
+port, ``->'', and the two\-part remote address;
+IP addresses may be reported as numbers or names, depending on the
+.BR +|\-M ,
+.BR \-n ,
+and
+.B \-P
+options;
+colon\-separated IPv6 numbers are enclosed in square brackets;
+IPv4 INADDR_ANY and IPv6 IN6_IS_ADDR_UNSPECIFIED addresses, and
+zero port numbers are represented by an asterisk ('*');
+a UDP destination address may be followed by the amount of time
+elapsed since the last packet was sent to the destination;
+TCP, UDP and UDPLITE remote addresses may be followed by TCP/TPI
+information in parentheses \- state (e.g., ``(ESTABLISHED)'', ``(Unbound)''),
+queue sizes, and window sizes (not all dialects) \- in a fashion
+similar to what
+.IR netstat (1)
+reports;
+see the
+.B \-T
+option description or the description of the TCP/TPI field in
+.B "OUTPUT FOR OTHER PROGRAMS"
+for more information on state, queue size, and window size;
+.IP
+or the address or name of a UNIX domain socket, possibly including
+a stream clone device name, a file system object's path name, local
+and foreign kernel addresses, socket pair information, and a bound
+vnode address;
+.IP
+or the local and remote mount point names of an NFS file;
+.IP
+or ``STR'', followed by the stream name;
+.IP
+or a stream character device name, followed by ``->'' and the stream name
+or a list of stream module names, separated by ``->'';
+.IP
+or ``STR:'' followed by the SCO OpenServer stream device and module
+names, separated by ``->'';
+.IP
+or system directory name, `` -- '', and as many components of the path
+name as
+.I lsof
+can find in the kernel's name cache for selected dialects
+(See the
+.B "KERNEL NAME CACHE"
+section for more information.);
+.IP
+or ``PIPE->'', followed by a Solaris kernel pipe destination address;
+.IP
+or ``COMMON:'', followed by the vnode device information structure's
+device name, for a Solaris common vnode;
+.IP
+or the address family, followed by a slash (`/'), followed by fourteen
+comma\-separated bytes of a non\-Internet raw socket address;
+.IP
+or the HP\-UX x.25 local address, followed by the virtual connection
+number (if any), followed by the remote address (if any);
+.IP
+or ``(dead)'' for disassociated Tru64 UNIX files \- typically terminal files
+that have been flagged with the TIOCNOTTY ioctl and closed by daemons;
+.IP
+or ``rd=<offset>'' and ``wr=<offset>'' for the values of the
+read and write offsets of a FIFO;
+.IP
+or ``clone \fIn\fP:/dev/event'' for SCO OpenServer file clones of the
+.I /dev/event
+device, where
+.I n
+is the minor device number of the file;
+.IP
+or ``(socketpair: n)'' for a Solaris 2.6, 8, 9  or 10
+UNIX domain socket, created by the
+.IR socketpair (3N)
+network function;
+.IP
+or ``no PCB'' for socket files that do not have a protocol block
+associated with them, optionally followed by ``, CANTSENDMORE'' if
+sending on the socket has been disabled, or ``, CANTRCVMORE'' if
+receiving on the socket has been disabled (e.g., by the
+.IR shutdown (2)
+function);
+.IP
+or the local and remote addresses of a Linux IPX socket file
+in the form <net>:[<node>:]<port>, followed in parentheses
+by the transmit and receive queue sizes, and the connection state;
+.IP
+or ``dgram'' or ``stream'' for the type UnixWare 7.1.1 and above in\-kernel
+UNIX domain sockets, followed by a colon (':') and the local path name
+when available, followed by ``->'' and the remote path name or kernel
+socket address in hexadecimal when available;
+.IP
+or the association value, association index, endpoint value, local address,
+local port, remote address and remote port for Linux SCTP sockets;
+.IP
+or ``protocol: '' followed by the Linux socket's protocol attribute.
+.PP
+For dialects that support a ``namefs'' file system, allowing one
+file to be attached to another with
+.IR fattach (3C),
+.I lsof
+will add ``(FA:<address1><direction><address2>)'' to the NAME column.
+<address1> and <address2> are hexadecimal vnode addresses.
+<direction> will be ``<-'' if <address2> has been fattach'ed to
+this vnode whose address is <address1>;
+and ``->'' if <address1>, the vnode address of this vnode, has been
+fattach'ed to <address2>.
+<address1> may be omitted if it already appears in the DEVICE column.
+.PP
+.I
+Lsof
+may add two parenthetical notes to the NAME column for open Solaris 10 files:
+\&``(?)'' if
+.I lsof
+considers the path name of questionable accuracy;
+and ``(deleted)'' if the
+.B \-X
+option has been specified and
+.I lsof
+detects the open file's path name has been deleted.
+Consult the
+.I lsof
+FAQ (The \fBFAQ\fP section gives its location.)
+for more information on these NAME column additions.
+.SH LOCKS
+.I Lsof
+can't adequately report the wide variety of UNIX dialect file locks
+in a single character.
+What it reports in a single character is a compromise between the
+information it finds in the kernel and the limitations of the reporting
+format.
+.PP
+Moreover, when a process holds several byte level locks on a file,
+.I lsof
+only reports the status of the first lock it encounters.
+If it is a byte level lock, then the lock character will be reported
+in lower case \- i.e., `r', `w', or `x' \- rather than the upper case
+equivalent reported for a full file lock.
+.PP
+Generally
+.I lsof
+can only report on locks held by local processes on local files.
+When a local process sets a lock on a remotely mounted (e.g., NFS)
+file, the remote server host usually records the lock state.
+One exception is Solaris \- at some patch levels of 2.3, and in all
+versions above 2.4, the Solaris kernel records information on remote
+locks in local structures.
+.PP
+.I Lsof
+has trouble reporting locks for some UNIX dialects.
+Consult the
+.B BUGS
+section of this manual page or the
+.I lsof
+FAQ (The \fBFAQ\fP section gives its location.)
+for more information.
+.SH "OUTPUT FOR OTHER PROGRAMS"
+When the
+.B \-F
+option is specified,
+.I lsof
+produces output that is suitable for processing by another program \- e.g, an
+.I awk
+or
+.I Perl
+script, or a C program.
+.PP
+Each unit of information is output in a field that is identified
+with a leading character and terminated by a NL (012) (or a NUL
+(000) if the 0 (zero) field identifier character is specified.)
+The data of the field follows immediately after the field identification
+character and extends to the field terminator.
+.PP
+It is possible to think of field output as process and file sets.
+A process set begins with a field whose identifier is `p' (for
+process IDentifier (PID)).
+It extends to the beginning of the next PID field or the beginning
+of the first file set of the process, whichever comes first.
+Included in the process set are fields that identify the command,
+the process group IDentification (PGID) number, the task (thread)
+ID (TID), and the user ID (UID) number or login name.
+.PP
+A file set begins with a field whose identifier is `f' (for
+file descriptor).
+It is followed by lines that describe the file's access mode,
+lock state, type, device, size, offset, inode, protocol, name
+and stream module names.
+It extends to the beginning of the next file or process set,
+whichever comes first.
+.PP
+When the NUL (000) field terminator has been selected with the
+0 (zero) field identifier character,
+.I lsof
+ends each process and file set with a NL (012) character.
+.PP
+.I Lsof
+always produces one field, the PID (`p') field.
+All other fields may be declared optionally in the field identifier
+character list that follows the
+.B \-F
+option.
+When a field selection character identifies an item
+.I lsof
+does not normally list \- e.g., PPID, selected with
+.BR \-R " \-"
+specification of the field character \- e.g., ``\fB\-FR\fP'' \-
+also selects the listing of the item.
+.PP
+It is entirely possible to select a set of fields that cannot
+easily be parsed \- e.g., if the field descriptor field is not
+selected, it may be difficult to identify file sets.
+To help you avoid this difficulty,
+.I lsof
+supports the
+.B \-F
+option; it selects the output of all fields with NL terminators
+(the
+.B \-F0
+option pair selects the output of all fields with NUL terminators).
+For compatibility reasons neither
+.B \-F
+nor
+.B \-F0
+select the raw device field.
+.PP
+These are the fields that
+.I lsof
+will produce.
+The single character listed first is the field identifier.
+.PP
+.nf
+	a	file access mode
+	c	process command name (all characters from proc or
+		user structure)
+	C	file structure share count
+	d	file's device character code
+	D	file's major/minor device number (0x<hexadecimal>)
+	f	file descriptor (always selected)
+	F	file structure address (0x<hexadecimal>)
+	G	file flaGs (0x<hexadecimal>; names if \fB+fg\fP follows)
+	g	process group ID
+	i	file's inode number
+	K	tasK ID
+	k	link count
+	l	file's lock status
+	L	process login name
+	m	marker between repeated output
+	M	the task comMand name
+	n	file name, comment, Internet address
+	N	node identifier (ox<hexadecimal>
+	o	file's offset (decimal)
+	p	process ID (always selected)
+	P	protocol name
+	r	raw device number (0x<hexadecimal>)
+	R	parent process ID
+	s	file's size (decimal)
+	S	file's stream identification
+	t	file's type
+	T	TCP/TPI information, identified by prefixes (the
+		`=' is part of the prefix):
+		    QR=<read queue size>
+		    QS=<send queue size>
+		    SO=<socket options and values> (not all dialects)
+		    SS=<socket states> (not all dialects)
+		    ST=<connection state>
+		    TF=<TCP flags and values> (not all dialects)
+		    WR=<window read size>  (not all dialects)
+		    WW=<window write size>  (not all dialects)
+		(TCP/TPI information isn't reported for all supported
+		  UNIX dialects. The \fB\-h\fP or \fB\-?\fP help output for the
+		  \fB\-T\fP option will show what TCP/TPI reporting can be
+		  requested.)
+	u	process user ID
+	z	Solaris 10 and higher zone name
+	Z	SELinux security context (inhibited when SELinux is disabled)
+	0	use NUL field terminator character in place of NL
+	1\-9	dialect\-specific field identifiers (The output
+		of \fB\-F?\fP identifies the information to be found
+		in dialect\-specific fields.)
+.fi
+.PP
+You can get on\-line help information on these characters and their
+descriptions by specifying the
+.B \-F?
+option pair.
+(Escape the `?' character as your shell requires.)
+Additional information on field content can be found in the
+.B OUTPUT
+section.
+.PP
+As an example, ``\fB\-F pcfn\fP'' will select the process ID (`p'),
+command name (`c'), file descriptor (`f') and file name (`n')
+fields with an NL field terminator character; ``\fB\-F pcfn0\fP''
+selects the same output with a NUL (000) field terminator character.
+.PP
+.I Lsof
+doesn't produce all fields for every process or file set, only
+those that are available.
+Some fields are mutually exclusive: file device characters and
+file major/minor device numbers; file inode number and protocol
+name; file name and stream identification; file size and offset.
+One or the other member of these mutually exclusive sets will appear
+in field output, but not both.
+.PP
+Normally
+.I lsof
+ends each field with a NL (012) character.
+The
+0 (zero) field identifier character may be specified to change the
+field terminator character
+to a NUL (000).
+A NUL terminator may be easier to process with
+.I xargs (1),
+for example, or with programs whose quoting mechanisms may not
+easily cope with the range of characters in the field output.
+When the NUL field terminator is in use,
+.I lsof
+ends each process and file set with a NL (012).
+.PP
+Three aids to producing programs that can process
+.I lsof
+field output are included in the
+.I lsof
+distribution.
+The first is a C header file,
+.IR lsof_fields.h ,
+that contains symbols for the field identification characters, indexes for
+storing them in a table, and explanation strings that may be compiled into
+programs.
+.I Lsof
+uses this header file.
+.PP
+The second aid is a set of sample scripts that process field output,
+written in
+.IR awk ,
+.I Perl
+4, and
+.I Perl
+5.
+They're located in the
+.I scripts
+subdirectory of the
+.I lsof
+distribution.
+.PP
+The third aid is the C library used for the
+.I lsof
+test suite.
+The test suite is written in C and uses field output to validate
+the correct operation of
+.IR lsof .
+The library can be found in the
+.I tests/LTlib.c
+file of the
+.I lsof
+distribution.
+The library uses the first aid, the
+.I lsof_fields.h
+header file.
+.SH "BLOCKS AND TIMEOUTS"
+.I Lsof
+can be blocked by some kernel functions that it uses \-
+.IR lstat (2),
+.IR readlink (2),
+and
+.IR stat (2).
+These functions are stalled in the kernel, for example, when the
+hosts where mounted NFS file systems reside become inaccessible.
+.PP
+.I Lsof
+attempts to break these blocks with timers and child processes,
+but the techniques are not wholly reliable.
+When
+.I lsof
+does manage to break a block, it will report the break with an error
+message.
+The messages may be suppressed with the
+.B \-t
+and
+.B \-w
+options.
+.PP
+The default timeout value may be displayed with the
+.B \-h
+or
+.B \-?
+option, and it may be changed with the
+.BI \-S " [t]"
+option.
+The minimum for
+.I t
+is two seconds, but you should avoid small values, since slow system
+responsiveness can cause short timeouts to expire unexpectedly and
+perhaps stop
+.I lsof
+before it can produce any output.
+.PP
+When
+.I lsof
+has to break a block during its access of mounted file system
+information, it normally continues, although with less information
+available to display about open files.
+.PP
+.I Lsof
+can also be directed to avoid the protection of timers and child processes
+when using the kernel functions that might block by specifying the
+.B \-O
+option.
+While this will allow
+.I lsof
+to start up with less overhead, it exposes
+.I lsof
+completely to the kernel situations that might block it.
+Use this option cautiously.
+.SH "AVOIDING KERNEL BLOCKS"
+.PP
+You can use the
+.B \-b
+option to tell
+.I lsof
+to avoid using kernel functions that would block.
+Some cautions apply.
+.PP
+First, using this option usually requires that your system supply
+alternate device numbers in place of the device numbers that
+.I lsof
+would normally obtain with the
+.IR lstat (2)
+and
+.IR stat (2)
+kernel functions.
+See the
+.B "ALTERNATE DEVICE NUMBERS"
+section for more information on alternate device numbers.
+.PP
+Second, you can't specify
+.I names
+for
+.I lsof
+to locate unless they're file system names.
+This is because
+.I lsof
+needs to know the device and inode numbers of files listed with
+.I names
+in the
+.I lsof
+options, and the
+.B \-b
+option prevents
+.I lsof
+from obtaining them.
+Moreover, since
+.I lsof
+only has device numbers for the file systems that have alternates,
+its ability to locate files on file systems depends completely on the
+availability and accuracy of the alternates.
+If no alternates are available, or if they're incorrect,
+.I lsof
+won't be able to locate files on the named file systems.
+.PP
+Third, if the names of your file system directories that
+.I lsof
+obtains from your system's mount table are symbolic links,
+.I lsof
+won't be able to resolve the links.
+This is because the
+.B \-b
+option causes
+.I lsof
+to avoid the kernel
+.IR readlink (2)
+function it uses to resolve symbolic links.
+.PP
+Finally, using the
+.B \-b
+option causes
+.I lsof
+to issue warning messages when it needs to use the kernel functions
+that the
+.B \-b
+option directs it to avoid.
+You can suppress these messages by specifying the
+.B \-w
+option, but if you do, you won't see the alternate device numbers
+reported in the warning messages.
+.SH "ALTERNATE DEVICE NUMBERS"
+.PP
+On some dialects, when
+.I lsof
+has to break a block because it can't get information about a
+mounted file system via the
+.IR lstat (2)
+and
+.IR stat (2)
+kernel functions, or because you specified the
+.B \-b
+option,
+.I lsof
+can obtain some of the information it needs \- the device number and
+possibly the file system type \- from the system mount table.
+When that is possible,
+.I lsof
+will report the device number it obtained.
+(You can suppress the report by specifying the
+.B \-w
+option.)
+.PP
+You can assist this process if your mount table is supported with an
+.I /etc/mtab
+or
+.I /etc/mnttab
+file that contains an options field by adding a ``dev=xxxx'' field for
+mount points that do not have one in their options strings.
+Note: you must be able to edit the file \- i.e., some mount tables
+like recent Solaris /etc/mnttab or Linux /proc/mounts are read\-only
+and can't be modified.
+.PP
+You may also be able to supply device numbers using the
+.B +m
+and
+.BI +m " m"
+options, provided they are supported by your dialect.
+Check the output of
+.I lsof's
+.B \-h
+or
+.B \-?
+options to see if the
+.B +m
+and
+.BI +m " m"
+options are available.
+.PP
+The ``xxxx'' portion of the field is the hexadecimal value
+of the file system's device number.
+(Consult the
+.I st_dev
+field of the output of the
+.IR lstat (2)
+and
+.IR stat (2)
+functions for the appropriate values for your file systems.)
+Here's an example from a Sun Solaris 2.6
+.I /etc/mnttab
+for a file system remotely mounted via NFS:
+.PP
+.nf
+	nfs  ignore,noquota,dev=2a40001
+.fi
+.PP
+There's an advantage to having ``dev=xxxx'' entries in your mount
+table file, especially for file systems that are mounted from remote
+NFS servers.
+When a remote server crashes and you want to identify its users by running
+.I lsof
+on one of its clients,
+.I lsof
+probably won't be able to get output from the
+.IR lstat (2)
+and
+.IR stat (2)
+functions for the file system.
+If it can obtain the file system's device number from the mount table,
+it will be able to display the files open on the crashed NFS server.
+.PP
+Some dialects that do not use an ASCII
+.I /etc/mtab
+or
+.I /etc/mnttab
+file for the mount table may still provide an alternative device number
+in their internal mount tables.
+This includes AIX, Apple Darwin, FreeBSD, NetBSD, OpenBSD, and Tru64 UNIX.
+.I Lsof
+knows how to obtain the alternative device number for these dialects
+and uses it when its attempt to
+.IR lstat (2)
+or
+.IR stat (2)
+the file system is blocked.
+.PP
+If you're not sure your dialect supplies alternate device numbers
+for file systems from its mount table, use this
+.I lsof
+incantation to see if it reports any alternate device numbers:
+.PP
+.IP
+lsof -b
+.PP
+Look for standard error file warning messages that
+begin ``assuming "dev=xxxx" from ...''.
+.SH "KERNEL NAME CACHE"
+.PP
+.I Lsof
+is able to examine the kernel's name cache or use other kernel
+facilities (e.g., the ADVFS 4.x tag_to_path() function under
+Tru64 UNIX) on some dialects for most file system types,
+excluding AFS, and extract recently used path name components from it.
+(AFS file system path lookups don't use the kernel's name cache; some
+Solaris VxFS file system operations apparently don't use it, either.)
+.PP
+.I Lsof
+reports the complete paths it finds in the NAME column.
+If
+.I lsof
+can't report all components in a path, it reports in the NAME column
+the file system name, followed by a space, two `-' characters, another
+space, and the name components it has located, separated by
+the `/' character.
+.PP
+When
+.I lsof
+is run in repeat mode \- i.e., with the
+.B \-r
+option specified \- the extent to which it can report path name
+components for the same file may vary from cycle to cycle.
+That's because other running processes can cause the kernel to
+remove entries from its name cache and replace them with others.
+.PP
+.I Lsof's
+use of the kernel name cache to identify the paths of files
+can lead it to report incorrect components under some circumstances.
+This can happen when the kernel name cache uses device and node
+number as a key (e.g., SCO OpenServer) and a key on a rapidly
+changing file system is reused.
+If the UNIX dialect's kernel doesn't purge the name cache entry for
+a file when it is unlinked,
+.I lsof
+may find a reference to the wrong entry in the cache.
+The
+.I lsof
+FAQ (The \fBFAQ\fP section gives its location.)
+has more information on this situation.
+.PP
+.I Lsof
+can report path name components for these dialects:
+.PP
+.nf
+	FreeBSD
+	HP\-UX
+	Linux
+	NetBSD
+	NEXTSTEP
+	OpenBSD
+	OPENSTEP
+	SCO OpenServer
+	SCO|Caldera UnixWare
+	Solaris
+	Tru64 UNIX
+.fi
+.PP
+.I Lsof
+can't report path name components for these dialects:
+.PP
+.nf
+	AIX
+.fi
+.PP
+If you want to know why
+.I lsof
+can't report path name components for some dialects, see the
+.I lsof
+FAQ (The \fBFAQ\fP section gives its location.)
+.SH "DEVICE CACHE FILE"
+.PP
+Examining all members of the
+.I /dev
+(or
+.IR /devices )
+node tree with
+.IR stat (2)
+functions can be time consuming.
+What's more, the information that
+.I lsof
+needs \- device number, inode number, and path \- rarely changes.
+.PP
+Consequently,
+.I lsof
+normally maintains an ASCII text file of cached
+.I /dev
+(or
+.IR /devices )
+information (exception: the /proc\-based Linux
+.I lsof
+where it's not needed.)
+The local system administrator who builds
+.I lsof
+can control the way the device cache file path is formed, selecting
+from these options:
+.PP
+.nf
+	Path from the \fB\-D\fP option;
+	Path from an environment variable;
+	System\-wide path;
+	Personal path (the default);
+	Personal path, modified by an environment variable.
+.fi
+.PP
+Consult the output of the
+.BR \-h ,
+.B \-D? ,
+or
+.B \-?
+help options for the current state of device cache support.
+The help output lists the default read\-mode device cache file path that
+is in effect for the current invocation of
+.IR lsof .
+The
+.B \-D?
+option output lists the read\-only and write device cache file paths,
+the names of any applicable environment variables, and the personal
+device cache path format.
+.PP
+.I Lsof
+can detect that the current device cache file has been accidentally
+or maliciously modified by integrity checks, including the computation
+and verification of a sixteen bit Cyclic Redundancy Check (CRC) sum on
+the file's contents.
+When
+.I lsof
+senses something wrong with the file, it issues a warning and attempts
+to remove the current cache file and create a new copy, but only to
+a path that the process can legitimately write.
+.PP
+The path from which a
+.I lsof
+process may attempt to read a device cache file may not be the same
+as the path to which it can legitimately write.
+Thus when
+.I lsof
+senses that it needs to update the device cache file, it may
+choose a different path for writing it from the path from which
+it read an incorrect or outdated version.
+.PP
+If available, the
+.B \-Dr
+option will inhibit the writing of a new device cache file.
+(It's always available when specified without a path name argument.)
+.PP
+When a new device is added to the system, the device cache file may
+need to be recreated.
+Since
+.I lsof
+compares the mtime of the device cache file with the mtime and ctime
+of the
+.I /dev
+(or
+.IR /devices )
+directory, it usually detects that a new device has been added;
+in that case
+.I lsof
+issues a warning message and attempts to rebuild the device cache file.
+.PP
+Whenever
+.I lsof
+writes a device cache file, it sets its ownership to the real UID
+of the executing process, and its permission modes to 0600, this
+restricting its reading and writing to the file's owner.
+.SH "LSOF PERMISSIONS THAT AFFECT DEVICE CACHE FILE ACCESS"
+.PP
+Two permissions of the
+.I lsof
+executable affect its ability to access device cache files.
+The permissions are set by the local system administrator when
+.I lsof
+is installed.
+.PP
+The first and rarer permission is setuid\-root.
+It comes into effect when
+.I lsof
+is executed; its effective UID is then
+root, while its real (i.e., that of the logged\-on user) UID is not.
+The
+.I lsof
+distribution recommends that versions for these dialects run setuid\-root.
+.PP
+.nf
+	HP-UX 11.11 and 11.23
+	Linux
+.fi
+.PP
+The second and more common permission is setgid.
+It comes into effect when the effective group IDentification number (GID)
+of the
+.I lsof
+process is set to one that can access kernel memory devices \-
+e.g., ``kmem'', ``sys'', or ``system''.
+.PP
+An
+.I lsof
+process that has setgid permission usually surrenders the permission
+after it has accessed the kernel memory devices.
+When it does that,
+.I lsof
+can allow more liberal device cache path formations.
+The
+.I lsof
+distribution recommends that versions for these dialects run setgid
+and be allowed to surrender setgid permission.
+.PP
+.nf
+	AIX 5.[12] and 5.3-ML1
+	Apple Darwin 7.x Power Macintosh systems
+	FreeBSD 4.x, 4.1x, 5.x and [6789].x for x86-based systems
+	FreeBSD 5.x, [6789].x and 1[012].8for Alpha, AMD64 and Sparc64
+	    based systems
+	HP\-UX 11.00
+	NetBSD 1.[456], 2.x and 3.x for Alpha, x86, and SPARC-based
+	    systems
+	NEXTSTEP 3.[13] for NEXTSTEP architectures
+	OpenBSD 2.[89] and 3.[0\-9] for x86-based systems
+	OPENSTEP 4.x
+	SCO OpenServer Release 5.0.6 for x86-based systems
+	SCO|Caldera UnixWare 7.1.4 for x86-based systems
+	Solaris 2.6, 8, 9 and 10
+	Tru64 UNIX 5.1
+.fi
+.PP
+(Note:
+.I lsof
+for AIX 5L and above needs setuid\-root permission if its
+.B \-X
+option is used.)
+.PP
+.I Lsof
+for these dialects does not support a device cache, so the permissions
+given to the executable don't apply to the device cache file.
+.PP
+.nf
+	Linux
+.fi
+.SH "DEVICE CACHE FILE PATH FROM THE \-D OPTION"
+.PP
+The
+.B \-D
+option provides limited means for specifying the device cache file path.
+Its
+.B ?
+function will report the read\-only and write device cache file paths that
+.I lsof
+will use.
+.PP
+When the
+.B \-D
+.BR b ,
+.BR r ,
+and
+.B u
+functions are available, you can use them to request that the cache file be
+built in a specific location (\fBb\fR[\fIpath\fR]);
+read but not rebuilt (\fBr\fR[\fIpath\fR]);
+or read and rebuilt (\fBu\fR[\fIpath\fR]).
+The
+.BR b ,
+.BR r ,
+and
+.B u
+functions are restricted under some conditions.
+They are restricted when the
+.I lsof
+process is setuid\-root.
+The path specified with the
+.B r
+function is always read\-only, even
+when it is available.
+.PP
+The
+.BR b ,
+.BR r ,
+and
+.B u
+functions are also restricted when the
+.I lsof
+process runs setgid and
+.I lsof
+doesn't surrender the setgid permission.
+(See the
+.B "LSOF PERMISSIONS THAT AFFECT DEVICE CACHE FILE ACCESS"
+section for a list of implementations that normally don't surrender
+their setgid permission.)
+.PP
+A further
+.B \-D
+function,
+.B i
+(for ignore), is always available.
+.PP
+When available, the
+.B b
+function tells
+.I lsof
+to read device information from the kernel with the
+.IR stat (2)
+function and build a device cache file at the indicated path.
+.PP
+When available, the
+.B r
+function tells
+.I lsof
+to read the device cache file, but not update it.
+When a path argument accompanies
+.BR \-Dr ,
+it names the device cache file path.
+The
+.B r
+function is always available when it is specified without a
+path name argument.
+If
+.I lsof
+is not running setuid\-root and surrenders its setgid permission,
+a path name argument may accompany the
+.B r
+function.
+.PP
+When available, the
+.B u
+function tells
+.I lsof
+to attempt to read and use the device cache file.
+If it can't read the file, or if it finds the contents of the
+file incorrect or outdated, it will read information from the kernel,
+and attempt to write an updated version of the device cache file,
+but only to a path it considers legitimate for the
+.I lsof
+process effective and real UIDs.
+.SH "DEVICE CACHE PATH FROM AN ENVIRONMENT VARIABLE"
+.PP
+.I Lsof's
+second choice for the device cache file is the contents of the
+LSOFDEVCACHE environment variable.
+It avoids this choice if the
+.I lsof
+process is setuid\-root, or the real UID of the process is root.
+.PP
+A further restriction applies to a device cache file path taken from
+the LSOFDEVCACHE environment variable:
+.I lsof
+will not write a device cache file to the path if the
+.I lsof
+process doesn't surrender its setgid permission.
+(See the
+.B "LSOF PERMISSIONS THAT AFFECT DEVICE CACHE FILE ACCESS"
+section for information on implementations that don't surrender
+their setgid permission.)
+.PP
+The local system administrator can disable the use of the LSOFDEVCACHE
+environment variable or change its name when building
+.IR lsof .
+Consult the output of
+.B \-D?
+for the environment variable's name.
+.SH "SYSTEM-WIDE DEVICE CACHE PATH"
+.PP
+The local system administrator may choose to have a system\-wide
+device cache file when building
+.IR lsof .
+That file will generally be constructed by a special system administration
+procedure when the system is booted or when the contents of
+.I /dev
+or
+.IR /devices )
+changes.
+If defined, it is
+.I lsof's
+third device cache file path choice.
+.PP
+You can tell that a system\-wide device cache file is in effect
+for your local installation by examining the
+.I lsof
+help option output \- i.e., the output from the
+.B \-h
+or
+.B \-?
+option.
+.PP
+.I Lsof
+will never write to the system\-wide device cache file path by
+default.
+It must be explicitly named with a
+.B \-D
+function in a root\-owned procedure.
+Once the file has been written, the procedure must change its permission
+modes to 0644 (owner\-read and owner\-write, group\-read, and other\-read).
+.SH "PERSONAL DEVICE CACHE PATH (DEFAULT)"
+.PP
+The default device cache file path of the
+.I lsof
+distribution is one recorded in the home directory of the real UID
+that executes
+.IR lsof .
+Added to the home directory is a second path component of the form
+.IR .lsof_hostname .
+.PP
+This is
+.I lsof's
+fourth device cache file path choice, and is
+usually the default.
+If a system\-wide device cache file path was defined when
+.I lsof
+was built,
+this fourth choice will be applied when
+.I lsof
+can't find the system\-wide device cache file.
+This is the
+.B only
+time
+.I lsof
+uses two paths when reading the device cache file.
+.PP
+The
+.I hostname
+part of the second component is the base
+name of the executing host, as returned by
+.IR gethostname (2).
+The base name is defined to be the characters preceding the first `.'
+in the
+.IR gethostname (2)
+output, or all the
+.IR gethostname (2)
+output if it contains no `.'.
+.PP
+The device cache file belongs to the user ID and is readable and
+writable by the user ID alone \- i.e., its modes are 0600.
+Each distinct real user ID on a given host that executes
+.I lsof
+has a distinct device cache file.
+The
+.I hostname
+part of the path distinguishes device cache files in an NFS\-mounted
+home directory into which device cache files are written from
+several different hosts.
+.PP
+The personal device cache file path formed by this method represents
+a device cache file that
+.I lsof
+will attempt to read, and will attempt to write should it not
+exist or should its contents be incorrect or outdated.
+.PP
+The
+.B \-Dr
+option without a path name argument will inhibit the writing of a new
+device cache file.
+.PP
+The
+.B \-D?
+option will list the format specification for constructing the
+personal device cache file.
+The conversions used in the format specification are described in the
+.I 00DCACHE
+file of the
+.I lsof
+distribution.
+.SH "MODIFIED PERSONAL DEVICE CACHE PATH"
+.PP
+If this option is defined by the local system administrator when
+.I lsof
+is built, the LSOFPERSDCPATH environment variable contents may
+be used to add a component of the personal device cache file path.
+.PP
+The LSOFPERSDCPATH variable contents are inserted in the path at the
+place marked by the local system administrator with the ``%p''
+conversion in the HASPERSDC format specification of the dialect's
+.I machine.h
+header file.
+(It's placed right after the home directory in the default
+.I lsof
+distribution.)
+.PP
+Thus, for example, if LSOFPERSDCPATH contains ``LSOF'', the home
+directory is ``/Homes/abe'', the host name is ``lsof.itap.purdue.edu'',
+and the HASPERSDC format is the default (``%h/%p.lsof_%L''), the
+modified personal device cache file path is:
+.PP
+.nf
+	/Homes/abe/LSOF/.lsof_vic
+.fi
+.PP
+The LSOFPERSDCPATH environment variable is ignored when the
+.I lsof
+process is setuid\-root or when the real UID of the process is root.
+.PP
+.I Lsof
+will not write to a modified personal device cache file path if the
+.I lsof
+process doesn't surrender setgid permission.
+(See the
+.B "LSOF PERMISSIONS THAT AFFECT DEVICE CACHE FILE ACCESS"
+section for a list of implementations that normally don't surrender
+their setgid permission.)
+.PP
+If, for example, you want to create a sub\-directory of personal
+device cache file paths by using the LSOFPERSDCPATH environment
+variable to name it, and
+.I lsof
+doesn't surrender its setgid permission, you will have to allow
+.I lsof
+to create device cache files at the standard personal path and
+move them to your subdirectory with shell commands.
+.PP
+The local system administrator may: disable this option when
+.I lsof
+is built; change the name of the environment variable from
+LSOFPERSDCPATH to something else; change the HASPERSDC
+format to include the personal path component in another place;
+or exclude the personal path component entirely.
+Consult the output of the
+.B \-D?
+option for the environment variable's name and the HASPERSDC
+format specification.
+.SH DIAGNOSTICS
+Errors are identified with messages on the standard error file.
+.PP
+.I Lsof
+returns a one (1) if any error was detected, including the failure to
+locate command names, file names, Internet addresses or files, login
+names, NFS files, PIDs, PGIDs, or UIDs it was asked to list.
+If the
+.B \-V
+option is specified,
+.I lsof
+will indicate the search items it failed to list.
+.PP
+It returns a zero (0) if no errors were detected and if it was able to
+list some information about all the specified search arguments.
+.PP
+.PP
+When
+.I lsof
+cannot open access to
+.I /dev
+(or
+.IR /devices )
+or one of its subdirectories, or get information on a file in them with
+.IR stat (2),
+it issues a warning message and continues.
+That
+.I lsof
+will issue warning messages about inaccessible files in
+.I /dev
+(or
+.IR /devices )
+is indicated in its help output \- requested with the
+.B \-h
+or
+>B \-?
+options \-  with the message:
+.PP
+.nf
+	Inaccessible /dev warnings are enabled.
+.fi
+.PP
+The warning message may be suppressed with the
+.B \-w
+option.
+It may also have been suppressed by the system administrator when
+.I lsof
+was compiled by the setting of the WARNDEVACCESS definition.
+In this case, the output from the help options will include the message:
+.PP
+.nf
+	Inaccessible /dev warnings are disabled.
+.fi
+.PP
+Inaccessible device warning messages usually disappear after
+.I lsof
+has created a working device cache file.
+.SH EXAMPLES
+For a more extensive set of examples, documented more fully, see the
+.I 00QUICKSTART
+file of the
+.I lsof
+distribution.
+.PP
+To list all open files, use:
+.IP
+lsof
+.PP
+To list all open Internet, x.25 (HP\-UX), and UNIX domain files, use:
+.IP
+lsof -i -U
+.PP
+To list all open IPv4 network files in use by the process whose PID is
+1234, use:
+.IP
+lsof -i 4 -a -p 1234
+.PP
+Presuming the UNIX dialect supports IPv6, to list only open IPv6
+network files, use:
+.IP
+lsof -i 6
+.PP
+To list all files using any protocol on ports 513, 514, or 515 of host
+wonderland.cc.purdue.edu, use:
+.IP
+lsof -i @wonderland.cc.purdue.edu:513-515
+.PP
+To list all files using any protocol on any port of mace.cc.purdue.edu
+(cc.purdue.edu is the default domain), use:
+.IP
+lsof -i @mace
+.PP
+To list all open files for login name ``abe'', or user ID 1234, or
+process 456, or process 123, or process 789, use:
+.IP
+lsof -p 456,123,789 -u 1234,abe
+.PP
+To list all open files on device /dev/hd4, use:
+.IP
+lsof /dev/hd4
+.PP
+To find the process that has /u/abe/foo open, use:
+.IP
+lsof /u/abe/foo
+.PP
+To send a SIGHUP to the processes that have /u/abe/bar open, use:
+.IP
+kill -HUP `lsof -t /u/abe/bar`
+.PP
+To find any open file, including an open UNIX domain socket file,
+with the name
+.IR /dev/log ,
+use:
+.IP
+lsof /dev/log
+.PP
+To find processes with open files on the NFS file system named
+.I /nfs/mount/point
+whose server is inaccessible, and presuming your mount table supplies
+the device number for
+.IR /nfs/mount/point ,
+use:
+.IP
+lsof -b /nfs/mount/point
+.PP
+To do the preceding search with warning messages suppressed, use:
+.IP
+lsof -bw /nfs/mount/point
+.PP
+To ignore the device cache file, use:
+.IP
+lsof -Di
+.PP
+To obtain PID and command name field output for each process, file
+descriptor, file device number, and file inode number for each file
+of each process, use:
+.IP
+lsof -FpcfDi
+.PP
+To list the files at descriptors 1 and 3 of every process running the
+.I lsof
+command for login ID ``abe'' every 10 seconds, use:
+.IP
+lsof -c lsof -a -d 1 -d 3 -u abe -r10
+.PP
+To list the current working directory of processes running a command that
+is exactly four characters long and has an 'o' or 'O' in character three,
+use this regular expression form of the
+.BI \-c " c"
+option:
+.IP
+lsof -c /^..o.$/i -a -d cwd
+.PP
+To find an IP version 4 socket file by its associated numeric dot\-form
+address, use:
+.IP
+lsof -i@128.210.15.17
+.PP
+To find an IP version 6 socket file (when the UNIX dialect supports
+IPv6) by its associated numeric colon\-form address, use:
+.IP
+lsof -i@[0:1:2:3:4:5:6:7]
+.PP
+To find an IP version 6 socket file (when the UNIX dialect supports
+IPv6) by an associated numeric colon\-form address that has a run of
+zeroes in it \- e.g., the loop\-back address \- use:
+.IP
+lsof -i@[::1]
+.PP
+To obtain a repeat mode marker line that contains the current time, use:
+.IP
+lsof -rm====%T====
+.PP
+To add spaces to the previous marker line, use:
+.IP
+lsof -r "m==== %T ===="
+.SH BUGS
+Since
+.I lsof
+reads kernel memory in its search for open files, rapid changes in kernel
+memory may produce unpredictable results.
+.PP
+When a file has multiple record locks, the lock status character
+(following the file descriptor) is derived from a test of the first
+lock structure, not from any combination of the individual record
+locks that might be described by multiple lock structures.
+.PP
+.I Lsof
+can't search for files with restrictive access permissions by
+.I name
+unless it is installed with root set\-UID permission.
+Otherwise it is limited to searching for files to which its user
+or its set-GID group (if any) has access permission.
+.PP
+The display of the destination address of a raw socket (e.g., for
+.IR ping )
+depends on the UNIX operating system.
+Some dialects store the destination address in the raw socket's protocol
+control block, some do not.
+.PP
+.I Lsof
+can't always represent Solaris device numbers in the same way that
+.IR ls (1)
+does.
+For example, the major and minor device numbers that the
+.IR lstat (2)
+and
+.IR stat (2)
+functions report for the directory on which CD-ROM files are mounted
+(typically
+.IR /cdrom )
+are not the same as the ones that it reports for the device on which
+CD-ROM files are mounted (typically
+.IR /dev/sr0 ).
+(\fILsof\fP reports the directory numbers.)
+.PP
+The support for
+.I /proc
+file systems is available only for BSD and Tru64 UNIX dialects, Linux, and
+dialects derived from SYSV R4 \- e.g., FreeBSD, NetBSD, OpenBSD, Solaris,
+UnixWare.
+.PP
+Some
+.I /proc
+file items \- device number, inode number, and file size \-
+are unavailable in some dialects.
+Searching for files in a
+.I /proc
+file system may require that the full path name be specified.
+.PP
+No text (\fBtxt\fP) file descriptors are displayed for Linux
+processes.
+All entries for files other than the current working directory,
+the root directory, and numerical file descriptors are labeled
+.B mem
+descriptors.
+.PP
+.I Lsof
+can't search for Tru64 UNIX named pipes by name, because their kernel
+implementation of lstat(2) returns an improper device number for a
+named pipe.
+.PP
+.I Lsof
+can't report fully or correctly on HP\-UX 9.01, 10.20, and 11.00 locks
+because of insufficient access to kernel data or errors in the
+kernel data.
+See the
+.I lsof
+FAQ (The \fBFAQ\fP section gives its location.)
+for details.
+.PP
+The AIX SMT file type is a fabrication.
+It's made up for file structures whose type (15) isn't defined in the AIX
+.I /usr/include/sys/file.h
+header file.
+One way to create such file structures is to run X clients with the DISPLAY
+variable set to ``:0.0''.
+.PP
+The
+.BI +|\-f [cfgGn]
+option is not supported under /proc\-based Linux
+.IR lsof ,
+because it doesn't read kernel structures from kernel memory.
+.SH ENVIRONMENT
+.I Lsof
+may access these environment variables.
+.TP \w'LSOFPERSDCPATH'u+4
+LANG
+defines a language locale.
+See
+.IR setlocale (3)
+for the names of other variables that can be used in place
+of LANG \- e.g., LC_ALL, LC_TYPE, etc.
+.TP
+LSOFDEVCACHE
+defines the path to a device cache file.
+See the
+.B "DEVICE CACHE PATH FROM AN ENVIRONMENT VARIABLE"
+section for more information.
+.TP
+LSOFPERSDCPATH
+defines the middle component of a modified personal device cache
+file path.
+See the
+.B "MODIFIED PERSONAL DEVICE CACHE PATH"
+section for more information.
+.SH FAQ
+Frequently-asked questions and their answers (an FAQ) are
+available in the
+.I 00FAQ
+file of the
+.I lsof
+distribution.
+.PP
+That file is also available via anonymous ftp from
+.I lsof.itap.purdue.edu
+at
+.IR pub/tools/unix/lsof FAQ .
+The URL is:
+.IP
+ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/FAQ
+.SH FILES
+.TP \w'.lsof_hostname'u+4
+.I /dev/kmem
+kernel virtual memory device
+.TP
+.I /dev/mem
+physical memory device
+.TP
+.I /dev/swap
+system paging device
+.TP
+.I .lsof_hostname
+.I lsof's
+device cache file
+(The suffix,
+.IR hostname ,
+is the first component of the host's name returned by
+.IR gethostname (2).)
+.SH AUTHORS
+.I Lsof
+was written by Victor A.\&Abell <abe@purdue.edu> of Purdue University.
+Many others have contributed to
+.IR lsof .
+They're listed in the
+.I 00CREDITS
+file of the
+.I lsof
+distribution.
+.SH DISTRIBUTION
+The latest distribution of
+.I lsof
+is available via anonymous ftp from the host
+.IR lsof.itap.purdue.edu .
+You'll find the
+.I lsof
+distribution in the
+.I pub/tools/unix/lsof
+directory.
+.PP
+You can also use this URL:
+.IP
+ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof
+.PP
+.I Lsof
+is also mirrored elsewhere.
+When you access
+.I lsof.itap.purdue.edu
+and change to its
+.I pub/tools/unix/lsof
+directory, you'll be given a list of some mirror sites.
+The
+.I pub/tools/unix/lsof
+directory also contains a more complete list in its
+.I mirrors
+file.
+Use mirrors with caution \- not all mirrors always have the latest
+.I lsof
+revision.
+.PP
+Some pre\-compiled
+.I Lsof
+executables are available on
+.IR lsof.itap.purdue.edu ,
+but their use is discouraged \- it's better that you build
+your own from the sources.
+If you feel you must use a pre\-compiled executable, please
+read the cautions that appear in the README files of the
+.I pub/tools/unix/lsof/binaries
+subdirectories and in the 00* files of the distribution.
+.PP
+More information on the
+.I lsof
+distribution can be found in its
+.I README.lsof_<version>
+file.
+If you intend to get the
+.I lsof
+distribution and build it, please read
+.I README.lsof_<version>
+and the other 00* files of the distribution before sending questions
+to the author.
+.SH SEE ALSO
+.PP
+Not all the following manual pages may exist in every UNIX
+dialect to which
+.I lsof
+has been ported.
+.PP
+access(2),
+awk(1),
+crash(1),
+fattach(3C),
+ff(1),
+fstat(8),
+fuser(1),
+gethostname(2),
+isprint(3),
+kill(1),
+localtime(3),
+lstat(2),
+modload(8),
+mount(8),
+netstat(1),
+ofiles(8L),
+perl(1),
+ps(1),
+readlink(2),
+setlocale(3),
+stat(2),
+strftime(3),
+time(2),
+uname(1).
diff --git a/OLD/comprev b/OLD/comprev
new file mode 100755
index 0000000000000000000000000000000000000000..b25ab719290ea39192929f60e8126d164f7b7e89
--- /dev/null
+++ b/OLD/comprev
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# comprev -- compare revisions
+
+n=1
+while test 1 -eq 1
+do
+  np=`expr $n + 1`
+  rcsdiff -r1.$n -r1.$np Configure | grep make.conf
+  n=`expr $n + 1`
+done
diff --git a/OLD/leak b/OLD/leak
new file mode 100755
index 0000000000000000000000000000000000000000..fd75602b5ebda9eb2ea7cd2476ffcdde4a321253
--- /dev/null
+++ b/OLD/leak
@@ -0,0 +1,51 @@
+#!/usr/local/bin/perl
+
+# leak < <lsof_leak_debug_output>
+
+while (<>) {
+    if (!/^MEM[afr]/) { next; }
+    chop;
+    if (/^MEMa ([^ ]*) (.*)/) {
+	$new = $1; $loc = $2;
+	if (defined($mem{$new})) {
+	    print "ERROR: $new already allocated;\n";
+	    print "  OLD: $mem{$new}\n";
+	    print "  NEW: $_\n";
+	} else {$mem{$new} = $loc; }
+	next;
+    } elsif (/^MEMf ([^ ]*) (.*)/) {
+	$old = $1; $loc = $2;
+	if (!defined($mem{$old})) {
+	    print "ERROR: $old not allocated: $_\n";
+	} else { undef($mem{$old}); }
+	next;
+    } elsif (/^MEMr ([^ ]*) ([^ ]*) (.*)/) {
+	$old = $1; $new = $2; $loc = $3;
+	if (!defined($mem{$old})) {
+	    print "ERROR: $old not allocated: $_\n";
+	} else { undef($mem{$old}); }
+	if (defined($mem{$new})) {
+	    print "ERROR: $new already allocated;\n";
+	    print "  OLD: $mem{$new}\n";
+	    print "  NEW: $_\n";
+	} else {$mem{$new} = $loc; }
+	next;
+    } else { print "ERROR: MEM what? $_\n"; }
+}
+foreach $addr (sort keys(%mem)) {
+    if (defined($mem{$addr})) {
+	if (($mem{$addr} =~ /^rnch.c/)) { next; }
+	if (($mem{$addr} =~ /^print.c:14[18]/)) { next; }
+	if (($mem{$addr} =~ /^print.c:323/)) { next; }
+	if (($mem{$addr} =~ /^print.c:1135/)) { next; }
+	if (($mem{$addr} =~ /^print.c:207/)) { next; }
+	if (($mem{$addr} =~ /^print.c:219/)) { next; }
+	if (($mem{$addr} =~ /^print.c:335/)) { next; }
+	if (($mem{$addr} =~ /^print.c:261/)) { next; }
+	if (($mem{$addr} =~ /^print.c:1076/)) { next; }
+	if (($mem{$addr} =~ /^proc.c:191/)) { next; }
+	if (($mem{$addr} =~ /^main.c:581/)) { next; }
+	if (($mem{$addr} =~ /^rvfs.c:68/)) { next; }
+	print "IN USE $addr: $mem{$addr}\n";
+    }
+}
diff --git a/OLD/lsof.h b/OLD/lsof.h
new file mode 100644
index 0000000000000000000000000000000000000000..06903fa5f630664db13cfce36ee14077a2ead7a7
--- /dev/null
+++ b/OLD/lsof.h
@@ -0,0 +1,1075 @@
+/*
+ * lsof.h - common header file for lsof
+ */
+
+
+/*
+ * Copyright 1994 Purdue Research Foundation, West Lafayette, Indiana
+ * 47907.  All rights reserved.
+ *
+ * Written by Victor A. Abell
+ *
+ * This software is not subject to any license of the American Telephone
+ * and Telegraph Company or the Regents of the University of California.
+ *
+ * Permission is granted to anyone to use this software for any purpose on
+ * any computer system, and to alter it and redistribute it freely, subject
+ * to the following restrictions:
+ *
+ * 1. Neither the authors nor Purdue University are responsible for any
+ *    consequences of the use of this software.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ *    explicit claim or by omission.  Credit to the authors and Purdue
+ *    University must appear in documentation and sources.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ *    misrepresented as being the original software.
+ *
+ * 4. This notice may not be removed or altered.
+ */
+
+
+/*
+ * $Id: lsof.h,v 1.69 2018/02/14 14:19:25 abe Exp $
+ */
+
+
+#if	!defined(LSOF_H)
+#define	LSOF_H	1
+
+#include "machine.h"
+
+# if	!defined(FSV_DEFAULT)
+#define	FSV_DEFAULT	0
+# endif	/* !defined(FSV_DEFAULT) */
+
+#include "lsof_fields.h"
+
+#include <ctype.h>
+#include <errno.h>
+
+# if	defined(HASSETLOCALE)
+#include <locale.h>
+# endif	/* defined(HASSETLOCALE) */
+
+#include <netdb.h>
+#include <pwd.h>
+#include <stdio.h>
+
+#include <sys/stat.h>
+#include <sys/wait.h>
+
+
+/*
+ * Definitions and structures that may be needed by dlsof.h
+ */
+
+# if	!defined(INODETYPE)
+#define	INODETYPE	unsigned long	/* node number storage type */
+#define	INODEPSPEC	"l"		/* node number printf specification
+					 * modifier */
+# endif	/* !defined(INODETYPE) */
+
+struct l_dev {
+	dev_t rdev;			/* device */
+	INODETYPE inode;		/* inode number */
+	char *name;			/* name */
+	int v;				/* has been verified
+					 * (when DCUnsafe == 1) */
+};
+
+
+# if	defined(HASEPTOPTS)
+/*
+ * End point definitions
+ */
+
+#define	CHEND_PIPE	1		/* pipe endpoint ID */
+#define	CHEND_PTY	4		/* pseudoterminal endpoint ID */
+#define	EPT_PIPE	1		/* process has pipe file */
+#define	EPT_PIPE_END	2		/* process has pipe end point file */
+#define	EPT_PTY		8		/* process has a pseudoterminal file */
+#define	EPT_PTY_END	16		/* process has a pseudoterminal end
+					 * point file */
+
+#  if	defined(HASUXSOCKEPT)
+#define	CHEND_UXS	2		/* UNIX socket endpoint ID */
+#define	EPT_UXS		4		/* process has a UNIX socket file */
+#define	EPT_UXS_END	8		/* process has a UNIX socket end point
+					 * file */
+#  endif	/* defined(HASUXSOCKEPT) */
+# endif	/* defined(HASEPTOPTS) */
+
+
+/*
+ * FILE_FLAG column names
+ */
+
+#define	FF_AIO		"AIO"
+#define	FF_APPEND	"AP"
+#define	FF_ASYNC	"ASYN"
+#define	FF_BLKANDSET	"BAS"
+#define	FF_BLKINUSE	"BKIU"
+#define	FF_BLKSEEK	"BSK"
+#define	FF_CIO		"CIO"
+#define	FF_CLONE	"CLON"
+#define	FF_CLREAD	"CLRD"
+#define	FF_COPYAVOID	"CA"
+#define	FF_CREAT	"CR"
+#define	FF_DATAFLUSH	"DFLU"
+#define	FF_DEFER	"DF"
+#define	FF_DEFERIND	"DFI"
+#define	FF_DELAY	"DLY"
+#define	FF_DIRECT	"DIR"
+#define	FF_DIRECTORY	"DTY"
+#define	FF_DOCLONE	"DOCL"
+#define	FF_DSYNC	"DSYN"
+#define	FF_EVTONLY	"EVO"
+#define	FF_EXCL		"EXCL"
+#define	FF_EXEC		"EX"
+#define	FF_EXLOCK	"XL"
+#define	FF_FILE_MBLK	"MBLK"
+#define	FF_FSYNC	"FSYN"
+#define	FF_GCFDEFER	"GCDF"
+#define	FF_GCFMARK	"GCMK"
+#define	FF_GENTTY	"GTTY"
+#define	FF_HASLOCK	"LCK"
+#define	FF_HUP		"HUP"
+#define	FF_KERNEL	"KERN"
+#define	FF_KIOCTL	"KIOC"
+#define	FF_LARGEFILE	"LG"
+#define	FF_MARK		"MK"
+#define	FF_MOUNT	"MNT"
+#define	FF_MSYNC	"MSYN"
+#define	FF_NBDRM	"NBDR"
+#define	FF_NBIO		"NBIO"
+#define	FF_NBLOCK	"NB"
+#define	FF_NBUF		"NBF"
+#define	FF_NMFS		"NMFS"
+#define	FF_NDELAY	"ND"
+#define	FF_NET		"NET"
+#define	FF_NOATM	"NATM"
+#define	FF_NOCACHE	"NC"
+#define	FF_NOCTTY	"NTTY"
+#define	FF_NODSYNC	"NDSY"
+#define	FF_NOFOLNK	"NFLK"
+#define	FF_NOTOSTOP	"NOTO"
+#define	FF_NSHARE	"NSH"
+#define	FF_OLRMIRROR	"OLRM"
+#define	FF_POSIX_AIO	"PAIO"
+#define	FF_POSIX_PIPE	"PP"
+#define	FF_RAIOSIG	"RAIO"
+#define	FF_RCACH	"RC"
+#define	FF_RDWR		"RW"
+#define	FF_READ		"R"
+#define	FF_REVOKED	"REV"
+#define	FF_RSHARE	"RSH"
+#define	FF_RSYNC	"RSYN"
+#define	FF_SETBLK	"BL"
+#define	FF_SHLOCK	"SL"
+#define	FF_SNAP		"SNAP"
+#define	FF_SOCKET	"SOCK"
+#define	FF_SQTSH1	"SQS1"
+#define	FF_SQTSH2	"SQS2"
+#define	FF_SQTREPAIR	"SQR"
+#define	FF_SQTSH	"SQSH"
+#define	FF_SQTSVM	"SQSV"
+#define	FF_STOPIO	"STPI"
+#define	FF_SYNC		"SYN"
+#define	FF_SYNCRON	"SWR"
+#define	FF_TCP_MDEVONLY	"TCPM"
+#define	FF_TERMIO	"TIO"
+#define	FF_TRUNC	"TR"
+#define	FF_VHANGUP	"VH"
+#define	FF_VTEXT	"VTXT"
+#define	FF_WAKEUP	"WKUP"
+#define	FF_WAITING	"WTG"
+#define	FF_WRITE	"W"
+
+
+/*
+ * Process open file flag names
+ */
+
+#define	POF_ALLOCATED	"ALLC"
+#define	POF_BNRD	"BR"
+#define	POF_BNWR	"BW"
+#define POF_BNHUP	"BHUP"
+#define	POF_CLOEXEC	"CX"
+#define	POF_CLOSING	"CLSG"
+#define	POF_FDLOCK	"LCK"
+#define	POF_INUSE	"USE"
+#define	POF_MAPPED	"MP"
+#define	POF_FSHMAT	"SHMT"
+#define	POF_RESERVED	"OPIP"
+#define	POF_RSVWT	"RSVW"
+
+
+/*
+ * Cross-over (-x) option values
+ */
+
+#define	XO_FILESYS	0x1		/* file system mount points */
+#define	XO_SYMLINK	0x2		/* symbolic links */
+#define	XO_ALL		(XO_FILESYS | XO_SYMLINK)
+
+#include "dlsof.h"
+
+#include <sys/types.h>			/* just in case -- because utmp.h
+					 * may need it */
+#include "./regex.h"
+
+# if	defined(EMPTY)
+#undef	EMPTY
+# endif	/* defined(EMPTY) */
+
+# if	defined(HASUTMPX)
+#include <utmpx.h>
+# else	/* !defined(HASUTMPX) */
+#include <utmp.h>
+# endif	/* defined(HASUTMPX) */
+
+extern int errno;
+extern char *optarg;
+extern int optind;
+
+#define	ACCESSERRFMT	"%s: WARNING: access %s: %s\n"
+
+# if	defined(HASDCACHE)
+#define	CRC_POLY	0120001 	/* CRC-16 polynomial */
+#define	CRC_TBLL	256		/* crc table length for software */
+#define	CRC_BITS	8		/* number of bits contributing */
+# endif	/* defined(HASDCACHE) */
+#define	CMDL		9		/* maximum number of characters from
+					 * command name to print in COMMAND
+					 * column */
+#define	CWD		" cwd"		/* current working directory fd name */
+#define	FDLEN		8		/* fd printing array length */
+#define	FSV_FA		0x1		/* file struct addr status */
+#define	FSV_CT		0x2		/* file struct count status */
+#define	FSV_FG		0x4		/* file struct flags */
+#define	FSV_NI		0x8		/* file struct node ID status */
+
+# if	!defined(GET_MAJ_DEV)
+#define	GET_MAJ_DEV	major		/* if no dialect specific macro has
+					 * been defined, use standard major()
+					 * macro */
+# endif	/* !defined(GET_MAJ_DEV) */
+
+# if	!defined(GET_MIN_DEV)
+#define	GET_MIN_DEV	minor		/* if no dialect specific macro has
+					 * been defined, use standard minor()
+					 * macro */
+# endif	/* !defined(GET_MIN_DEV) */
+
+# if	defined(HASSELINUX)
+#define	HASHCNTX	128		/* security context hash bucket count
+					 * -- MUST BE A POWER OF 2!!! */
+# endif	/* defined(HASSELINUX) */
+
+# if	defined(HASZONES)
+#define	HASHZONE	128		/* zone hash bucket count -- MUST BE
+					 * A POWER OF 2!!! */
+# endif	/* defined(HASZONES) */
+
+#define	IDINCR		10		/* PID/PGID table malloc() increment */
+
+# if	!defined(INADDR_LOOPBACK)
+#define	INADDR_LOOPBACK	(u_long)0x7f000001
+# endif	/* !defined(INADDR_LOOPBACK) */
+
+#define	IPROTOL		8		/* Internet protocol length */
+
+# if	!defined(KA_T_FMT_X)
+#define	KA_T_FMT_X	"0x%08lx"	/* format for printing kernel
+					 * addresses in 0x... format */
+# endif	/* !defined(KA_T_FMT_X) */
+
+# if	!defined(LOGINML)
+#  if	defined(HASUTMPX)
+static struct utmpx dummy_utmp;		/* to get login name length */
+#define	LOGINML		sizeof(dummy_utmp.ut_user)
+					/* login name length */
+#  else	/* !defined(HASUTMPX) */
+static struct utmp dummy_utmp;		/* to get login name length */
+#define	LOGINML		sizeof(dummy_utmp.ut_name)
+					/* login name length */
+#  endif	/* defined(HASUTMPX) */
+# endif	/* !defined(LOGINML) */
+
+#define	LPROCINCR	128		/* Lproc[] allocation increment */
+#define	LSOF_URL	"ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/"
+#define	MIN_AF_ADDR	sizeof(struct in_addr)
+					/* minimum AF_* address length */
+
+# if	defined(HASIPv6)
+#define	MAX_AF_ADDR	sizeof(struct in6_addr)
+					/* maximum AF_* address length */
+# else	/* !defined(HASIPv6) */
+#define	MAX_AF_ADDR	MIN_AF_ADDR	/* maximum AF_* address length */
+# endif	/* defined(HASIPv6) */
+
+#define	MAXDCPATH	4		/* paths in DCpath[] */
+#define	MAXNWAD		100		/* maximum network addresses */
+
+# if	!defined(MEMMOVE)
+#define	MEMMOVE		memmove
+# endif	/* !defined*MEMMOVE) */
+
+#define	N_REGLR		0		/* regular file system node */
+#define	N_AFS		1		/* AFS node */
+#define	N_AFPFS		2		/* Apple Darwin AppleShare */
+#define	N_ANON_INODE	3		/* Linux anon_inodefs node */
+#define	N_AUSX		4		/* Auspex LFS node */
+#define	N_AUTO		5		/* automount node */
+#define	N_BLK		6		/* block device node */
+#define	N_CACHE		7		/* cached file system node */
+#define	N_CDFS		8		/* CD-ROM node */
+#define	N_CFS		9		/* CFS node */
+#define	N_CHR		10		/* character device node */
+#define	N_COM		11		/* streams common device node */
+#define	N_CTFSADIR	12		/* Solaris CTFS adir node */
+#define	N_CTFSBUND	13		/* Solaris CTFS bundle node */
+#define	N_CTFSCDIR	14		/* Solaris CTFS cdir node */
+#define	N_CTFSCTL	15		/* Solaris CTFS ctl node */
+#define	N_CTFSEVT	16		/* Solaris CTFS events node */
+#define	N_CTFSLATE	17		/* Solaris CTFS latest node */
+#define	N_CTFSROOT	18		/* Solaris CTFS root node */
+#define	N_CTFSSTAT	19		/* Solaris CTFS status node */
+#define	N_CTFSSYM	20		/* Solaris CTFS symbolic node */
+#define	N_CTFSTDIR	21		/* Solaris CTFS type node */
+#define	N_CTFSTMPL	22		/* Solaris CTFS template node */
+#define	N_DEV		23		/* DEV FS node */
+#define	N_DOOR		24		/* DOOR node */
+#define	N_FD		25		/* FD node */
+#define	N_FIFO		26		/* FIFO node */
+#define	N_HSFS		27		/* High Sierra node */
+#define	N_KERN		28		/* BSD /kern node */
+#define	N_LOFS		29		/* loopback node */
+#define	N_MNT		30		/* mount file system device node */
+#define	N_MPC		31		/* multiplexed device node */
+#define	N_MVFS		32		/* multi-volume file system node (?) */
+#define	N_NFS		33		/* NFS node */
+#define	N_NFS4		34		/* NFS version 4 node */
+#define	N_NM		35		/* named file system node */
+#define	N_OBJF		36		/* objfs file system node */
+#define	N_PCFS		37		/* PC file system node */
+#define	N_PIPE		38		/* pipe device node */
+#define	N_PORT		39		/* port node */
+#define	N_PROC		40		/* /proc node */
+#define	N_PSEU		41		/* pseudofs node */
+#define	N_SAMFS		42		/* Solaris SAM-FS */
+#define	N_SANFS		43		/* AIX SANFS */
+#define	N_SDEV		44		/* Solaris sdev file system node */
+#define	N_SHARED	45		/* Solaris sharedfs */
+#define	N_SOCK		46		/* sock_vnodeops node */
+#define	N_SPEC		47		/* spec_vnodeops node */
+#define	N_STREAM	48		/* stream node */
+#define	N_TMP		49		/* tmpfs node */
+#define	N_UFS		50		/* UNIX file system node */
+#define	N_UNKN		51		/* unknown node type */
+#define	N_VXFS		52		/* Veritas file system node */
+#define	N_XFS		53		/* XFS node */
+#define	N_ZFS		54		/* ZFS node */
+
+# if	!defined(OFFDECDIG)
+#define	OFFDECDIG	8		/* maximum number of digits in the
+					 * offset decimal form (0t...) */
+# endif	/* !defined(OFFDECDIG) */
+
+# if	!defined(USELOCALREADDIR)
+#define	CloseDir	closedir	/* use standard closedir() */
+#define	OpenDir		opendir		/* use standard opendir() */
+#define	ReadDir		readdir		/* use standard readdir() */
+# endif	/* !defined(USELOCALREADDIR) */
+
+#define	RPTTM		15		/* default repeat seconds */
+#define	RTD		" rtd"		/* root directory fd name */
+#define	TASKCMDL	9		/* maximum number of characters from
+					 * command name to print in TASKCMD
+					 * column */
+#define TCPTPI_FLAGS	0x0001		/* report TCP/TPI socket options and
+					 * state, and TCP_NODELAY state */
+#define	TCPTPI_QUEUES	0x0002		/* report TCP/TPI queue lengths */
+#define	TCPTPI_STATE	0x0004		/* report TCP/TPI state */
+#define TCPTPI_WINDOWS	0x0008		/* report TCP/TPI window sizes */
+#define	TCPTPI_ALL	(TCPTPI_QUEUES | TCPTPI_STATE | TCPTPI_WINDOWS)
+					/* report all TCP/TPI info */
+#define	TCPUDPALLOC	32		/* allocation amount for TCP and UDP
+					 * state tables */
+#define	TMLIMIT		15		/* readlink() & stat() timeout sec */
+#define	TMLIMMIN	2		/* minimum timeout */
+#define	TYPEL		8		/* type character length */
+#define	UIDCACHEL	1024		/* UID cache length */
+#define	UIDINCR		10		/* UID table malloc() increment */
+#define	USERPRTL	8		/* UID/login print length limit */
+
+# if	!defined(SZOFFTYPE)
+#define	SZOFFTYPE	unsigned long	/* type for size and offset */
+#undef	SZOFFPSPEC
+#define	SZOFFPSPEC	"l"		/* SZOFFTYPE printf specification
+					 * modifier */
+# endif	/* !defined(SZOFFTYPE) */
+
+# if	!defined(TIMEVAL_LSOF)
+#define	TIMEVAL_LSOF	timeval
+# endif	/* !defined(TIMEVAL_LSOF) */
+
+# if	!defined(XDR_PMAPLIST)
+#define	XDR_PMAPLIST	xdr_pmaplist
+# endif	/* !defined(XDR_PMAPLIST) */
+
+# if	!defined(XDR_VOID)
+#define	XDR_VOID	xdr_void
+# endif	/* !defined(XDR_VOID) */
+
+
+/*
+ * Output title definitions
+ */
+
+#define	CMDTTL		"COMMAND"
+extern int CmdColW;
+#define	CNTXTTL		"SECURITY-CONTEXT"
+extern int CntxColW;
+#define DEVTTL		"DEVICE"
+extern int DevColW;
+#define	FCTTL		"FCT"
+extern int FcColW;
+#define	FDTTL 		"FD"
+extern int FdColW;
+#define	FGTTL		"FILE-FLAG"
+extern int FgColW;
+#define	FSTTL		"FILE-ADDR"
+extern int FsColW;
+#define	NITTL		"NODE-ID"
+extern int NiColW;
+extern char *NiTtl;
+#define	NLTTL		"NLINK"
+extern int NlColW;
+#define	NMTTL		"NAME"
+extern int NmColW;
+#define NODETTL		"NODE"
+extern int NodeColW;
+#define OFFTTL		"OFFSET"
+#define	PGIDTTL		"PGID"
+extern int PgidColW;
+#define	PIDTTL		"PID"
+extern int PidColW;
+#define	PPIDTTL		"PPID"
+extern int PpidColW;
+#define SZTTL		"SIZE"
+#define	SZOFFTTL	"SIZE/OFF"
+extern int SzOffColW;
+#define	TASKCMDTTL	"TASKCMD"
+extern	int TaskCmdColW;
+#define	TASKTIDTTL	"TID"
+extern	int TaskTidColW;
+#define TYPETTL		"TYPE"
+extern int TypeColW;
+#define	USERTTL		"USER"
+extern int UserColW;
+#define ZONETTL		"ZONE"
+extern int ZoneColW;
+
+
+/*
+ * Selection flags
+ */
+
+#define	PS_PRI		1		/* primary process selection -- e.g.,
+					 * by PID or UID */
+#define	PS_SEC		2		/* secondary process selection -- e.g.,
+					 * by directory or file */
+#define	SELCMD		0x0001		/* select process by command name */
+#define	SELCNTX		0x0002		/* select security context (-Z) */
+#define	SELFD		0x0004		/* select file by descriptor name */
+#define	SELNA		0x0008		/* select socket by address (-i@...) */
+#define	SELNET		0x0010		/* select Internet socket files (-i) */
+#define	SELNFS		0x0020		/* select NFS files (-N) */
+#define	SELNLINK	0x0040		/* select based on link count */
+#define	SELNM		0x0080		/* select by name */
+#define	SELPGID		0x0100		/* select process group IDs (-g) */
+#define	SELPID		0x0200		/* select PIDs (-p) */
+#define	SELUID		0x0400		/* select UIDs (-u) */
+#define	SELUNX		0x0800		/* select UNIX socket (-U) */
+#define	SELZONE		0x1000		/* select zone (-z) */
+#define	SELEXCLF	0x2000		/* file selection excluded */
+#define	SELTASK		0x4000		/* select tasks (-K) */
+#define	SELPINFO	0x8000		/* selected for pipe info (cleared in
+					 * link_lfile() */
+#define	SELUXSINFO	0x10000		/* selected for UNIX socket info;
+					 * cleared in link_lfile() */
+#define	SELPTYINFO	0x20000		/* selected for pseudoterminal info;
+					 * cleared in link_lfile() */
+#define	SELALL		(SELCMD|SELCNTX|SELFD|SELNA|SELNET|SELNM|SELNFS|SELPID|SELUID|SELUNX|SELZONE|SELTASK)
+#define	SELPROC		(SELCMD|SELCNTX|SELPGID|SELPID|SELUID|SELZONE|SELTASK)
+					/* process selecters */
+#define	SELFILE		(SELFD|SELNFS|SELNLINK|SELNM)	/* file selecters */
+#define	SELNW		(SELNA|SELNET|SELUNX)		/* network selecters */
+
+/*
+ * Structure definitions
+ */
+
+# if	defined(HAS_AFS)
+struct afsnode {			/* AFS pseudo-node structure */
+	dev_t dev;
+	unsigned char ino_st;		/* 1 if inode has a value */
+	unsigned char nlink_st;		/* 1 if nlink has a value */
+	INODETYPE inode;
+	unsigned long size;
+	long nlink;
+};
+# endif	/* defined(HAS_AFS) */
+
+extern int AllProc;
+
+# if	defined(HAS_STD_CLONE)
+struct clone {
+	int dx;			/* index of device entry in Devtp[] */
+	struct clone *next;	/* forward link */
+};
+extern struct clone *Clone;
+# endif	/* defined(HAS_STD_CLONE) */
+
+# if	defined(HASNLIST)
+struct drive_Nl {			/* data to drive build_Nl() */
+	char *nn;			/* nickname for lookups */
+	char *knm;			/* kernel variable for name list */
+};
+extern struct drive_Nl Drive_Nl[];	/* defined in dstore.c */
+# endif	/* defined(HASNLIST) */
+
+
+/*
+ * Global storage definitions (including their structure definitions)
+ */
+
+typedef struct efsys_list {
+	char *path;			/* path to file system for which kernel
+					 * blocks are to be eliminated */
+	int pathl;			/* path length */
+	int rdlnk;			/* avoid readlink(2) if non-zero */
+	struct mounts *mp;		/* local mount table entry pointer */
+	struct efsys_list *next;	/* next efsys_list entry pointer */
+} efsys_list_t;
+extern efsys_list_t *Efsysl;		/* file systems for which kernel blocks
+					 * are to be eliminated */
+
+struct int_lst {
+	int i;				/* integer argument */
+	int f;				/* find state -- meaningful only if
+					 * x == 0 */
+	int x;				/* excluded state */
+};
+
+typedef struct lsof_rx {		/* regular expression table entry */
+	char *exp;			/* original regular expression */
+	regex_t cx;			/* compiled expression */
+	int mc;				/* match count */ 
+} lsof_rx_t;
+extern lsof_rx_t *CmdRx;
+extern int NCmdRxU;
+
+# if	defined(HASFSTRUCT)
+struct pff_tab {			/* print file flags table structure */
+	long val;			/* flag value */
+	char *nm;			/* name to print for flag */
+};
+# endif	/* defined(HASFSTRUCT) */
+
+# if	defined(HASEPTOPTS)
+typedef struct pxinfo {			/* hashed pipe, UNIX socket or pseudo-
+					 * terminal inode information */
+	INODETYPE ino;			/* file's inode */
+	struct lfile *lf;		/* connected peer file */
+	int lpx;			/* connected process index */
+	struct pxinfo *next;		/* next entry for hashed inode */
+} pxinfo_t;
+
+typedef struct uxsin {			/* UNIX socket information */
+	INODETYPE inode;		/* node number */
+	char *pcb;			/* protocol control block */
+	char *path;			/* file path */
+	unsigned char sb_def;		/* stat(2) buffer definitions */
+	dev_t sb_dev;			/* stat(2) buffer device */
+	INODETYPE sb_ino;		/* stat(2) buffer node number */
+	dev_t sb_rdev;			/* stat(2) raw device number */
+	uint32_t ty;			/* socket type */
+
+#  if	defined(HASEPTOPTS) && defined(HASUXSOCKEPT)
+	struct uxsin *icons;		/* incoming socket conections */
+	unsigned int icstat;		/* incoming connection status
+					 * 0 == none */
+	pxinfo_t *pxinfo;		/* inode information */
+	struct uxsin *peer;	        /* connected peer(s) info */
+#  endif	/* defined(HASEPTOPTS) && defined(HASUXSOCKEPT) */
+
+	struct uxsin *next;
+} uxsin_t;
+# endif	/* defined(HASEPTOPTS) */
+
+
+struct seluid {
+	uid_t uid;			/* User ID */
+	char *lnm;			/* specified login name (NULL = none) */
+	unsigned char excl;		/* excluded state */
+	unsigned char f;		/* selected User ID find state
+					 * (meaningful only if excl == 0) */
+};
+
+# if	defined(HASBLKDEV)
+extern struct l_dev *BDevtp, **BSdev;
+extern int BNdev;
+# endif	/* defined(HASBLKDEV) */
+
+extern int CkPasswd;
+
+struct str_lst {
+	char *str;			/* string */
+	int len;			/* string length */
+	short f;			/* selected string find state */
+	short x;			/* exclusion (if non-zero) */
+	struct str_lst *next;		/* next list entry */
+};
+extern struct str_lst *Cmdl;
+extern int CmdLim;
+extern int Cmdni;
+extern int Cmdnx;
+ 
+# if	defined(HASSELINUX)
+typedef struct cntxlist {
+	char *cntx;			/* zone name */
+	int f;				/* "find" flag (used only in CntxArg) */
+	struct cntxlist *next;		/* next zone hash entry */
+} cntxlist_t;
+extern cntxlist_t *CntxArg;
+extern int CntxStatus;
+# endif	/* defined(HASSELINUX) */
+
+# if	defined(HASDCACHE)
+extern unsigned DCcksum;
+extern int DCfd;
+extern FILE *DCfs;
+extern char *DCpathArg;
+extern char *DCpath[];
+extern int DCpathX;
+extern int DCrebuilt;
+extern int DCstate;
+extern int DCunsafe;
+# endif	/* defined(HASDCACHE) */
+
+extern int DChelp;
+extern dev_t DevDev;
+extern struct l_dev *Devtp;
+extern char **Dstk;
+extern int Dstkn;
+extern int Dstkx;
+extern int ErrStat;
+extern uid_t Euid;
+extern int Fand;
+extern int Fblock;
+extern int Fcntx;
+extern int Ffield;
+extern int Ffilesys;
+extern int Fhelp;
+extern int Fhost;
+
+# if	defined(HASNCACHE)
+extern int Fncache;
+extern int NcacheReload;
+# endif	/* defined(HASNCACHE) */
+
+extern int Fnet;
+extern int FnetTy;
+extern int Fnfs;
+extern int Fnlink;
+extern int Foffset;
+extern int Fovhd;
+extern int FeptE;
+
+extern int Fport;
+
+# if	!defined(HASNORPC_H)
+extern int FportMap;
+# endif	/* !defined(HASNORPC_H) */
+
+extern int Fpgid;
+extern int Fppid;
+extern int Fsize;
+extern int Fsv;
+extern int FsvByf;
+extern int FsvFlagX;
+extern int Ftask;
+extern int Ftcptpi;
+extern int Fterse;
+extern int Funix;
+extern int Futol;
+extern int Fverbose;
+extern int Fwarn;
+
+# if	defined(HASXOPT_VALUE)
+extern int Fxopt;
+# endif	/* defined(HASXOPT_VALUE) */
+
+extern int Fxover;
+extern int Fzone;
+
+struct fd_lst {
+	char *nm;			/* file descriptor name -- range if
+					 * NULL */
+	int lo;				/* range start (if nm NULL) */
+	int hi;				/* range end (if nm NULL) */
+	struct fd_lst *next;
+};
+extern struct fd_lst *Fdl;
+extern int FdlTy;			/* Fdl[] type: -1 == none
+					 *		0 == include
+					 *		1 == exclude */
+
+struct fieldsel {
+	char id;			/* field ID character */
+	unsigned char st;		/* field status */
+	char *nm;			/* field name */
+	int *opt;			/* option variable address */
+	int ov;				/* value to OR with option variable */
+};
+extern struct fieldsel FieldSel[];
+
+extern int Hdr;
+
+enum IDType {PGID, PID};
+extern int  IgnTasks;
+extern char *InodeFmt_d;
+extern char *InodeFmt_x;
+extern int LastPid;
+
+struct lfile {
+	char access;
+	char lock;
+	unsigned char dev_def;		/* device number definition status */
+	unsigned char inp_ty;		/* inode/iproto type
+					 *	0: neither inode nor iproto
+					 *	1: print inode in decimal
+					 *	2: iproto contains string
+					 *      3: print inode in hex
+					 */
+	unsigned char is_com;		/* common stream status */
+	unsigned char is_nfs;		/* NFS file status */
+	unsigned char is_stream;	/* stream device status */
+
+# if	defined(HASVXFS) && defined(HASVXFSDNLC)
+	unsigned char is_vxfs;		/* VxFS file status */
+# endif	/* defined(HASVXFS) && defined(HASVXFSDNLC) */
+
+	unsigned char lmi_srch;		/* local mount info search status:
+					 * 1 = printname() search required */
+
+# if	defined(HASMNTSTAT)
+	unsigned char mnt_stat;		/* mount point stat(2) status */
+# endif	/* defined(HASMNTSTAT) */
+
+	unsigned char nlink_def;	/* link count definition status */
+	unsigned char off_def;		/* offset definition status */
+
+# if	defined(HASEPTOPTS)
+	unsigned char chend;		/* communication channel endpoint
+					 * file */
+#  if	defined(HASPTYEPT)
+	int tty_index;			/* pseudoterminal index of slave side
+					 * (if this is the master side) */
+#  endif	/* defined(HASPTYEPT) */
+# endif	/* defined(HASEPTOPTS) */
+
+	unsigned char rdev_def;		/* rdev definition status */
+	unsigned char sz_def;		/* size definition status */
+
+# if	defined(HASFSTRUCT)
+	unsigned char fsv;		/* file struct value status */
+# endif	/* defined(HASFSTRUCT) */
+
+	char fd[FDLEN];
+	char iproto[IPROTOL];
+	char type[TYPEL];
+	unsigned int sf;		/* select flags -- SEL* symbols */
+	int ch;				/* VMPC channel: -1 = none */
+	int ntype;			/* node type -- N_* value */
+	SZOFFTYPE off;
+	SZOFFTYPE sz;
+	dev_t dev;
+	dev_t rdev;
+	INODETYPE inode;
+	long nlink;			/* link count */
+	char *dev_ch;
+	char *fsdir;			/* file system directory */
+	char *fsdev;			/* file system device */
+
+# if	defined(HASFSINO)
+	INODETYPE fs_ino;		/* file system inode number */
+# endif	/* defined HASFSINO) */
+
+	struct linaddr {		/* local Internet address information */
+	    int af;			/* address family: 0 for none; AF_INET;
+					 * or AF_INET6 */
+	    int p;			/* port */
+	    union {
+		struct in_addr a4;	/* AF_INET Internet address */
+
+# if	defined(HASIPv6)
+		struct in6_addr a6;	/* AF_INET6 Internet address */
+# endif	/* defined(HASIPv6) */
+
+	    } ia;
+	} li[2];			/* li[0]: local
+					 * li[1]: foreign */
+	struct ltstate {		/* local TCP/TPI state */
+	    int type;			/* state type:
+					 *   -1 == none
+					 *    0 == TCP
+					 *    1 == TPI or socket (SS_*) */
+	    union {
+		int i;			/* integer state */
+		unsigned int ui;	/* unsigned integer state */
+	    } state;
+
+# if	defined(HASSOOPT)
+	    unsigned char pqlens;	/* pqlen status: 0 = none */
+	    unsigned char qlens;	/* qlen status:  0 = none */
+	    unsigned char qlims;	/* qlim status:  0 = none */
+	    unsigned char rbszs;	/* rbsz status:  0 = none */
+	    unsigned char sbszs;	/* sbsz status:  0 = none */
+	    int kai;			/* TCP keep-alive interval */
+	    int ltm;			/* TCP linger time */
+	    unsigned int opt;		/* socket options */
+	    unsigned int pqlen;		/* partial connection queue length */
+	    unsigned int qlen;		/* connection queue length */
+	    unsigned int qlim;		/* connection queue limit */
+	    unsigned long rbsz;		/* receive buffer size */
+	    unsigned long sbsz;		/* send buffer size */
+# endif	/* defined(HASSOOPT) */
+
+# if	defined(HASSOSTATE)
+	    unsigned int ss;		/* socket state */
+#  if	defined(HASSBSTATE)
+	    unsigned int sbs_rcv;	/* receive socket buffer state */
+	    unsigned int sbs_snd;	/* send socket buffer state */
+#  endif	/* defined(HASSBSTATE) */
+# endif	/* defined(HASSOSTATE) */
+
+# if	defined(HASTCPOPT)
+	    unsigned int topt;		/* TCP options */
+	    unsigned char msss;		/* mss status: 0 = none */
+	    unsigned long mss;		/* TCP maximum segment size */
+# endif	/* defined(HASTCPOPT) */
+
+# if	defined(HASTCPTPIQ)
+	    unsigned long rq;		/* receive queue length */
+	    unsigned long sq;		/* send queue length */
+	    unsigned char rqs;		/* rq status: 0 = none */
+	    unsigned char sqs;		/* sq status: 0 = none */
+# endif	/* defined(HASTCPTPIQ) */
+
+# if	defined(HASTCPTPIW)
+	    unsigned char rws;		/* rw status: 0 = none */
+	    unsigned char wws;		/* ww status: 0 = none */
+	    unsigned long rw;		/* read window size */
+	    unsigned long ww;		/* write window size */
+# endif	/* defined(HASTCPTPIW) */
+
+	} lts;
+	char *nm;
+	char *nma;			/* NAME column addition */
+
+# if	defined(HASNCACHE) && HASNCACHE<2
+	KA_T na;			/* file structure's node address */
+# endif	/* defined(HASNCACHE) && HASNCACHE<2 */
+
+# if	defined(HASNCACHE) && defined(HASNCVPID)
+	unsigned long id;		/* capability ID */
+# endif	/* defined(HASNCACHE) && defined(HASNCVPID) */
+
+# if	defined(HASLFILEADD)
+	HASLFILEADD
+# endif	/* defined(HASLFILEADD) */
+
+# if	defined(HASFSTRUCT)
+	KA_T fsa;			/* file structure address */
+	long fct;			/* file structure's f_count */
+	long ffg;			/* file structure's f_flag */
+	long pof;			/* process open-file flags */
+	KA_T fna;			/* file structure node address */
+# endif	/* defined(HASFSTRUCT) */
+
+	struct lfile *next;
+};
+extern struct lfile *Lf, *Plf;
+
+
+struct lproc {
+	char *cmd;			/* command name */
+ 
+# if	defined(HASSELINUX)
+	char *cntx;			/* security context */
+# endif	/* defined(HASSELINUX) */
+
+	short sf;			/* select flags -- SEL* symbols */
+	short pss;			/* state: 0 = not selected
+				 	 *	  1 = wholly selected
+				 	 *	  2 = partially selected */
+# if	defined(HASEPTOPTS)
+	short ept;			/* end point status -- EPT_* values */
+# endif	/* defined(HASEPTOPTS) */
+
+	int pid;			/* process ID */
+
+# if	defined(HASTASKS)
+	int tid;			/* task ID */
+	char *tcmd;			/* task command name */
+# endif	/* HASTASKS */
+
+	int pgid;			/* process group ID */
+	int ppid;			/* parent process ID */
+	uid_t uid;			/* user ID */
+
+# if	defined(HASZONES)
+	char *zn;			/* zone name */
+# endif	/* defined(HASZONES) */
+
+	struct lfile *file;		/* open files of process */
+};
+extern struct lproc *Lp, *Lproc;
+
+extern int MaxFd;
+extern char *Memory;
+extern int MntSup;
+extern char *MntSupP;
+
+# if	defined(HASPROCFS)
+extern struct mounts *Mtprocfs;
+# endif
+
+extern int Mxpgid;
+extern int Mxpid;
+extern int Mxuid;
+extern gid_t Mygid;
+extern int Mypid;
+extern uid_t Myuid;
+extern char *Namech;
+extern size_t Namechl;
+extern int Ndev;
+
+# if	defined(HASNLIST)
+#  if	!defined(NLIST_TYPE)
+#define	NLIST_TYPE	nlist
+#  endif	/* !defined(NLIST_TYPE) */
+extern struct NLIST_TYPE *Nl;
+extern int Nll;
+# endif	/* defined(HASNLIST) */
+extern long Nlink;
+extern int Nlproc;
+extern char *Nmlst;
+extern int Npgid;
+extern int Npgidi;
+extern int Npgidx;
+extern int Npid;
+extern int Npidi;
+extern int Npidx;
+extern int Npuns;
+extern int Ntype;
+extern int Nuid;
+extern int Nuidexcl;
+extern int Nuidincl;
+
+struct nwad {
+	char *arg;			/* argument */
+	char *proto;			/* protocol */
+	int af;				/* address family -- e.g.,
+					 * AF_INET, AF_INET6 */
+	unsigned char a[MAX_AF_ADDR];	/* address */
+	int sport;			/* starting port */
+	int eport;			/* ending port */
+	int f;				/* find state */
+	struct nwad *next;		/* forward link */
+};
+extern struct nwad *Nwad;
+
+extern int OffDecDig;
+extern char *Pn;
+
+# if	defined(HASFSTRUCT)
+extern struct pff_tab Pff_tab[];	/* file flags table */
+extern struct pff_tab Pof_tab[];	/* process open file flags table */
+# endif	/* defined(HASFSTRUCT) */
+
+# if	defined(HASPROCFS)
+struct procfsid {
+	pid_t pid;			/* search PID */
+	char *nm;			/* search name */
+	unsigned char f;		/* match found if == 1 */
+
+#  if	defined(HASPINODEN)
+	INODETYPE inode;		/* search inode number */
+#  endif	/* defined(HASPINODEN) */
+
+	struct procfsid *next;		/* forward link */
+};
+
+extern int Procfind;
+extern struct procfsid *Procfsid;
+extern int Procsrch;
+# endif	/* defined(HASPROCFS) */
+
+extern int PrPass;
+extern int RptTm;
+extern struct l_dev **Sdev;
+extern int SelAll;
+extern int Selflags;
+extern int SelProc;
+extern int Setgid;
+extern int Selinet;
+extern int Setuidroot;
+extern struct sfile *Sfile;
+extern struct int_lst *Spgid;
+extern struct int_lst *Spid;
+extern struct seluid *Suid;
+extern char *SzOffFmt_0t;
+extern char *SzOffFmt_d;
+extern char *SzOffFmt_dv;
+extern char *SzOffFmt_x;
+extern int TaskCmdLim;
+extern int TaskPrtCmd;
+extern int TaskPrtTid;
+extern int TcpStAlloc;
+extern unsigned char *TcpStI;
+extern int TcpStIn;
+extern int TcpStOff;
+extern unsigned char *TcpStX;
+extern int TcpStXn;
+extern int TcpNstates;
+extern char **TcpSt;
+extern char Terminator;
+extern int TmLimit;
+extern int UdpStAlloc;
+extern unsigned char *UdpStI;
+extern int UdpStIn;
+extern int UdpStOff;
+extern unsigned char *UdpStX;
+extern int UdpStXn;
+extern int UdpNstates;
+extern char **UdpSt;
+
+# if	defined(HASZONES)
+typedef struct znhash {
+	char *zn;			/* zone name */
+	int f;				/* "find" flag (used only in ZoneArg) */
+	struct znhash *next;		/* next zone hash entry */
+} znhash_t;
+extern znhash_t **ZoneArg;
+# endif	/* defined(HASZONES) */
+
+#include "proto.h"
+#include "dproto.h"
+
+#endif	/* LSOF_H */
diff --git a/OLD/lsof1_00DIST b/OLD/lsof1_00DIST
new file mode 100644
index 0000000000000000000000000000000000000000..29122d552b64efb21bb303df1dc3fb61f6d143ea
--- /dev/null
+++ b/OLD/lsof1_00DIST
@@ -0,0 +1,31 @@
+	Notes for the comp.sources.unix distribution of lsof 1.0
+
+Lsof (for LiSt Open Files) lists files opened by processes on selected
+Unix systems.  It is my answer to those who regularly ask me when I am
+going to make fstat (comp.sources.unix volume 18, number 107) or ofiles
+(volume 18, number 57) available on SunOS 4.1.1 or the like.
+
+Lsof is a complete redesign of the fstat/ofiles series, based on the SunOS
+vnode model.  Thus, it has been tested on AIX 3.1.[357], HP-UX [78].x,
+NeXTStep 2.[01], Sequent Dynix 3.0.12 and 3.1.2, and Sunos 4.1 and 4.1.1.
+Using available kernel access methods, such as nlist() and kvm_read(),
+lsof reads process table entries, user areas and file pointers to reach
+the underlying structures that describe files opened by processes.
+
+Lsof interprets most vnode extensions -- cdrnodes, fifonodes, gnodes,
+inodes, rnodes, snodes and tmpnodes.  It understands NFS connections.  It
+recognizes FIFOs, multiplexed files, Unix and Internet sockets.
+
+Lsof accepts options to limit and filter its output.  That output describes
+the process that has opened the file, the command the process is executing,
+the owner of the process, the file descriptor of the file, and the file's
+device, inode number, size and file system name.  Additional special output
+is provided for special files -- e. g., the local and destination Internet
+addresses of Internet socket files.
+
+Lsof may be used and distributed freely, subject to the limited conditions
+described in its source file.
+
+Victor A. Abell
+Purdue University Computing Center
+November 22, 1991
diff --git a/OLD/lsof2_00DIST b/OLD/lsof2_00DIST
new file mode 100644
index 0000000000000000000000000000000000000000..f7177eccd46ce083d4bda89bcff2c1bff2b0356a
--- /dev/null
+++ b/OLD/lsof2_00DIST
@@ -0,0 +1,360 @@
+*********** THIS IS THE FINAL RELEASE OF VERSION 2 OF LSOF. *************
+|									|
+|  Version 3 of lsof is now available.  Look in this directory for:	|
+|									|
+|	lsof_3.<level>.tar.gz						|
+|									|
+| (<level> is the release level, 0 as of 24 May 1994.)			|
+|									|
+| Vic Abell								|
+|									|
+*************************************************************************
+
+		Notes for the distribution of lsof version 2.36
+
+Lsof (for LiSt Open Files) lists files opened by processes on selected UNIX
+systems.  It's my update to fstat (comp.sources.unix volume 18, number 107)
+and ofiles (volume 18, number 57).  A description of the changes lsof has
+undergone to reach its current version is in What's new in Version 2.36?
+					     ---------------------------
+
+Lsof is a complete redesign of the fstat/ofiles series and its closer parent,
+lsof 1.09.  It has been tested on:
+
+      AIX 3.2.[1234]		for the IBM RISC/System 6000
+      BSDI BSD/386 1.0		for PC compatibles
+      EP/IX 2.1.1		for the CDC 4680
+      FreeBSD 1.0e		for PC compatibles
+      HP-UX [789].x		for HP systems (some combinations)
+      IRIX 5.1.1		for SGI systems
+      NetBSD 0.9a		for PC compatibles
+      NeXTStep 2.1, 3.0, 3.1	for NeXT work stations
+      OSF/1 1.[23] and 2.0	for DEC Alpha work stations
+      Sequent Dynix 3.0.12	for the Sequent Symmetry
+      SunOS 4.1.[123]		for Sun 3 and 4
+      SunOS 5.1 (Solaris 2.1)	for Sun 4 systems
+      SunOS 5.3 (Solaris 2.3)	for Sun 4 systems
+      Ultrix 2.2 and 4.2	for DEC work stations
+
+Although it has not been tested on them, lsof will probably work on AIX
+3.1.[357], EP/IX 1.4.3, ETAV 1.17, IRIX 4.0.5, NeXTStep 2.0 and SunOS 4.1.
+(It used to work on those UNIX dialects, but I no longer have access to
+them for testing.)
+
+Using available kernel data access methods -- getproc(), getuser(), kvm_*(),
+nlist(), pstat(), read(), readx() -- lsof reads process table entries, user
+areas and file pointers to reach the underlying structures that describe
+files opened by processes.
+
+Lsof interprets most file node structures -- cdrnodes, devnodes, fifonodes,
+gnodes, High Sierra nodes, inodes, mfsnodes, procnodes, rnodes, snodes,
+specnodes, s5inodes, tmpnodes.  It understands NFS connections.  It
+recognizes FIFOs, multiplexed files, UNIX and Internet sockets.  It knows
+about System V streams.  On many systems it recognizes execution text and
+library references.
+
+Lsof accepts options to limit and filter its output.  That output describes
+the process that has opened the file, the command the process is executing,
+the owner of the process, the file descriptor of the file, and the file's
+access mode, lock status, device, inode number, size or offset, file system
+name and stream head name.  Additional special output is provided for special
+files -- e. g., the local and destination Internet addresses of Internet
+socket files.  (Lsof has a special filter that limits output to the listing
+of Internet socket files having designated protocol usage, host name or
+address, or service name or port.)
+
+Lsof may be used and distributed freely, subject to the limitations described
+in its source files.
+
+What's new in Version 2.36?
+---------------------------
+
+This is a list of the changes that have led to version 2.36.
+
+	*  The version 1.09 sources were reorganized and broken into smaller
+	   files.  There are three header files -- one for includes and
+	   defines, one for function prototypes and a third for machine-
+	   dependent definitions.
+
+	*  Lsof understands some System V platforms: the ETA-10P* running
+	   Release 3.1 and Lachman Associates, Inc. TCP/IP Release 3.0;
+	   Silicon Graphics Indigo systems running IRIX 4.0.5 and 5.1.1;
+	   CDC 4680 systems running EP/IX 1.4.3 and 2.1.1.
+	   
+	*  Lsof has a security compilation option, enabled by defining the
+	   HASSECURITY symbol (e.g., in the Makefile or in machine.h).  When
+	   the security mode is enabled, only the root user may list all
+	   open files; the non-root user may list only open files whose
+	   processes have the same user ID as the real user ID of the lsof
+	   process (the one that its user logged on with).  Lsof is
+	   distributed with the security mode disabled, but there is a
+	   skeleton for defining it in the machine.h header file.
+
+	*  Lsof has a SLOWDEV mode for systems whose /dev directory tree is
+	   deep and whose stat() function is slow.  This mode is activated
+	   with the -T option and prevents lsof from plumbing the depths of
+	   the /dev tree.  When the mode is active, lsof may be unable to
+	   associate /dev path names with all major/minor device number pairs.
+
+	   This mode is enabled for EP/IX 1.4.3, because it takes a minimum
+	   of 27 seconds to stat() all the entries in its /dev tree.  The
+	   mode is no longer needed for EP/IX 2.1.1.
+
+	   Note: at versions 2.07, 2.08 and 2.09, when SLOWDEV was enabled,
+	   the -T option inhibited a full /dev search; at version 2.10 -T
+	   enables a full search.
+
+	*  An attempt has been made to make the lsof sources ANSI C compliant.
+	   Compliance has been tested with the -ansi and -pedantic options of
+	   the NeXTStep gcc compiler.  The compliance changes have been
+	   verified to compile without error on all other available platforms.
+	   However, there may be older platforms or untested ones where the
+	   changes cause compilation errors.
+
+	*  In version 2.09 the timeout handling of stat() calls, particularly
+	   on inaccessible NFS directories, was improved, thanks to a
+	   suggestion from Benson I. Margulies <benson@odi.com>.
+
+	*  In version 2.10 the Margulies stat() timeout suggestion was
+	   significantly extended to handle more systems and situations.
+
+	*  In version 2.11 the interpolation of symbolic links was extended to
+	   directory names, obtained via the getmntent() function, improving
+	   the usability of lsof under HP-UX.
+
+	   Steinar Haug <Steinar.Haug@delab.sintef.no> pointed out the need
+	   for this addition.
+
+	*  At Steinar Haug's suggestion I added the -i network address option
+	   in version 2.12.
+
+	*  At version 2.13 I enhanced network address argument processing
+	   and correctly allocated the user area buffer for swapped DYNIX
+	   processes.
+
+	*  I added a UID cache at version 2.14 to improve speed on systems
+	   with many processes and many users.
+
+	*  I added SunOS support at 2.15 to read the current working directory
+	   and root directory paths, thanks to a hint from Carl Johnson
+	   <carlj@cyclone.bt.co.uk>.
+
+	*  I added SunOS 5.1 (Solaris 2.1) support at version 2.16, thanks to
+	   Dave Curry <davy@ecn.purdue.edu>.
+
+	*  February 24, 1993: I changed Makefile generation to produce more
+	   generic Makefiles.  No source code changes were involved, so the
+	   version number didn't change.
+
+	*  April 12, 1993: at the suggestion of Dave Stevens of the Purdue
+	   University Computing Center <dls@cc.purdue.edu> I added better
+	   support in version 2.17 for raw sockets, especially determining
+	   Internet addresses for applications like ping.  This support is
+	   uneven, because it depends on how a given UNIX OS supports raw
+	   socket addressing.  The changes of version 2.17 have not been
+	   tested on older OS dialects -- e.g., AIX 3.1.x, HP-UX 7.x, etc.
+
+	*  May 11, 1993, version 2.18: in response to a bug report from Greg
+	   Earle <earle@isolar.Tujunga.CA.US>, I added support for Sun High
+	   Sierra file system nodes.  This support allows one to search for
+	   processes using CD-ROM files, for example.  The code has been tested
+	   under Solaris 2.1 and SunOS 4.1.3.
+	   
+	   The High Sierra support code exposed a difficulty with identifying
+	   the major/minor device numbers of some SunOS and Solaris files.  It
+	   seems that both systems will return different major/minor device
+	   numbers for the directory on which a CD-ROM is mounted (e.g.,
+	   /cdrom) and the file system associated with it (e.g., /dev/sr0).
+	   Further, some Solaris device values can't be converted to major/
+	   minor device numbers with the makedev(3) functions; lsof prints
+	   such device values as one hexadecimal number.
+
+	   I fixed a bug in the SGI file pointer scan loop in response to a
+	   report from Dave Olson <olson@anchor.esd.sgi.com>.
+
+	*  May 24, 1993 -- I corrected an incompatibility with AIX 3.2.3. Its
+	   strncpy() is now a built-in and can't be split by a #if.  The fix
+	   was supplied by Scott J. Ellentuch <scoell@stormking.com> and Horst
+	   Luehrsen <Horst.Luehrsen@Informatik.Uni-Erlangen.De>.
+
+	*  July 1, 1993, version 2.19: in response to a request from Jos
+	   Vos <jos@bull.nl>, I added network address to host name and port
+	   number to port name conversions.  I added the -H flag to disable
+	   host name conversion; -P, port name.
+
+	*  July 22, 1993, version 2.19: at NeXTStep 3.1 it is no longer
+	   possible to use the -ansi and -pedantic compiler flags to check for
+	   ANSI C compliance.  The flags cause compilation errors in system
+	   header files.  The Makefile for NeXTStep 3.1, Makefile.next31,
+	   reflects this sad fact.
+
+	*  August 13, 1993, version 2.20: I added code for SunOS to skip
+	   automountable file systems that are not mounted.  The change was
+	   suggested by Dominique Petitpierre <petitp@divsun.unige.ch>.
+
+	   I shifted ANSI C conformance testing to gcc 2.3.3 under SunOS 4.1.3,
+	   because of system header file problems under NeXTStep 3.1.  The
+	   CDEFS macro for gcc is:
+
+		CDEFS=  -ansi -Dsun
+
+	*  August 17, 1993, version 2.21: I added code to display SunOS and
+	   Solaris text file usage.  I added code to handle readlink() and
+	   stat() deadlocks better, including the new options "-m" and "-S t".
+
+	*  September 10, 1993, version 2.22: I updated CLONEMAJ and N_UNIX
+	   definitions for SunOS 5.1 (Solaris 2.1) per information received
+	   from Casper Dik <casper@fwi.uva.nl>.
+
+	*  September 16, 1993, version 2.23: I updated EP/IX support to OS
+	   version 2.1.1.  Theoretically the EP/IX 1.4.3 support should still
+	   work, provided the Makefile has "-D_EPIXV=10403".
+
+	   The SLOWDEV definition was removed for EP/IX 2.1.1.  It remains
+	   27 for EP/IX 1.4.3.
+
+	*  October 14, 1993, version 2.24: I completely revised the breaking
+	   of NFS deadlocks in response to a discovery that the AIX 3.2.4
+	   lstat() call can only be broken with a SIGKILL.  Lsof now does
+	   system calls that have NFS deadlock potential -- lstat() and
+	   readlink() -- in a child process, retrieving the output via a
+	   pipe, limiting the read via a SIGALRM, and stopping a deadlocked
+	   child process with a SIGKILL.
+
+	   Version 2.24 has a correction that makes it possible to search
+	   for EP/IX 2.1.1 files by name.
+
+	*  October 20, 1993, version 2.25: I added code, provided by John
+	   Silva <johns@hpwarf.wal.hp.com>, that prints HP-UX [89].x text and
+	   memory region nodes.  The -L option was enabled for HP-UX [89].x
+	   to allow the printing of duplicate text and memory region nodes.
+
+	   I added rudimentary support for HP-UX [89].x link level access
+	   files.
+
+	   I removed a trailing `/' from path arguments longer than one
+	   character to make file system name matching possible.  The bug was
+	   reported by John Silva <johns@hpwarf.wal.hp.com>.
+
+	   I made yet another correction to make it possible to search for
+	   EP/IX 2.1.1 files by name and file system.
+
+	   I corrected some serious omissions and bugs in the version 2.24
+	   deadlock breaking code.  A close() and wait() were missing, and
+	   the child process was using exit() instead of _exit().  The
+	   problems only seemed to bother the Solaris version of lsof.
+
+	*  November 14, 1993, version 2.26: I added support for SGI IRIX 5.1.1,
+	   thanks to much help from Dave Olson <olson@anchor.esd.sgi.com>.
+	   There are now separate Makefiles for IRIX 4.0.5 and 5.1.1.
+
+	   All user ID references are now type cast uid_t to correct problems
+	   in the UID cacheing algorithm, used by printuid() in print.c.
+
+	*  December 2, 1993, version 2.27: I added changes for SunOS 5.3
+	   (Solaris 2.3) to display socket information correctly, courtesy of
+	   Casper Dik <casper@fwi.uva.nl>.  Kernel structures for SunOS 5.3
+	   sockets whose connections originate locally no longer contain the
+	   local network address -- hence lsof displays * for the INADDR_ANY
+	   value they do contain.
+
+	   I added support for CCITT x.25 sockets under HP-UX 8.x and
+	   (presumably) 9.x, courtesy of Pasi Kaara <Pasi.Kaara@atk.tpo.fi>.
+	   Pasi also helped find a couple bugs in the HP-UX [89].x handling
+	   of virtual file system names.
+
+	*  December 20, 1993 (no version number change): I added display of
+	   x.25 socket's PCB.  I changed the Solaris Makefile to use the GID
+	   for sys.  I added fix to allow IRIX 4.0.5 usage, based on bug report
+	   and testing by Brian Silver <silver@ctron.com>.
+
+	*  January 11, 1994, version 2.28: I ported lsof to OSF/1 1.[23] for
+	   the DEC Alpha.  Anthony Baxter <anthony.baxter@aaii.oz.au>, Dwight
+	   McKay <mckay@gimli.bio.purdue.edu>, and Jeffrey Mogul
+	   <mogul@pa.dec.com> gave generous assistance.  Dwight provided the
+	   test system; Anthony and Jeffrey advised on OSF/1 matters.
+
+	*  January 26, 1994, version 2.29; I ported lsof to OSF/1 2.0 for the
+	   DEC Alpha.  Axel Clauberg <clauberg@rrz.uni-koeln.de> and Claus
+	   Kalle <kalle@rrz.uni-koeln.de> graciously provided a test system.
+	   Axel provided a critical clue to the organization of the
+	   <sys/proc.h> header file that enabled me to accomplish this port.
+
+	*  February 12, 1994, version 2.30: I ported lsof to Ultrix 2.2 and
+	   4.2 for DEC work stations.  The system to which the 2.2 port was
+	   directed is a local one that has been extensively updated with
+	   4.3BSD{Tahoe,Reno} network features, so it may not match a
+	   standard 2.2 system, if there is any such system still in use.
+
+	   Terry Friedrichsen <terry@venus.sunquest.com>, Dwight McKay
+	   <mckay@gimli.bio.purdue.edu>, and Jeffrey Mogul
+	   <mogul@pa.dec.com> gave generous assistance.  Dwight provided the
+	   test system; Jeff and Terry advised on Ultrix matters.
+
+	*  February 17, 1994, version 2.31: this is a bug fix release.  It
+	   includes fixes to:
+
+	   o  Allow specifying more than one file or file system argument;
+
+	   o  Display correct SunOS 4.x VCHR inode numbers -- e.g., /dev/kmem,
+	      /dev/console -- and allow searching for them by name in versions
+	      of SunOS older than 4.1.3;
+
+	   o  Search for OSF/1 /dev/ptyp? files by name, even though there is
+	      no inode number in the kernel open file structures for these
+	      files that corresponds to the inode number available from the
+	      stat() function call.
+	      
+	      Terry Friedrichsen <terry@venus.sunquest.com> reported this bug.
+	      Jeffrey Mogul <mogul@pa.dec.com> provided conclusive evidence
+	      that the inode number does not exists in the kernel open file
+	      structures.
+
+	*  February 25, 1994, version 2.32: I ported lsof to BSDI BSD/386 1.0,
+	   FreeBSD 1.0e, and NetBSD 0.9a for PC compatibles.
+
+	   Bill Bormann <bormann@vm.cc.purdue.edu> provided the FreeBSD test
+	   platform.  Dave Stevens <dls@mace.cc.purdue.edu> provided the
+	   BSDI BSD/386 test platform.
+
+	   Sean McDermott <spm@staff.cc.purdue.edu> did the NetBSD 0.9a
+	   testing.
+
+	   I added code to the handling of NFS deadlocks to time out the wait
+	   for a child process to complete.  The time-out is accompanied by a
+	   warning that the child process may be hung.
+
+	   I fixed a few minor OSF/1 bugs.
+
+	   I corrected an #if test that made it impossible to compile misc.c
+	   under IRIX 4.0.5.  Bob Mende Pie <mende@piecomputer.rutgers.edu>
+	   supplied the correction.
+
+	*  March 10, 1994, version 2.33: I added ADVFS/MSFS file system support
+	   for DEC OSF/1 1.3a.  This has not been tested under versions 1.2
+	   or 2.0 of DEC OSF/1.
+
+	   Achim Bohnet <ach@mpe-garching.mpg.de> and Bernt Christandl
+	   <beb@mpe-garching.mpg.de> graciously provided test time on a 1.3a
+	   system with the ADVFS/MSFS layered file system product.
+
+	   I fixed a Solaris 2.[13] bug that prevented proper lookup of socket
+	   streams.  Steve Kirsch <stk@infoseek.com> reported the bug and
+	   graciously provided test time for locating and fixing it.
+
+	*  April 13, 1994, version 2.34: I fixed some minor bugs, including:
+	   using Purdue DYNIX's /etc/passwd stay-open mode; handling an
+	   empty /etc/services file without causing a segmentation fault;
+	   handling Unix domain sockets consistently; eliminating an IRIX
+	   reference to a virtual memory region pointer that is obsolescent.
+
+	*  April 19, 1994, version 2.35: I extended the /etc/passwd stay-open
+	   mode handling to another Purdue dialect: Ultrix 2.2.
+
+	*  May 2, 1994, version 2.36: a child process, blocked by NFS, is now
+	   sent both the SIGINT and the SIGKILL signals in an attempt to
+	   terminate it.  David DiGiacomo <dd@mv.us.adobe.com suggested this.
+
+Victor A. Abell <abe@cc.purdue.edu>
+Purdue University Computing Center
+May 24, 1994
diff --git a/OLD/lsof3_00DIST b/OLD/lsof3_00DIST
new file mode 100644
index 0000000000000000000000000000000000000000..4fee99f493f551a32e0c725dfffc2234504ab42c
--- /dev/null
+++ b/OLD/lsof3_00DIST
@@ -0,0 +1,2460 @@
+
+	    Notes for the distribution of lsof version 3
+
+********************************************************************
+| The latest release of lsof is always available via anonymous ftp |
+| from vic.cc.purdue.edu.  Look in pub/tools/unix/lsof.            |
+********************************************************************
+
+		Contents
+
+	    Dialects Supported
+	    How Lsof Works
+	    Lsof Output
+	    Getting Started Quickly
+	    Limiting, Filtering, and Selecting Lsof Output
+	    Parsing Lsof Output with Another Program
+	    Repeat Mode
+	    Distribution Restrictions
+	    Cautions
+	    Distribution Contents
+	    Warranty
+	    Bug Reports
+	    What's new in Version 3
+	    Version 3 Release Notes
+		3.0,  May 24, 1994
+		3.01, May 27, 1994
+		3.02, June 2, 1994
+		3.03, July 8, 1994
+		3.04, July 15, 1994
+		3.05, July 26, 1994
+		3.06, September 2, 1994
+		3.07, September 8, 1994
+		3.08, September 23, 1994
+		3.09, October 18, 1994
+		3.10, October 21, 1994
+		3.11, October 28, 1994
+		3.12, October 29, 1994
+		3.13, November 11, 1994
+		3.14, November 16, 1994
+		3.15, November 25, 1994
+		3.16, December 2, 1994
+		3.17, January 25, 1994
+		3.18, January 31, 1995
+		3.19, February 10, 1995
+		3.20, February 23, 1995
+		3.21, March 3, 1995
+		3.22, March 9, 1995
+		3.23, March 24, 1995
+		3.24, March 31, 1995
+		3.25, April 5, 1995
+		3.26, April 20, 1995
+		3.27, May 2, 1995
+		3.28, May 26, 1995
+		3.29, June 2, 1995
+		3.30, June 8, 1995
+		3.31, June 16, 1995
+		3.32, June 23, 1995
+		3.33, June 28, 1995
+		3.34, June 30, 1995
+		3.35, July 9, 1995
+		3.36, July 20, 1995
+		3.37, July 27, 1995
+		3.38, August 3, 1995
+		3.39, August 10, 1995
+		3.40, August 25, 1995
+		3.41, September 5, 1995
+		3.42, September 7, 1995
+		3.43, September 12, 1995
+		3.44, September 19, 1995
+		3.45, September 20, 1995
+		3.46, October 5, 1995
+		3.47, October 16, 1995
+		3.48, October 20, 1995
+		3.49, October 25, 1995
+		3.50, October 31, 1995
+		3.51, November 8, 1995
+		3.52, November 27, 1995
+		3.53, December 8, 1995
+		3.54, December 15, 1995
+		3.55, December 21, 1995
+		3.56, January 2, 1996
+		3.57, January 12, 1996
+		3.58, February 7, 1996
+		3.59, February 21, 1996
+		3.60, February 27, 1996
+		3.61, March 9, 1996
+		3.62, March 26, 1996
+		3.63, April 11, 1996
+		3.64, April 26, 1996
+		3.65, May 20, 1996
+		3.66, June 19, 1996
+		3.67, July 1, 1996
+		3.68, July 17, 1996
+		3.69, July 30, 1996
+		3.70, August 9, 1996
+		3.71, August 15, 1996
+		3.72, August 28, 1996
+		3.73, September 5, 1996
+		3.74, September 6, 1996
+		3.75, September 9, 1996
+		3.76, September 21, 1996
+		3.77, October 2, 1996
+		3.78, October 14, 1996
+		3.79, October 29, 1996
+		3.80, November 8, 1996
+		3.81, November 14, 1996
+		3.82, December 11, 1996
+		3.83, December 30, 1996
+		3.84, January 13, 1997
+		3.85, January 17, 1997
+		3.86, January 30, 1997
+		3.87, February 11, 1997
+		3.88, February 17, 1997
+
+
+Dialects Supported
+==================
+
+Lsof (for LiSt Open Files) lists files opened by processes on
+selected Unix systems.  It's a major revision of lsof version 2,
+and has been tested on:
+
+    AIX 3.2.5, 4.1[.[1234]],	the IBM RISC/System 6000
+	and 4.2
+    BSDI BSD/OS 2.0, 2.0.1,	Intel-based systems
+	and 2.1
+    DC/OSx 1.1			Pyramid systems
+    EP/IX 2.1.1			the CDC 4680
+    FreeBSD 1.1.5.1, 2.0, 	Intel-based systems
+	2.0.5, 2.1, 2.1.5,
+	2.2, and 3.0
+    HP-UX 8.x, 9.x, 10.01,	HP systems (some combinations)
+	10.10, and 10.20
+    IRIX 5.2, 5.3, 6.0, 6.0.1,	SGI systems
+	and 6.[1234]
+    Linux through 2.0		Intel-based systems
+    NetBSD 1.0, 1.1, and 1.2	Intel and SPARC-based systems
+    NEXTSTEP 2.1 and 3.[0123]	all NEXTSTEP architectures
+    OpenBSD 1.2 and 2.0		Intel-based systems
+    OSF/1 2.0, 3.0, 3.2, and	the DEC Alpha
+	4.0-BETA
+    Reliant UNIX 5.43		Pyramid systems
+    RISC/os 4.52		MIPS R2000-based systems
+    SCO OpenServer 1.1, 3.0,	Intel-based systems
+	and 5.[024]
+    SCO UnixWare 2.1 and 2.1.1	Intel-based systems
+    Sequent PTX 2.1.[1569], 	Sequent systems
+	4.0.[23], 4.1.[024],
+	4.2[.1], and 4.3
+    Solaris 2.[123456], 2.5.1,	 Sun 4 and i86pc systems
+	and 2.6-Beta
+    SunOS 4.1.[1234]		Sun 3 and 4
+    Ultrix 4.2, 4.3, 4.4,	DEC RISC and VAX
+	and 4.5
+
+(The pub/tools/unix/lsof/contrib directory on vic.cc.purdue.edu
+contains information on other ports.)
+
+If your favorite Unix dialect is not in the list, or if your version
+of it is more recent than the ones listed, please contact me at
+<abe@vic.cc.purdue.edu>.
+
+
+How Lsof Works
+==============
+
+Using available kernel data access methods -- getproc(), getuser(),
+kvm_*(), nlist(), pstat(), read(), readx(), /proc -- lsof reads
+process table entries, user areas and file pointers to reach the
+underlying structures that describe files opened by processes.
+
+Lsof interprets most file node structures -- advfsnodes, autonodes,
+cnodes, cdrnodes, devnodes, fifonodes, gnodes, hsnodes, inodes,
+mfsnodes, pcnodes, procnodes, rnodes, snodes, specnodes, s5inodes,
+tmpnodes.  It understands NFS connections.  It recognizes FIFOs,
+multiplexed files, Unix and Internet sockets.  It knows about
+streams.  It understands /proc file systems for some dialects.  On
+many dialects it recognizes execution text and library references.
+It knows about AFS on some Unix dialects.
+
+
+Lsof Output
+===========
+
+The lsof output describes:
+
+    * the identification number of the process (PID) that has opened
+      the file;
+
+    * the process group identification number (PGRP) of the process
+      (optional);
+
+    * the process identification number of the parent process (PPID)
+      (optional);
+
+    * the command the process is executing;
+
+    * the owner of the process;
+
+    * for all files in use by the process, including the executing
+      text file and the shared libraries it is using:
+
+      * the file descriptor number of the file, if applicable;
+
+      * the file's access mode;
+
+      * the file's lock status;
+
+      * the file's device numbers;
+
+      * the file's inode number;
+
+      * the file's size or offset;
+
+      * the name of the file system containing the file;
+
+      * any available components of the file's path name;
+
+      * the names of the file's stream components;
+
+      * the file's local and remote network addresses;
+
+      * other file or dialect-specific values.
+
+
+Getting Started Quickly
+=======================
+
+If you want to get started using lsof quickly, or see some examples
+of how lsof can be used, consult the 00QUICKSTART file of the lsof
+distribution.
+
+The 00QUICKSTART file won't help you build or install lsof, but it
+will cut through the density of the lsof man page, giving you more
+readily an idea of what you can do with lsof.
+
+For information on building and installing lsof, consult the 00README
+file of the lsof distribution.
+
+
+Limiting, Filtering, and Selecting Lsof Output
+==============================================
+
+Lsof accepts options to limit, filter, and select its output.
+These are the possible criteria:
+
+    * Process ID (PID) number -- to list the open files for a given
+      process;
+
+    * Process Group ID (PGRP) -- to list the open files for all
+      the processes of a given process group;
+
+    * User ID number or login name -- to list the open files for
+      all the processes of a given user;
+
+    * Internet address -- to list the open files using a given
+      Internet address (host name), protocol, or port (number or
+      name); or to list all open Internet files;
+
+    * command name;
+
+    * file descriptor name or number;
+
+    * list all open NFS files;
+
+    * list all open Unix domain socket files;
+
+    * list all uses of a specific file;
+
+    * list all open files on a file system.
+
+Selection options are normally ORed -- i.e., an open file meeting
+any of the criteria is listed.  The selection options may be ANDed
+so that an open file will be listed only if it meets all the
+criteria.
+
+In the absence of any selection criteria, lsof lists files open to
+all processes.
+
+
+Parsing Lsof Output with Another Program
+========================================
+
+The lsof -F option directs it to produce "field" output that can
+easily be parsed by another program.  The lsof distribution contains
+sample awk, perl 4, and perl 5 scripts in its scripts subdirectory
+that show how to post-process field output.
+
+
+Repeat Mode
+===========
+
+Lsof can be directed to produce output, delay for a specified time,
+then repeat the output, cycling until stopped by an interrupt or
+quit signal.  This mode is useful for monitoring the status of some
+file operation -- e.g., an ftp transfer or a tape backup operation.
+
+Repeat mode is more efficient when combined with lsof's selection
+options, since they limit lsof overhead.
+
+It's possible to use lsof's field output options to supply repeat
+mode output to another process for its manipulation.  The scripts
+subdirectory of the lsof distribution has sample Perl scripts
+showing how to consume lsof repeat mode output from a pipe.
+
+
+Distribution Restrictions
+=========================
+
+Lsof may be used and distributed freely, subject to these limitations:
+
+1. Neither the author nor Purdue University is responsible for
+   any consequences of the use of this software.
+
+2. The origin of this software must not be misrepresented, either
+   by explicit claim or by omission.  Credit to the author and
+   Purdue University must appear in documentation and sources.
+
+3. Altered versions must be plainly marked as such, and must not
+   be misrepresented as being the original software.
+
+4. This notice may not be removed from or altered in the lsof source
+   files.
+
+
+Cautions
+========
+
+Lsof is a tool that is closely tied to the Unix operating system
+version.  It uses header files that describe kernel structures and
+reads kernel structures that typically change from OS version to
+OS version.
+
+DON'T TRY TO USE AN LSOF BINARY, COMPILED FOR ONE UNIX OS VERSION,
+ON ANOTHER.
+
+On some Unix dialects, notably SunOS and Solaris, lsof versions
+may be even more restricted by architecture type.  An lsof binary,
+compiled for SunOS 4.1.3 on a sun4c machine, for example, won't
+work on a sun4m machine.  Although I have no evidence that they
+exist, the potential for similar restrictions exists in Solaris
+versions of lsof.
+
+AN LSOF BINARY, COMPILED FOR ONE SOLARIS ARCHITECTURE, ISN'T
+GUARANTEED TO WORK ON A DIFFERENT SOLARIS ARCHITECTURE.
+
+
+Distribution Contents
+=====================
+
+The lsof distribution is checked for completeness when it is
+constructed and by the Inventory script when you run the Configure
+script.  (See The Inventory Script section of the 00README file of
+this distribution.)
+
+If you're worried you don't have everything, run the Inventory
+script.  Here's aan approximate picture of what you should have:
+
+lsof_<version>:
+
+   00CREDITS    00PORTING     Customize  lsof_fields.h  proc.c
+   00DCACHE     00QUICKSTART  Inventory  main.c         proto.h
+   00DIST       00README      arg.c      misc.c         scripts/
+   00FAQ        AFSConfig     dialects/  node.c         store.c
+   00MANIFEST   Configure     lsof.h     print.c        version
+   
+lsof_<version>/dialects:
+
+  aix/       epix/      linux/     osf/      riscos/  sun/
+  bsdi/      freebsd/   netbsd/    ptx/      sco/     ultrix/
+  common/    hpux/      next/      pyramid/  sgi/     unixware/
+
+lsof_<version>/dialects/common:
+
+  00Manifest  dvch.frag   lkud.frag   prtf.frag   rnam.frag
+  ckfa.frag   fchi.frag   pcdn.frag   rdev.frag   rnch.frag
+  cvfs.frag   isfn.frag   prfp.frag   rmnt.frag   rvfs.frag
+
+Specific dialects sub-directories may differ slightly, depending
+on the needs of the dialect, but they should all contain:
+
+lsof_<version>/dialects/next:
+
+  Makefile  ddev.c   dlsof.h  dnode.c  dproto.h  dstore.c
+  Mksrc*    dfile.c  dmnt.c   dproc.c  dsock.c   machine.h
+
+lsof_<version>/scripts:
+
+  00MANIFEST          count_pf.perl*      list_fields.awk
+  00README            count_pf.perl5*     list_fields.perl*
+  big_brother.perl5   list_NULf.perl5*    watch_a_file.perl*
+
+
+Warranty
+========
+
+Lsof is provided as-is without any warranty of any kind, either
+expressed or implied, including, but not limited to, the implied
+warranties of merchantability and fitness for a particular purpose.
+The entire risk as to the quality and performance of lsof is with
+you.  Should lsof prove defective, you assume the cost of all
+necessary servicing, repair, or correction.
+
+
+Bug Reports
+===========
+
+Now that the obligatory disclaimer is out of the way, let me hasten
+to add that I accept lsof bug reports and try hard to respond to
+them.  I will also consider and discuss requests for new features,
+ports to new dialects, or ports to new OS versions.
+
+PLEASE DON'T SEND A BUG REPORT ABOUT LSOF TO THE UNIX DIALECT
+VENDOR.
+
+At worst such a bug report will confuse the vendor; at best, the
+vendor will forward the bug report to me.
+
+Please send all bug reports, requests, etc. to me via email at
+<abe@purdue.edu>.
+
+
+What's new in Version 3
+=======================
+
+I had three goals in mind for version 3:
+
+    1.	Make it faster.
+
+	Lsof 3 defers as many lookup operations -- /dev scan, mount
+	table scan, /etc/services scan -- until they're needed.
+
+	I used prof on lsof and used its information to reduce lsof's
+	overhead.
+
+    2.  Make it easier to maintain and port to other systems, and
+	eliminate complicated nestings of #if/#else/#endif
+	pre-processor statements.
+
+    3.	Add a few features:
+
+	o  ANDing of options;
+
+	o  Sorting of output by Process ID;
+
+	o  Searching for Unix domain sockets by name -- to a limited
+	   extent.
+
+	o  Process group ID support.  (This was a late addition.)
+
+As a result of goal 2, the organization of lsof version 3 differs
+greatly from version 2.  The main directory contains totally common
+functions, a dialect subdirectory contains subdirectories of code
+specific to each Unix dialect that is supported.  There is also a
+dialects/common subdirectory that contains code fragments that are
+used by more than one, but not all dialects.
+
+A top-level Configure script constructs the complete set of sources
+for a given dialect and the Makefile at the top-level.  Configure
+is self-documenting.  When it is finished, Configure calls a second
+script, Customize, that assists with the modification of a few
+important compile-time options.
+
+
+Version 3 Release Notes
+=======================
+
+3.0		May 24, 1994
+		This is the first official release of lsof 3.
+
+3.01		May 27, 1994
+		Corrected the #ifdef condition for HASPWSTAYOPEN
+		under Sequent Dynix 3.0.12.
+
+		Fixed bug that prevented the display of current
+		working and root directory path names under SunOS
+		4.1.x, even when the user area contained pointers
+		to them.
+
+		Changed the strategy for allocating space to the
+		local proc table in EP/IX, NEXTSTEP, Solaris, and
+		SunOS.
+
+		Closed the distance between reading the Solaris
+		proc structure and its companion pid structure in
+		an effort to avoid using a stale pid structure
+		pointer.  A stale pid structure pointer sometimes
+		causes a segmentation violation in kvm_read().
+
+		Added code to the SunOS kread() function to filter
+		out non-kernel addresses that might lead kvm_read()
+		to a segmentation violation.  The Configure script
+		was updated to create a header file, kernelbase.h,
+		with the necessary kernel memory boundary value;
+		and to remove the header file when the -clean option
+		is specified.  The Configure script now passes the
+		target name to the Mksrc shell script.  It's used
+		by sun/Mksrc to determine the source for kernelbase.h.
+
+3.02		June 2, 1994
+		Added #if's to of kernelbase.h for Solaris and
+		SunOS.  This eliminates a redeclaration complaint
+		from old versions of SunOS.
+
+		Added code to process_file() in all dialects to
+		display "no more information" when f_count in the
+		file structure is zero.
+
+3.03		July 8, 1994
+		Added support for displaying process group IDs.
+		This includes two new options: -j to select PGRP
+		display; and -g<list> to specify a list of PGRPs
+		whose files are to be displayed.  (-j was chosen
+		to match a similar option in some ps(1)'s.)
+
+		Philippe-Andre Prindeville <philipp@res.enst.fr>
+		suggested this addition.
+
+3.04		July 15, 1994
+		Corrected handling of port name component of -i
+		option on systems where htons() is required.
+
+		Corrected casting of UID arguments -- needed when
+		UID is a short and the compiler wants the minimum
+		argument size to be larger.
+
+3.05		July 26, 1994
+		Added printing of DECnet socket information for
+		the Ultrix 4.2 and 4.3 dialects.  John Beacom
+		<beacom@wisnud.physics.wisc.edu> kindly provided
+		the test system.  A new Configure abbreviation,
+		ultrix42dn, must be used to activate the DECnet
+		support.
+
+3.06		September 2, 1994
+		The major news in this revision are the V/88 R32V3
+		and R40V4.2 ports for Motorola M88K systems.  Chance
+		Neale <cneale@panix.com> kindly provided test systems
+		and Mike Feldman <feldman@charm.urbana.mcd.mot.com>
+		provided technical assistance.
+
+		Version 3.06 contains other, minor modifications:
+
+		*  The Configure script has been isolated from the
+		   environment, thanks to a report of a CC=xlc
+		   problem from Johnny Tolliver <jxt@ca04.cad.ornl.gov>.
+		   Johnny also suggested a better form for the install
+		   commands in the Makefile's install rule.  This
+		   change affected all the dialect Mksrc scripts.
+
+		   A new HP-UX abbreviation (hpuxx25) was added
+		   for systems that have the /etc/conf/x25 include
+		   files.  The old HP-UX abbreviation (hpux) no
+		   longer references /etc/conf or defines HPUX_CCITT.
+
+		*  The command "lsof `tty`" now works most places (maybe
+		   not always for SGI IRIX, but I tried) thanks to a bug
+		   report from Casper Dik <casper@fwi.uva.nl>.
+
+		*  A mode has been added to disable forking when
+		   debugging.  The V/88 R40V4.2 debugger needed that.
+
+		*  Printing of stream NAMEs was standardized (IRIX
+		   was different) and an attempt was made to avoid
+		   stream NAMEs like /dev/ttyx4->/dev/ttyx4.
+		
+		*  A new documentation file, 00FAQ, accompanies the
+		   distribution.  It contains frequently asked
+		   questions about lsof, and the best answers I can
+		   manage to give.
+
+		*  I have a new HP-UX test system, courtesy of Dave
+		   Curry <davy@ecn.purdue.edu> and George Goble
+		   <ghg@ecn.purdue.edu> of Purdue's Engineering Computer
+		   Network.  I want to thank J. Nelson Howell
+		   <nelson@zeus.mgmt.purdue.edu> of Purdue's School of
+		   Management for his prior support of lsof development
+		   under HP-UX.
+
+3.07		September 8, 1994
+		This revision contains a small security enhancement.
+		Tim Ramsey <tar@ksu.ksu.edu> pointed out that lsof's
+		setgid or setuid power might allow it's user to
+		read an alternate kernel name list or memory file
+		via the -c and -k options that the real UID might
+		not have authority to read.  In revision 3.07 lsof
+		uses access(2) to check the real UID's authority
+		to read files named with -c and -k.
+
+3.08		September 23, 1994
+		This revision contains support for Novell's UnixWare,
+		versions 1.1, 1.1.1, and 1.1.2.  Peter Lord
+		<plord@novell.co.uk> made this possible by providing
+		a copy of UnixWare and supplying technical advice.
+		Binaries and sources for this version will be
+		available from Novell sources.  See the Novell
+		UnixWare section of the distribution's 00README
+		file for details.
+
+		This version adds /proc file system support to the
+		dialects derived from SYSV R4 (except EP/IX 2.1.1):
+		FreeBSD, IRIX 5.2, Solaris, UnixWare, and V/88
+		R40V4.2.
+
+		This version compiles under IRIX 4.0.5 again,
+		correcting a problem introduced at version 3.06 in
+		the "lsof `tty`" fix.
+
+		HP-UX now skips file systems whose mount type is
+		"ignore".  The presence of the -c option is now
+		controlled by the HASCOPT definition in machine.h.
+		The HASSWAPPORT option is now documented and
+		implemented correctly.  Hans Petter Christiansen
+		<hpchr@dxcern.cern.ch> suggested these changes.
+
+3.09		October 18, 1994
+		This revision recognizes the DEC Alpha OSF/1 V3.0,
+		IBM AIX 4.1, and Solaris 2.4 dialects.  It has
+		support for the SunOS 4.1.3 PC file system and two
+		bug fixes: an IRIX, V/88, and Solaris file argument
+		processing bug; and a V/88 include error.
+
+		Alex Kreis <akreis@us.oracle.com> made the initial
+		request for DEC OSF/1 V3.0 support and provided
+		help with testing.  Ron Young <ron@screamer.nevada.edu>
+		graciously provided a test host.  James Woodward
+		<woodward@zk3.dec.com> provided invaluable clues
+		to V3.0 kernel organization.  Others who read the
+		alpha-osf-managers mailing list made generous offers
+		of test facilities, and I thank them, too.  The
+		decosf3 abbreviation was added to the Configure
+		script, and the script was modified to request the
+		name of the system configuration subdirectory of
+		/sys where the configuration-specific header files
+		reside for the decosf1, decosf2, and decosf3
+		configuration abbreviations.
+
+		Mark Peek <mark_peek@taligent.com> provided and
+		tested the AIX 4.1 changes.
+
+		Casper Dik <casper@fwi.uva.nl> provided and tested
+		the Solaris 2.4 changes.
+
+		Friedel Loinger <friedel@wise.tau.ac.il> suggested
+		the addition of support for the SunOS 4.1.3 PC file
+		system ("pcfs").
+
+		Andreas Stolcke <stolcke@ICSI.Berkeley.EDU> supplied
+		a fix to a file argument processing bug that causes
+		lsof to crash when supplied the path of an NFS
+		mounted file.  The bug affects lsof versions for
+		Motorola V/88 R40V4.2, SGI IRIX 5.2, and Solaris
+		2.[123].
+
+		Corrected an error in the path to include prdata.h
+		in dlsof.h for Motorola V/88 R40V4.2.
+
+3.10		October 21, 1994
+		This revision adds support for the cache and PC file
+		systems to Solaris.  It fixes these bugs: a problem
+		with the display of Motorola V/88 R40V4.2 device
+		numbers; and a failure of Readlink() to resolve
+		symbolic links completely in all cases.
+
+		Some major internal restructuring was necessary to
+		be able to display negative inode numbers for SunOS
+		PC file system nodes, while displaying them as
+		unsigned numbers for Solaris, hence all dialect
+		versions were affected.
+
+3.11		October 28, 1994
+		This revision adds support for Linux version 1.0.9.
+		Tim Korb <jtk@arthur.cs.purdue.edu> kindly provided
+		a development system in the Computer Science
+		Department at Purdue.  It is likely that the Linux
+		revision will have to be adjusted for each installation,
+		and it is probable that this revision will not run
+		under later versions of Linux.  See the 00FAQ and
+		00REAME files for more information on Linux tuning.
+
+3.12		October 29, 1994
+		This revision supports Linux version 1.1.47 -- the
+		Yggdrasil Plug-and-Play Linux Fall '94 release.
+		Both Linux versions now obtain kernel symbol
+		addresses from the /zSystem.map file.
+
+		November 4, 1994
+		Hendrik G. Seliger <hank@Blimp.automat.uni-essen.de>
+		reports that lsof compiles and seems to work under
+		Linux 1.1.61.  He used the linux1147 Configure
+		abbreviation.  Marty Leisner <leisner@sdsp.mc.xerox.com>
+		reports that the linux1147 Configure abbreviation
+		produces a working lsof for Linux 1.1.64, too.
+
+3.13		November 11, 1994
+		This revision contains Pyramid DC/OSx support, provided
+		by Anthony Shortland <Anthony.Shortland@FMR.com>.
+
+		Marty Leisner <leisner@sdsp.mc.xerox.com> reported
+		a segmentation violation failure in Linux lsof.
+		In response I changed its task structure access to
+		use /dev/kmem instead of mmap'ing kernel memory.
+		This avoids a possible segmentation violation when
+		bad pointers are obtained from kernel memory.  I
+		also enabled the setting of Linux INET and Unix
+		select flags so that the -n and -U options work --
+		I forgot to do that when I did the Linux port.
+
+		Marty Leisner reports that the lunix1147 Configure
+		abbreviation produces a working lsof for Linux
+		1.1.64, too.
+
+		Francois Pindard <pinard@iro.umontreal.ca> provided
+		a correction to the Linux install rule.
+
+3.14		November 16, 1994
+		This revision adjusts the Configure script stanzas
+		for DEC OSF/1, Motorola V/88, Pyramid DC/OSx, and
+		Ultrix.  It also contains additional support for
+		DC/OSx and Ultrix.
+
+		Bruce Beare <bjb@pyramid.com> and Robert Vernon
+		<bob@pyramid.com.au> helped me understand Pyramid
+		nomenclature.  Robert Vernon provided DC/OSx support
+		for the RxFS file system and added machine series
+		auto-detection to the Configure script. Alex Podlecki
+		<a.podlecki@att.com> helped test the updated DC/OSx
+		distribution.
+
+		Chris Timmons <skynyrd@tahoma.cwu.edu> provided
+		information on RISC and VAX Ultrix 4.4 that led to
+		correct prefixing of nlist() names.  I updated the
+		Configure script to detect Ultrix version, machine
+		hardware type, and the presence of DECnet support.
+
+		I also updated the OSF/1 and V/88 Configure scripts
+		to determine configuration parameters automatically.
+
+3.15		November 25, 1994
+		Corrected DEC OSF/1 V2.0 support of the ADVFS file
+		system.
+
+		Bernt Christandl <beb@mpe-garching.mpg.de> and Alex
+		Kreis <akreis@us.oracle.com> helped test.  No OSF/1
+		V1.x system with ADVFS was available for testing.
+
+3.16		December 2, 1994
+		Fixed some device number handling bugs in DEC OSF/1
+		V2.0 and V3.0 support.
+
+3.17		January 25, 1994
+		lsof now supports SGI IRIX 5.3, thanks to changes
+		supplied by Dave Olson <olson@anchor.engr.sgi.com>;
+		and SCO OpenDesktop or OpenServer releases 1.1 and
+		3.0, thanks to support from Dion Johnson <dionj@sco.com>,
+		Bela Lubkin <belal@sco.com>, and Nathan Peterson
+		<nathanp@sco.com>.
+
+		Dave Olson pointed out an IRIX stream handling bug
+		in sgi/dnode.c.  When I investigated it, I found
+		that it had implications wider than SGI IRIX.  The
+		eventual fix provided the display of inode numbers
+		for character devices when the inode number must
+		be obtained from /dev.  IRIX, Solaris, and SunOS
+		benefit from the fix.
+
+		I added version detection to the Configure script,
+		so there is now just one Configure abbreviation
+		for IRIX versions 4.05, 5.2, and 5.3 -- ``irix''.
+		(The Configure abbreviation for the SCO dialect
+		``sco''.)
+
+		Ian Darrow <ian@sq.com> pointed out that lsof
+		wouldn't Configure or work properly under Solaris
+		on an i86pc.  Sorting out the difficulties made
+		clear that the HASSWAPPORT definition should be
+		removed from every machine.h file and that ntohs()
+		should be used in every dsock.c on every port
+		supplied to printinaddr().
+
+		Andreas Stolcke <stolcke@ICSI.Berkeley.EDU> pointed
+		out a method that sometimes allows lsof to report
+		on files open to a crashed or unavailable remote
+		NFS server.  This led to the addition of code,
+		where possible, to estimate the device number of
+		mount points that cannot be stat()'d.  The alternate
+		device number can come from /etc/mtab or /etc/mnttab,
+		or from the dialect's version of them.  On systems
+		that use /etc/mtab or /etc/mnttab, it is sometimes
+		possible to add the device number manually to the
+		mount options field in the form ``dev=xxxx''.  Some
+		internal changes in the way lsof handles device
+		numbers were necessary to prevent ones whose dev_t
+		typedef is a signed short from causing sign extension
+		when promoted to integers as function arguments.
+
+		David Addison <addy@meiko.co.uk> and Robert Ehrlich
+		<Robert.Ehrlich@inria.fr> pointed out that lsof
+		errs when reporting device numbers and other node
+		information for some special Sun files.  I rewrote
+		most of sun/dnode.c to correct the problem; Robert
+		rewrote it again; and I rewrote it once more.
+		David and Robert helped me test it under Solaris
+		2.[34] and SunOs 4.1.[23].
+
+		While using code from the Motorola V/88 port for
+		the SCO port, I found and fixed some NFS bugs in
+		the V/88 port.
+
+3.18		January 31, 1995
+		I added the -b and -w options.  The -b option causes
+		lsof to avoid the functions lstat(2), readlink(2),
+		and stat(2) that might block in the kernel -- e.g.,
+		when they reference an inaccessible NFS file system.
+		Instead it uses alternate device numbers obtained
+		from the mount table, where possible.
+
+		The -w option causes lsof to suppress warning
+		messages -- e.g., when the -b option has been
+		specified.  The suppression of warning messages
+		was formerly bundled into the -t option.  The -t
+		option now selects -w.
+
+		I figured out how to make alternate AIX 3.2.5 device
+		numbers from the kernel mount structure.  The new
+		-b option therefore works under AIX 3.2.5.
+
+		With the help of Chance Neale <cneale@panix.com>
+		I fixed bugs in the Motorola V/88 R32V3 NFS support.
+
+		I added a solariscc Configure abbreviation for those
+		who want to use Sun's C compiler.
+
+3.19		February 10, 1995
+		Robert Ehrlich <Robert.Ehrlich@inria.fr> pointed out
+		that lsof might be able to gather more complete path
+		name information from the kernel's name cache.  Name
+		cache access may be inhibited with the new -C option.
+		Revision 3.19 implements name cache access for:
+
+		    DEC OSF/1 [23].0
+		    Dynix (Purdue 3.0.12)
+		    EP/IX 2.1.1
+		    FreeBSD 1.1.5.1
+		    HP-UX 9.01
+		    Motorola V/88 R40V4.2
+		    NEXTSTEP 3.1
+		    SGI IRIX 5.3
+		    Solaris 2.[34]
+		    SunOS 4.1.x
+		    Ultrix 2.2 and 4.2
+
+		Revision 3.19 does NOT implement name cache access for:
+				   ===
+
+		    AIX                 The knlist() function won't
+					return cache addresses --
+					some IBM wisdom to "protect"
+					their customers.
+
+		    Linux		My only access is to 1.0.9,
+					and it doesn't seem to have
+					a kernel name cache.
+
+		    Motorola V/88	It doesn't have a unified
+			     R32V3	name cache.
+
+		    Novell UnixWare     I don't have a test system.
+
+		    Pyramid DC/OSx	I don't have a test system.
+
+		    SCO OpenDesktop	It doesn't have a unified
+			OpenServer	name cache.
+
+		    SGI IRIX 4.0.5H	I saw no unified name cache 
+					in the header files before
+					my 4.05H system was converted
+					to 5.2.
+
+		    SGI IRIX 5.2	I don't have a test system.
+
+		Another Robert Ehrlich suggestion led to the
+		establishment of a device cache file feature.  The
+		new -D option gives control of it.  This feature
+		speeds lsof dramatically on some dialects after
+		lsof has been called once and the cache has been
+		built.  (Calling stat(2) on several hundred or
+		thousand /dev nodes can take a long time.)  The
+		feature can be disabled or modified in the machine.h
+		header file and the dialects/*/ddev.c source file
+		when lsof is built.
+
+3.20		February 23, 1995
+		Upgraded Linux socket handling for versions 1.1.75
+		or greater with help from Marty Leisner
+		<leisner@sdsp.mc.xerox.com> and Linus Torvalds
+		<Linus.Torvalds@cs.Helsinki.FI>.  There is now a
+		single Configure script abbreviation for linux.
+
+		Updated for Motorola V/88 R40V4.3 with help from
+		Mike Feldman feldman@charm.urbana.mcd.mot.com>
+		and Chance Neale <cneale@panix.com>.
+
+		Updated for SGI IRIX 6.0 with help from Przemek
+		Klosowski <przemek@rrdjazz.nist.gov and Dave Olson
+		<olson@anchor.engr.sgi.com>.
+
+		Corrected access of device cache file that needs
+		to be updated so that someone other than the file
+		owner can rewrite it.  Deleted the chmod() failure
+		warning.
+
+		Updated Configure and the Sun Makefile to specify
+		absolute paths to the Sun install program.
+
+3.21		March 3, 1995
+		Removed BSDI BSD/386 support, because I no longer
+		have a test system, and I needed to have separate
+		sources for two of the three dialects (FreeBSD,
+		and NetBSD) once served by the BSDI BSD/386 sources.
+		FreeBSD sources are now in the freebsd subdirectory;
+		NetBSD, in netbsd.
+
+		With the help of Greg Earle <earle@isolar.Tujunga.CA.US>
+		and Paul Kranenburg <pk@cs.few.eur.nl> installed
+		new NetBSD support for versions 1.0 and 1.0A.  The
+		NetBSD 0.9 support was removed.  The 1.0A support has
+		been tested on Intel and SPARC-based systems.
+
+3.22		March 9, 1995
+		Fixed a bug in name cache handling that occasionally
+		caused lsof to cause a segmentation violation on
+		FreeBSD.  Although the bug didn't do that anywhere
+		else, recreated the binaries of all dialect versions
+		that use the affected code from rnam.frag and rnch.frag.
+
+3.23		March 24, 1995
+		Removed forgotten HASSWAPPORT reference from HP-UX
+		machine.h and inserted ntohs() calls in the printinaddr()
+		calls of dsock.c for HP-UX and NEXTSTEP.
+
+		Added support for NEXTSTEP 3.3, courtesy of Allan
+		Nathanson <ajn@NeXT.com>
+
+3.24		March 31, 1995
+		Changed Configure script to handle DEC OSF/1 V3.2.
+		Removed leading zero from DEC OSF/1 and ADVFS
+		version values.  Added dialects/osf/dec_a/3.2 header
+		file directory, courtesy of Dave Morrison
+		<dmorriso@us.oracle.com>, who also tested the 3.24
+		DEC/OSF1 V3.2 lsof.
+
+3.25		April 5, 1995
+		Ported to RISC/os on a R2030 (R2000-based) system,
+		provided by Zdenko Tomasic <zdenko@harvey.cam.rice.edu>.
+
+		Tightened security on the device cache file; lsof
+		always tries to change its ownerships to the effective
+		IDs after creating it.  This was suggested by Stefan
+		Kelm <kelm@cert.dfn.de>.
+
+		Ported to FreeBSD 2.0, starting with work done by
+		Kurt Jaeger <pi@complx.stgt.sub.org> on lsof revision
+		3.16.  Ade Barkah <mbarkah@hemi.com> and William
+		McVey <wam@cs.purdue.edu> provided test systems.
+
+3.26		April 20, 1995
+		Ported to SCO OpenDesktop or OpenServer 5.0 (aka
+		Everest and 3.2v5.0.0).  Hugh Dickins <hughd@sco.COM>,
+		Bela Lubkin <belal@sco.COM>, Craig B. Olofson
+		<craigo@sco.COM>, and Nathan Peterson <nathan@sco.com>,
+		provided me an early-release version of 3.2v5.0.0
+		and gave technical advice.
+
+		Added length checking of the Namech buffer to the
+		printinaddr() function.
+
+3.27		May 2, 1995
+		Corrected typo in AIX install rule, courtesy of a
+		report from John Colgrave <colgrave@hursley.ibm.com>.
+
+		At the suggestion of Greg Earle
+		<earle@isolar.Tujunga.CA.US> added a function to
+		print the name of the unknown protocol (the AF_*
+		symbol), when there is no specific processing for
+		it in dsock.c.  This change affected most dialects:
+		exceptions are DC/OSx, Linux, Motorola V/88, and
+		UnixWare.
+
+3.28		May 26, 1995
+		Added support for Sequent PTX 2 and PTX 4.  The
+		PTX 2.1.6 and PTX 4.0.2 test systems and technical
+		advice were provided by Gerrit Huizenga
+		<gerrit@sequent.com>, Peter Jordan <petej@sequent.com>,
+		Kevin Smallwood <kcs@sequent.com>, and Mike Spitzer
+		<mks@sequent.com>. (Thomas A. Endo) <tendo@netcom.com>
+		and (David Putz).  <PutzDW@PO1.LMB.unisys.com> tested
+		under PTX 2.1.5.  Bob Foertsch <foertsch@uiuc.edu>
+		tested under PTX 4.  Kevin Smallwood tested under
+		2.1.1.  Others who helped include Shane Kenney
+		<shane@sequent.com>, Stephan Rossi <rossi@mtu.edu>,
+		Douglas R. Smith <drsmith@us.oracle.com>, and Joel
+		White <jdwhite@netcom.com>.
+
+		Changed the local dev structure's name to l_dev to
+		avoid conflicts with the PTX dev structure.  Added
+		a common/rdev1.frag -- a variant of rdev.frag.  It's
+		used by EP/IX, PTX, RISC/os, and V/88.
+
+		Changed printname() to check Namech first and print
+		it if it contains something.  This eliminates some
+		hacks in the handling of names for streams, but
+		generates some duplicate device name look-up code
+		in the dnode.c files of some dialects.
+
+3.29		June 2, 1995
+		Added clone device support to Motorola V/88 R40V4.3.
+
+		Added a generic ``-X'' option for dialect-specific
+		use.  Used it in AIX to allow use of readx().  Lsof
+		no longer uses readx() by default, because its use
+		can cause an AIX 3.2.x and 4.1.x kernel error to
+		appear. Kevin Ruderman <rudi@acs.bu.edu> reported
+		this bug to me and the possibility that lsof might
+		trigger it.
+		
+		The error, known as the Stale Segment ID bug, hangs
+		the kernel in its dir_search() function, thus
+		hanging the application process that called it so
+		tightly that the application process can neither
+		be killed nor stopped.  The bug does not directly
+		affect lsof, but may cause the hang when the kernel
+		is searching directories for other processes.
+		00FAQ and 00README describe the Stale Segment ID
+		bug in more detail.  Consult dialects/aix/machine.h
+		for options on enabling or disabling readx() by
+		default, or permanently enabling or disabling it
+		with the HASXOPT and HASXOPT_VALUE definitions.
+
+		When not using readx(), AIX lsof may not report
+		fully on all text and loader references.  Changes
+		to the kernel getuser() function in AIX 4.1.1 appear
+		to have eliminated the text file and loader file
+		reference information that once led lsof to use
+		readx(); of course, without that information, lsof
+		can no longer report on the executing text file or
+		shared libraries in 4.1.1.
+
+		Changed the Configure script to use a single
+		abbreviation, aix, for AIX.  Configure now uses
+		/usr/bin/oslevel to determine the AIX version; in
+		the absence of /usr/bin/oslevel, Configure issues
+		a warning and assumes the version is 3.2.0.  Source
+		code changes were made to dialects/aix/*.[ch] to
+		accommodate the new form of the _AIXV value.
+
+3.30		June 8, 1995
+		Added -c to the installation of the man page in
+		the Ultrix Makefile's install rule.  Thanks go to
+		Jules van Weerden <Jules.vanWeerden@let.ruu.nl>
+		for noticing this omission.
+
+		Made FreeBSD 2.0 changes: 1) added automatic sensing
+		of the FreeBSD 2.0 boot file path, using the
+		getbootfile(3) function (suggested by Ade Barkah);
+		2) changed kvm_getprocs(3) function call to use
+		KERN_PROC_ALL symbol from <sys/sysctl.h>, thus
+		eliminating incorrect use of the <sys/kinfo.h> and
+		<sys/kinfo_proc.h> header files; and 3) removed
+		<sys/kinfo.h> and <sys/kinfo_proc.h> header files
+		from the dialects/freebsd/include/2/sys subdirectory
+		of distribution.
+
+		Tested under AIX 4.1.2.
+
+3.31		June 16, 1995
+		Added the NOUSAGEONERR definition to allow lsof to
+		be compiled with the displaying of usage information
+		after option error messages disabled.  Lsof is
+		distributed without the NOUSAGEONERR definition --
+		i.e., usage output is displayed after option error
+		messages.
+
+		Worked on documentation in the 00* files and the
+		man page, adding tables of contents, making usage
+		more consistent, trying to insure proper dialect
+		titles, and inserting some notes about distribution
+		restrictions (few) and warranty (none).
+
+		Fixed Motorola V88 R32V3 bug in handling Internet
+		files.  This bug was introduced some time ago, but
+		I have only recently been able to test under R32V3
+		again.
+
+3.32		June 23, 1995
+		Added the ability to the Linux nlist() function to
+		automatically detect that the kernel binary is COFF
+		or ELF form.  Also corrected the UID_ARG cast from
+		int to u_int.  These changes were suggested by
+		Michael Shields <shields@tembel.org>.  Joseph J.
+		Nuspl Jr.  <nuspl@nvwls.cc.purdue.edu> provided a
+		test system.
+
+		Updated lsof for HP-UX 10.  Richard Allen <ra@rhi.hi.is>
+		provided a test system.  The hpux stanza in the
+		HP-UX configure script was updated to sense the
+		HP-UX version automatically, and to sense the
+		availability of CCITT header files in /etc/conf/x25.
+
+3.33		June 28, 1994
+		Added options to select "field" output that can be
+		parsed by a subsequent program.  (The -f, -F, and
+		-0 options form the selection set.)   Provided
+		sample awk and Perl scripts for parsing and displaying
+		field output.  This feature was suggested by Dan
+		Bernstein <djb@silverton.berkeley.edu>.
+
+		Tested under PTX 4.0.3.
+
+3.34		June 30, 1995
+		Changed display of file offset to decimal in the
+		form "0t12345678" if it is less than 100,000,000.
+		The offset is displayed in hexadecimal in the form
+		"0x12abcdef" if it is larger than 99,999,999.
+
+		Changed inode field output from signed to unsigned
+		decimal.  Updated the list_fields.{awk,perl} and
+		list_NULf.perl5 scripts.
+		
+		Documented the truncated inode output form (leading
+		`*' and 5 digits) for inodes that are too large
+		for the output field; thanks go to Leonard Sitongia
+		<sitongia@zia.hao.ucar.edu> for pointing out that
+		this wasn't documented.
+
+3.35		July 9, 1995
+		Added loopback file system support to Solaris with
+		advice from Casper Dik <casper@Holland.Sun.COM>.
+
+		Removed the NOUSAGEONERR compile option in favor of
+		producing a shortened usage message when option
+		errors are detected.
+
+		Marty Leisner <leisner@sdsp.mc.xerox.com> provided
+		code to validate the Linux system map file (/System.map
+		or /zSystem.map).  If lsof detects that the system
+		map file doesn't match the booted kernel, it
+		complains and quits.
+
+		Updated host name cache to include dot forms -- e.g.,
+		when the host name can't be obtained via gethostbydddr().
+		This prevents subsequent lookup delays for the same address.
+
+3.36		July 20, 1995
+		Updated kernel name cache handling to assume a default
+		size for pointer-linked caches (DEC OSF/1, FreeBSD,
+		NetBSD, and SGI IRIX 5.3) when the kernel's cache size
+		variable has a value of zero.  A warning is issued,
+		but lsof proceeds to read and use the name cache.
+
+		Folded rdev1.frag into rdev.frag by supporting a
+		HASDNAMLEN #define for those dialects whose DIRTYPE
+		structure has a d_namlen definition.
+
+		Updated Linux distribution to avoid using d_namlen
+		from struct dirent if the Linux version is 1.2.10 or
+		greater.  This avoidance might work on earlier
+		version of Linux, too, but I have no way of telling.
+
+		Added support for FreeBSD 2.0.5.  Ade Barkah
+		<mbarkah@hemi.com> provided a test system.
+
+		Added WARNDEVACCESS definition to machine.h control
+		the default issuance of device directory and
+		subdirectory access errors.
+
+		Changed options:
+			
+		  -m (mount warning) option deleted
+		  -c (core file) option changed to -m
+		  -c option redesignated as command selector
+		  -d (device warning) option deleted
+		  -d option redesignated as file descriptor selector
+		  -O (order) option changed to less-overhead option
+		  -r option added to enable repeat mode
+
+		Added a repeat mode in which lsof will display
+		output, sleep for the number of seconds defined by
+		the repeat-mode option, -r <seconds>, and then
+		display output again, doing this repetitively until
+		it receives an interrupt or quit signal.  This
+		option is much more efficient for monitoring a file
+		than calling lsof repeatedly from a shell script,
+		since it entails only one set of lsof startup
+		operations.
+
+		The CANDOCHILD compile-time option has been removed.
+		The -O run-time option will do the same thing.
+
+3.37		July 27, 1995
+		Fixed incorrect setting of low-overhead flag from -O
+		option.
+
+		Marty Leisner reports that d_namlen is not needed
+		under Linux 1.2.8.  Changed the #if test that sets
+		HASDNAMLEN accordingly.
+
+		Made more changes to option processing: combined
+		-f, -F, and -0 into -F (-0 becomes a field identifier
+		value for -F); now allow -F, -g, -r, and -S to have
+		an optional value; made -F? (help) and -F0 (all
+		fields plus NUL terminator) special forms of -F;
+		and added support for --.  These option processing
+		changes are handled with a local getopt() function
+		(named GetOpt() to avoid confusion).
+
+		Made yet another attempt to create "standard"
+		install and deinstall SunOS/Solaris Makefile rules.
+
+		Corrected improper use of examine_lproc() when in
+		repeat mode.
+
+3.38		August 3, 1995
+		Modified Linux and PTX to show TCP's "send next"
+		sequence number as the offset for TCP socket files.
+
+		Added some version tests for Linux 1.3.0, provided by
+		Roman Gollent <roman@portal.stwing.upenn.edu>.
+
+		Added some more PTX tests around code that shouldn't
+		be active when the NFS layered product is unavailable.
+		Mark Vasoll <vasoll@a.cs.okstate.edu> provided them.
+
+3.39		August 10, 1995
+		Added generic support for dialect-specific elements
+		in the lfile structure.  The HASLFILEADD and
+		SETLFILEADD macroes are used in lsof.h to define
+		the elements and in proc.c to preset them.  Field
+		identifiers `1' through `9' are allocated to
+		dialect-specific files.  The HASFIELDAP<x> strings
+		define the -F? help text for the FieldSel[] table
+		of store.c, and LISTLFILEAP<x> are macroes, used
+		in the print_proc() function of proc.c, to list
+		fields.  (<x> is the field identifier.)  Other
+		private element and field processing should be done
+		in dialect-specific modules.
+
+		Used {HAS,SET}LFILEADD, HASFIELDAP[12], and
+		LISTLFILEAP[12] to define and list link count and
+		inode address lfile elements under PTX.  Used the
+		-X option to control when the values are displayed.
+
+3.40		August 25, 1995
+		Added support for Solaris 2.5-BETA, including
+		rudimentary support for door files and extensive
+		support for fattach'ed files with the help of Henry
+		Katz <hkatz@panix.com>, Joseph Kowalski
+		<jek3@jurassic.Eng.Sun.COM>, and Mike Tracy
+		<mtrac@jurassic-45.Eng.Sun.COM>.
+
+		Changed most dialects to use slightly safer fchown()
+		on the device cache file.  Changed dvch.frag to
+		avoid creating a device cache file that is owned
+		by root.  Cleared caches when reading of device
+		cache file fails and removed extra NL from device
+		cache error messages.
+
+		After receiving yet another complaint about Makefile
+		install rules, I decided to remove all install and
+		deinstall rules from the distribution Makefiles.
+		The Makefiles now contain a set of comments (echo
+		commands) that describe what the install rule might
+		be.  The lsof user is now free to construct install
+		and deinstall rules that meet local conventions
+		and preferences.
+
+3.41		September 5, 1995
+		Changed Linux kernel symbol handling to avoid the
+		stripping of leading `_' characters that was
+		installed in revision 3.32.  (Recent Linux kernels
+		have some symbols that are the same except for the
+		leading `_'.)
+
+		The Linux kernel loader format is now determined
+		by testing for "_system_utsname" (COFF) and
+		"system_utsname" (ELF) in the symbols returned by
+		the get_kernel_syms() syscall.  If neither or both
+		symbols are present, a warning is issued and COFF
+		format is assumed.  If the loader format is COFF,
+		then kernel symbols important to lsof are assumed
+		to have a leading `_'.
+
+		Because recent Linux releases add a parameter
+		hashing suffix to kernel symbols, lsof removes it
+		before comparing kernel symbol names and addresses
+		to those in /[z]System.map.
+
+		Marty Leisner, Keith Parks <emkxp01@mtcc.demon.co.uk>,
+		and Michael Shields helped me with the Linux changes.
+
+		After much discussion of the security of the device
+		cache file on the bugtraq mailing list, I adopted
+		a suggestion from Dave Sill <de5@sws5.CTD.ORNL.GOV>.
+		His suggestion removes the world-writable device
+		cache file from /tmp and creates instead a mode
+		0600 device cache file in the home directory of
+		the real user ID that is executing lsof.  Lsof
+		issues a warning message when it does this.  (The
+		warning can be suppressed with -w.)  The HASDCACHE
+		definition becomes a relative path.  When lsof is
+		run from root, it will create a device cache file
+		in root's home directory, e.g., / or /root, but
+		the file will be readable and writable only by
+		root.  This should make the device cache file much
+		more secure.
+
+		Added support for SGI IRIX 6.1.  Dave Olson provided
+		technical support and Przemek Klosowski supplied
+		a test system.  Since Przemek's system formerly
+		supported my testing of lsof for IRIX 6.0, its
+		update to 6.1 means I have not tested lsof under
+		IRIX 6.0 since revision 3.39.
+
+		Changed name list structure element initialization
+		for V/88 to make gcc happy.  Albert Chin-A-Young
+		<china@cig.mot.com> suggested this.
+
+3.42		September 7, 1995
+		Changed device cache file naming process to add a
+		suffix formed of an underscore, followed by the
+		first component of the host name returned by
+		gethostname(2).  This allows lsof to create separate
+		device cache files for each host from which it is
+		run for the same UID when the UID's home directory
+		is shared by the hosts via NFS.
+
+3.43		September 12, 1995
+		Enabled SCO searching for stream files and Release
+		5.0 Unix domain socket files by name.
+
+		Defined HASDOPTPATH for dialects that can supply
+		a path with -Db, -Dr, and -Du.  Defined it for all
+		but DC/OSx, UnixWare, and V/88.  Used it in the
+		ctrl_dcache() function of arg.c to enable and
+		disable -Db, -Dr, and -Du.
+
+		Used is_readable() in dvch.frag when opening the
+		device cache file for reading.
+
+3.44		September 19, 1995
+		Added test for setuid-root state so that some
+		security-sensitive code now disabled by #define's
+		can by dynamically disabled.
+
+		Enhanced, extended, improved, secured, and documented
+		formation and use of the device cache file path.
+		More options, more carefully controlled are now
+		available.  A separate documentation file, 00DCACHE,
+		accompanies the distribution to explain the device
+		cache file path handling.
+
+		Where possible, lsof now drops setgid permission
+		as soon as possible.  Two exceptions are the Solaris
+		and SunOS versions of lsof which need to close and
+		re-open kvm access.  Setuid-root lsof implementations
+		must retain that permission to access files in /proc.
+
+		Improved the README.lsof_<revision> file that
+		appears in the lsof wrapper tar file with help from
+		Jon A. Tankersley <tank@amoco.com>.
+
+		Added Veritas file system support to the HP-UX
+		dialect port.
+
+		Albert Chin-A-Young tested lsof under Motorola V/88
+		R40V4.1 and provided #if/#else/#endif changes.
+
+3.45		September 20, 1995
+		Enabled setgid permission surrender for Solaris
+		and SunOS dialects.
+
+
+3.46		October 5, 1995
+		Added more conversions to HASPERSDC, based on
+		suggestions from John Gardiner Myers <jgm+@CMU.EDU>.
+		They make it possible to locate the personal device
+		cache file in /tmp, for example.  A new -D function,
+		`?', reports device cache file name formation
+		information.
+
+		Gained access to AIX 4.1.3, compiled lsof there, and
+		found that it seems to work.
+
+		Tested lsof under FreeBSD 2.1.0-950726-SNAP.  John
+		Clear <jac@dragonfly.vet.purdue.edu> kindly provided
+		a test system.
+
+		Added a Customize script that helps with the job
+		of modifying some important (e.g., security-related)
+		compile-time options.  Configure calls Customize,
+		but can be told not to with the -n|-nocust options.
+
+		Fixed over-sensitivity to unexpected kernel file
+		structure pointer values in HP-UX version that led
+		to premature exit.  Lionel Cons <cons@dxcern.cern.ch>
+		pointed out the problem.
+
+		With the help of Leif Hedstrom <leif@infoseek.com>
+		identified a pair of conflicting Solaris 2.4 patches
+		that prevent lsof from working.  A work-around is
+		described in section 00FAQ.
+
+3.47		October 16, 1995
+		Enabled suppression of an HP-UX pstat() warning
+		message.  Added big_brother.perl5 to field output
+		scripts/ subdirectory.  Both changes are courtesy
+		of Lionel Cons <Lionel.Cons@cern.ch>.
+
+		Added a test for automount detritus in the SCO mount
+		table.
+
+		Added kernel name cache support to SCO dialect.
+		Modified most name cache support to report full
+		path names without the intervening `` -- '' when
+		possible.
+
+		Added an Inventory script to check the contents of
+		the distribution, using a new file, 00MANIFEST.
+		The Configure script normally calls Inventory.
+		Changed the -n option to Configure to avoid calling
+		the Customize and Inventory scripts and dropped
+		the -nocust option.  The presence of .neverCust
+		suppresses the calling of Customize; .neverInv,
+		Inventory.  The Inventory script creates .ck00MAN
+		when it completes, so that subsequent calls to
+		Inventory won't check the inventory again -- although
+		the caller is given the opportunity to have the
+		inventory rechecked.
+
+		Added PTX 4.1.0 support, courtesy of a test system
+		supplied by Kevin Smallwood <kcs@sequent.com>.
+
+		Picked lint for gcc in the V/88 dproc.c from hints
+		provided by Albert Chin-A-Young <chinay@cig.mot.com>.
+
+3.48		October 20, 1995
+		Improved root directory detection during name cache
+		lookup.
+
+		Remove the Novell UnixWare and Pyramid DC/OSx ports
+		from the distribution, because I have not been able
+		to test them for 40 or more revisions.   Their pieces
+		may now be found on vic.cc.purdue.edu in
+		pub/tools/unix/lsof/OLD/{binaries,dialects}.
+
+		Corrected an error in Customize that caused it to
+		incorrectly redefine HASSYSDC to HASSYSDCPATH.  This
+		was reported by Michael Beirne <beirne@dcdsv0.fnal.gov>.
+
+		Made sure that lsof will compile when HASDCACHE is
+		undefined.  A problem with a reference to the DChelp
+		symbol was reported by Vasco Pedro <vp@fct.unl.pt>
+		and resolved by always defining DChelp.
+
+		Corrected handling of -c and -m options.
+
+		Corrected the reading of the SCO /etc/mnttab.  Bela
+		Lubkin <belal@sco.com> helped me understand its
+		special multi-line format.  The "nothing/nowhere"
+		lines are continuations of the file system directory
+		and device names when either are > 31 characters.
+
+		Corrected SCO version list in Configure help output.
+
+		Update special SCO name cache code to make it more
+		robust.
+
+		Add support for IRIX 6.0.1 with the help of Eberhard
+		Mater <system@grzap1.rz.go.dlr.de>.
+
+3.49		October 25, 1995
+		Removed need for dialects/sgi/irix601hdr subdirectory,
+		replacing it with one created by dialects/sgi/Mksrc
+		and composed of symbolic links to dialects/sgi/irix6hdr.
+		Eberhard Mater did the testing.
+
+		Added file system inode number to the local file
+		structures of the DEC OSF/1, DYNIX, EP/IX, HP-UX,
+		NeXT, PTX, RISCos, SGI, Sun, and V/88 dialects.
+		Added code to name cache, node, and VFS functions
+		to set the file system inode number and use it for
+		faster recognition of files on the file system
+		mount point.
+
+		Added kernel name cache support to Linux.  This
+		has been tested only under release 1.2.13.
+
+3.50		October 31, 1995
+		Updated 00FAQ: reorganized and renumbered sections;
+		added some DEC OSF/1 sections; section about the
+		Solaris and SunOS Sun KERNELBASE.
+
+		Added an alternative readdir() function, called
+		ReadDir(), to dialects/osf/ddev.c  This function
+		was supplied by Duncan McEwan <duncan@comp.vuw.ac.nz>,
+		who discovered that the getdirentries() function
+		in DEC OSF/1 versions 3.[02] returns an incorrect
+		length for the /dev/fd directory when it is a file
+		system mount point.  Modified the Configure script
+		to define USELOCALREADDIR for 3.[02] to enable
+		using this local function.
+
+		Modified the Solaris/SunOS Mksrc to create a dummy
+		(empty) kernelbase.h for Solaris 2.5 (5.5).
+
+3.51		November 8, 1995
+		Modified the Configure script to declare the kernel
+		state definitions appropriate to IRIX 6.1 on IP21
+		and IP26 platforms.  News of the need for this came
+		from Kate Fissell <Kate.Fissell@IUS4.IUS.CS.CMU.EDU>
+		and Dave Olson <olson@anchor.engr.sgi.com>.
+
+		Modified the SGI IRIX dproc.c to provide more
+		information when the kernel's idea of the size of
+		a proc structure doesn't match sizeof(struct proc).
+		This mismatch can occur if the wrong kernel state
+		definitions are used to condition the header files
+		(e.g., <sys/proc.h>) included when compiling dproc.c.
+
+		Made the -i option with no arguments equivalent to
+		the -n option -- i.e., they both select the listing
+		of all open Internet files.
+
+		Supplied a missing "you" in the Customize script
+		introduction.  John Jackson <jrj@cc.purdue.edu>
+		noticed the omission.
+
+		Modified the Customize script to put long messages
+		in here documents rather than echo statements, so
+		that changing and reformatting them is easier.
+		John Jackson offered this helpful suggestion.
+
+		Fixed a port number cast bug in Solaris 2.[45],
+		courtesy of information and code supplied by Allan
+		Black <allan@scotnet.co.uk>.
+
+		Automated the detection of Solaris 2.4 patches
+		101945-32 and 102303-02 that cause the installed
+		kernel's user structure to differ from the one
+		defined by <sys/user.h> because of a patch to
+		<sys/auxv.h> that wasn't applied when the kernel
+		was built.  The Configure script invokes an alternate
+		auxv.h file and warns that it is doing so.
+
+		Fixed a problem with Inventory script that shows up
+		on systems where echo is not an sh built-in.  The
+		bug was reported by Scott Ballew <smb@cc.purdue.edu>.
+
+3.52		November 27, 1995
+		Added support for Linux versions 1.3.22 and above,
+		courtesy of changes supplied by Keith Parks
+		<emkxp01@mtcc.demon.co.uk>.
+
+		Changed -d option processing to allow specification
+		of a comma-separated list of file descriptors.
+
+		Modified SCO support to allow NFS code to be optional
+		at the request of Dave Gilbert
+		<agere!dgilbert%peapod.com@zool.interaccess.com>.
+
+		Enabled HP-UX 10.x version to display device and
+		inode numbers for FIFOs.  The problem was reported
+		by Jeff Earickson <jaearick@colby.edu>.
+
+3.53		December 8, 1995
+		Enhanced NeXTSTEP FIFO reporting.
+
+		Fixed a formatting problem in the man page, reported
+		by Angel Li <angel@flipper.rsmas.miami.edu>.
+
+		Added support for DEC OSF/1 4.0-BETA.  Angel Li
+		provided the test system.
+
+		Added a -v option to display lsof version information.
+		Marty Leisner <leisner@sdsp.mc.xerox.com> suggested
+		this.
+
+		Replaced touch with echo in Inventory script to avoid
+		DEC OSF/1 4.0 complaint.
+
+		Tested under PTX 4.1.2.
+
+3.54		December 15, 1995
+		Added support for IRIX 6.2-BETA.  The support for
+		older IRIX versions changed considerably in the
+		process.  Revision 3.54 has been tested under these
+		older IRIX versions: 5.3 and 6.1.  Angel Li
+		<angel@flipper.rsmas.miami.edu> provided a test
+		system and Jim Brown <jim@guanabana.rsmas.miami.edu>
+		helped.
+
+		Tested under AIX 4.1.4.
+
+		Decommissioned the DYNIX port -- I no longer have
+		access to a test system.
+
+		Added the HASXOPT_ROOT define to allow the lsof
+		builder to restrict the use of the dialect-specific
+		X option (AIX and PTX currently) to processes whose
+		real user ID is root.  Updated the Customize script
+		to provide an easy mechanism to change HASXOPT_ROOT.
+		AIX uses HASXOPT_ROOT; PTX does not.  This change
+		was suggested by R. Lindsay Todd <toddr@rpi.edu>.
+
+3.55		December 22, 1995
+		Eliminated need for modified DEC OSF/1 headers by
+		using #undef and #define statements.  Chip Stettler
+		<STETTLERC@wlmpo1.wilm.ge.com> helped test.
+
+		Added quick start documentation file, 00QUICKSTART,
+		containing examples and explanations of lsof use.
+
+		Verified that lsof works under the released Solaris
+		2.5.
+
+3.56		January 2, 1996
+		Corrected lock reporting for Solaris 2.[345].
+
+		Corrected Linux malloc() kernel symbol handling bug,
+		reported by Keith Parks <emkxp01@mtcc.demon.co.uk>.
+
+		Corrected AIX loader text file selection bug; it
+		caused all process IDs to be listed when the -t
+		option and one file system name was specified.
+		The bug was reported by Christopher C. Evert
+		<cevert@waii.com>.
+
+		Made sure Solaris Kb variable is zeroed before
+		first use.
+
+3.57		January 12, 1996
+		Updated SunOS port to obtain lock information from
+		v_filocks and the lock_list struct to which it
+		points.
+
+		Changed -H to -n.  The function formerly performed
+		by -n can be done by using -i with no address.
+
+		Updated Linux FIFO support so that the display for FIFOs
+		contains device number, inode number, and NAME.  Johannes
+		Kroeger <jkroeger@squirrel.owl.de> reported the lack of
+		these items in the Linux FIFO display.
+
+		Added RCS identification to header files, Makefiles,
+		and common fragments.
+
+		Added BSDI BSD/OS support for 2.0, 2.0.1, and 2.1-BETA.
+		Terry Kennedy <terry@spcvxa.spc.edu> kindly provided a
+		2.1-BETA test system and did the 2.0.1 testing.
+
+		Modified the Inventory script to compensate for dialects
+		that have an expr that doesn't set its exit code when
+		string matches fail.
+
+		Converted internal representations of file offset and
+		size to unsigned long.
+
+		Corrected bug in NetBSD lock handling.
+
+		Corrected bug in FreeBSD file system type name handling.
+
+		Keith Parks <emkxp01@mtcc.demon.co.uk> reports lsof
+		3.57 compiles and runs under Linux 1.3.56.
+
+3.58		February 7, 1996
+		Changed Solaris 2.3 configuration to pass the level
+		of patch 101318 to the source code.  This allows
+		a Solaris 2.3 lock handling difference to be
+		accommodated.
+
+		Updated 00QUICKSTART to reflect -n and -H changes
+		made in revision 3.57.  (Ooops!)
+
+		Changed Configure script to compile lsof for SCO
+		versions beyond 3.2v5.0.0 as it is compiled for
+		3.2v5.0.0.  Bill Campbell <bill@celestial.com>
+		reported he has done this successfully.
+
+		Added information to 00FAQ about a Linux kernel
+		symbol problem (section 3.7.6) and included a
+		<linux/random.h> patch to work around it. The patch
+		was supplied by Keith Parks <emkxp01@mtcc.demon.co.uk>.
+
+3.59		February 21, 1996
+		In response to a query from Louis Rayman
+		<lou@asahi.ps.quotron.com>, added special support
+		for Solaris "sockmod" streams, used for Unix domain
+		sockets, that allows their file system device type
+		and inode number to be displayed.  It also allows
+		lsof to search for them by name or type (-U).
+
+		Added range handling to -d argument.
+
+		Added the display of CDFS file size to DEC OSF/1 output.
+
+		Added an include of <rpc/xdr.h> to keep gcc on HP-UX
+		10 happy.  Blair Zajac <blair@olympia.gps.caltech.edu>
+		suggested it.
+
+		Added Ultrix 4.5 to support list, courtesy of a
+		notification from Gregory Neil Shapiro <gshapiro@WPI.EDU>.
+
+		Added AFS support for Solaris 2.4 at the request
+		of Michael L. Lewis <mlewis@morgan.com> and Phillip
+		Moore <wpm@morgan.com>.  Phillip helped me locate
+		a test host, generously provided by Heidi Hornstein
+		<heidi@cmf.nrl.navy.mil> with support from Chaskiel
+		Moses Grundman <cg2v+@andrew.cmu.edu> and Sushila
+		R. Subramanian <sushi@cmf.nrl.navy.mil>.  Lsof is
+		configured for AFS with a new script, AFSConfig.
+
+		Used a SunOS 4.1.4 test system, provided by Chaskiel,
+		to extend Solaris AFS support to cover SunOS.  Used
+		another test system, provided by Chaskiel, to extend
+		AFS support to NEXTSTEP 3.2.
+
+		Tested lsof under AFS on yet another Chaskiel-provided
+		system, running Linux 1.2.13 and AFS 3.3, and found
+		that lsof needed no changes to recognize its AFS files.
+
+		Used a test system, provided by Curt Freeland
+		<curt@grumpy.cse.nd.edu> and Terry McCoy
+		<terry@anubis.cc.nd.edu> to extend Solaris AFS
+		support to Solaris 2.5 with AFS 3.4-Alpha.
+
+		Added the [-A A] option for specifying the name list
+		file that contains dynamic kernel module addresses.
+		This is defined for the NEXTSTEP, SunOS, and Solaris
+		implementations.
+
+		Added stty isig handling (where appropriate) to
+		the Customize and Inventory scripts.
+
+		Added support to Solaris for the nfs3 file system
+		type.  Its absence was reported by Patrick D.
+		Sullivan <pds@snt.bellsouth.com>.
+
+		In response to a report from Tigran Aivazian
+		<bs_s641@ceres.king.ac.uk)> corrected bug in Linux
+		local nlist() function and based the default kernel
+		loader format on a Configure test for CONFIG_KERNEL_ELF
+		in /usr/src/linux/include/linux/autoconf.h.
+
+		Fixed a bug in name cache exploration for BSD-derived
+		dialects -- e.g., FreeBSD.
+
+		Updated for NetBSD 1.1.
+
+3.60		February 27, 1996
+		Improved Unix domain socket reporting for Solaris.
+		Louis Rayman <lou@asahi.ps.quotron.com> helped test.
+
+		Added warning messages about absence of Linux
+		CONFIG_MODULES definition in autoconf.h, leading
+		to lack of get_kernel_syms() support.  Tigran
+		Aivazian <bs_s641@ceres.king.ac.uk)> supplied the
+		information.
+
+3.61		March 8, 1996
+		Added AFS support for AIX and HP-UX and verified
+		that the lsof Ultrix version needs no additions
+		for AFS.  Chaskiel Moses Grundman <cg2v+@andrew.cmu.edu>
+		provided the HP-UX and Ultrix test systems.  Jan
+		Tax <jan_tax@unc.edu> provided an AIX 4.1.4 test
+		system. Bob Cook <bobcook@SLAC.Stanford.EDU> provided
+		3.2.5 and 4.1.4 test systems.
+
+		Fixed minor problems and made improvements to
+		NEXTSTEP, Solaris, and SunOS AFS support.  Changed
+		the AFSConfig script to ask for AFS version.
+
+		During the Hp-UX AFS work, added the hpuxgcc
+		abbreviation to the Configure script for configuring
+		lsof to be compiled with gcc under lsof.
+
+		Fixed a NetBSD mount structure array referencing
+		bug, reported by Peter Svensson <petersv@df.lth.se>.
+
+		Dropped support for Motorola V/88, because I no
+		longer have access to test systems.
+
+		Added rudimentary support for the IRIX XFS file
+		system type, pending more information.
+
+3.61		March 12, 1996
+		Corrected misuse of the LSOF_DINC shell variable
+		in the Configure script for HP-UX and Solaris.
+		Larry Rogers <lrr@cert.org> pointed out this problem.
+		Also removed an obsolete irix52 abbreviation from
+		Configure.
+
+		I didn't consider this change sufficient to warrant
+		a new version number, but just rebuilt the 3.61
+		distribution.
+
+3.62		March 26, 1996
+		Updated AFS comments in 00README.
+
+		Supplied missing break statement in a N_VXFS case
+		clause in the HP-UX dnode.c.
+
+		Added Veritas file support to PTX, courtesy of code
+		supplied by Laurent Montaron <lpm@sequent.com> and
+		help from Kevin Smallwood <kcs@sequent.com>.
+		Created two new source modules (dnode[12].c) to
+		separate PTX header file node definitions and thus
+		eliminate symbol conflicts.  Laurent did most of
+		the testing.
+
+		Added tests to BSDI, FreeBSD, HP-UX, IRIX, NetBSD,
+		NEXTSTEP, PTX, Solaris and SunOS lsof versions that
+		allow them to report on unknown file system types.
+
+		Added IRIX 6.0.1 #if/#else/#endif support in response
+		to a report and suggested modifications from Scott
+		Presnell <srp@zgi.com>.
+
+		With the help of Dave Olson <olson@anchor.engr.sgi.com>
+		improved the IRIX 6.2-BETA XFS support.
+
+3.62		March 27, 1996
+		Corrected SunOS incompatibility with last-minute
+		addition of Solaris MVFS support.  The problem was
+		reported by Larry W. Virden <lvirden@cas.org>.
+
+		I didn't consider this change sufficient to warrant
+		a new version number, but just rebuilt the 3.62
+		distribution.
+
+3.63		April 11, 1996
+		Upgraded Solaris MVFS support.  In the process,
+		enlarged Solaris and SunOS DEVICE output column.
+
+		Changed SunOS 4.1.x Configure to make -DNOCONST
+		Makefile definition dependent on SC version.
+
+		At the suggestion of John DiMarco <jdd@cdf.toronto.edu>
+		suppressed two warning messages: the device cache
+		file creation warning when -Db has been specified;
+		and the one issued when -D? is used with a non-writable
+		system-wide device cache file and there is no other
+		writable path.  Also at John's suggestion redid
+		the manner in which child processes are used to
+		avoid kernel calls that might block; the net effect
+		of the change is that normally one child process
+		is required, rather than one per kernel call.
+
+		Refined the NetBSD test for <nfs/nfsproto.h> with
+		a Configure script change.
+
+		Modified Configure script to compute AIX version
+		with ``uname -rv'' when /usr/bin/oslevel can't be
+		executed.  Stephen C. Woods <scw@seas.ucla.edu>
+		suggested this.
+
+		Disabled conflicting prototype definitions in the
+		local netdb.h used when the SCO 3.0 netdb.h is
+		missing.  Disabled #include of <strings.h> unless
+		the SCO version is 5.0 or above.  Don Kirouac
+		<dkirouac@minicom.com> pointed out these problems.
+
+3.63		April 15, 1996
+		Improved Configure's SunOS 4.1.x CC test for compiler
+		support of the const keyword and avoided Configure's
+		``test -f {Customize,Inventory}'' (because the
+		Ultrix test doesn't grok -x) in response to a report
+		from Larry Schwimmer <rosebud@cyclone.Stanford.EDU>.
+
+		I didn't consider this change sufficient to warrant
+		a new version number, but just rebuilt the 3.63
+		distribution.
+
+3.64		April 26, 1996
+		Added a negate option for entries of the -u list.
+		Kurt Hillig <khillig@Chem.LSA.umich.edu> suggested
+		it.
+
+		Added a check for legal protocols in the -i option.
+
+		Adjusted the Configure and SGI MkKernOpts scripts
+		to handle more IRIX situations per instructions
+		from Dave Olson <olson@anchor.engr.sgi.com>.
+
+		Added support for HP-UX 10.10, courtesy of a test
+		system provided by Mark Bixby <markb@cccd.edu>.
+
+3.65		May 20, 1995
+		Corrected errors, reported by Arne H. Juul
+		<arnej@pvv.unit.no>, in use of IRIX stat structure.
+
+		Added support for the IRIX 6.2 cachefs, following
+		a report from Peter Van Epp <vanepp@sfu.ca>.
+
+		Added clone support for AIX 4.1.4 and above.
+
+		Adjusted the IRIX configuration to work properly
+		for 64 bit IRIX 6.2 systems.  Richard Chycoski
+		<richard@sfu.ca> and Peter Van Epp <vanepp@sfu.ca>
+		provided a test system.
+
+3.66		June 19, 1996
+		Improved the HP-UX VXFS test in the Configure
+		script, based on a report from Robert Hall
+		<rjh6810@misty.ca.boeing.com>.
+
+		Added SCO information to 00FAQ.  Added information
+		about lsof slowness and nameserver.
+
+		Added an untested Configure abbreviation for Solaris
+		2.5.1.
+
+		Ambrose Li <ambrose@www.mingpaoxpress.com> supplied
+		a Linux change that avoids a conflict with the
+		d_namlen definition in versions 1.99.8 and above.
+
+		Added compiler version identification to the
+		Configure script for AIX and Solaris cc.
+
+		Added support for FreeBSD 2.2-960612-SNAP.  Ade
+		Barkah <mbarkah@hemi.com> provided a test system.
+
+3.67		Jult 1, 1996
+		Made miscellanous documentation corrections.
+
+		Added support for gcc under AIX 4.1 and above,
+		including an aixgcc Configure abbreviation, and a
+		work-around for an long long alignment problem.
+		Stuart D. Gathman <stuart@bmsi.com> and Waldemar
+		Zurowski <bilbo@pwr.wroc.pl> helped me to understand
+		the gcc problem and devise the work-around.
+
+3.68		July 17, 1996
+		Malgorzata Roos <groos@rzusun.unizh.ch>: pointed
+		out the AIX lsof didn't report the inode number
+		for named pipes (FIFOs) and wouldn't locate them
+		by name; _and_ supplied a fix.  (Now _that's_ the
+		kind of bug report I like.  :-)
+
+		Update Configure script to clean out aix41*
+		subdirectories created by the AIX gcc work-around.
+
+		Taught IRIX lsof how to report the correct device
+		number, inode number, and size for named NFS pipes.
+
+		Taught HP-UX 9.x lsof how to report size/offset
+		and inode number for named NFS pipes.  (HP-UX 10.x
+		already knows.)
+
+		Taught DEC OSF/1 (errr, Digital Unix) lsof to report
+		device and inode numbers correctly for named pipes.
+		Because stat(2) under DEC OSF/1 V3.2 doesn't report
+		the device number correctly for named pipes, lsof
+		can't locate them by name, but it can do that under
+		DEC OSF/1 V2.0.
+
+		Taught EP/IX 2.1.1 lsof to report device and inode
+		numbers correctly for named pipes.
+
+		Taught versions of lsof for PTX 2.1.6 and 4.1.2 to
+		report device and inode numbers correctly for named
+		pipes.
+
+		Taught RISC/os 4.52 lsof to report device and inode
+		numbers correctly for named pipes.
+
+		Taught versions of lsof for Ultrix 4.2 and above
+		to report inode numbers and file systems names
+		correctly for named pipes (FIFOs).
+
+		Added safety check when trying to get a sockaddr_un
+		structure from a BSDI, FreeBSD, or NetBSD mbuf.
+
+		Improved documentation on install permissions in
+		00README at the suggestion of Paul Wickman
+		<Paul.Wickman@amd.com>.
+
+		Installed support for the DTYPE_PIPE file structure
+		in FreeBSD 2.2.  Changed the FreeBSD version symbol
+		from _FREEBSDV to FREEBSDV.
+
+		Added support for NetBSD 1.2.
+
+3.69		July 30, 1996
+		Added block device name caching and reporting for
+		all dialects.
+
+		Improved (I think) IRIX 6.2 64 bit configuration.
+
+		Eliminated C name space pollution by removing the
+		leading `_' from all dialect version symbols that
+		had it: _AIXV, _BSDIV, _OSF1V, _ADVFSV, _EPIXV,
+		_HPUXV, _IRIXV, _PTXV, _RISCOSV, and _SCOV. 
+
+		Changed decosf stanza in Configure script to
+		automatically detect the subdirectory of /sys (or
+		/usr/sys) that contain's the configuration header
+		files for the machine.  Added a 00FAQ entry about
+		this.
+
+3.70		August 9, 1996
+		Set the execute bits on scripts/big_brother.perl5.
+		Changed -H in scripts/watch_a_file.perl to -n.
+		Retained all the command name characters that are
+		available in the proc or user struct for field
+		output.  Improved sample install rules for BSDI
+		and HP-UX.  Strengthened HP-UX CCITT test in the
+		Configure script. Gildas Perrot <perrot@francenet.fr>
+		suggested these changes.
+
+		Improved Solaris local TCP address reporting, based
+		on a bug report from John Caruso <jcaruso@csg.com>.
+
+		Improved HP-UX VFS handling, and corrected a bug
+		in VFS handling, based on bug reports from David
+		Capshaw <David.Capshaw@SEMATECH.Org>.
+
+		Added support to -i argument handling to allow port
+		lists and ranges, and service name lists to be
+		specified.  John DuBois <spcecdt@armory.com>
+		suggested this.
+
+		Dropped support for IRIX 4.0.5H.  Revived support
+		for IRIX 5.2, courtesy of a test system from Dan
+		Trinkle <trinkle@cs.purdue.edu>.
+
+3.71		August 15, 1996
+		Improved handling of port ranges specified with
+		the -i option.  Improved performance when the only
+		option is -i.
+
+3.72		August 28, 1996
+		Fixed bugs and typos in SCO mount table handling.
+
+		Added support for OpenBSD (only the i386 architecture
+		type has been tested), using the NetBSD dialect
+		sources.  David Mazieres <dm@amsterdam.lcs.mit.edu>
+		provided a test system.
+
+		Added fdesc file system support to FreeBSD, NetBSD
+		and OpenBSD.  Changed the way proc file system
+		support is activated with additions to the Configure
+		script and changes to the dialect machine.h files.
+		Dropped the distribution of the Freebsd <procfs/procfs.h>
+		header file.
+
+		Added support for PTX 4.1.4.
+
+3.73		September 5, 1996
+		Added information to 00FAQ for missing CCITT HP-UX
+		header file x25L3.h.  Pasi Kaara <ppk@atk.tpo.fi>
+		provided the information.
+
+		Changed AIX header file #include pattern to prevent
+		gcc's loader from complaining about multiply defined
+		etherbroadcastaddr[], fddi_broadcastaddr[], and
+		ie5_broadcastaddr[] CONST u_char arrays from
+		<net/net_globals.h>.  (The AIX loader doesn't
+		complain.)  David Capshaw <David.Capshaw@SEMATECH.Org>
+		reported this problem.
+
+		Removed the HASPWSTAYOPEN definition; it was only
+		used for two dialects that are no longer supported.
+
+		Corrected a bug in UID cacheing that appeared during
+		long repeat-mode (-r) operations.  The bug was
+		reported by Peter Van Epp <vanepp@sfu.ca>.  When
+		in repeat mode the UID cache will be cleared when
+		/etc/passwd changes.
+
+		Fixed a bug in FreeBSD support that causes a
+		segmentation fault on VBAD vnodes.
+
+		Deleted ultrix22 from Configure and RHF from Ultrix
+		source files.  Dropped 2.2 from support list.
+
+3.74		September 6, 1996
+		Corrected a bug in FreeBSD's proc table handling,
+		reported by David O'Brien <obrien@Nuxi.cs.ucdavis.edu>.
+
+3.75		September 9, 1996
+		Added FreeBSD proc table handling fix from revision
+		3.74 to BSDI, NetBSD, and OpenBSD dialects.
+
+		Improved Solaris VFS handling.
+
+		Added pipe handling to OpenBSD.  Changed Configure
+		script to define OPENBSDV for OpenBSD and used that
+		definition to include the pipe support in the NetBSD
+		sources.  The Configure script defines NETBSDV for
+		NetBSD.  So far neither dialect has any #if/#else/#endif
+		blocks that depend on version number.
+
+		Added support for AIX 4.2.
+
+3.76		September 21, 1996
+		Plugged a memory leak in command handling, introduced
+		in revision 3.70.  The bug was reported by Peter
+		Van Epp <vanepp@sfu.ca>.
+
+		Fixed a bug in the reporting of size for IRIX 5.3
+		EFS files, introduced in revision 3.69 by the name
+		space pollution abatement.  The _IRIXV definition
+		was used in the IRIX 5.x private efs_inode.h header
+		file to configure the inode stricture for IRIX 5.3,
+		so I changed the tests to use IRIXV.
+
+		Changed information on the AIX Stale Segment ID bug
+		to reflect the fact that IBM now says they won't
+		fix it.  They have closed the APAR.
+
+		Disabled the AIX gcc long long alignment hack under
+		AIX 4.2, because it doesn't work there.  Installed
+		a fatal error message in Configure that gcc can't
+		be used to compile lsof under AIX 4.2 until a work-
+		around can be developed.
+
+		Upgraded BSDI, FreeBSD (2.0 and above), NetBSD
+		(1.1B and above), and OpenBSD lock reporting.
+		David Mazieres <dm@amsterdam.lcs.mit.edu> reported
+		the need for the upgrade.
+
+		Made similar lock reporting upgrades to (versions
+		tested are in parentheses): AIX (4.1.4 and 4.2);
+		DEC OSF/1 (2.0 and 3.2d); EP/IX (2.1.1); HP-UX (9.x
+		and 10.10); IRIX (5.2, 5.3, and 6.2); Linux; NEXTSTEP
+		(3.1); PTX (2.1.6 and 4.2); RISCos; SCO (releases
+		3.0 and 5.0); Solaris (2.5); SunOS (4.1.3); and
+		Ultrix (4.2).
+
+		Updated man page and 00FAQ with more information on
+		lock reporting.
+
+		Updated PTX lsof for 4.2.  Upgraded HP-UX lsof for
+		10.20.  Used a test system, provided by Richard
+		Allen <ra@rhi.hi.is>, and received testing assistance
+		from Marc Winkler <marc@healthchex.com>.
+
+		Changed handling of Internet addresses to avoid DNS
+		lookup operations when the address has clearly not
+		been selected.  John DuBois <johnd@sco.COM> suggested
+		this.
+
+3.77		October 2, 1996
+		Changed SCO Configure stanza to call nm by its full
+		path, thus avoiding possible confusion.  The change
+		was suggested by Jean-Pierre Radley <jpr@jpr.com>.
+
+		Added changes to allow lsof to be compiled by gcc
+		under AIX 4.2 -- enabled some gcc-specific typedef's
+		in the AIX machine.h and disabled the Configure
+		script's rejection of aixgcc for AIX 4.2.  The
+		typdef's were supplied by Henry Grebler
+		<henryg@optimation.com.au>.
+
+		Based on information supplied by Henry and David
+		J. Wilson <davidw@optimation.com.au>, invented a
+		description and processing for an unknown file
+		struct that is established by AIX 4.2 (at least)
+		for X processes when DISPLAY=:0.0.  For convenience
+		I gave its type the DTYPE_PIPE definition, but that
+		may be incorrect.
+
+		Fixed some Solaris 2.[34] errors in locking code,
+		added at 3.76, that I couldn't test.  Rainer Orth
+		<ro@TechFak.Uni-Bielefeld.DE> reported the problem
+		and supplied the fixes.
+
+		Made Configure script supply NeXTSTEP 3.x version
+		in Makefile so that the shadow vnode locking code,
+		introduced in 3.76, would be disabled for NeXTSTEP
+		3.0.  Rainer Orth discovered this problem, too.
+
+		Added reporting of UNIX domain socket inode numbers
+		for Linux version 2.0 and above.  The addition was
+		supplied by Matthew Burt <BurtM@poole.siemens.co.uk>.
+
+		Enhanced file searching to report all instances of
+		references to automounted file systems, even when
+		they're direct mounts not yet realized.  Enhanced
+		Solaris 2.5 lsof to grok autofs nodes.  Victoria
+		H. Lau <vlau@msmail2.hac.com> pointed out the need
+		for these enhancements and helped test them.
+
+		Changed AIX lock length test so it will work with
+		gcc under AIX 4.2.
+
+		Changed PTX HAS_VXFS symbol, indicating presence
+		of VxFS, to HASVXFS for consistency with the HP-UX
+		form of the symbol.
+
+3.78		October 14, 1996
+		Changed strtol() call in private Linux nlist()
+		function to strtoul().  Linux kernel addresses at
+		2.1.0 have their top bit set and appear to be
+		negative to strtol().  This information was provided
+		by Marty Leisner <leisner@sdsp.mc.xerox.com>.
+		Marty also notes that other, unknown-as-of-yet
+		problems prevent lsof from working under 2.1.  He
+		is investigating, since I don't have access to a
+		2.1 system.
+
+		Added definitions to machine.h for a private file
+		struct type (HASPRIVFILETYPE and PRIVFILETYPE) that
+		can be accommodated without changing prfp.frag,
+		much as HASPIPEFN works for PIPE file struct types.
+
+		Used the new private file struct type support to
+		support the AIX f_type=0xf that DISPLAY=:0.0 causes.
+		Changed its output TYPE from PIPE to SMT; displayed
+		file size as buffer size less free bytes in buffer;
+		enabled recognizion under AIX 4.1.4.  Mike Feldman
+		<feldman@charm.urbana.mcd.mot.com> and others helped
+		me identify this file as a Shared Memory Transport
+		(SMT) socket.
+
+		Corrected a function prototype in the HP-UX dnode.c
+		for HP-UX 10 and greater; gcc objected; HP's cc did
+		not.  Christian Krackowizer <kra1@technodat.co.at>
+		reported the problem.
+
+		Made AFSConfig script more capable of locating the
+		cell's root directory.  Updated AFS documentation
+		in 00FAQ and 00README.  Both were suggested by
+		Timothy Miller <tsm@cs.brown.edu>.
+
+		Installed update to big_brother.perl5 script from
+		Lionel Cons <Lionel.Cons@cern.ch>.
+
+3.79		October 29, 1996
+		Added support for IRIX 6.4, courtesy of a test
+		system provided by Angel Li <angel@rrsl.rsmas.miami.edu>.
+		Fixed FIFO and NFS3 bugs in IRIX 6.2 lsof in the
+		process.  Lsof has not been tested under IRIX 6.3,
+		but the Configure script has a stanza for it.
+
+		Changed device functions to use stat() instead of
+		lstat().  Used WARNDEVACCESS to suppress stat(2)
+		failure messages.
+
+		Tested under OpenBSD 2.0.
+
+3.80		November 8, 1996
+		Corrected comments in 00README about using the
+		sunos413 and sunos413cc Configure abbreviations.
+
+		Made some Configure and Customize script changes,
+		suggested by Bruce Jerrick <bruce@cse.ogi.edu>.
+
+		Added missing elements to definition of local
+		Solaris 2.3 lock_descriptor structure so that
+		dnode.c will compile and work properly under it.
+		Corrected a bug in Solaris 2.[34] lock descriptor
+		handling.
+
+3.81		November 14, 1996
+		Corrected error in the "invented" HP-UX 10.20 proc
+		struct.  The erroneous struct definition named the
+		set-UID member as the UID member, resulting in
+		occasional incorrect UID attributions in lsof
+		output.
+
+		At the suggestion of Larry Schwimmer
+		<schwim@cyclone.stanford.edu>, changed AFSConfig
+		to use awk to get the cell name from
+		/usr/etc/vice/ThisCell, thus avoiding a problem
+		when the cell name line has more than one word.
+
+		Added -DSWASH to IRIX 6.2 options propagated from
+		the kernel build CCOPTS to lsof's Makefile.  Randolph
+		J. Herber <herber@dcdrjh.fnal.gov> did the detective
+		work that revealed the need for this.  IRIX 6.2 patch
+		1488 added -DSWASH and its effects.
+
+3.82		December 11, 1996
+		Updated Configure script for FreeBSD 3.0 and SCO
+		OpenServer 5.0.[24].  FreeBSD Configure script
+		change was supplied by David E. O'Brien
+		<obrien@NUXI.com> and SCO Configure script change
+		was supplied by Bela Lubkin <belal@sco.COM>.
+
+		Tested lsof under FreeBSD 3.0, courtesy of a test
+		system provided by Ade Barkah <mbarkah@hemi.com>.
+
+		Added changes to support SCO OpenServer 5.0.4
+		(Comet), supplied by Bela Lubkin <belal@sco.COM>.
+
+		Added support for UnixWare 2.1.  D. Chris Daniels
+		<chrisd@dlpco.com> provided a test system and Bela
+		Lubkin provided technical assistance.
+
+		Added support for Pyramid DC/OSx 1.1 and Reliant
+		UNIX 5.43.  Bruce Beare <bjb@pyramid.com> and Kevin
+		Smith <kevin@pyramid.com> provided test systems
+		and technical assistance.  This dialect version
+		must run setuid-root, since it accesses proc and
+		user structures vic the /proc file system.
+
+		Tested under PTX 2.1.9 and added support for PTX
+		4.2.1.
+
+		At Bela Lubkin's suggestion added a commercial to
+		the lsof man page, -h option, and -v option output,
+		telling where to get the latest revision.  This
+		entailed large scale rearrangement of the -h output
+		to keep it as short as possible.  It also involved
+		shortening the -X explanation for PTX.
+
+		Made sure that address segment access errors didn't
+		incorrectly force the listing of a process.  This
+		fix was needed by the Sun, Pyramid, and UnixWare
+		ports.
+
+		Corrected bug in the way the local device table is
+		sorted.
+
+3.83		December 30, 1996
+		Added support for Solaris 2.6 (Beta) with help from
+		Casper Dik <casper@holland.Sun.COM>, May Jackson
+		<methalya.jackson@eng.sun.com>, Joseph Kowalski
+		<jek3@Eng.Sun.COM>, and the Solaris 2.6 Beta test
+		program.
+
+		Fixed an inode file system type processing bug in
+		SCO OpenServ 5.0 and greater, reported by Robert
+		Lipe <robertl@arnet.com>.
+
+		Fixed bugs in SCO kernel name cache probing, courtesy
+		of code and suggestions from Bela Lubkin <belal@sco.COM>.
+
+		Revised kernel name list handling to remove the need
+		for changing two files (dlsof.h and dstore.c) when
+		altering, removing, or adding name list symbols.
+		All dialects were affected.
+
+		Added support for SCO OpenServer event "clones."
+		Robert Lipe need for their support and Bela Lubkin
+		provided technical assistance in identifying them.
+
+		Added display of bound name to Solaris UNIX domain
+		socket file handling.
+
+		Correct bug in SunOS address space ("txt" file)
+		handling.
+
+		Tested under UnixWare 2.1.1.
+
+		Changed SGI IRIX lsof to use the kernel's proc
+		struct size when striding through its proc table
+		(IRIX versions below 6.4).  The proc struct size
+		difference warning is still issued, and lsof still
+		uses the proc struct size and proc struct from
+		<sys/proc.h> to read and process proc table
+		information.  Added a note to 00FAQ about this.
+
+		Deferred Internet host and port name lookups to
+		print time, thus avoiding lookups for files that
+		are not listed.
+
+3.84		January 13, 1997
+		Updated the Pyramid private configuration script,
+		MkKernOpts, to propagate the R4000 definition for
+		DC/OSx systems so equipped.  Anthony Shortland
+		<anthony.shortland@FMR.COM> pointed out the need
+		for this and Kevin Smith <kevin@pyramid.com> provided
+		access to a test system.
+
+		Added information to 00FAQ about UDP ports for
+		which lsof can't find users, because the ports are
+		reserved to the kernel and aren't associated with
+		open files.
+
+3.85		January 17, 1987
+		The DEC OSF/1 kernel name cache can be processed
+		as a simple table, rather than a linked list, so
+		changed the interface to rnam.frag accordingly.
+
+		Added a new optional output field, parent process
+		ID (PPID).  The -R option (for paRent) selects it,
+		and the `R' field identifier labels it.  Updated
+		some scripts to handle it and developed two new
+		scripts, idrlogin.perl and idrlogin.perl5, to
+		use it in locating nework (rlogind and telnetd)
+		source addresses for shell processes.  Added some
+		information about the new scripts to 00QUICKSTART.
+
+3.86		January 30, 1997
+		Add explanation of why device warning messages
+		disappear when the device cache file is used.
+
+		Changed Linux Configure stanza to check more
+		places for the [z]System.map file and warn if
+		the one located differs in date from /vmlinuz.
+		Bjorn S. Nilsson <NILSSON@nbivms.nbi.dk> suggested
+		this for easier configuration at Linux 2.0.28.
+
+		Changed Linux Confifgure stanza to check for the
+		presence of fl_fd, fl_file, and fl_whence in the
+		file_lock structure of <linux.fs.h> and define
+		symbols appropriately.
+
+		Changed Linux lock testing to test task structure
+		pointer (fl_owner) from file_lock struct as well
+		as (possibly) the file struct pointer (fl_file) or
+		file decriptor number (fl_fd) to identify the lock
+		owner, depending on what HAS_FL_* symbols were
+		defined by Configure's file_lock structure examination.
+		Added section to Linux Problems in 00FAQ about this.
+
+		Corrected 00FAQ reference in Configure's Solaris
+		2.4 stanza.
+
+3.87		February 11, 1997
+		Corrected setting of VxFS device number for HP-UX
+		and PTX.
+
+		Added VM map flag test #if/#else/#endif for recent
+		versions of FreeBSD 3.0, supplied by Chris Timmons
+		<skynyrd@opus.cts.cwu.edu>.
+
+		Added a #define that removes a conflict between a
+		signal() prototype in the IRIX 6.4 <sys/systm.h>
+		and one in its <sys/signal.h>, exposed when cachefs
+		support is enabled.  Wolfgang Hecht
+		<hecht@zedat.fu-berlin.de> identified the need for
+		this addition and helped test it.  Refined IRIX
+		proc struct size test, warning, and use.
+
+		Revised Linux system map file handling (yet again)
+		to search for the file at execution time, rather
+		than in the Configure script.  Marty Leisner
+		<leisner@sdsp.mc.xerox.com> suggested this.
+
+		Added VxFS support to Solaris lsof with help from
+		Peter Radig <radig@DresdnerBank.de>.  Philip Kizer
+		<pckizer@tamu.edu> helped test.
+
+		Added support for PTX 4.3, thanks to access provided
+		by Peter Jordan <petej@sequent.com>.
+
+3.87		February 11, 1997
+supplement	Updated FreeBSD kernel name list handling.
+
+3.88		February 17, 1997
+		Added documentation files -- 00.README.FIRST[_<version>]
+		and 00RELEASE.SUMMARY_<version> -- to the distribution.
+
+
+Vic Abell <abe@purdue.edu>
+Purdue University Computing Center
+February 17, 1997
diff --git a/OLD/lsof_h.dbg b/OLD/lsof_h.dbg
new file mode 100644
index 0000000000000000000000000000000000000000..e483fa355f51cb86b9ed682153baa5941b6d3ce7
--- /dev/null
+++ b/OLD/lsof_h.dbg
@@ -0,0 +1,22 @@
+
+
+/* DEBUG -- where "appropriate in lsof.h */
+#define	calloc	next_calloc
+#define	free	next_free
+#define	malloc	next_malloc
+#define	realloc	next_realloc
+#include <stdlib.h>
+#undef	calloc
+#undef	free
+#undef	malloc
+#undef	realloc
+#define	calloc(n, s)	lsofcalloc(__FILE__, __LINE__, n, s)
+#define	free(p)		lsoffree(__FILE__, __LINE__, p)
+#define	malloc(s)	lsofmalloc(__FILE__, __LINE__, s)
+#define	realloc(p, s)	lsofrealloc(__FILE__, __LINE__, p, s)
+extern	void *lsofcalloc(char *f, int l, size_t n, size_t s);
+extern	void lsoffree(char *f, int l, void *p);
+extern	void *lsofmalloc(char *f, int l, size_t s);
+extern	void *lsofrealloc(char *f, int l, void *p, size_t s);
+extern int DBMon;
+/* end DEBUG section for lsof.h */
diff --git a/OLD/main.c b/OLD/main.c
new file mode 100644
index 0000000000000000000000000000000000000000..054cdcdf9a49f2a535e0e4c4ba9e80247df8c2a4
--- /dev/null
+++ b/OLD/main.c
@@ -0,0 +1,1876 @@
+/*
+ * main.c - common main function for lsof
+ *
+ * V. Abell, Purdue University
+ */
+
+
+/*
+ * Copyright 1994 Purdue Research Foundation, West Lafayette, Indiana
+ * 47907.  All rights reserved.
+ *
+ * Written by Victor A. Abell
+ *
+ * This software is not subject to any license of the American Telephone
+ * and Telegraph Company or the Regents of the University of California.
+ *
+ * Permission is granted to anyone to use this software for any purpose on
+ * any computer system, and to alter it and redistribute it freely, subject
+ * to the following restrictions:
+ *
+ * 1. Neither the authors nor Purdue University are responsible for any
+ *    consequences of the use of this software.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ *    explicit claim or by omission.  Credit to the authors and Purdue
+ *    University must appear in documentation and sources.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ *    misrepresented as being the original software.
+ *
+ * 4. This notice may not be removed or altered.
+ */
+
+#ifndef lint
+static char copyright[] =
+"@(#) Copyright 1994 Purdue Research Foundation.\nAll rights reserved.\n";
+static char *rcsid = "$Id: main.c,v 1.57 2015/07/07 20:16:58 abe Exp abe $";
+#endif
+
+
+#include "lsof.h"
+
+
+/*
+ * Local definitions
+ */
+
+static int GObk[] = { 1, 1 };		/* option backspace values */
+static char GOp;			/* option prefix -- '+' or '-' */
+static char *GOv = (char *)NULL;	/* option `:' value pointer */
+static int GOx1 = 1;			/* first opt[][] index */
+static int GOx2 = 0;			/* second opt[][] index */
+
+
+_PROTOTYPE(static int GetOpt,(int ct, char *opt[], char *rules, int *err));
+_PROTOTYPE(static char *sv_fmt_str,(char *f));
+
+
+/*
+ * main() - main function for lsof
+ */
+
+int
+main(argc, argv)
+	int argc;
+	char *argv[];
+{
+	int ad, c, i, n, rv, se1, se2, ss;
+	char *cp;
+	int err = 0;
+	int ev = 0;
+	int fh = 0;
+	char *fmtr = (char *)NULL;
+	long l;
+	MALLOC_S len;
+	struct lfile *lf;
+	struct nwad *np, *npn;
+	char options[128];
+	int rc = 0;
+	struct stat sb;
+	struct sfile *sfp;
+	struct lproc **slp = (struct lproc **)NULL;
+	int sp = 0;
+	struct str_lst *str, *strt;
+	int version = 0;
+	int xover = 0;
+
+#if	defined(HAS_STRFTIME)
+	char *fmt = (char *)NULL;
+	size_t fmtl = (size_t)0;
+#endif	/* defined(HAS_STRFTIME) */
+
+#if	defined(HASZONES)
+	znhash_t *zp;
+#endif	/* defined(HASZONES) */
+
+#if	defined(HASSELINUX)
+/*
+ * This stanza must be immediately before the "Save progam name." code, since
+ * it contains code itself.
+ */
+	cntxlist_t *cntxp;
+
+	CntxStatus = is_selinux_enabled() ? 1 : 0;
+#endif	/* defined(HASSELINUX) */
+
+/*
+ * Save program name.
+ */
+	if ((Pn = strrchr(argv[0], '/')))
+	    Pn++;
+	else
+	    Pn = argv[0];
+/*
+ * Close enough file descriptors above 2 that library functions will have
+ * open descriptors.
+ *
+ * Make sure stderr, stdout, and stdin are open descriptors.  Open /dev/null
+ * for ones that aren't.  Be terse.
+ *
+ * Make sure umask allows lsof to define its own file permissions.
+ */
+
+	if ((MaxFd = (int) GET_MAX_FD()) < 53)
+	    MaxFd = 53;
+
+#if	defined(HAS_CLOSEFROM)
+	(void) closefrom(3);
+#else	/* !defined(HAS_CLOSEFROM) */
+	for (i = 3; i < MaxFd; i++)
+	    (void) close(i);
+#endif	/* !defined(HAS_CLOSEFROM) */
+
+	while (((i = open("/dev/null", O_RDWR, 0)) >= 0) && (i < 2))
+	    ;
+	if (i < 0)
+	    Exit(1);
+	if (i > 2)
+	    (void) close(i);
+	(void) umask(0);
+
+#if	defined(HASSETLOCALE)
+/*
+ * Set locale to environment's definition.
+ */
+	(void) setlocale(LC_CTYPE, "");
+#endif	/* defined(HASSETLOCALE) */
+
+/*
+ * Common initialization.
+ */
+	Mypid = getpid();
+	if ((Mygid = (gid_t)getgid()) != getegid())
+	    Setgid = 1;
+	Euid = geteuid();
+	if ((Myuid = (uid_t)getuid()) && !Euid)
+	    Setuidroot = 1;
+	if (!(Namech = (char *)malloc(MAXPATHLEN + 1))) {
+	    (void) fprintf(stderr, "%s: no space for name buffer\n", Pn);
+	    Exit(1);
+	}
+	Namechl = (size_t)(MAXPATHLEN + 1);
+/*
+ * Create option mask.
+ */
+	(void) snpf(options, sizeof(options),
+	    "?a%sbc:%sD:d:%s%sf:F:g:hi:%s%slL:%s%snNo:Op:Pr:%ss:S:tT:u:UvVwx:%s%s%s",
+
+#if	defined(HAS_AFS) && defined(HASAOPT)
+	    "A:",
+#else	/* !defined(HAS_AFS) || !defined(HASAOPT) */
+	    "",
+#endif	/* defined(HAS_AFS) && defined(HASAOPT) */
+
+#if	defined(HASNCACHE)
+	    "C",
+#else	/* !defined(HASNCACHE) */
+	    "",
+#endif	/* defined(HASNCACHE) */
+
+#if	defined(HASEOPT)
+	    "e:",
+#else	/* !defined(HASEOPT) */
+	    "",
+#endif	/* defined(HASEOPT) */
+
+#if	defined(HASEPTOPTS)
+	    "E",
+#else	/* !defined(HASEPTOPTS) */
+	    "",
+#endif	/* defined(HASEPTOPTS) */
+
+#if	defined(HASKOPT)
+	    "k:",
+#else	/* !defined(HASKOPT) */
+	    "",
+#endif	/* defined(HASKOPT) */
+
+#if	defined(HASTASKS)
+	    "K:",
+#else	/* !defined(HASTASKS) */
+	    "",
+#endif	/* defined(HASTASKS) */
+
+#if	defined(HASMOPT) || defined(HASMNTSUP)
+	    "m:",
+#else	/* !defined(HASMOPT) && !defined(HASMNTSUP) */
+	    "",
+#endif	/* defined(HASMOPT) || defined(HASMNTSUP) */
+
+#if	defined(HASNORPC_H)
+	    "",
+#else	/* !defined(HASNORPC_H) */
+	    "M",
+#endif	/* defined(HASNORPC_H) */
+
+#if	defined(HASPPID)
+	    "R",
+#else	/* !defined(HASPPID) */
+	    "",
+#endif	/* defined(HASPPID) */
+
+#if	defined(HASXOPT)
+# if	defined(HASXOPT_ROOT)
+	    (Myuid == 0) ? "X" : "",
+# else	/* !defined(HASXOPT_ROOT) */
+	    "X",
+# endif	/* defined(HASXOPT_ROOT) */
+#else	/* !defined(HASXOPT) */
+	    "",
+#endif	/* defined(HASXOPT) */
+
+#if	defined(HASZONES)
+	    "z:",
+#else	/* !defined(HASZONES) */
+	    "",
+#endif	/* defined(HASZONES) */
+ 
+#if	defined(HASSELINUX)
+	    "Z:"
+#else	/* !defined(HASSELINUX) */
+	    ""
+#endif	/* defined(HASSELINUX) */
+
+	    );
+/*
+ * Loop through options.
+ */
+	while ((c = GetOpt(argc, argv, options, &rv)) != EOF) {
+	    if (rv) {
+		err = 1;
+		continue;
+	    }
+	    switch (c) {
+	    case 'a':
+		Fand = 1;
+		break;
+
+#if	defined(HAS_AFS) && defined(HASAOPT)
+	    case 'A':
+		if (!GOv || *GOv == '-' || *GOv == '+') {
+		    (void) fprintf(stderr, "%s: -A not followed by path\n", Pn);
+		    err = 1;
+		    if (GOv) {
+			GOx1 = GObk[0];
+			GOx2 = GObk[1];
+		    }
+		} else
+		    AFSApath = GOv;
+		break;
+#endif	/* defined(HAS_AFS) && defined(HASAOPT) */
+
+	    case 'b':
+		Fblock = 1;
+		break;
+	    case 'c':
+		if (GOp == '+') {
+		    if (!GOv || (*GOv == '-') || (*GOv == '+')
+		    ||  !isdigit((int)*GOv))
+		    {
+			(void) fprintf(stderr,
+			    "%s: +c not followed by width number\n", Pn);
+			err = 1;
+			if (GOv) {
+			    GOx1 = GObk[0];
+			    GOx2 = GObk[1];
+			}
+		    } else {
+			CmdLim = TaskCmdLim = atoi(GOv);
+
+#if	defined(MAXSYSCMDL)
+			if (CmdLim > MAXSYSCMDL) {
+			    (void) fprintf(stderr,
+				"%s: +c %d > what system provides (%d)\n",
+				Pn, CmdLim, MAXSYSCMDL);
+			    err = 1;
+			}
+#endif	/* defined(MAXSYSCMDL) */
+
+		    }
+		    break;
+		}
+		if (GOv && (*GOv == '/')) {
+		    if (enter_cmd_rx(GOv))
+			err = 1;
+		} else {
+		    if (enter_str_lst("-c", GOv, &Cmdl, &Cmdni, &Cmdnx))
+			err = 1;
+
+#if	defined(MAXSYSCMDL)
+		    else if (Cmdl->len > MAXSYSCMDL) {
+			(void) fprintf(stderr, "%s: \"-c ", Pn);
+			(void) safestrprt(Cmdl->str, stderr, 2);
+			(void) fprintf(stderr, "\" length (%d) > what system",
+			    Cmdl->len);
+			(void) fprintf(stderr, " provides (%d)\n",
+			    MAXSYSCMDL);
+			Cmdl->len = 0;	/* (to avoid later error report) */
+			err = 1;
+		    }
+#endif	/* defined(MAXSYSCMDL) */
+
+		}
+		break;
+
+#if	defined(HASNCACHE)
+	    case 'C':
+		Fncache = (GOp == '-') ? 0 : 1;
+		break;
+
+#endif	/* defined(HASNCACHE) */
+	    case 'd':
+		if (GOp == '+') {
+		    if (enter_dir(GOv, 0))
+			err = 1;
+		    else {
+			Selflags |= SELNM;
+			xover = 1;
+		    }
+		} else {
+		    if (enter_fd(GOv))
+			err = 1;
+		}
+		break;
+	    case 'D':
+		if (GOp == '+') {
+		    if (enter_dir(GOv, 1))
+			err = 1;
+		    else {
+			Selflags |= SELNM;
+			xover = 1;
+		    }
+		} else {
+
+#if	defined(HASDCACHE)
+		    if (ctrl_dcache(GOv))
+			err = 1;
+#else	/* !defined(HASDCACHE) */
+		    (void) fprintf(stderr, "%s: unsupported option: -D\n", Pn);
+		    err = 1;
+#endif	/* defined(HASDCACHE) */
+
+		}
+		break;
+
+#if	defined(HASEOPT)
+	    case 'e':
+		if (enter_efsys(GOv, ((GOp == '+') ? 1 : 0)))
+		    err = 1;
+		break;
+#endif	/* defined(HASEOPT) */
+
+#if	defined(HASEPTOPTS)
+	    case 'E':
+		FeptE = (GOp == '+') ? 2 : 1;
+		break;
+#endif	/* defined(HASEPTOPTS) */
+
+	    case 'f':
+		if (!GOv || *GOv == '-' || *GOv == '+') {
+		    Ffilesys = (GOp == '+') ? 2 : 1;
+		    if (GOv) {
+			GOx1 = GObk[0];
+			GOx2 = GObk[1];
+		    }
+		    break;
+		}
+
+#if	defined(HASFSTRUCT)
+		for (; *GOv; GOv++) {
+		    switch (*GOv) {
+
+# if	!defined(HASNOFSCOUNT)
+		    case 'c':
+		    case 'C':
+			if (GOp == '+') {
+			    Fsv |= FSV_CT;
+			    FsvByf = 1;
+			} else
+			    Fsv &= (unsigned char)~FSV_CT;
+			break;
+# endif	/* !defined(HASNOFSCOUNT) */
+
+# if	!defined(HASNOFSADDR)
+		    case 'f':
+		    case 'F':
+			if (GOp == '+') {
+			    Fsv |= FSV_FA;
+			    FsvByf = 1;
+			} else
+			    Fsv &= (unsigned char)~FSV_FA;
+			break;
+# endif	/* !defined(HASNOFSADDR) */
+
+# if	!defined(HASNOFSFLAGS)
+		    case 'g':
+		    case 'G':
+			if (GOp == '+') {
+			    Fsv |= FSV_FG;
+			    FsvByf = 1;
+			} else
+			    Fsv &= (unsigned char)~FSV_FG;
+			FsvFlagX = (*GOv == 'G') ? 1 : 0;
+			break;
+# endif	/* !defined(HASNOFSFLAGS) */
+
+# if	!defined(HASNOFSNADDR)
+		    case 'n':
+		    case 'N':
+			if (GOp == '+') {
+			    Fsv |= FSV_NI;
+			    FsvByf = 1;
+			} else
+			    Fsv &= (unsigned char)~FSV_NI;
+			break;
+# endif	/* !defined(HASNOFSNADDR */
+
+		    default:
+			(void) fprintf(stderr,
+			    "%s: unknown file struct option: %c\n", Pn, *GOv);
+			err++;
+		    }
+		}
+#else	/* !defined(HASFSTRUCT) */
+		(void) fprintf(stderr,
+		    "%s: unknown string for %cf: %s\n", Pn, GOp, GOv);
+		err++;
+#endif	/* defined(HASFSTRUCT) */
+
+		break;
+	    case 'F':
+		if (!GOv || *GOv == '-' || *GOv == '+'
+		||  strcmp(GOv, "0") == 0) {
+		    if (GOv) {
+			if (*GOv == '-' || *GOv == '+') {
+			    GOx1 = GObk[0];
+			    GOx2 = GObk[1];
+			} else if (*GOv == '0')
+			    Terminator = '\0';
+		    }
+		    for (i = 0; FieldSel[i].nm; i++) {
+
+#if	!defined(HASPPID)
+			if (FieldSel[i].id == LSOF_FID_PPID)
+			    continue;
+#endif	/* !defined(HASPPID) */
+
+#if	!defined(HASTASKS)
+			if (FieldSel[i].id == LSOF_FID_TCMD)
+			    continue;
+#endif	/* !defined(HASTASKS) */
+
+#if	!defined(HASFSTRUCT)
+			if (FieldSel[i].id == LSOF_FID_CT
+			||  FieldSel[i].id == LSOF_FID_FA
+			||  FieldSel[i].id == LSOF_FID_FG
+			||  FieldSel[i].id == LSOF_FID_NI)
+			    continue;
+#endif	/* !defined(HASFSTRUCT) */
+ 
+#if	defined(HASSELINUX)
+			if ((FieldSel[i].id == LSOF_FID_CNTX) && !CntxStatus)
+			    continue;
+#else	/* !defined(HASSELINUX) */
+			if (FieldSel[i].id == LSOF_FID_CNTX)
+			    continue;
+#endif	/* !defined(HASSELINUX) */
+
+			if (FieldSel[i].id == LSOF_FID_RDEV)
+			    continue;	/* for compatibility */
+
+#if	!defined(HASTASKS)
+			if (FieldSel[i].id == LSOF_FID_TID)
+			    continue;
+#endif	/* !defined(HASTASKS) */
+
+#if	!defined(HASZONES)
+			if (FieldSel[i].id == LSOF_FID_ZONE)
+			    continue;
+#endif	/* !defined(HASZONES) */
+
+			FieldSel[i].st = 1;
+			if (FieldSel[i].opt && FieldSel[i].ov)
+			    *(FieldSel[i].opt) |= FieldSel[i].ov;
+		    }
+
+#if	defined(HASFSTRUCT)
+		    Ffield = FsvFlagX = 1;
+#else	/* !defined(HASFSTRUCT) */
+		    Ffield = 1;
+#endif	/* defined(HASFSTRUCT) */
+
+		    break;
+		}
+		if (strcmp(GOv, "?") == 0) {
+		    fh = 1;
+		    break;
+		}
+		for (; *GOv; GOv++) {
+		    for (i = 0; FieldSel[i].nm; i++) {
+
+#if	!defined(HASPPID)
+			if (FieldSel[i].id == LSOF_FID_PPID)
+			    continue;
+#endif	/* !defined(HASPPID) */
+
+#if	!defined(HASTASKS)
+			if (FieldSel[i].id == LSOF_FID_TCMD)
+			    continue;
+#endif	/* !defined(HASTASKS) */
+
+#if	!defined(HASFSTRUCT)
+			if (FieldSel[i].id == LSOF_FID_CT
+			||  FieldSel[i].id == LSOF_FID_FA
+			||  FieldSel[i].id == LSOF_FID_FG
+			||  FieldSel[i].id == LSOF_FID_NI)
+			    continue;
+#endif	/* !defined(HASFSTRUCT) */
+
+#if	!defined(HASTASKS)
+			if (FieldSel[i].id == LSOF_FID_TID)
+			    continue;
+#endif	/* !defined(HASTASKS) */
+
+			if (FieldSel[i].id == *GOv) {
+			    FieldSel[i].st = 1;
+			    if (FieldSel[i].opt && FieldSel[i].ov)
+				*(FieldSel[i].opt) |= FieldSel[i].ov;
+
+#if	defined(HASFSTRUCT)
+			    if (i == LSOF_FIX_FG)
+				FsvFlagX = 1;
+#endif	/* defined(HASFSTRUCT) */
+
+			    if (i == LSOF_FIX_TERM)
+				Terminator = '\0';
+			    break;
+			}
+		    }
+		    if ( ! FieldSel[i].nm) {
+			(void) fprintf(stderr,
+			    "%s: unknown field: %c\n", Pn, *GOv);
+			err++;
+		    }
+		}
+		Ffield = 1;
+		break;
+	    case 'g':
+		if (GOv) {
+		    if (*GOv == '-' || *GOv == '+') {
+			GOx1 = GObk[0];
+			GOx2 = GObk[1];
+		    } else if (enter_id(PGID, GOv))
+			err = 1;
+		}
+		Fpgid = 1;
+		break;
+	    case 'h':
+	    case '?':
+		Fhelp = 1;
+		break;
+	    case 'i':
+		if (!GOv || *GOv == '-' || *GOv == '+') {
+		    Fnet = 1;
+		    FnetTy = 0;
+		    if (GOv) {
+			GOx1 = GObk[0];
+			GOx2 = GObk[1];
+		    }
+		    break;
+		}
+		if (enter_network_address(GOv))
+		    err = 1;
+		break;
+
+#if	defined(HASKOPT)
+	    case 'k':
+		if (!GOv || *GOv == '-' || *GOv == '+') {
+		    (void) fprintf(stderr, "%s: -k not followed by path\n", Pn);
+		    err = 1;
+		    if (GOv) {
+			GOx1 = GObk[0];
+			GOx2 = GObk[1];
+		    }
+		} else
+		    Nmlst = GOv;
+		break;
+#endif	/* defined(HASKOPT) */
+
+#if	defined(HASTASKS)
+	    case 'K':
+		if (!GOv || *GOv == '-' || *GOv == '+') {
+		    Ftask = 1;
+		    IgnTasks = 0;
+		    Selflags |= SELTASK;
+		    if (GOv) {
+			GOx1 = GObk[0];
+			GOx2 = GObk[1];
+		    }
+		} else {
+		    if (!strcasecmp(GOv, "i")) {
+			Ftask = 0;
+			IgnTasks = 1;
+			Selflags &= ~SELTASK;
+		   } else {
+			(void) fprintf(stderr,
+			    "%s: -K not followed by i (but by %s)\n", Pn, GOv);
+			err = 1;
+		   }
+		}
+		break;
+#endif	/* defined(HASTASKS) */
+
+	    case 'l':
+		Futol = 0;
+		break;
+	    case 'L':
+		Fnlink = (GOp == '+') ? 1 : 0;
+		if (!GOv || *GOv == '-' || *GOv == '+') {
+		    Nlink = 0l;
+		    if (GOv) {
+			GOx1 = GObk[0];
+			GOx2 = GObk[1];
+		    }
+		    break;
+		}
+		for (cp = GOv, l = 0l, n = 0; *cp; cp++) {
+		    if (!isdigit((unsigned char)*cp))
+			break;
+		    l = (l * 10l) + ((long)*cp - (long)'0');
+		    n++;
+		}
+		if (n) {
+		    if (GOp != '+') {
+			(void) fprintf(stderr,
+			    "%s: no number may follow -L\n", Pn);
+			err = 1;
+		    } else {
+			Nlink = l;
+			Selflags |= SELNLINK;
+		    }
+		} else
+		    Nlink = 0l;
+		if (*cp) {
+		    GOx1 = GObk[0];
+		    GOx2 = GObk[1] + n;
+		}
+		break;
+
+#if	defined(HASMOPT) || defined(HASMNTSUP)
+	    case 'm':
+		if (GOp == '-') {
+
+# if	defined(HASMOPT)
+		    if (!GOv || *GOv == '-' || *GOv == '+') {
+			(void) fprintf(stderr,
+			    "%s: -m not followed by path\n", Pn);
+			err = 1;
+			if (GOv) {
+			    GOx1 = GObk[0];
+			    GOx2 = GObk[1];
+			}
+		    } else
+			Memory = GOv;
+# else	/* !defined(HASMOPT) */
+		    (void) fprintf(stderr, "%s: -m not supported\n", Pn);
+		    err = 1;
+# endif	/* defined(HASMOPT) */
+
+		} else if (GOp == '+') {
+
+# if	defined(HASMNTSUP)
+		    if (!GOv || *GOv == '-' || *GOv == '+') {
+			MntSup = 1;
+			if (GOv) {
+			    GOx1 = GObk[0];
+			    GOx2 = GObk[1];
+			}
+		    } else {
+			MntSup = 2;
+			MntSupP = GOv;
+		    }
+# else	/* !defined(HASMNTSUP) */
+		    (void) fprintf(stderr, "%s: +m not supported\n", Pn);
+		    err = 1;
+# endif	/* defined(HASMNTSUP) */
+
+		} else {
+		    (void) fprintf(stderr, "%s: %cm not supported\n", Pn, GOp);
+		    err = 1;
+		}
+		break;
+#endif	/* defined(HASMOPT) || defined(HASMNTSUP) */
+
+#if	!defined(HASNORPC_H)
+	    case 'M':
+		FportMap = (GOp == '+') ? 1 : 0;
+		break;
+#endif	/* !defined(HASNORPC_H) */
+
+	    case 'n':
+		Fhost = (GOp == '-') ? 0 : 1;
+		break;
+	    case 'N':
+		Fnfs = 1;
+		break;
+	    case 'o':
+		if (!GOv || *GOv == '-' || *GOv == '+') {
+		    Foffset = 1;
+		    if (GOv) {
+			GOx1 = GObk[0];
+			GOx2 = GObk[1];
+		    }
+		    break;
+		}
+		for (cp = GOv, i = n = 0; *cp; cp++) {
+		    if (!isdigit((unsigned char)*cp))
+			break;
+		    i = (i * 10) + ((int)*cp - '0');
+		    n++;
+		}
+		if (n)
+		    OffDecDig = i;
+		else
+		    Foffset = 1;
+		if (*cp) {
+		    GOx1 = GObk[0];
+		    GOx2 = GObk[1] + n;
+		}
+		break;
+	    case 'O':
+		Fovhd = (GOp == '-') ? 1 : 0;
+		break;
+	    case 'p':
+		if (enter_id(PID, GOv))
+		    err = 1;
+		break;
+	    case 'P':
+		Fport = (GOp == '-') ? 0 : 1;
+		break;
+	    case 'r':
+		if (GOp == '+')
+		    ev = rc = 1;
+		if (!GOv || *GOv == '-' || *GOv == '+') {
+		    RptTm = RPTTM;
+		    if (GOv) {
+			GOx1 = GObk[0];
+			GOx2 = GObk[1];
+		    }
+		    break;
+		}
+		for (cp = GOv, i = n = 0; *cp; cp++) {
+		    if (!isdigit((unsigned char)*cp))
+			break;
+		    i = (i * 10) + ((int)*cp - '0');
+		    n++;
+		}
+		if (n)
+		    RptTm = i;
+		else
+		    RptTm = RPTTM;
+		if (!*cp)
+		     break;
+		while(*cp && (*cp == ' '))
+		    cp++;
+		if (*cp != LSOF_FID_MARK) {
+		    GOx1 = GObk[0];
+		    GOx2 = GObk[1] + n;
+		    break;
+		}
+
+#if	defined(HAS_STRFTIME)
+
+	    /*
+	     * Collect the strftime(3) format and test it.
+	     */
+		cp++;
+		if ((fmtl = strlen(cp) + 1) < 1) {
+		    (void) fprintf(stderr, "%s: <fmt> too short: \"%s\"\n",
+			Pn, cp);
+		    err = 1;
+		} else {
+		    fmt = cp;
+		    fmtl = (fmtl * 8) + 1;
+		    if (!(fmtr = (char *)malloc((MALLOC_S)fmtl))) {
+			(void) fprintf(stderr,
+			    "%s: no space (%d) for <fmt> result: \"%s\"\n",
+			    Pn, (int)fmtl, cp);
+			    Exit(1);
+		    }
+		    if (util_strftime(fmtr, fmtl - 1, fmt) < 1) {
+			(void) fprintf(stderr, "%s: illegal <fmt>: \"%s\"\n",
+			    Pn, fmt);
+			err = 1;
+		    }
+		}
+
+#else	/* !defined(HAS_STRFTIME) */
+		(void) fprintf(stderr, "%s: m<fmt> not supported: \"%s\"\n",
+		    Pn, cp);
+		err = 1;
+#endif	/* defined(HAS_STRFTIME) */
+
+		break;
+
+#if	defined(HASPPID)
+	    case 'R':
+		Fppid = 1;
+		break;
+#endif	/* defined(HASPPID) */
+
+	    case 's':
+
+#if	defined(HASTCPUDPSTATE)
+		if (!GOv || *GOv == '-' || *GOv == '+') {
+		    Fsize = 1;
+		    if (GOv) {
+			GOx1 = GObk[0];
+			GOx2 = GObk[1];
+		    }
+		} else {
+		    if (enter_state_spec(GOv))
+			err = 1;
+		}
+#else	/* !defined(HASTCPUDPSTATE) */
+		Fsize = 1;
+#endif	/* defined(HASTCPUDPSTATE) */
+
+		break;
+	    case 'S':
+		if (!GOv || *GOv == '-' || *GOv == '+') {
+		    TmLimit = TMLIMIT;
+		    if (GOv) {
+			GOx1 = GObk[0];
+			GOx2 = GObk[1];
+		    }
+		    break;
+		}
+		for (cp = GOv, i = n = 0; *cp; cp++) {
+		    if (!isdigit((unsigned char)*cp))
+			break;
+		    i = (i * 10) + ((int)*cp - '0');
+		    n++;
+		}
+		if (n)
+		    TmLimit = i;
+		else
+		    TmLimit = TMLIMIT;
+		if (*cp) {
+		    GOx1 = GObk[0];
+		    GOx2 = GObk[1] + n;
+		}
+		if (TmLimit < TMLIMMIN) {
+		    (void) fprintf(stderr,
+			"%s: WARNING: -S time (%d) changed to %d\n",
+			Pn, TmLimit, TMLIMMIN);
+		    TmLimit = TMLIMMIN;
+		}
+		break;
+	    case 't':
+		Fterse = Fwarn = 1;
+		break;
+	    case 'T':
+		if (!GOv || *GOv == '-' || *GOv == '+') {
+		    Ftcptpi = (GOp == '-') ? 0 : TCPTPI_STATE;
+		    if (GOv) {
+			GOx1 = GObk[0];
+			GOx2 = GObk[1];
+		    }
+		    break;
+		}
+		for (Ftcptpi = 0; *GOv; GOv++) {
+		    switch (*GOv) {
+
+#if	defined(HASSOOPT) || defined(HASSOSTATE) || defined(HASTCPOPT)
+		    case 'f':
+			Ftcptpi |= TCPTPI_FLAGS;
+			break;
+#endif	/* defined(HASSOOPT) || defined(HASSOSTATE) || defined(HASTCPOPT) */
+
+#if	defined(HASTCPTPIQ)
+		    case 'q':
+			Ftcptpi |= TCPTPI_QUEUES;
+			break;
+#endif	/* defined(HASTCPTPIQ) */
+
+		    case 's':
+			Ftcptpi |= TCPTPI_STATE;
+			break;
+
+#if	defined(HASTCPTPIW)
+		    case 'w':
+			Ftcptpi |= TCPTPI_WINDOWS;
+			break;
+#endif	/* defined(HASTCPTPIW) */
+
+		    default:
+			(void) fprintf(stderr,
+			"%s: unsupported TCP/TPI info selection: %c\n",
+			    Pn, *GOv);
+			err = 1;
+		    }
+		}
+		break;
+	    case 'u':
+		if (enter_uid(GOv))
+		    err = 1;
+		break;
+	    case 'U':
+		Funix = 1;
+		break;
+	    case 'v':
+		version = 1;
+		break;
+	    case 'V':
+		Fverbose = 1;
+		break;
+	    case 'w':
+		Fwarn = (GOp == '+') ? 0 : 1;
+		break;
+	    case 'x':
+		if (!GOv || *GOv == '-' || *GOv == '+') {
+		    Fxover = XO_ALL;
+		    if (GOv) {
+			GOx1 = GObk[0];
+			GOx2 = GObk[1];
+		    }
+		    break;
+		} else {
+		    for (; *GOv; GOv++) {
+			switch (*GOv) {
+			case 'f':
+			    Fxover |= XO_FILESYS;
+			    break;
+			case 'l':
+			    Fxover |= XO_SYMLINK;
+			    break;
+			default:
+			    (void) fprintf(stderr,
+				"%s: unknown cross-over option: %c\n",
+				Pn, *GOv);
+			    err++;
+			}
+		    }
+		}
+		break;
+
+#if	defined(HASXOPT)
+	    case 'X':
+		Fxopt = Fxopt ? 0 : 1;
+		break;
+#endif	/* defined(HASXOPT) */
+
+#if	defined(HASZONES)
+	    case 'z':
+		Fzone = 1;
+		if (GOv && (*GOv != '-') && (*GOv != '+')) {
+
+		/*
+		 * Add to the zone name argument hash.
+		 */
+		    if (enter_zone_arg(GOv))
+			err = 1;
+		} else if (GOv) {
+		    GOx1 = GObk[0];
+		    GOx2 = GObk[1];
+		}
+		break;
+#endif	/* defined(HASZONES) */
+ 
+#if	defined(HASSELINUX)
+	    case 'Z':
+		if (!CntxStatus) {
+		   (void) fprintf(stderr, "%s: -Z limited to SELinux\n", Pn);
+		    err = 1;
+		} else {
+		    Fcntx = 1;
+		    if (GOv && (*GOv != '-') && (*GOv != '+')) {
+
+		    /*
+		     * Add to the context name argument hash.
+		     */
+			if (enter_cntx_arg(GOv))
+			    err = 1;
+		    } else if (GOv) {
+			GOx1 = GObk[0];
+			GOx2 = GObk[1];
+		    }
+		}
+		break;
+#endif	/* defined(HASSELINUX) */
+
+	    default:
+		(void) fprintf(stderr, "%s: unknown option (%c)\n", Pn, c);
+		err = 1;
+	    }
+	}
+/*
+ * If IgnTasks is set, remove SELTASK from SelAll and SelProc.
+ */
+	SelAll = IgnTasks ? (SELALL & ~SELTASK) : SELALL;
+	SelProc = IgnTasks ? (SELPROC & ~SELTASK) : SELPROC;
+/*
+ * Check for argument consistency.
+ */
+	if (Cmdnx && Cmdni) {
+
+	/*
+	 * Check for command inclusion/exclusion conflicts.
+	 */
+	    for (str = Cmdl; str; str = str->next) {
+		if (str->x) {
+		    for (strt = Cmdl; strt; strt = strt->next) {
+			if (!strt->x) {
+			    if (!strcmp(str->str, strt->str)) {
+				(void) fprintf(stderr,
+				    "%s: -c^%s and -c%s conflict.\n",
+				    Pn, str->str, strt->str);
+				err++;
+			    }
+			}
+		    }
+		}
+	    }
+	}
+
+#if	defined(HASTCPUDPSTATE)
+	if (TcpStXn && TcpStIn) {
+
+	/*
+	 * Check for excluded and included TCP states.
+	 */
+	    for (i = 0; i < TcpNstates; i++) {
+		if (TcpStX[i] && TcpStI[i]) {
+		    (void) fprintf(stderr,
+			"%s: can't include and exclude TCP state: %s\n",
+			Pn, TcpSt[i]);
+		    err = 1;
+		}
+	    }
+	}
+	if (UdpStXn && UdpStIn) {
+
+	/*
+	 * Check for excluded and included UDP states.
+	 */
+	    for (i = 0; i < UdpNstates; i++) {
+		if (UdpStX[i] && UdpStI[i]) {
+		    (void) fprintf(stderr,
+			"%s: can't include and exclude UDP state: %s\n",
+			Pn, UdpSt[i]);
+		    err = 1;
+		}
+	    }
+	}
+#endif	/* defined(HASTCPUDPSTATE) */
+
+	if (Fsize && Foffset) {
+	    (void) fprintf(stderr, "%s: -o and -s are mutually exclusive\n",
+		Pn);
+	    err++;
+	}
+	if (Ffield) {
+	    if (Fterse) {
+		(void) fprintf(stderr,
+		    "%s: -F and -t are mutually exclusive\n", Pn);
+		err++;
+	    }
+	    FieldSel[LSOF_FIX_PID].st = 1;
+
+#if	defined(HAS_STRFTIME)
+	    if (fmtr) {
+
+	    /*
+	     * The field output marker format can't contain "%n" new line
+	     * requests.
+	     */
+		for (cp = strchr(fmt, '%'); cp; cp = strchr(cp, '%')) {
+		    if (*++cp  == 'n') {
+			(void) fprintf(stderr,
+			    "%s: %%n illegal in -r m<fmt> when -F has", Pn);
+			(void) fprintf(stderr,
+			    " been specified: \"%s\"\n", fmt);
+			err++;
+			break;
+		    } else if (*cp == '%')
+			cp++;
+		}
+	    }
+#endif	/* defined(HAS_STRFTIME) */
+
+	}
+	if (Fxover && !xover) {
+	    (void) fprintf(stderr, "%s: -x must accompany +d or +D\n", Pn);
+	    err++;
+	}
+
+#if	defined(HASEOPT)
+	if (Efsysl) {
+
+	/*
+	 * If there are file systems specified by -e options, check them.
+	 */
+	    efsys_list_t *ep;		/* Efsysl pointer */
+	    struct mounts *mp, *mpw;	/* local mount table pointers */
+
+	    if ((mp = readmnt())) {
+		for (ep = Efsysl; ep; ep = ep->next) {
+		    for (mpw = mp; mpw; mpw = mpw->next) {
+			if (!strcmp(mpw->dir, ep->path)) {
+			    ep->mp = mpw;
+			    break;
+			}
+		    }
+		    if (!ep->mp) {
+			(void) fprintf(stderr,
+			    "%s: \"-e %s\" is not a mounted file system.\n",
+			    Pn, ep->path);
+			err++;
+		    }
+		}
+	    }
+	}
+#endif	/* defined(HASEOPT) */
+
+	if (DChelp || err || Fhelp || fh || version)
+	    usage(err ? 1 : 0, fh, version);
+/*
+ * Reduce the size of Suid[], if necessary.
+ */
+	if (Suid && Nuid && Nuid < Mxuid) {
+	    if (!(Suid = (struct seluid *)realloc((MALLOC_P *)Suid,
+			 (MALLOC_S)(sizeof(struct seluid) * Nuid))))
+	    {
+		(void) fprintf(stderr, "%s: can't realloc UID table\n", Pn);
+		Exit(1);
+	    }
+	    Mxuid = Nuid;
+	}
+/*
+ * Compute the selection flags.
+ */
+	if ((Cmdl && Cmdni) || CmdRx)
+	    Selflags |= SELCMD;
+ 
+#if	defined(HASSELINUX)
+	if (CntxArg)
+	    Selflags |= SELCNTX;
+#endif	/* defined(HASSELINUX) */
+
+	if (Fdl)
+	    Selflags |= SELFD;
+	if (Fnet)
+	    Selflags |= SELNET;
+	if (Fnfs)
+	    Selflags |= SELNFS;
+	if (Funix)
+	    Selflags |= SELUNX;
+	if (Npgid && Npgidi)
+	    Selflags |= SELPGID;
+	if (Npid && Npidi)
+	    Selflags |= SELPID;
+	if (Nuid && Nuidincl)
+	    Selflags |= SELUID;
+	if (Nwad)
+	    Selflags |= SELNA;
+
+#if	defined(HASZONES)
+	if (ZoneArg)
+	    Selflags |= SELZONE;
+#endif	/* defined(HASZONES) */
+
+	if (GOx1 < argc)
+	    Selflags |= SELNM;
+	if (Selflags == 0) {
+	    if (Fand) {
+		(void) fprintf(stderr,
+		    "%s: no select options to AND via -a\n", Pn);
+		usage(1, 0, 0);
+	    }
+	    Selflags = SelAll;
+	} else {
+	    if (GOx1 >= argc && (Selflags & (SELNA|SELNET)) != 0
+	    &&  (Selflags & ~(SELNA|SELNET)) == 0)
+		Selinet = 1;
+	    AllProc = 0;
+	}
+/*
+ * Get the device for DEVDEV_PATH.
+ */
+	if (stat(DEVDEV_PATH, &sb)) {
+	    se1 = errno;
+ 	    if ((ad = strcmp(DEVDEV_PATH, "/dev"))) {
+		if ((ss = stat("/dev", &sb)))
+		    se2 = errno;
+		else
+		    se2 = 0;
+	    } else {
+		se2 = 0;
+		ss = 1;
+	    }
+	    if (ss) {
+		(void) fprintf(stderr, "%s: can't stat(%s): %s\n", Pn,
+		    DEVDEV_PATH, strerror(se1));
+		if (ad) {
+		    (void) fprintf(stderr, "%s: can't stat(/dev): %s\n", Pn,
+		    strerror(se2));
+		}
+		Exit(1);
+	    }
+	}
+	DevDev = sb.st_dev;
+/*
+ * Process the file arguments.
+ */
+	if (GOx1 < argc) {
+	    if (ck_file_arg(GOx1, argc, argv, Ffilesys, 0, (struct stat *)NULL))
+		usage(1, 0, 0);
+	}
+/*
+ * Do dialect-specific initialization.
+ */
+	initialize();
+	if (Sfile)
+	    (void) hashSfile();
+
+#if	defined(WILLDROPGID)
+/*
+ * If this process isn't setuid(root), but it is setgid(not_real_gid),
+ * relinquish the setgid power.  (If it hasn't already been done.)
+ */
+	(void) dropgid();
+#endif	/* defined(WILLDROPGID) */
+
+
+#if	defined(HASDCACHE)
+/*
+ * If there is a device cache, prepare the device table.
+ */
+	if (DCstate)
+	    readdev(0);
+#endif	/* defined(HASDCACHE) */
+
+/*
+ * Define the size and offset print formats.
+ */
+	(void) snpf(options, sizeof(options), "%%%su", INODEPSPEC);
+	InodeFmt_d = sv_fmt_str(options);
+	(void) snpf(options, sizeof(options), "%%#%sx", INODEPSPEC);
+	InodeFmt_x = sv_fmt_str(options);
+	(void) snpf(options, sizeof(options), "0t%%%su", SZOFFPSPEC);
+	SzOffFmt_0t = sv_fmt_str(options);
+	(void) snpf(options, sizeof(options), "%%%su", SZOFFPSPEC);
+	SzOffFmt_d = sv_fmt_str(options);
+	(void) snpf(options, sizeof(options), "%%*%su", SZOFFPSPEC);
+	SzOffFmt_dv = sv_fmt_str(options);
+	(void) snpf(options, sizeof(options), "%%#%sx", SZOFFPSPEC);
+	SzOffFmt_x = sv_fmt_str(options);
+
+#if	defined(HASMNTSUP)
+/*
+ * Report mount supplement information, as requested.
+ */
+	if (MntSup == 1) {
+	    (void) readmnt();
+	    Exit(0);
+	}
+#endif	/* defined(HASMNTSUP) */
+
+/*
+ * Gather and report process information every RptTm seconds.
+ */
+	if (RptTm)
+	    CkPasswd = 1;
+	do {
+
+	/*
+	 * Gather information about processes.
+	 */
+	    gather_proc_info();
+	/*
+	 * If the local process table has more than one entry, sort it by PID.
+	 */
+	    if (Nlproc > 1) {
+		if (Nlproc > sp) {
+		    len = (MALLOC_S)(Nlproc * sizeof(struct lproc *));
+		    sp = Nlproc;
+		    if (!slp)
+			slp = (struct lproc **)malloc(len);
+		    else
+			slp = (struct lproc **)realloc((MALLOC_P *)slp, len);
+		    if (!slp) {
+			(void) fprintf(stderr,
+			    "%s: no space for %d sort pointers\n", Pn, Nlproc);
+			Exit(1);
+		    }
+		}
+		for (i = 0; i < Nlproc; i++) {
+		    slp[i] = &Lproc[i];
+		}
+		(void) qsort((QSORT_P *)slp, (size_t)Nlproc,
+			     (size_t)sizeof(struct lproc *), comppid);
+	    }
+	    if ((n = Nlproc)) {
+
+#if	defined(HASNCACHE)
+	    /*
+	     * If using the kernel name cache, force its reloading.
+	     */
+		NcacheReload = 1;
+#endif	/* defined(HASNCACHE) */
+
+#if	defined(HASEPTOPTS)
+	    /*
+	     * If endpoint info has been requested, make sure it is coded for
+	     * printing.
+	     *
+	     * Lf contents must be preserved, since they may point to a
+	     * malloc()'d area, and since Lf is used throughout the print
+	     */
+		if (FeptE) {
+		    lf = Lf;
+
+		/*
+		 * Check the files that have been selected for printing by
+		 * by some selection criterion other than being a pipe.
+		 */
+		    for (i = 0; i < Nlproc; i++) {
+			Lp = (Nlproc > 1) ? slp[i] : &Lproc[i];
+			if (Lp->pss && (Lp->ept & EPT_PIPE))
+			    (void) process_pinfo(0);
+		    }
+		/*
+		 * In a second pass, process unselected endpoint files,
+		 * possibly selecting them for printing.
+		 */
+		    for (i = 0; i < Nlproc; i++) {
+			Lp = (Nlproc > 1) ? slp[i] : &Lproc[i];
+			if (Lp->ept & EPT_PIPE_END)
+			    (void) process_pinfo(1);
+		    }
+
+# if	defined(HASUXSOCKEPT)
+		/*
+		 * Process UNIX socket endpoint files in a similar fashion.
+		 */
+		    for (i = 0; i < Nlproc; i++) {
+			Lp = (Nlproc > 1) ? slp[i] : &Lproc[i];
+			if (Lp->pss && (Lp->ept & EPT_UXS))
+			    (void) process_uxsinfo(0);
+		    }
+		    for (i = 0; i < Nlproc; i++) {
+			Lp = (Nlproc > 1) ? slp[i] : &Lproc[i];
+			if (Lp->ept & EPT_UXS_END) {
+			    (void) process_uxsinfo(1);
+			}
+		    }
+# endif	/* defined(HASUXSOCKEPT) */
+
+		    Lf = lf;
+		}
+#endif	/* defined(HASEPTOPTS) */
+
+	    /*
+	     * Print the selected processes and count them.
+	     *
+	     * Lf contents must be preserved, since they may point to a
+	     * malloc()'d area, and since Lf is used throughout the print
+	     * process.
+	     */
+		for (lf = Lf, print_init(); PrPass < 2; PrPass++) {
+		    for (i = n = 0; i < Nlproc; i++) {
+			Lp = (Nlproc > 1) ? slp[i] : &Lproc[i];
+			if (Lp->pss) {
+			    if (print_proc())
+				n++;
+			}
+			if (RptTm && PrPass)
+			    (void) free_lproc(Lp);
+		    }
+		}
+		Lf = lf;
+	    }
+	/*
+	 * If a repeat time is set, sleep for the specified time.
+	 *
+	 * If conditional repeat mode is in effect, see if it's time to exit.
+	 */
+	    if (RptTm) {
+
+#if	defined(HASEPTOPTS)
+		(void) clear_pinfo();
+#endif	/* defined(HASEPTOPTS) */
+
+		if (rc) {
+		    if (!n)
+			break;
+		    else
+			ev = 0;
+		}
+
+#if	defined(HAS_STRFTIME)
+		if (fmt && fmtr) {
+
+		/*
+		 * Format the marker line.
+		 */
+		    (void) util_strftime(fmtr, fmtl - 1, fmt);
+		    fmtr[fmtl - 1] = '\0';
+		}
+#endif	/* defined(HAS_STRFTIME) */
+
+		if (Ffield) {
+		    putchar(LSOF_FID_MARK);
+
+#if	defined(HAS_STRFTIME)
+		    if (fmtr)
+	    	        (void) printf("%s", fmtr);
+#endif	/* defined(HAS_STRFTIME) */
+
+		    putchar(Terminator);
+		    if (Terminator != '\n')
+			putchar('\n');
+		} else {
+
+#if	defined(HAS_STRFTIME)
+		    if (fmtr)
+			cp = fmtr;
+		    else
+#endif	/* defined(HAS_STRFTIME) */
+
+			cp = "=======";
+		    puts(cp);
+		}
+		(void) fflush(stdout);
+		(void) childx();
+		(void) sleep(RptTm);
+		Hdr = Nlproc = 0;
+		CkPasswd = 1;
+	    }
+	} while (RptTm);
+/*
+ * See if all requested information was displayed.  Return zero if it
+ * was; one, if not.  If -V was specified, report what was not displayed.
+ */
+	(void) childx();
+	rv = 0;
+	for (str = Cmdl; str; str = str->next) {
+
+	/*
+	 * Check command specifications.
+	 */
+	    if (str->f)
+		continue;
+	    rv = 1;
+	    if (Fverbose) {
+		(void) printf("%s: command not located: ", Pn);
+		safestrprt(str->str, stdout, 1);
+	    }
+	}
+	for (i = 0; i < NCmdRxU; i++) {
+	
+	/*
+	 * Check command regular expressions.
+	 */
+	    if (CmdRx[i].mc)
+		continue;
+	    rv = 1;
+	    if (Fverbose) {
+		(void) printf("%s: no command found for regex: ", Pn);
+		safestrprt(CmdRx[i].exp, stdout, 1);
+	    }
+	}
+	for (sfp = Sfile; sfp; sfp = sfp->next) {
+
+	/*
+	 * Check file specifications.
+	 */
+	    if (sfp->f)
+		continue;
+	    rv = 1;
+	    if (Fverbose) {
+		(void) printf("%s: no file%s use located: ", Pn,
+		    sfp->type ? "" : " system");
+		safestrprt(sfp->aname, stdout, 1);
+	    }
+	}
+
+#if	defined(HASPROCFS)
+	/*
+	 * Report on proc file system search results.
+	 */
+	    if (Procsrch && !Procfind) {
+		rv = 1;
+		if (Fverbose) {
+		    (void) printf("%s: no file system use located: ", Pn);
+		    safestrprt(Mtprocfs ? Mtprocfs->dir : HASPROCFS, stdout, 1);
+		}
+	    }
+	    {
+		struct procfsid *pfi;
+
+		for (pfi = Procfsid; pfi; pfi = pfi->next) {
+		    if (!pfi->f) {
+			rv = 1;
+			if (Fverbose) {
+			    (void) printf("%s: no file use located: ", Pn);
+			    safestrprt(pfi->nm, stdout, 1);
+			}
+		    }
+		}
+	    }
+#endif	/* defined(HASPROCFS) */
+
+	if ((np = Nwad)) {
+
+	/*
+	 * Check Internet address specifications.
+	 *
+	 * If any Internet address derived from the same argument was found,
+	 * consider all derivations found.  If no derivation from the same
+	 * argument was found, report only the first failure.
+	 *
+	 */
+	    for (; np; np = np->next) {
+		if (!(cp = np->arg))
+		    continue;
+		for (npn = np->next; npn; npn = npn->next) {
+		    if (!npn->arg)
+			continue;
+		    if (!strcmp(cp, npn->arg)) {
+
+		    /*
+		     * If either of the duplicate specifications was found,
+		     * mark them both found.  If neither was found, mark all
+		     * but the first one found.
+		     */
+			if (np->f)
+			    npn->f = np->f;
+			else if (npn->f)
+			    np->f = npn->f;
+			else
+			    npn->f = 1;
+		    }
+		}
+	    }
+	    for (np = Nwad; np; np = np->next) {
+		if (!np->f && (cp = np->arg)) {
+		    rv = 1;
+		    if (Fverbose) {
+			(void) printf("%s: Internet address not located: ", Pn);
+			safestrprt(cp ? cp : "(unknown)", stdout, 1);
+		    }
+		}
+	    }
+	}
+	if (Fnet && Fnet < 2) {
+
+	/*
+	 * Report no Internet files located.
+	 */
+	    rv = 1;
+	    if (Fverbose)
+		(void) printf("%s: no Internet files located\n", Pn);
+	}
+
+#if	defined(HASTCPUDPSTATE)
+	if (TcpStIn) {
+
+	/*
+	 * Check for included TCP states not located.
+	 */
+	    for (i = 0; i < TcpNstates; i++) {
+		if (TcpStI[i] == 1) {
+		    rv = 1;
+		    if (Fverbose)
+			(void) printf("%s: TCP state not located: %s\n",
+			    Pn, TcpSt[i]);
+		}
+	    }
+	}
+	if (UdpStIn) {
+
+	/*
+	 * Check for included UDP states not located.
+	 */
+	    for (i = 0; i < UdpNstates; i++) {
+		if (UdpStI[i] == 1) {
+		    rv = 1;
+		    if (Fverbose)
+			(void) printf("%s: UDP state not located: %s\n",
+			    Pn, UdpSt[i]);
+		}
+	    }
+	}
+#endif	/* defined(HASTCPUDPSTATE) */
+
+	if (Fnfs && Fnfs < 2) {
+
+	/*
+	 * Report no NFS files located.
+	 */
+	    rv = 1;
+	    if (Fverbose)
+		(void) printf("%s: no NFS files located\n", Pn);
+	}
+	for (i = 0; i < Npid; i++) {
+
+	/*
+	 * Check inclusionary process ID specifications.
+	 */
+	    if (Spid[i].f || Spid[i].x)
+		continue;
+	    rv = 1;
+	    if (Fverbose)
+		(void) printf("%s: process ID not located: %d\n",
+		    Pn, Spid[i].i);
+	}
+
+#if	defined(HASTASKS)
+	if (Ftask && Ftask < 2) {
+
+	/*
+	 * Report no tasks located.
+	 */
+	    rv = 1;
+	    if (Fverbose)
+		(void) printf("%s: no tasks located\n", Pn);
+	}
+#endif	/* defined(HASTASKS) */
+
+#if	defined(HASZONES)
+	if (ZoneArg) {
+
+	/*
+	 * Check zone argument results.
+	 */
+	    for (i = 0; i < HASHZONE; i++) {
+		for (zp = ZoneArg[i]; zp; zp = zp->next) {
+		    if (!zp->f) {
+			rv = 1;
+			if (Fverbose) {
+			    (void) printf("%s: zone not located: ", Pn);
+			    safestrprt(zp->zn, stdout, 1);
+			}
+		    }
+		}
+	    }
+	}
+#endif	/* defined(HASZONES) */
+ 
+#if	defined(HASSELINUX)
+	if (CntxArg) {
+
+	/*
+	 * Check context argument results.
+	 */
+	    for (cntxp = CntxArg; cntxp; cntxp = cntxp->next) {
+		if (!cntxp->f) {
+		    rv = 1;
+		    if (Fverbose) {
+			(void) printf("%s: context not located: ", Pn);
+			safestrprt(cntxp->cntx, stdout, 1);
+		    }
+		}
+	    }
+	}
+#endif	/* defined(HASSELINUX) */
+
+	for (i = 0; i < Npgid; i++) {
+
+	/*
+	 * Check inclusionary process group ID specifications.
+	 */
+	    if (Spgid[i].f || Spgid[i].x)
+		continue;
+	    rv = 1;
+	    if (Fverbose)
+		(void) printf("%s: process group ID not located: %d\n",
+		    Pn, Spgid[i].i);
+	}
+	for (i = 0; i < Nuid; i++) {
+
+	/*
+	 * Check inclusionary user ID specifications.
+	 */
+	    if (Suid[i].excl || Suid[i].f)
+		continue;
+	    rv = 1;
+	    if (Fverbose) {
+		if (Suid[i].lnm) {
+		    (void) printf("%s: login name (UID %lu) not located: ",
+			Pn, (unsigned long)Suid[i].uid);
+		    safestrprt(Suid[i].lnm, stdout, 1);
+		} else
+		    (void) printf("%s: user ID not located: %lu\n", Pn,
+			(unsigned long)Suid[i].uid);
+	    }
+	}
+	if (!rv && rc)
+	    rv = ev;
+	if (!rv && ErrStat)
+	    rv = 1;
+	Exit(rv);
+	return(rv);		/* to make code analyzers happy */
+}
+
+
+/*
+ * GetOpt() -- Local get option
+ *
+ * Liberally adapted from the public domain AT&T getopt() source,
+ * distributed at the 1985 UNIFORM conference in Dallas
+ *
+ * The modifications allow `?' to be an option character and allow
+ * the caller to decide that an option that may be followed by a
+ * value doesn't have one -- e.g., has a default instead.
+ */
+
+static int
+GetOpt(ct, opt, rules, err)
+	int ct;				/* option count */
+	char *opt[];			/* options */
+	char *rules;			/* option rules */
+	int *err;			/* error return */
+{
+	register int c;
+	register char *cp = (char *)NULL;
+
+	if (GOx2 == 0) {
+
+	/*
+	 * Move to a new entry of the option array.
+	 *
+	 * EOF if:
+	 *
+	 *	Option list has been exhausted;
+	 *	Next option doesn't start with `-' or `+';
+	 *	Next option has nothing but `-' or `+';
+	 *	Next option is ``--'' or ``++''.
+	 */
+	    if (GOx1 >= ct
+	    ||  (opt[GOx1][0] != '-' && opt[GOx1][0] != '+')
+	    ||  !opt[GOx1][1])
+		 return(EOF);
+	    if (strcmp(opt[GOx1], "--") == 0 || strcmp(opt[GOx1], "++") == 0) {
+		GOx1++;
+		return(EOF);
+	    }
+	    GOp = opt[GOx1][0];
+	    GOx2 = 1;
+	}
+/*
+ * Flag `:' option character as an error.
+ *
+ * Check for a rule on this option character.
+ */
+	*err = 0;
+	if ((c = opt[GOx1][GOx2]) == ':') {
+	    (void) fprintf(stderr,
+		"%s: colon is an illegal option character.\n", Pn);
+	    *err = 1;
+	} else if (!(cp = strchr(rules, c))) {
+	    (void) fprintf(stderr, "%s: illegal option character: %c\n", Pn, c);
+	    *err = 2;
+	}
+	if (*err) {
+
+	/*
+	 * An error was detected.
+	 *
+	 * Advance to the next option character.
+	 *
+	 * Return the character causing the error.
+	 */
+	    if (opt[GOx1][++GOx2] == '\0') {
+		GOx1++;
+		GOx2 = 0;
+	    }
+	    return(c);
+	}
+	if (*(cp + 1) == ':') {
+
+	/*
+	 * The option may have a following value.  The caller decides
+	 * if it does.
+	 *
+	 * Save the position of the possible value in case the caller
+	 * decides it does not belong to the option and wants it
+	 * reconsidered as an option character.  The caller does that
+	 * with:
+	 *		GOx1 = GObk[0]; GOx2 = GObk[1];
+	 *
+	 * Don't indicate that an option of ``--'' is a possible value.
+	 *
+	 * Finally, on the assumption that the caller will decide that
+	 * the possible value belongs to the option, position to the
+	 * option following the possible value, so that the next call
+	 * to GetOpt() will find it.
+	 */
+	    if(opt[GOx1][GOx2 + 1] != '\0') {
+		GObk[0] = GOx1;
+		GObk[1] = ++GOx2;
+		GOv = &opt[GOx1++][GOx2];
+	    } else if (++GOx1 >= ct)
+		GOv = (char *)NULL;
+	    else {
+		GObk[0] = GOx1;
+		GObk[1] = 0;
+		GOv = opt[GOx1];
+		if (strcmp(GOv, "--") == 0)
+		    GOv = (char *)NULL;
+		else
+		    GOx1++;
+	    }
+	    GOx2 = 0;
+	} else {
+
+	/*
+	 * The option character stands alone with no following value.
+	 *
+	 * Advance to the next option character.
+	 */
+	    if (opt[GOx1][++GOx2] == '\0') {
+		GOx2 = 0;
+		GOx1++;
+	    }
+	    GOv = (char *)NULL;
+	}
+/*
+ * Return the option character.
+ */
+	return(c);
+}
+
+
+/*
+ * sv_fmt_str() - save format string
+ */
+
+static char *
+sv_fmt_str(f)
+	char *f;			/* format string */
+{
+	char *cp;
+	MALLOC_S l;
+
+	l = (MALLOC_S)(strlen(f) + 1);
+	if (!(cp = (char *)malloc(l))) {
+	    (void) fprintf(stderr,
+		"%s: can't allocate %d bytes for format: %s\n", Pn, (int)l, f);
+	    Exit(1);
+	}
+	(void) snpf(cp, l, "%s", f);
+	return(cp);
+}
diff --git a/OLD/main.c.old b/OLD/main.c.old
new file mode 100644
index 0000000000000000000000000000000000000000..7266b82ce5269f925e3d33739e6e474542437f3a
--- /dev/null
+++ b/OLD/main.c.old
@@ -0,0 +1,1870 @@
+/*
+ * main.c - common main function for lsof
+ *
+ * V. Abell, Purdue University
+ */
+
+
+/*
+ * Copyright 1994 Purdue Research Foundation, West Lafayette, Indiana
+ * 47907.  All rights reserved.
+ *
+ * Written by Victor A. Abell
+ *
+ * This software is not subject to any license of the American Telephone
+ * and Telegraph Company or the Regents of the University of California.
+ *
+ * Permission is granted to anyone to use this software for any purpose on
+ * any computer system, and to alter it and redistribute it freely, subject
+ * to the following restrictions:
+ *
+ * 1. Neither the authors nor Purdue University are responsible for any
+ *    consequences of the use of this software.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ *    explicit claim or by omission.  Credit to the authors and Purdue
+ *    University must appear in documentation and sources.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ *    misrepresented as being the original software.
+ *
+ * 4. This notice may not be removed or altered.
+ */
+
+#ifndef lint
+static char copyright[] =
+"@(#) Copyright 1994 Purdue Research Foundation.\nAll rights reserved.\n";
+static char *rcsid = "$Id: main.c,v 1.57 2015/07/07 20:16:58 abe Exp abe $";
+#endif
+
+
+#include "lsof.h"
+
+
+/*
+ * Local definitions
+ */
+
+static int GObk[] = { 1, 1 };		/* option backspace values */
+static char GOp;			/* option prefix -- '+' or '-' */
+static char *GOv = (char *)NULL;	/* option `:' value pointer */
+static int GOx1 = 1;			/* first opt[][] index */
+static int GOx2 = 0;			/* second opt[][] index */
+
+
+_PROTOTYPE(static int GetOpt,(int ct, char *opt[], char *rules, int *err));
+_PROTOTYPE(static char *sv_fmt_str,(char *f));
+
+
+/*
+ * main() - main function for lsof
+ */
+
+int
+main(argc, argv)
+	int argc;
+	char *argv[];
+{
+	int ad, c, i, n, rv, se1, se2, ss;
+	char *cp;
+	int err = 0;
+	int ev = 0;
+	int fh = 0;
+	char *fmtr = (char *)NULL;
+	long l;
+	MALLOC_S len;
+	struct lfile *lf;
+	struct nwad *np, *npn;
+	char options[128];
+	int rc = 0;
+	struct stat sb;
+	struct sfile *sfp;
+	struct lproc **slp = (struct lproc **)NULL;
+	int sp = 0;
+	struct str_lst *str, *strt;
+	int version = 0;
+	int xover = 0;
+
+#if	defined(HAS_STRFTIME)
+	char *fmt = (char *)NULL;
+	size_t fmtl = (size_t)0;
+#endif	/* defined(HAS_STRFTIME) */
+
+#if	defined(HASZONES)
+	znhash_t *zp;
+#endif	/* defined(HASZONES) */
+
+#if	defined(HASSELINUX)
+/*
+ * This stanza must be immediately before the "Save progam name." code, since
+ * it contains code itself.
+ */
+	cntxlist_t *cntxp;
+
+	CntxStatus = is_selinux_enabled() ? 1 : 0;
+#endif	/* defined(HASSELINUX) */
+
+/*
+ * Save program name.
+ */
+	if ((Pn = strrchr(argv[0], '/')))
+	    Pn++;
+	else
+	    Pn = argv[0];
+/*
+ * Close enough file descriptors above 2 that library functions will have
+ * open descriptors.
+ *
+ * Make sure stderr, stdout, and stdin are open descriptors.  Open /dev/null
+ * for ones that aren't.  Be terse.
+ *
+ * Make sure umask allows lsof to define its own file permissions.
+ */
+
+	if ((MaxFd = (int) GET_MAX_FD()) < 53)
+	    MaxFd = 53;
+	for (i = 3; i < MaxFd; i++)
+	    (void) close(i);
+	while (((i = open("/dev/null", O_RDWR, 0)) >= 0) && (i < 2))
+	    ;
+	if (i < 0)
+	    Exit(1);
+	if (i > 2)
+	    (void) close(i);
+	(void) umask(0);
+
+#if	defined(HASSETLOCALE)
+/*
+ * Set locale to environment's definition.
+ */
+	(void) setlocale(LC_CTYPE, "");
+#endif	/* defined(HASSETLOCALE) */
+
+/*
+ * Common initialization.
+ */
+	Mypid = getpid();
+	if ((Mygid = (gid_t)getgid()) != getegid())
+	    Setgid = 1;
+	Euid = geteuid();
+	if ((Myuid = (uid_t)getuid()) && !Euid)
+	    Setuidroot = 1;
+	if (!(Namech = (char *)malloc(MAXPATHLEN + 1))) {
+	    (void) fprintf(stderr, "%s: no space for name buffer\n", Pn);
+	    Exit(1);
+	}
+	Namechl = (size_t)(MAXPATHLEN + 1);
+/*
+ * Create option mask.
+ */
+	(void) snpf(options, sizeof(options),
+	    "?a%sbc:%sD:d:%s%sf:F:g:hi:%s%slL:%s%snNo:Op:Pr:%ss:S:tT:u:UvVwx:%s%s%s",
+
+#if	defined(HAS_AFS) && defined(HASAOPT)
+	    "A:",
+#else	/* !defined(HAS_AFS) || !defined(HASAOPT) */
+	    "",
+#endif	/* defined(HAS_AFS) && defined(HASAOPT) */
+
+#if	defined(HASNCACHE)
+	    "C",
+#else	/* !defined(HASNCACHE) */
+	    "",
+#endif	/* defined(HASNCACHE) */
+
+#if	defined(HASEOPT)
+	    "e:",
+#else	/* !defined(HASEOPT) */
+	    "",
+#endif	/* defined(HASEOPT) */
+
+#if	defined(HASEPTOPTS)
+	    "E",
+#else	/* !defined(HASEPTOPTS) */
+	    "",
+#endif	/* defined(HASEPTOPTS) */
+
+#if	defined(HASKOPT)
+	    "k:",
+#else	/* !defined(HASKOPT) */
+	    "",
+#endif	/* defined(HASKOPT) */
+
+#if	defined(HASTASKS)
+	    "K:",
+#else	/* !defined(HASTASKS) */
+	    "",
+#endif	/* defined(HASTASKS) */
+
+#if	defined(HASMOPT) || defined(HASMNTSUP)
+	    "m:",
+#else	/* !defined(HASMOPT) && !defined(HASMNTSUP) */
+	    "",
+#endif	/* defined(HASMOPT) || defined(HASMNTSUP) */
+
+#if	defined(HASNORPC_H)
+	    "",
+#else	/* !defined(HASNORPC_H) */
+	    "M",
+#endif	/* defined(HASNORPC_H) */
+
+#if	defined(HASPPID)
+	    "R",
+#else	/* !defined(HASPPID) */
+	    "",
+#endif	/* defined(HASPPID) */
+
+#if	defined(HASXOPT)
+# if	defined(HASXOPT_ROOT)
+	    (Myuid == 0) ? "X" : "",
+# else	/* !defined(HASXOPT_ROOT) */
+	    "X",
+# endif	/* defined(HASXOPT_ROOT) */
+#else	/* !defined(HASXOPT) */
+	    "",
+#endif	/* defined(HASXOPT) */
+
+#if	defined(HASZONES)
+	    "z:",
+#else	/* !defined(HASZONES) */
+	    "",
+#endif	/* defined(HASZONES) */
+ 
+#if	defined(HASSELINUX)
+	    "Z:"
+#else	/* !defined(HASSELINUX) */
+	    ""
+#endif	/* defined(HASSELINUX) */
+
+	    );
+/*
+ * Loop through options.
+ */
+	while ((c = GetOpt(argc, argv, options, &rv)) != EOF) {
+	    if (rv) {
+		err = 1;
+		continue;
+	    }
+	    switch (c) {
+	    case 'a':
+		Fand = 1;
+		break;
+
+#if	defined(HAS_AFS) && defined(HASAOPT)
+	    case 'A':
+		if (!GOv || *GOv == '-' || *GOv == '+') {
+		    (void) fprintf(stderr, "%s: -A not followed by path\n", Pn);
+		    err = 1;
+		    if (GOv) {
+			GOx1 = GObk[0];
+			GOx2 = GObk[1];
+		    }
+		} else
+		    AFSApath = GOv;
+		break;
+#endif	/* defined(HAS_AFS) && defined(HASAOPT) */
+
+	    case 'b':
+		Fblock = 1;
+		break;
+	    case 'c':
+		if (GOp == '+') {
+		    if (!GOv || (*GOv == '-') || (*GOv == '+')
+		    ||  !isdigit((int)*GOv))
+		    {
+			(void) fprintf(stderr,
+			    "%s: +c not followed by width number\n", Pn);
+			err = 1;
+			if (GOv) {
+			    GOx1 = GObk[0];
+			    GOx2 = GObk[1];
+			}
+		    } else {
+			CmdLim = TaskCmdLim = atoi(GOv);
+
+#if	defined(MAXSYSCMDL)
+			if (CmdLim > MAXSYSCMDL) {
+			    (void) fprintf(stderr,
+				"%s: +c %d > what system provides (%d)\n",
+				Pn, CmdLim, MAXSYSCMDL);
+			    err = 1;
+			}
+#endif	/* defined(MAXSYSCMDL) */
+
+		    }
+		    break;
+		}
+		if (GOv && (*GOv == '/')) {
+		    if (enter_cmd_rx(GOv))
+			err = 1;
+		} else {
+		    if (enter_str_lst("-c", GOv, &Cmdl, &Cmdni, &Cmdnx))
+			err = 1;
+
+#if	defined(MAXSYSCMDL)
+		    else if (Cmdl->len > MAXSYSCMDL) {
+			(void) fprintf(stderr, "%s: \"-c ", Pn);
+			(void) safestrprt(Cmdl->str, stderr, 2);
+			(void) fprintf(stderr, "\" length (%d) > what system",
+			    Cmdl->len);
+			(void) fprintf(stderr, " provides (%d)\n",
+			    MAXSYSCMDL);
+			Cmdl->len = 0;	/* (to avoid later error report) */
+			err = 1;
+		    }
+#endif	/* defined(MAXSYSCMDL) */
+
+		}
+		break;
+
+#if	defined(HASNCACHE)
+	    case 'C':
+		Fncache = (GOp == '-') ? 0 : 1;
+		break;
+
+#endif	/* defined(HASNCACHE) */
+	    case 'd':
+		if (GOp == '+') {
+		    if (enter_dir(GOv, 0))
+			err = 1;
+		    else {
+			Selflags |= SELNM;
+			xover = 1;
+		    }
+		} else {
+		    if (enter_fd(GOv))
+			err = 1;
+		}
+		break;
+	    case 'D':
+		if (GOp == '+') {
+		    if (enter_dir(GOv, 1))
+			err = 1;
+		    else {
+			Selflags |= SELNM;
+			xover = 1;
+		    }
+		} else {
+
+#if	defined(HASDCACHE)
+		    if (ctrl_dcache(GOv))
+			err = 1;
+#else	/* !defined(HASDCACHE) */
+		    (void) fprintf(stderr, "%s: unsupported option: -D\n", Pn);
+		    err = 1;
+#endif	/* defined(HASDCACHE) */
+
+		}
+		break;
+
+#if	defined(HASEOPT)
+	    case 'e':
+		if (enter_efsys(GOv, ((GOp == '+') ? 1 : 0)))
+		    err = 1;
+		break;
+#endif	/* defined(HASEOPT) */
+
+#if	defined(HASEPTOPTS)
+	    case 'E':
+		FeptE = (GOp == '+') ? 2 : 1;
+		break;
+#endif	/* defined(HASEPTOPTS) */
+
+	    case 'f':
+		if (!GOv || *GOv == '-' || *GOv == '+') {
+		    Ffilesys = (GOp == '+') ? 2 : 1;
+		    if (GOv) {
+			GOx1 = GObk[0];
+			GOx2 = GObk[1];
+		    }
+		    break;
+		}
+
+#if	defined(HASFSTRUCT)
+		for (; *GOv; GOv++) {
+		    switch (*GOv) {
+
+# if	!defined(HASNOFSCOUNT)
+		    case 'c':
+		    case 'C':
+			if (GOp == '+') {
+			    Fsv |= FSV_CT;
+			    FsvByf = 1;
+			} else
+			    Fsv &= (unsigned char)~FSV_CT;
+			break;
+# endif	/* !defined(HASNOFSCOUNT) */
+
+# if	!defined(HASNOFSADDR)
+		    case 'f':
+		    case 'F':
+			if (GOp == '+') {
+			    Fsv |= FSV_FA;
+			    FsvByf = 1;
+			} else
+			    Fsv &= (unsigned char)~FSV_FA;
+			break;
+# endif	/* !defined(HASNOFSADDR) */
+
+# if	!defined(HASNOFSFLAGS)
+		    case 'g':
+		    case 'G':
+			if (GOp == '+') {
+			    Fsv |= FSV_FG;
+			    FsvByf = 1;
+			} else
+			    Fsv &= (unsigned char)~FSV_FG;
+			FsvFlagX = (*GOv == 'G') ? 1 : 0;
+			break;
+# endif	/* !defined(HASNOFSFLAGS) */
+
+# if	!defined(HASNOFSNADDR)
+		    case 'n':
+		    case 'N':
+			if (GOp == '+') {
+			    Fsv |= FSV_NI;
+			    FsvByf = 1;
+			} else
+			    Fsv &= (unsigned char)~FSV_NI;
+			break;
+# endif	/* !defined(HASNOFSNADDR */
+
+		    default:
+			(void) fprintf(stderr,
+			    "%s: unknown file struct option: %c\n", Pn, *GOv);
+			err++;
+		    }
+		}
+#else	/* !defined(HASFSTRUCT) */
+		(void) fprintf(stderr,
+		    "%s: unknown string for %cf: %s\n", Pn, GOp, GOv);
+		err++;
+#endif	/* defined(HASFSTRUCT) */
+
+		break;
+	    case 'F':
+		if (!GOv || *GOv == '-' || *GOv == '+'
+		||  strcmp(GOv, "0") == 0) {
+		    if (GOv) {
+			if (*GOv == '-' || *GOv == '+') {
+			    GOx1 = GObk[0];
+			    GOx2 = GObk[1];
+			} else if (*GOv == '0')
+			    Terminator = '\0';
+		    }
+		    for (i = 0; FieldSel[i].nm; i++) {
+
+#if	!defined(HASPPID)
+			if (FieldSel[i].id == LSOF_FID_PPID)
+			    continue;
+#endif	/* !defined(HASPPID) */
+
+#if	!defined(HASTASKS)
+			if (FieldSel[i].id == LSOF_FID_TCMD)
+			    continue;
+#endif	/* !defined(HASTASKS) */
+
+#if	!defined(HASFSTRUCT)
+			if (FieldSel[i].id == LSOF_FID_CT
+			||  FieldSel[i].id == LSOF_FID_FA
+			||  FieldSel[i].id == LSOF_FID_FG
+			||  FieldSel[i].id == LSOF_FID_NI)
+			    continue;
+#endif	/* !defined(HASFSTRUCT) */
+ 
+#if	defined(HASSELINUX)
+			if ((FieldSel[i].id == LSOF_FID_CNTX) && !CntxStatus)
+			    continue;
+#else	/* !defined(HASSELINUX) */
+			if (FieldSel[i].id == LSOF_FID_CNTX)
+			    continue;
+#endif	/* !defined(HASSELINUX) */
+
+			if (FieldSel[i].id == LSOF_FID_RDEV)
+			    continue;	/* for compatibility */
+
+#if	!defined(HASTASKS)
+			if (FieldSel[i].id == LSOF_FID_TID)
+			    continue;
+#endif	/* !defined(HASTASKS) */
+
+#if	!defined(HASZONES)
+			if (FieldSel[i].id == LSOF_FID_ZONE)
+			    continue;
+#endif	/* !defined(HASZONES) */
+
+			FieldSel[i].st = 1;
+			if (FieldSel[i].opt && FieldSel[i].ov)
+			    *(FieldSel[i].opt) |= FieldSel[i].ov;
+		    }
+
+#if	defined(HASFSTRUCT)
+		    Ffield = FsvFlagX = 1;
+#else	/* !defined(HASFSTRUCT) */
+		    Ffield = 1;
+#endif	/* defined(HASFSTRUCT) */
+
+		    break;
+		}
+		if (strcmp(GOv, "?") == 0) {
+		    fh = 1;
+		    break;
+		}
+		for (; *GOv; GOv++) {
+		    for (i = 0; FieldSel[i].nm; i++) {
+
+#if	!defined(HASPPID)
+			if (FieldSel[i].id == LSOF_FID_PPID)
+			    continue;
+#endif	/* !defined(HASPPID) */
+
+#if	!defined(HASTASKS)
+			if (FieldSel[i].id == LSOF_FID_TCMD)
+			    continue;
+#endif	/* !defined(HASTASKS) */
+
+#if	!defined(HASFSTRUCT)
+			if (FieldSel[i].id == LSOF_FID_CT
+			||  FieldSel[i].id == LSOF_FID_FA
+			||  FieldSel[i].id == LSOF_FID_FG
+			||  FieldSel[i].id == LSOF_FID_NI)
+			    continue;
+#endif	/* !defined(HASFSTRUCT) */
+
+#if	!defined(HASTASKS)
+			if (FieldSel[i].id == LSOF_FID_TID)
+			    continue;
+#endif	/* !defined(HASTASKS) */
+
+			if (FieldSel[i].id == *GOv) {
+			    FieldSel[i].st = 1;
+			    if (FieldSel[i].opt && FieldSel[i].ov)
+				*(FieldSel[i].opt) |= FieldSel[i].ov;
+
+#if	defined(HASFSTRUCT)
+			    if (i == LSOF_FIX_FG)
+				FsvFlagX = 1;
+#endif	/* defined(HASFSTRUCT) */
+
+			    if (i == LSOF_FIX_TERM)
+				Terminator = '\0';
+			    break;
+			}
+		    }
+		    if ( ! FieldSel[i].nm) {
+			(void) fprintf(stderr,
+			    "%s: unknown field: %c\n", Pn, *GOv);
+			err++;
+		    }
+		}
+		Ffield = 1;
+		break;
+	    case 'g':
+		if (GOv) {
+		    if (*GOv == '-' || *GOv == '+') {
+			GOx1 = GObk[0];
+			GOx2 = GObk[1];
+		    } else if (enter_id(PGID, GOv))
+			err = 1;
+		}
+		Fpgid = 1;
+		break;
+	    case 'h':
+	    case '?':
+		Fhelp = 1;
+		break;
+	    case 'i':
+		if (!GOv || *GOv == '-' || *GOv == '+') {
+		    Fnet = 1;
+		    FnetTy = 0;
+		    if (GOv) {
+			GOx1 = GObk[0];
+			GOx2 = GObk[1];
+		    }
+		    break;
+		}
+		if (enter_network_address(GOv))
+		    err = 1;
+		break;
+
+#if	defined(HASKOPT)
+	    case 'k':
+		if (!GOv || *GOv == '-' || *GOv == '+') {
+		    (void) fprintf(stderr, "%s: -k not followed by path\n", Pn);
+		    err = 1;
+		    if (GOv) {
+			GOx1 = GObk[0];
+			GOx2 = GObk[1];
+		    }
+		} else
+		    Nmlst = GOv;
+		break;
+#endif	/* defined(HASKOPT) */
+
+#if	defined(HASTASKS)
+	    case 'K':
+		if (!GOv || *GOv == '-' || *GOv == '+') {
+		    Ftask = 1;
+		    IgnTasks = 0;
+		    Selflags |= SELTASK;
+		    if (GOv) {
+			GOx1 = GObk[0];
+			GOx2 = GObk[1];
+		    }
+		} else {
+		    if (!strcasecmp(GOv, "i")) {
+			Ftask = 0;
+			IgnTasks = 1;
+			Selflags &= ~SELTASK;
+		   } else {
+			(void) fprintf(stderr,
+			    "%s: -K not followed by i (but by %s)\n", Pn, GOv);
+			err = 1;
+		   }
+		}
+		break;
+#endif	/* defined(HASTASKS) */
+
+	    case 'l':
+		Futol = 0;
+		break;
+	    case 'L':
+		Fnlink = (GOp == '+') ? 1 : 0;
+		if (!GOv || *GOv == '-' || *GOv == '+') {
+		    Nlink = 0l;
+		    if (GOv) {
+			GOx1 = GObk[0];
+			GOx2 = GObk[1];
+		    }
+		    break;
+		}
+		for (cp = GOv, l = 0l, n = 0; *cp; cp++) {
+		    if (!isdigit((unsigned char)*cp))
+			break;
+		    l = (l * 10l) + ((long)*cp - (long)'0');
+		    n++;
+		}
+		if (n) {
+		    if (GOp != '+') {
+			(void) fprintf(stderr,
+			    "%s: no number may follow -L\n", Pn);
+			err = 1;
+		    } else {
+			Nlink = l;
+			Selflags |= SELNLINK;
+		    }
+		} else
+		    Nlink = 0l;
+		if (*cp) {
+		    GOx1 = GObk[0];
+		    GOx2 = GObk[1] + n;
+		}
+		break;
+
+#if	defined(HASMOPT) || defined(HASMNTSUP)
+	    case 'm':
+		if (GOp == '-') {
+
+# if	defined(HASMOPT)
+		    if (!GOv || *GOv == '-' || *GOv == '+') {
+			(void) fprintf(stderr,
+			    "%s: -m not followed by path\n", Pn);
+			err = 1;
+			if (GOv) {
+			    GOx1 = GObk[0];
+			    GOx2 = GObk[1];
+			}
+		    } else
+			Memory = GOv;
+# else	/* !defined(HASMOPT) */
+		    (void) fprintf(stderr, "%s: -m not supported\n", Pn);
+		    err = 1;
+# endif	/* defined(HASMOPT) */
+
+		} else if (GOp == '+') {
+
+# if	defined(HASMNTSUP)
+		    if (!GOv || *GOv == '-' || *GOv == '+') {
+			MntSup = 1;
+			if (GOv) {
+			    GOx1 = GObk[0];
+			    GOx2 = GObk[1];
+			}
+		    } else {
+			MntSup = 2;
+			MntSupP = GOv;
+		    }
+# else	/* !defined(HASMNTSUP) */
+		    (void) fprintf(stderr, "%s: +m not supported\n", Pn);
+		    err = 1;
+# endif	/* defined(HASMNTSUP) */
+
+		} else {
+		    (void) fprintf(stderr, "%s: %cm not supported\n", Pn, GOp);
+		    err = 1;
+		}
+		break;
+#endif	/* defined(HASMOPT) || defined(HASMNTSUP) */
+
+#if	!defined(HASNORPC_H)
+	    case 'M':
+		FportMap = (GOp == '+') ? 1 : 0;
+		break;
+#endif	/* !defined(HASNORPC_H) */
+
+	    case 'n':
+		Fhost = (GOp == '-') ? 0 : 1;
+		break;
+	    case 'N':
+		Fnfs = 1;
+		break;
+	    case 'o':
+		if (!GOv || *GOv == '-' || *GOv == '+') {
+		    Foffset = 1;
+		    if (GOv) {
+			GOx1 = GObk[0];
+			GOx2 = GObk[1];
+		    }
+		    break;
+		}
+		for (cp = GOv, i = n = 0; *cp; cp++) {
+		    if (!isdigit((unsigned char)*cp))
+			break;
+		    i = (i * 10) + ((int)*cp - '0');
+		    n++;
+		}
+		if (n)
+		    OffDecDig = i;
+		else
+		    Foffset = 1;
+		if (*cp) {
+		    GOx1 = GObk[0];
+		    GOx2 = GObk[1] + n;
+		}
+		break;
+	    case 'O':
+		Fovhd = (GOp == '-') ? 1 : 0;
+		break;
+	    case 'p':
+		if (enter_id(PID, GOv))
+		    err = 1;
+		break;
+	    case 'P':
+		Fport = (GOp == '-') ? 0 : 1;
+		break;
+	    case 'r':
+		if (GOp == '+')
+		    ev = rc = 1;
+		if (!GOv || *GOv == '-' || *GOv == '+') {
+		    RptTm = RPTTM;
+		    if (GOv) {
+			GOx1 = GObk[0];
+			GOx2 = GObk[1];
+		    }
+		    break;
+		}
+		for (cp = GOv, i = n = 0; *cp; cp++) {
+		    if (!isdigit((unsigned char)*cp))
+			break;
+		    i = (i * 10) + ((int)*cp - '0');
+		    n++;
+		}
+		if (n)
+		    RptTm = i;
+		else
+		    RptTm = RPTTM;
+		if (!*cp)
+		     break;
+		while(*cp && (*cp == ' '))
+		    cp++;
+		if (*cp != LSOF_FID_MARK) {
+		    GOx1 = GObk[0];
+		    GOx2 = GObk[1] + n;
+		    break;
+		}
+
+#if	defined(HAS_STRFTIME)
+
+	    /*
+	     * Collect the strftime(3) format and test it.
+	     */
+		cp++;
+		if ((fmtl = strlen(cp) + 1) < 1) {
+		    (void) fprintf(stderr, "%s: <fmt> too short: \"%s\"\n",
+			Pn, cp);
+		    err = 1;
+		} else {
+		    fmt = cp;
+		    fmtl = (fmtl * 8) + 1;
+		    if (!(fmtr = (char *)malloc((MALLOC_S)fmtl))) {
+			(void) fprintf(stderr,
+			    "%s: no space (%d) for <fmt> result: \"%s\"\n",
+			    Pn, (int)fmtl, cp);
+			    Exit(1);
+		    }
+		    if (util_strftime(fmtr, fmtl - 1, fmt) < 1) {
+			(void) fprintf(stderr, "%s: illegal <fmt>: \"%s\"\n",
+			    Pn, fmt);
+			err = 1;
+		    }
+		}
+
+#else	/* !defined(HAS_STRFTIME) */
+		(void) fprintf(stderr, "%s: m<fmt> not supported: \"%s\"\n",
+		    Pn, cp);
+		err = 1;
+#endif	/* defined(HAS_STRFTIME) */
+
+		break;
+
+#if	defined(HASPPID)
+	    case 'R':
+		Fppid = 1;
+		break;
+#endif	/* defined(HASPPID) */
+
+	    case 's':
+
+#if	defined(HASTCPUDPSTATE)
+		if (!GOv || *GOv == '-' || *GOv == '+') {
+		    Fsize = 1;
+		    if (GOv) {
+			GOx1 = GObk[0];
+			GOx2 = GObk[1];
+		    }
+		} else {
+		    if (enter_state_spec(GOv))
+			err = 1;
+		}
+#else	/* !defined(HASTCPUDPSTATE) */
+		Fsize = 1;
+#endif	/* defined(HASTCPUDPSTATE) */
+
+		break;
+	    case 'S':
+		if (!GOv || *GOv == '-' || *GOv == '+') {
+		    TmLimit = TMLIMIT;
+		    if (GOv) {
+			GOx1 = GObk[0];
+			GOx2 = GObk[1];
+		    }
+		    break;
+		}
+		for (cp = GOv, i = n = 0; *cp; cp++) {
+		    if (!isdigit((unsigned char)*cp))
+			break;
+		    i = (i * 10) + ((int)*cp - '0');
+		    n++;
+		}
+		if (n)
+		    TmLimit = i;
+		else
+		    TmLimit = TMLIMIT;
+		if (*cp) {
+		    GOx1 = GObk[0];
+		    GOx2 = GObk[1] + n;
+		}
+		if (TmLimit < TMLIMMIN) {
+		    (void) fprintf(stderr,
+			"%s: WARNING: -S time (%d) changed to %d\n",
+			Pn, TmLimit, TMLIMMIN);
+		    TmLimit = TMLIMMIN;
+		}
+		break;
+	    case 't':
+		Fterse = Fwarn = 1;
+		break;
+	    case 'T':
+		if (!GOv || *GOv == '-' || *GOv == '+') {
+		    Ftcptpi = (GOp == '-') ? 0 : TCPTPI_STATE;
+		    if (GOv) {
+			GOx1 = GObk[0];
+			GOx2 = GObk[1];
+		    }
+		    break;
+		}
+		for (Ftcptpi = 0; *GOv; GOv++) {
+		    switch (*GOv) {
+
+#if	defined(HASSOOPT) || defined(HASSOSTATE) || defined(HASTCPOPT)
+		    case 'f':
+			Ftcptpi |= TCPTPI_FLAGS;
+			break;
+#endif	/* defined(HASSOOPT) || defined(HASSOSTATE) || defined(HASTCPOPT) */
+
+#if	defined(HASTCPTPIQ)
+		    case 'q':
+			Ftcptpi |= TCPTPI_QUEUES;
+			break;
+#endif	/* defined(HASTCPTPIQ) */
+
+		    case 's':
+			Ftcptpi |= TCPTPI_STATE;
+			break;
+
+#if	defined(HASTCPTPIW)
+		    case 'w':
+			Ftcptpi |= TCPTPI_WINDOWS;
+			break;
+#endif	/* defined(HASTCPTPIW) */
+
+		    default:
+			(void) fprintf(stderr,
+			"%s: unsupported TCP/TPI info selection: %c\n",
+			    Pn, *GOv);
+			err = 1;
+		    }
+		}
+		break;
+	    case 'u':
+		if (enter_uid(GOv))
+		    err = 1;
+		break;
+	    case 'U':
+		Funix = 1;
+		break;
+	    case 'v':
+		version = 1;
+		break;
+	    case 'V':
+		Fverbose = 1;
+		break;
+	    case 'w':
+		Fwarn = (GOp == '+') ? 0 : 1;
+		break;
+	    case 'x':
+		if (!GOv || *GOv == '-' || *GOv == '+') {
+		    Fxover = XO_ALL;
+		    if (GOv) {
+			GOx1 = GObk[0];
+			GOx2 = GObk[1];
+		    }
+		    break;
+		} else {
+		    for (; *GOv; GOv++) {
+			switch (*GOv) {
+			case 'f':
+			    Fxover |= XO_FILESYS;
+			    break;
+			case 'l':
+			    Fxover |= XO_SYMLINK;
+			    break;
+			default:
+			    (void) fprintf(stderr,
+				"%s: unknown cross-over option: %c\n",
+				Pn, *GOv);
+			    err++;
+			}
+		    }
+		}
+		break;
+
+#if	defined(HASXOPT)
+	    case 'X':
+		Fxopt = Fxopt ? 0 : 1;
+		break;
+#endif	/* defined(HASXOPT) */
+
+#if	defined(HASZONES)
+	    case 'z':
+		Fzone = 1;
+		if (GOv && (*GOv != '-') && (*GOv != '+')) {
+
+		/*
+		 * Add to the zone name argument hash.
+		 */
+		    if (enter_zone_arg(GOv))
+			err = 1;
+		} else if (GOv) {
+		    GOx1 = GObk[0];
+		    GOx2 = GObk[1];
+		}
+		break;
+#endif	/* defined(HASZONES) */
+ 
+#if	defined(HASSELINUX)
+	    case 'Z':
+		if (!CntxStatus) {
+		   (void) fprintf(stderr, "%s: -Z limited to SELinux\n", Pn);
+		    err = 1;
+		} else {
+		    Fcntx = 1;
+		    if (GOv && (*GOv != '-') && (*GOv != '+')) {
+
+		    /*
+		     * Add to the context name argument hash.
+		     */
+			if (enter_cntx_arg(GOv))
+			    err = 1;
+		    } else if (GOv) {
+			GOx1 = GObk[0];
+			GOx2 = GObk[1];
+		    }
+		}
+		break;
+#endif	/* defined(HASSELINUX) */
+
+	    default:
+		(void) fprintf(stderr, "%s: unknown option (%c)\n", Pn, c);
+		err = 1;
+	    }
+	}
+/*
+ * If IgnTasks is set, remove SELTASK from SelAll and SelProc.
+ */
+	SelAll = IgnTasks ? (SELALL & ~SELTASK) : SELALL;
+	SelProc = IgnTasks ? (SELPROC & ~SELTASK) : SELPROC;
+/*
+ * Check for argument consistency.
+ */
+	if (Cmdnx && Cmdni) {
+
+	/*
+	 * Check for command inclusion/exclusion conflicts.
+	 */
+	    for (str = Cmdl; str; str = str->next) {
+		if (str->x) {
+		    for (strt = Cmdl; strt; strt = strt->next) {
+			if (!strt->x) {
+			    if (!strcmp(str->str, strt->str)) {
+				(void) fprintf(stderr,
+				    "%s: -c^%s and -c%s conflict.\n",
+				    Pn, str->str, strt->str);
+				err++;
+			    }
+			}
+		    }
+		}
+	    }
+	}
+
+#if	defined(HASTCPUDPSTATE)
+	if (TcpStXn && TcpStIn) {
+
+	/*
+	 * Check for excluded and included TCP states.
+	 */
+	    for (i = 0; i < TcpNstates; i++) {
+		if (TcpStX[i] && TcpStI[i]) {
+		    (void) fprintf(stderr,
+			"%s: can't include and exclude TCP state: %s\n",
+			Pn, TcpSt[i]);
+		    err = 1;
+		}
+	    }
+	}
+	if (UdpStXn && UdpStIn) {
+
+	/*
+	 * Check for excluded and included UDP states.
+	 */
+	    for (i = 0; i < UdpNstates; i++) {
+		if (UdpStX[i] && UdpStI[i]) {
+		    (void) fprintf(stderr,
+			"%s: can't include and exclude UDP state: %s\n",
+			Pn, UdpSt[i]);
+		    err = 1;
+		}
+	    }
+	}
+#endif	/* defined(HASTCPUDPSTATE) */
+
+	if (Fsize && Foffset) {
+	    (void) fprintf(stderr, "%s: -o and -s are mutually exclusive\n",
+		Pn);
+	    err++;
+	}
+	if (Ffield) {
+	    if (Fterse) {
+		(void) fprintf(stderr,
+		    "%s: -F and -t are mutually exclusive\n", Pn);
+		err++;
+	    }
+	    FieldSel[LSOF_FIX_PID].st = 1;
+
+#if	defined(HAS_STRFTIME)
+	    if (fmtr) {
+
+	    /*
+	     * The field output marker format can't contain "%n" new line
+	     * requests.
+	     */
+		for (cp = strchr(fmt, '%'); cp; cp = strchr(cp, '%')) {
+		    if (*++cp  == 'n') {
+			(void) fprintf(stderr,
+			    "%s: %%n illegal in -r m<fmt> when -F has", Pn);
+			(void) fprintf(stderr,
+			    " been specified: \"%s\"\n", fmt);
+			err++;
+			break;
+		    } else if (*cp == '%')
+			cp++;
+		}
+	    }
+#endif	/* defined(HAS_STRFTIME) */
+
+	}
+	if (Fxover && !xover) {
+	    (void) fprintf(stderr, "%s: -x must accompany +d or +D\n", Pn);
+	    err++;
+	}
+
+#if	defined(HASEOPT)
+	if (Efsysl) {
+
+	/*
+	 * If there are file systems specified by -e options, check them.
+	 */
+	    efsys_list_t *ep;		/* Efsysl pointer */
+	    struct mounts *mp, *mpw;	/* local mount table pointers */
+
+	    if ((mp = readmnt())) {
+		for (ep = Efsysl; ep; ep = ep->next) {
+		    for (mpw = mp; mpw; mpw = mpw->next) {
+			if (!strcmp(mpw->dir, ep->path)) {
+			    ep->mp = mpw;
+			    break;
+			}
+		    }
+		    if (!ep->mp) {
+			(void) fprintf(stderr,
+			    "%s: \"-e %s\" is not a mounted file system.\n",
+			    Pn, ep->path);
+			err++;
+		    }
+		}
+	    }
+	}
+#endif	/* defined(HASEOPT) */
+
+	if (DChelp || err || Fhelp || fh || version)
+	    usage(err ? 1 : 0, fh, version);
+/*
+ * Reduce the size of Suid[], if necessary.
+ */
+	if (Suid && Nuid && Nuid < Mxuid) {
+	    if (!(Suid = (struct seluid *)realloc((MALLOC_P *)Suid,
+			 (MALLOC_S)(sizeof(struct seluid) * Nuid))))
+	    {
+		(void) fprintf(stderr, "%s: can't realloc UID table\n", Pn);
+		Exit(1);
+	    }
+	    Mxuid = Nuid;
+	}
+/*
+ * Compute the selection flags.
+ */
+	if ((Cmdl && Cmdni) || CmdRx)
+	    Selflags |= SELCMD;
+ 
+#if	defined(HASSELINUX)
+	if (CntxArg)
+	    Selflags |= SELCNTX;
+#endif	/* defined(HASSELINUX) */
+
+	if (Fdl)
+	    Selflags |= SELFD;
+	if (Fnet)
+	    Selflags |= SELNET;
+	if (Fnfs)
+	    Selflags |= SELNFS;
+	if (Funix)
+	    Selflags |= SELUNX;
+	if (Npgid && Npgidi)
+	    Selflags |= SELPGID;
+	if (Npid && Npidi)
+	    Selflags |= SELPID;
+	if (Nuid && Nuidincl)
+	    Selflags |= SELUID;
+	if (Nwad)
+	    Selflags |= SELNA;
+
+#if	defined(HASZONES)
+	if (ZoneArg)
+	    Selflags |= SELZONE;
+#endif	/* defined(HASZONES) */
+
+	if (GOx1 < argc)
+	    Selflags |= SELNM;
+	if (Selflags == 0) {
+	    if (Fand) {
+		(void) fprintf(stderr,
+		    "%s: no select options to AND via -a\n", Pn);
+		usage(1, 0, 0);
+	    }
+	    Selflags = SelAll;
+	} else {
+	    if (GOx1 >= argc && (Selflags & (SELNA|SELNET)) != 0
+	    &&  (Selflags & ~(SELNA|SELNET)) == 0)
+		Selinet = 1;
+	    AllProc = 0;
+	}
+/*
+ * Get the device for DEVDEV_PATH.
+ */
+	if (stat(DEVDEV_PATH, &sb)) {
+	    se1 = errno;
+ 	    if ((ad = strcmp(DEVDEV_PATH, "/dev"))) {
+		if ((ss = stat("/dev", &sb)))
+		    se2 = errno;
+		else
+		    se2 = 0;
+	    } else {
+		se2 = 0;
+		ss = 1;
+	    }
+	    if (ss) {
+		(void) fprintf(stderr, "%s: can't stat(%s): %s\n", Pn,
+		    DEVDEV_PATH, strerror(se1));
+		if (ad) {
+		    (void) fprintf(stderr, "%s: can't stat(/dev): %s\n", Pn,
+		    strerror(se2));
+		}
+		Exit(1);
+	    }
+	}
+	DevDev = sb.st_dev;
+/*
+ * Process the file arguments.
+ */
+	if (GOx1 < argc) {
+	    if (ck_file_arg(GOx1, argc, argv, Ffilesys, 0, (struct stat *)NULL))
+		usage(1, 0, 0);
+	}
+/*
+ * Do dialect-specific initialization.
+ */
+	initialize();
+	if (Sfile)
+	    (void) hashSfile();
+
+#if	defined(WILLDROPGID)
+/*
+ * If this process isn't setuid(root), but it is setgid(not_real_gid),
+ * relinquish the setgid power.  (If it hasn't already been done.)
+ */
+	(void) dropgid();
+#endif	/* defined(WILLDROPGID) */
+
+
+#if	defined(HASDCACHE)
+/*
+ * If there is a device cache, prepare the device table.
+ */
+	if (DCstate)
+	    readdev(0);
+#endif	/* defined(HASDCACHE) */
+
+/*
+ * Define the size and offset print formats.
+ */
+	(void) snpf(options, sizeof(options), "%%%su", INODEPSPEC);
+	InodeFmt_d = sv_fmt_str(options);
+	(void) snpf(options, sizeof(options), "%%#%sx", INODEPSPEC);
+	InodeFmt_x = sv_fmt_str(options);
+	(void) snpf(options, sizeof(options), "0t%%%su", SZOFFPSPEC);
+	SzOffFmt_0t = sv_fmt_str(options);
+	(void) snpf(options, sizeof(options), "%%%su", SZOFFPSPEC);
+	SzOffFmt_d = sv_fmt_str(options);
+	(void) snpf(options, sizeof(options), "%%*%su", SZOFFPSPEC);
+	SzOffFmt_dv = sv_fmt_str(options);
+	(void) snpf(options, sizeof(options), "%%#%sx", SZOFFPSPEC);
+	SzOffFmt_x = sv_fmt_str(options);
+
+#if	defined(HASMNTSUP)
+/*
+ * Report mount supplement information, as requested.
+ */
+	if (MntSup == 1) {
+	    (void) readmnt();
+	    Exit(0);
+	}
+#endif	/* defined(HASMNTSUP) */
+
+/*
+ * Gather and report process information every RptTm seconds.
+ */
+	if (RptTm)
+	    CkPasswd = 1;
+	do {
+
+	/*
+	 * Gather information about processes.
+	 */
+	    gather_proc_info();
+	/*
+	 * If the local process table has more than one entry, sort it by PID.
+	 */
+	    if (Nlproc > 1) {
+		if (Nlproc > sp) {
+		    len = (MALLOC_S)(Nlproc * sizeof(struct lproc *));
+		    sp = Nlproc;
+		    if (!slp)
+			slp = (struct lproc **)malloc(len);
+		    else
+			slp = (struct lproc **)realloc((MALLOC_P *)slp, len);
+		    if (!slp) {
+			(void) fprintf(stderr,
+			    "%s: no space for %d sort pointers\n", Pn, Nlproc);
+			Exit(1);
+		    }
+		}
+		for (i = 0; i < Nlproc; i++) {
+		    slp[i] = &Lproc[i];
+		}
+		(void) qsort((QSORT_P *)slp, (size_t)Nlproc,
+			     (size_t)sizeof(struct lproc *), comppid);
+	    }
+	    if ((n = Nlproc)) {
+
+#if	defined(HASNCACHE)
+	    /*
+	     * If using the kernel name cache, force its reloading.
+	     */
+		NcacheReload = 1;
+#endif	/* defined(HASNCACHE) */
+
+#if	defined(HASEPTOPTS)
+	    /*
+	     * If endpoint info has been requested, make sure it is coded for
+	     * printing.
+	     *
+	     * Lf contents must be preserved, since they may point to a
+	     * malloc()'d area, and since Lf is used throughout the print
+	     */
+		if (FeptE) {
+		    lf = Lf;
+
+		/*
+		 * Check the files that have been selected for printing by
+		 * by some selection criterion other than being a pipe.
+		 */
+		    for (i = 0; i < Nlproc; i++) {
+			Lp = (Nlproc > 1) ? slp[i] : &Lproc[i];
+			if (Lp->pss && (Lp->ept & EPT_PIPE))
+			    (void) process_pinfo(0);
+		    }
+		/*
+		 * In a second pass, process unselected endpoint files,
+		 * possibly selecting them for printing.
+		 */
+		    for (i = 0; i < Nlproc; i++) {
+			Lp = (Nlproc > 1) ? slp[i] : &Lproc[i];
+			if (Lp->ept & EPT_PIPE_END)
+			    (void) process_pinfo(1);
+		    }
+
+# if	defined(HASUXSOCKEPT)
+		/*
+		 * Process UNIX socket endpoint files in a similar fashion.
+		 */
+		    for (i = 0; i < Nlproc; i++) {
+			Lp = (Nlproc > 1) ? slp[i] : &Lproc[i];
+			if (Lp->pss && (Lp->ept & EPT_UXS))
+			    (void) process_uxsinfo(0);
+		    }
+		    for (i = 0; i < Nlproc; i++) {
+			Lp = (Nlproc > 1) ? slp[i] : &Lproc[i];
+			if (Lp->ept & EPT_UXS_END) {
+			    (void) process_uxsinfo(1);
+			}
+		    }
+# endif	/* defined(HASUXSOCKEPT) */
+
+		    Lf = lf;
+		}
+#endif	/* defined(HASEPTOPTS) */
+
+	    /*
+	     * Print the selected processes and count them.
+	     *
+	     * Lf contents must be preserved, since they may point to a
+	     * malloc()'d area, and since Lf is used throughout the print
+	     * process.
+	     */
+		for (lf = Lf, print_init(); PrPass < 2; PrPass++) {
+		    for (i = n = 0; i < Nlproc; i++) {
+			Lp = (Nlproc > 1) ? slp[i] : &Lproc[i];
+			if (Lp->pss) {
+			    if (print_proc())
+				n++;
+			}
+			if (RptTm && PrPass)
+			    (void) free_lproc(Lp);
+		    }
+		}
+		Lf = lf;
+	    }
+	/*
+	 * If a repeat time is set, sleep for the specified time.
+	 *
+	 * If conditional repeat mode is in effect, see if it's time to exit.
+	 */
+	    if (RptTm) {
+
+#if	defined(HASEPTOPTS)
+		(void) clear_pinfo();
+#endif	/* defined(HASEPTOPTS) */
+
+		if (rc) {
+		    if (!n)
+			break;
+		    else
+			ev = 0;
+		}
+
+#if	defined(HAS_STRFTIME)
+		if (fmt && fmtr) {
+
+		/*
+		 * Format the marker line.
+		 */
+		    (void) util_strftime(fmtr, fmtl - 1, fmt);
+		    fmtr[fmtl - 1] = '\0';
+		}
+#endif	/* defined(HAS_STRFTIME) */
+
+		if (Ffield) {
+		    putchar(LSOF_FID_MARK);
+
+#if	defined(HAS_STRFTIME)
+		    if (fmtr)
+	    	        (void) printf("%s", fmtr);
+#endif	/* defined(HAS_STRFTIME) */
+
+		    putchar(Terminator);
+		    if (Terminator != '\n')
+			putchar('\n');
+		} else {
+
+#if	defined(HAS_STRFTIME)
+		    if (fmtr)
+			cp = fmtr;
+		    else
+#endif	/* defined(HAS_STRFTIME) */
+
+			cp = "=======";
+		    puts(cp);
+		}
+		(void) fflush(stdout);
+		(void) childx();
+		(void) sleep(RptTm);
+		Hdr = Nlproc = 0;
+		CkPasswd = 1;
+	    }
+	} while (RptTm);
+/*
+ * See if all requested information was displayed.  Return zero if it
+ * was; one, if not.  If -V was specified, report what was not displayed.
+ */
+	(void) childx();
+	rv = 0;
+	for (str = Cmdl; str; str = str->next) {
+
+	/*
+	 * Check command specifications.
+	 */
+	    if (str->f)
+		continue;
+	    rv = 1;
+	    if (Fverbose) {
+		(void) printf("%s: command not located: ", Pn);
+		safestrprt(str->str, stdout, 1);
+	    }
+	}
+	for (i = 0; i < NCmdRxU; i++) {
+	
+	/*
+	 * Check command regular expressions.
+	 */
+	    if (CmdRx[i].mc)
+		continue;
+	    rv = 1;
+	    if (Fverbose) {
+		(void) printf("%s: no command found for regex: ", Pn);
+		safestrprt(CmdRx[i].exp, stdout, 1);
+	    }
+	}
+	for (sfp = Sfile; sfp; sfp = sfp->next) {
+
+	/*
+	 * Check file specifications.
+	 */
+	    if (sfp->f)
+		continue;
+	    rv = 1;
+	    if (Fverbose) {
+		(void) printf("%s: no file%s use located: ", Pn,
+		    sfp->type ? "" : " system");
+		safestrprt(sfp->aname, stdout, 1);
+	    }
+	}
+
+#if	defined(HASPROCFS)
+	/*
+	 * Report on proc file system search results.
+	 */
+	    if (Procsrch && !Procfind) {
+		rv = 1;
+		if (Fverbose) {
+		    (void) printf("%s: no file system use located: ", Pn);
+		    safestrprt(Mtprocfs ? Mtprocfs->dir : HASPROCFS, stdout, 1);
+		}
+	    }
+	    {
+		struct procfsid *pfi;
+
+		for (pfi = Procfsid; pfi; pfi = pfi->next) {
+		    if (!pfi->f) {
+			rv = 1;
+			if (Fverbose) {
+			    (void) printf("%s: no file use located: ", Pn);
+			    safestrprt(pfi->nm, stdout, 1);
+			}
+		    }
+		}
+	    }
+#endif	/* defined(HASPROCFS) */
+
+	if ((np = Nwad)) {
+
+	/*
+	 * Check Internet address specifications.
+	 *
+	 * If any Internet address derived from the same argument was found,
+	 * consider all derivations found.  If no derivation from the same
+	 * argument was found, report only the first failure.
+	 *
+	 */
+	    for (; np; np = np->next) {
+		if (!(cp = np->arg))
+		    continue;
+		for (npn = np->next; npn; npn = npn->next) {
+		    if (!npn->arg)
+			continue;
+		    if (!strcmp(cp, npn->arg)) {
+
+		    /*
+		     * If either of the duplicate specifications was found,
+		     * mark them both found.  If neither was found, mark all
+		     * but the first one found.
+		     */
+			if (np->f)
+			    npn->f = np->f;
+			else if (npn->f)
+			    np->f = npn->f;
+			else
+			    npn->f = 1;
+		    }
+		}
+	    }
+	    for (np = Nwad; np; np = np->next) {
+		if (!np->f && (cp = np->arg)) {
+		    rv = 1;
+		    if (Fverbose) {
+			(void) printf("%s: Internet address not located: ", Pn);
+			safestrprt(cp ? cp : "(unknown)", stdout, 1);
+		    }
+		}
+	    }
+	}
+	if (Fnet && Fnet < 2) {
+
+	/*
+	 * Report no Internet files located.
+	 */
+	    rv = 1;
+	    if (Fverbose)
+		(void) printf("%s: no Internet files located\n", Pn);
+	}
+
+#if	defined(HASTCPUDPSTATE)
+	if (TcpStIn) {
+
+	/*
+	 * Check for included TCP states not located.
+	 */
+	    for (i = 0; i < TcpNstates; i++) {
+		if (TcpStI[i] == 1) {
+		    rv = 1;
+		    if (Fverbose)
+			(void) printf("%s: TCP state not located: %s\n",
+			    Pn, TcpSt[i]);
+		}
+	    }
+	}
+	if (UdpStIn) {
+
+	/*
+	 * Check for included UDP states not located.
+	 */
+	    for (i = 0; i < UdpNstates; i++) {
+		if (UdpStI[i] == 1) {
+		    rv = 1;
+		    if (Fverbose)
+			(void) printf("%s: UDP state not located: %s\n",
+			    Pn, UdpSt[i]);
+		}
+	    }
+	}
+#endif	/* defined(HASTCPUDPSTATE) */
+
+	if (Fnfs && Fnfs < 2) {
+
+	/*
+	 * Report no NFS files located.
+	 */
+	    rv = 1;
+	    if (Fverbose)
+		(void) printf("%s: no NFS files located\n", Pn);
+	}
+	for (i = 0; i < Npid; i++) {
+
+	/*
+	 * Check inclusionary process ID specifications.
+	 */
+	    if (Spid[i].f || Spid[i].x)
+		continue;
+	    rv = 1;
+	    if (Fverbose)
+		(void) printf("%s: process ID not located: %d\n",
+		    Pn, Spid[i].i);
+	}
+
+#if	defined(HASTASKS)
+	if (Ftask && Ftask < 2) {
+
+	/*
+	 * Report no tasks located.
+	 */
+	    rv = 1;
+	    if (Fverbose)
+		(void) printf("%s: no tasks located\n", Pn);
+	}
+#endif	/* defined(HASTASKS) */
+
+#if	defined(HASZONES)
+	if (ZoneArg) {
+
+	/*
+	 * Check zone argument results.
+	 */
+	    for (i = 0; i < HASHZONE; i++) {
+		for (zp = ZoneArg[i]; zp; zp = zp->next) {
+		    if (!zp->f) {
+			rv = 1;
+			if (Fverbose) {
+			    (void) printf("%s: zone not located: ", Pn);
+			    safestrprt(zp->zn, stdout, 1);
+			}
+		    }
+		}
+	    }
+	}
+#endif	/* defined(HASZONES) */
+ 
+#if	defined(HASSELINUX)
+	if (CntxArg) {
+
+	/*
+	 * Check context argument results.
+	 */
+	    for (cntxp = CntxArg; cntxp; cntxp = cntxp->next) {
+		if (!cntxp->f) {
+		    rv = 1;
+		    if (Fverbose) {
+			(void) printf("%s: context not located: ", Pn);
+			safestrprt(cntxp->cntx, stdout, 1);
+		    }
+		}
+	    }
+	}
+#endif	/* defined(HASSELINUX) */
+
+	for (i = 0; i < Npgid; i++) {
+
+	/*
+	 * Check inclusionary process group ID specifications.
+	 */
+	    if (Spgid[i].f || Spgid[i].x)
+		continue;
+	    rv = 1;
+	    if (Fverbose)
+		(void) printf("%s: process group ID not located: %d\n",
+		    Pn, Spgid[i].i);
+	}
+	for (i = 0; i < Nuid; i++) {
+
+	/*
+	 * Check inclusionary user ID specifications.
+	 */
+	    if (Suid[i].excl || Suid[i].f)
+		continue;
+	    rv = 1;
+	    if (Fverbose) {
+		if (Suid[i].lnm) {
+		    (void) printf("%s: login name (UID %lu) not located: ",
+			Pn, (unsigned long)Suid[i].uid);
+		    safestrprt(Suid[i].lnm, stdout, 1);
+		} else
+		    (void) printf("%s: user ID not located: %lu\n", Pn,
+			(unsigned long)Suid[i].uid);
+	    }
+	}
+	if (!rv && rc)
+	    rv = ev;
+	if (!rv && ErrStat)
+	    rv = 1;
+	Exit(rv);
+	return(rv);		/* to make code analyzers happy */
+}
+
+
+/*
+ * GetOpt() -- Local get option
+ *
+ * Liberally adapted from the public domain AT&T getopt() source,
+ * distributed at the 1985 UNIFORM conference in Dallas
+ *
+ * The modifications allow `?' to be an option character and allow
+ * the caller to decide that an option that may be followed by a
+ * value doesn't have one -- e.g., has a default instead.
+ */
+
+static int
+GetOpt(ct, opt, rules, err)
+	int ct;				/* option count */
+	char *opt[];			/* options */
+	char *rules;			/* option rules */
+	int *err;			/* error return */
+{
+	register int c;
+	register char *cp = (char *)NULL;
+
+	if (GOx2 == 0) {
+
+	/*
+	 * Move to a new entry of the option array.
+	 *
+	 * EOF if:
+	 *
+	 *	Option list has been exhausted;
+	 *	Next option doesn't start with `-' or `+';
+	 *	Next option has nothing but `-' or `+';
+	 *	Next option is ``--'' or ``++''.
+	 */
+	    if (GOx1 >= ct
+	    ||  (opt[GOx1][0] != '-' && opt[GOx1][0] != '+')
+	    ||  !opt[GOx1][1])
+		 return(EOF);
+	    if (strcmp(opt[GOx1], "--") == 0 || strcmp(opt[GOx1], "++") == 0) {
+		GOx1++;
+		return(EOF);
+	    }
+	    GOp = opt[GOx1][0];
+	    GOx2 = 1;
+	}
+/*
+ * Flag `:' option character as an error.
+ *
+ * Check for a rule on this option character.
+ */
+	*err = 0;
+	if ((c = opt[GOx1][GOx2]) == ':') {
+	    (void) fprintf(stderr,
+		"%s: colon is an illegal option character.\n", Pn);
+	    *err = 1;
+	} else if (!(cp = strchr(rules, c))) {
+	    (void) fprintf(stderr, "%s: illegal option character: %c\n", Pn, c);
+	    *err = 2;
+	}
+	if (*err) {
+
+	/*
+	 * An error was detected.
+	 *
+	 * Advance to the next option character.
+	 *
+	 * Return the character causing the error.
+	 */
+	    if (opt[GOx1][++GOx2] == '\0') {
+		GOx1++;
+		GOx2 = 0;
+	    }
+	    return(c);
+	}
+	if (*(cp + 1) == ':') {
+
+	/*
+	 * The option may have a following value.  The caller decides
+	 * if it does.
+	 *
+	 * Save the position of the possible value in case the caller
+	 * decides it does not belong to the option and wants it
+	 * reconsidered as an option character.  The caller does that
+	 * with:
+	 *		GOx1 = GObk[0]; GOx2 = GObk[1];
+	 *
+	 * Don't indicate that an option of ``--'' is a possible value.
+	 *
+	 * Finally, on the assumption that the caller will decide that
+	 * the possible value belongs to the option, position to the
+	 * option following the possible value, so that the next call
+	 * to GetOpt() will find it.
+	 */
+	    if(opt[GOx1][GOx2 + 1] != '\0') {
+		GObk[0] = GOx1;
+		GObk[1] = ++GOx2;
+		GOv = &opt[GOx1++][GOx2];
+	    } else if (++GOx1 >= ct)
+		GOv = (char *)NULL;
+	    else {
+		GObk[0] = GOx1;
+		GObk[1] = 0;
+		GOv = opt[GOx1];
+		if (strcmp(GOv, "--") == 0)
+		    GOv = (char *)NULL;
+		else
+		    GOx1++;
+	    }
+	    GOx2 = 0;
+	} else {
+
+	/*
+	 * The option character stands alone with no following value.
+	 *
+	 * Advance to the next option character.
+	 */
+	    if (opt[GOx1][++GOx2] == '\0') {
+		GOx2 = 0;
+		GOx1++;
+	    }
+	    GOv = (char *)NULL;
+	}
+/*
+ * Return the option character.
+ */
+	return(c);
+}
+
+
+/*
+ * sv_fmt_str() - save format string
+ */
+
+static char *
+sv_fmt_str(f)
+	char *f;			/* format string */
+{
+	char *cp;
+	MALLOC_S l;
+
+	l = (MALLOC_S)(strlen(f) + 1);
+	if (!(cp = (char *)malloc(l))) {
+	    (void) fprintf(stderr,
+		"%s: can't allocate %d bytes for format: %s\n", Pn, (int)l, f);
+	    Exit(1);
+	}
+	(void) snpf(cp, l, "%s", f);
+	return(cp);
+}
diff --git a/OLD/main_c.dbg b/OLD/main_c.dbg
new file mode 100644
index 0000000000000000000000000000000000000000..89668f53b409473668c0271cb9aec2dd8981a936
--- /dev/null
+++ b/OLD/main_c.dbg
@@ -0,0 +1,53 @@
+char psb[64];	/* DEBUG in main()'s declarations */
+(void) snpf(psb, sizeof(psb), "/bin/ps -l -p %d", Mypid);	/* DEBUG before the do loop */
+DBMon=1;	/* DEBUG in the do loop before gather_proc_info() */
+system(psb);	/* DEBUG in the sleep section after fflush() */
+/* start DEBUG section after the end of main() */
+
+int DBMon=0;
+
+void *
+lsofcalloc(char *f, int l, size_t n, size_t s)
+{
+#undef	calloc
+	void *v;
+	v = (void *)calloc(n, s);
+	if (DBMon)
+	    (void) fprintf(stderr, "MEMa %#x %s:%d calloc(%d, %d)\n",
+		v, f, l, n, s);
+	return(v);
+}
+
+void
+lsoffree(char *f, int l, void *p)
+{
+#undef	free
+	(void) free(p);
+	if (DBMon)
+	    (void) fprintf(stderr, "MEMf %#x %s:%d free\n", p, f, l);
+}
+
+void *
+lsofmalloc(char *f, int l, size_t s)
+{
+#undef	malloc
+	void *v;
+	v = (void *)malloc(s);
+	if (DBMon)
+	    (void) fprintf(stderr, "MEMa %#x %s:%d malloc(%d)\n", v, f, l, s);
+	return(v);
+}
+
+void *
+lsofrealloc(char *f, int l, void *p, size_t s)
+{
+#undef	realloc
+	void *v;
+	v = (void *)realloc(p, s);
+	if (DBMon)
+	    (void) fprintf(stderr, "MEMr %#x %#x %s:%d realloc(%d)\n",
+		p, v, f, l, s);
+	return(v);
+}
+
+/* end DEBUG section */
diff --git a/OLD/misc.c b/OLD/misc.c
new file mode 100644
index 0000000000000000000000000000000000000000..ba79ffd56debc384a194d66eff8c1aad2eab8bf1
--- /dev/null
+++ b/OLD/misc.c
@@ -0,0 +1,1687 @@
+/*
+ * misc.c - common miscellaneous functions for lsof
+ */
+
+
+/*
+ * Copyright 1994 Purdue Research Foundation, West Lafayette, Indiana
+ * 47907.  All rights reserved.
+ *
+ * Written by Victor A. Abell
+ *
+ * This software is not subject to any license of the American Telephone
+ * and Telegraph Company or the Regents of the University of California.
+ *
+ * Permission is granted to anyone to use this software for any purpose on
+ * any computer system, and to alter it and redistribute it freely, subject
+ * to the following restrictions:
+ *
+ * 1. Neither the authors nor Purdue University are responsible for any
+ *    consequences of the use of this software.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ *    explicit claim or by omission.  Credit to the authors and Purdue
+ *    University must appear in documentation and sources.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ *    misrepresented as being the original software.
+ *
+ * 4. This notice may not be removed or altered.
+ */
+
+#ifndef lint
+static char copyright[] =
+"@(#) Copyright 1994 Purdue Research Foundation.\nAll rights reserved.\n";
+static char *rcsid = "$Id: misc.c,v 1.28 2014/10/13 22:36:20 abe Exp abe $";
+#endif
+
+
+#include "lsof.h"
+
+#if	defined(HASWIDECHAR)
+# if	defined(WIDECHARINCL)
+#include WIDECHARINCL
+# endif	/* defined(WIDECHARINCL) */
+# if	defined(HASWCTYPE_H)
+#include <wctype.h>
+# endif	/* defined(HASWCTYPE_H) */
+#endif	/* defined(HASWIDECHAR) */
+
+
+/*
+ * Local definitions
+ */
+
+#if	!defined(MAXSYMLINKS)
+#define	MAXSYMLINKS	32
+#endif	/* !defined(MAXSYMLINKS) */
+
+
+/*
+ * Local function prototypes
+ */
+
+_PROTOTYPE(static void closePipes,(void));
+_PROTOTYPE(static int dolstat,(char *path, char *buf, int len));
+_PROTOTYPE(static int dostat,(char *path, char *buf, int len));
+_PROTOTYPE(static int doreadlink,(char *path, char *buf, int len));
+_PROTOTYPE(static int doinchild,(int (*fn)(), char *fp, char *rbuf, int rbln));
+
+#if	defined(HASINTSIGNAL)
+_PROTOTYPE(static int handleint,(int sig));
+#else	/* !defined(HASINTSIGNAL) */
+_PROTOTYPE(static void handleint,(int sig));
+#endif	/* defined(HASINTSIGNAL) */
+
+
+/*
+ * Local variables
+ */
+
+static pid_t Cpid = 0;			/* child PID */
+static jmp_buf Jmp_buf;			/* jump buffer */
+static int Pipes[] =			/* pipes for child process */
+	{ -1, -1, -1, -1 };
+static int CtSigs[] = { 0, SIGINT, SIGKILL };
+					/* child termination signals (in order
+					 * of application) -- the first is a
+					 * dummy to allow pipe closure to
+					 * cause the child to exit */
+#define	NCTSIGS	(sizeof(CtSigs) / sizeof(int))
+
+
+#if	defined(HASNLIST)
+/*
+ * build-Nl() - build kernel name list table
+ */
+
+static struct drive_Nl *Build_Nl = (struct drive_Nl *)NULL;
+					/* the default Drive_Nl address */
+
+void
+build_Nl(d)
+	struct drive_Nl *d;		/* data to drive the construction */
+{
+	struct drive_Nl *dp;
+	int i, n;
+
+	for (dp = d, n = 0; dp->nn; dp++, n++)
+	    ;
+	if (n < 1) {
+	    (void) fprintf(stderr,
+		"%s: can't calculate kernel name list length\n", Pn);
+	    Exit(1);
+	}
+	if (!(Nl = (struct NLIST_TYPE *)calloc((n + 1),
+					       sizeof(struct NLIST_TYPE))))
+	{
+	    (void) fprintf(stderr,
+		"%s: can't allocate %d bytes to kernel name list structure\n",
+		Pn, (int)((n + 1) * sizeof(struct NLIST_TYPE)));
+	    Exit(1);
+	}
+	for (dp = d, i = 0; i < n; dp++, i++) {
+	    Nl[i].NL_NAME = dp->knm;
+	}
+	Nll = (int)((n + 1) * sizeof(struct NLIST_TYPE));
+	Build_Nl = d;
+}
+#endif	/* defined(HASNLIST) */
+
+
+/*
+ * childx() - make child process exit (if possible)
+ */
+
+void
+childx()
+{
+	static int at, sx;
+	pid_t wpid;
+
+	if (Cpid > 1) {
+
+	/*
+	 * First close the pipes to and from the child.  That should cause the
+	 * child to exit.  Compute alarm time shares.
+	 */
+	    (void) closePipes();
+	    if ((at = TmLimit / NCTSIGS) < TMLIMMIN)
+		at = TMLIMMIN;
+	/*
+	 * Loop, waiting for the child to exit.  After the first pass, help
+	 * the child exit by sending it signals.
+	 */
+	    for (sx = 0; sx < NCTSIGS; sx++) {
+		if (setjmp(Jmp_buf)) {
+
+		/*
+		 * An alarm has rung.  Disable further alarms.
+		 *
+		 * If there are more signals to send, continue the signal loop.
+		 *
+		 * If the last signal has been sent, issue a warning (unless
+		 * warninge have been suppressed) and exit the signal loop.
+		 */
+		    (void) alarm(0);
+		    (void) signal(SIGALRM, SIG_DFL);
+		    if (sx < (NCTSIGS - 1))
+			continue;
+		    if (!Fwarn)
+			(void) fprintf(stderr,
+			    "%s: WARNING -- child process %d may be hung.\n",
+			    Pn, (int)Cpid);
+		    break;
+	        }
+	    /*
+	     * Send the next signal to the child process, after the first pass
+	     * through the loop.
+	     *
+	     * Wrap the wait() with an alarm.
+	     */
+		if (sx)
+		    (void) kill(Cpid, CtSigs[sx]);
+		(void) signal(SIGALRM, handleint);
+		(void) alarm(at);
+		wpid = (pid_t) wait(NULL);
+		(void) alarm(0);
+		(void) signal(SIGALRM, SIG_DFL);
+		if (wpid == Cpid)
+		    break;
+	    }
+	    Cpid = 0;
+	}
+}
+
+
+/*
+ * closePipes() - close open pipe file descriptors
+ */
+
+static void
+closePipes()
+{
+	int i;
+
+	for (i = 0; i < 4; i++) {
+	    if (Pipes[i] >= 0) {
+		(void) close(Pipes[i]);
+		Pipes[i] = -1;
+	    }
+	}
+}
+
+
+/*
+ * compdev() - compare Devtp[] entries
+ */
+
+int
+compdev(a1, a2)
+	COMP_P *a1, *a2;
+{
+	struct l_dev **p1 = (struct l_dev **)a1;
+	struct l_dev **p2 = (struct l_dev **)a2;
+
+	if ((dev_t)((*p1)->rdev) < (dev_t)((*p2)->rdev))
+	    return(-1);
+	if ((dev_t)((*p1)->rdev) > (dev_t)((*p2)->rdev))
+	    return(1);
+	if ((INODETYPE)((*p1)->inode) < (INODETYPE)((*p2)->inode))
+	    return(-1);
+	if ((INODETYPE)((*p1)->inode) > (INODETYPE)((*p2)->inode))
+	    return(1);
+	return(strcmp((*p1)->name, (*p2)->name));
+}
+
+
+/*
+ * doinchild() -- do a function in a child process
+ */
+
+static int
+doinchild(fn, fp, rbuf, rbln)
+	int (*fn)();			/* function to perform */
+	char *fp;			/* function parameter */
+	char *rbuf;			/* response buffer */
+	int rbln;			/* response buffer length */
+{
+	int en, rv;
+
+/*
+ * Check reply buffer size.
+ */
+	if (!Fovhd && rbln > MAXPATHLEN) {
+	    (void) fprintf(stderr,
+		"%s: doinchild error; response buffer too large: %d\n",
+		Pn, rbln);
+	    Exit(1);
+	}
+/*
+ * Set up to handle an alarm signal; handle an alarm signal; build
+ * pipes for exchanging information with a child process; start the
+ * child process; and perform functions in the child process.
+ */
+	if (!Fovhd) {
+	    if (setjmp(Jmp_buf)) {
+
+	    /*
+	     * Process an alarm that has rung.
+	     */
+		(void) alarm(0);
+		(void) signal(SIGALRM, SIG_DFL);
+		(void) childx();
+		errno = ETIMEDOUT;
+		return(1);
+	    } else if (!Cpid) {
+
+	    /*
+	     * Create pipes to exchange function information with a child
+	     * process.
+	     */
+		if (pipe(Pipes) < 0 || pipe(&Pipes[2]) < 0) {
+		    (void) fprintf(stderr, "%s: can't open pipes: %s\n",
+			Pn, strerror(errno));
+		    Exit(1);
+		}
+	    /*
+	     * Fork a child to execute functions.
+	     */
+		if ((Cpid = fork()) == 0) {
+
+		/*
+		 * Begin the child process.
+		 */
+
+		    int r_al, r_rbln;
+		    char r_arg[MAXPATHLEN+1], r_rbuf[MAXPATHLEN+1];
+		    int (*r_fn)();
+		/*
+		 * Close sufficient open file descriptors except Pipes[0] and
+		 * Pipes[3].
+		 */
+
+#if	defined(HAS_DUP2) && defined(HAS_CLOSEFROM)
+		    int rc;
+
+		    rc = dup2(Pipes[0], 0);
+		    if (rc < 0) {
+			(void) fprintf(stderr,
+			    "%s: can't dup fd 0 for pipe: %s\n",
+			    Pn, strerror(errno));
+			Exit(1);
+		    }
+		    Pipes[0] = 0;
+		    rc = dup2(Pipes[3], 1);
+		    if (rc < 0) {
+			(void) fprintf(stderr,
+			    "%s: can't dup fd 3 for pipe: %s\n",
+			    Pn, strerror(errno));
+			Exit(1);
+		    }
+		    Pipes[3] = 1;
+		    (void) closefrom(2);
+		    Pipes[1] = -1;
+		    Pipes[2] = -1;
+
+#else	/* !defined(HAS_DUP2) && !defined(HAS_CLOSEFROM) */
+		    int fd;
+
+		    for (fd = 0; fd < MaxFd; fd++) {
+			if (fd == Pipes[0] || fd == Pipes[3])
+			    continue;
+			(void) close(fd);
+			if (fd == Pipes[1])
+			    Pipes[1] = -1;
+			else if (fd == Pipes[2])
+			    Pipes[2] = -1;
+		    }
+		    if (Pipes[1] >= 0) {
+			(void) close(Pipes[1]);
+			Pipes[1] = -1;
+		    }
+		    if (Pipes[2] >= 0) {
+			(void) close(Pipes[2]);
+			Pipes[2] = -1;
+		    }
+#endif	/* defined(HAS_DUP2) && defined(HAS_CLOSEFROM) */
+
+		/*
+		 * Read function requests, process them, and return replies.
+		 */
+		    for (;;) {
+			if (read(Pipes[0], (char *)&r_fn, sizeof(r_fn))
+			    != (int)sizeof(r_fn)
+			||  read(Pipes[0], (char *)&r_al, sizeof(int))
+			    != (int)sizeof(int)
+			||  r_al < 1
+			||  r_al > (int)sizeof(r_arg)
+			||  read(Pipes[0], r_arg, r_al) != r_al
+			||  read(Pipes[0], (char *)&r_rbln, sizeof(r_rbln))
+			    != (int)sizeof(r_rbln)
+			||  r_rbln < 1 || r_rbln > (int)sizeof(r_rbuf))
+			    break;
+			rv = r_fn(r_arg, r_rbuf, r_rbln);
+			en = errno;
+			if (write(Pipes[3], (char *)&rv, sizeof(rv))
+			    != sizeof(rv)
+			||  write(Pipes[3], (char *)&en, sizeof(en))
+			    != sizeof(en)
+			||  write(Pipes[3], r_rbuf, r_rbln) != r_rbln)
+			    break;
+		    }
+		    (void) _exit(0);
+		}
+	    /*
+	     * Continue in the parent process to finish the setup.
+	     */
+		if (Cpid < 0) {
+		    (void) fprintf(stderr, "%s: can't fork: %s\n",
+			Pn, strerror(errno));
+		    Exit(1);
+		}
+		(void) close(Pipes[0]);
+		(void) close(Pipes[3]);
+		Pipes[0] = Pipes[3] = -1;
+	    }
+	}
+	if (!Fovhd) {
+	    int len;
+
+	/*
+	 * Send a function to the child and wait for the response.
+	 */
+	    len  = strlen(fp) + 1;
+	    (void) signal(SIGALRM, handleint);
+	    (void) alarm(TmLimit);
+	    if (write(Pipes[1], (char *)&fn, sizeof(fn)) != sizeof(fn)
+	    ||  write(Pipes[1], (char *)&len, sizeof(len)) != sizeof(len)
+	    ||  write(Pipes[1], fp, len) != len
+	    ||  write(Pipes[1], (char *)&rbln, sizeof(rbln)) != sizeof(rbln)
+	    ||  read(Pipes[2], (char *)&rv, sizeof(rv)) != sizeof(rv)
+	    ||  read(Pipes[2], (char *)&en, sizeof(en)) != sizeof(en)
+	    ||  read(Pipes[2], rbuf, rbln) != rbln) {
+		(void) alarm(0);
+		(void) signal(SIGALRM, SIG_DFL);
+		(void) childx();
+		errno = ECHILD;
+		return(-1);
+	    }
+	} else {
+
+	/*
+	 * Do the operation directly -- not in a child.
+	 */
+	    (void) signal(SIGALRM, handleint);
+	    (void) alarm(TmLimit);
+	    rv = fn(fp, rbuf, rbln);
+	    en = errno;
+	}
+/*
+ * Function completed, response collected -- complete the operation.
+ */
+	(void) alarm(0);
+	(void) signal(SIGALRM, SIG_DFL);
+	errno = en;
+	return(rv);
+}
+
+
+/*
+ * dolstat() - do an lstat() function
+ */
+
+static int
+dolstat(path, rbuf, rbln)
+	char *path;			/* path */
+	char *rbuf;			/* response buffer */
+	int rbln;			/* response buffer length */
+
+/* ARGSUSED */
+
+{
+	return(lstat(path, (struct stat *)rbuf));
+}
+
+
+/*
+ * doreadlink() -- do a readlink() function
+ */
+
+static int
+doreadlink(path, rbuf, rbln)
+	char *path;			/* path */
+	char *rbuf;			/* response buffer */
+	int rbln;			/* response buffer length */
+{
+	return(readlink(path, rbuf, rbln));
+}
+
+
+/*
+ * dostat() - do a stat() function
+ */
+
+static int
+dostat(path, rbuf, rbln)
+	char *path;			/* path */
+	char *rbuf;			/* response buffer */
+	int rbln;			/* response buffer length */
+
+/* ARGSUSED */
+
+{
+	return(stat(path, (struct stat *)rbuf));
+}
+
+
+#if	defined(WILLDROPGID)
+/*
+ * dropgid() - drop setgid permission
+ */
+
+void
+dropgid()
+{
+	if (!Setuidroot && Setgid) {
+	    if (setgid(Mygid) < 0) {
+		(void) fprintf(stderr, "%s: can't setgid(%d): %s\n",
+		    Pn, (int)Mygid, strerror(errno));
+		Exit(1);
+	    }
+	    Setgid = 0;
+	}
+}
+#endif	/* defined(WILLDROPGID) */
+
+
+/*
+ * enter_dev_ch() - enter device characters in file structure
+ */
+
+void
+enter_dev_ch(m)
+	char *m;
+{
+	char *mp;
+
+	if (!m || *m == '\0')
+	    return;
+	if (!(mp = mkstrcpy(m, (MALLOC_S *)NULL))) {
+	    (void) fprintf(stderr, "%s: no more dev_ch space at PID %d: \n",
+		Pn, Lp->pid);
+	    safestrprt(m, stderr, 1);
+	    Exit(1);
+	}
+	if (Lf->dev_ch)
+	   (void) free((FREE_P *)Lf->dev_ch);
+	Lf->dev_ch = mp;
+}
+
+
+/*
+ * enter_IPstate() -- enter a TCP or UDP state
+ */
+
+void
+enter_IPstate(ty, nm, nr)
+	char *ty;			/* type -- TCP or UDP */
+	char *nm;			/* state name (may be NULL) */
+	int nr;				/* state number */
+{
+
+#if	defined(USE_LIB_PRINT_TCPTPI)
+	TcpNstates = nr;
+#else	/* !defined(USE_LIB_PRINT_TCPTPI) */
+
+	int al, i, j, oc, nn, ns, off, tx;
+	char *cp;
+	MALLOC_S len;
+/*
+ * Check the type name and set the type index.
+ */
+	if (!ty) {
+	    (void) fprintf(stderr,
+		"%s: no type specified to enter_IPstate()\n", Pn);
+	    Exit(1);
+	}
+	if (!strcmp(ty, "TCP"))
+	    tx = 0;
+	else if (!strcmp(ty, "UDP"))
+	    tx = 1;
+	else {
+	    (void) fprintf(stderr, "%s: unknown type for enter_IPstate: %s\n",
+		Pn, ty);
+	    Exit(1);
+	}
+/*
+ * If the name argument is NULL, reduce the allocated table to its minimum
+ * size.
+ */
+	if (!nm) {
+	    if (tx) {
+		if (UdpSt) {
+		    if (!UdpNstates) {
+			(void) free((MALLOC_P *)UdpSt);
+			UdpSt = (char **)NULL;
+		    }
+		    if (UdpNstates < UdpStAlloc) {
+			len = (MALLOC_S)(UdpNstates * sizeof(char *));
+			if (!(UdpSt = (char **)realloc((MALLOC_P *)UdpSt, len)))
+			{
+			    (void) fprintf(stderr,
+				"%s: can't reduce UdpSt[]\n", Pn);
+			    Exit(1);
+			}
+		    }
+		    UdpStAlloc = UdpNstates;
+		}
+	    } else {
+		if (TcpSt) {
+		    if (!TcpNstates) {
+			(void) free((MALLOC_P *)TcpSt);
+			TcpSt = (char **)NULL;
+		    }
+		    if (TcpNstates < TcpStAlloc) {
+			len = (MALLOC_S)(TcpNstates * sizeof(char *));
+			if (!(TcpSt = (char **)realloc((MALLOC_P *)TcpSt, len)))
+			{
+			    (void) fprintf(stderr,
+				"%s: can't reduce TcpSt[]\n", Pn);
+			    Exit(1);
+			}
+		    }
+		    TcpStAlloc = TcpNstates;
+		}
+	    }
+	    return;
+	}
+/*
+ * Check the name and number.
+ */
+	if ((len = (size_t)strlen(nm)) < 1) {
+	    (void) fprintf(stderr,
+		"%s: bad %s name (\"%s\"), number=%d\n", Pn, ty, nm, nr);
+	    Exit(1);
+	}
+/*
+ * Make a copy of the name.
+ */
+	if (!(cp = mkstrcpy(nm, (MALLOC_S *)NULL))) {
+	    (void) fprintf(stderr,
+		"%s: enter_IPstate(): no %s space for %s\n",
+		Pn, ty, nm);
+	    Exit(1);
+	}
+/*
+ * Set the necessary offset for using nr as an index.  If it is
+ * a new offset, adjust previous entries.
+ */
+	if ((nr < 0) && ((off = -nr) > (tx ? UdpStOff : TcpStOff))) {
+	    if (tx ? UdpSt : TcpSt) {
+
+	    /*
+	     * A new, larger offset (smaller negative state number) could mean
+	     * a previously allocated state table must be enlarged and its
+	     * previous entries moved.
+	     */
+		oc = off - (tx ? UdpStOff : TcpStOff);
+		al = tx ? UdpStAlloc : TcpStAlloc;
+		ns = tx ? UdpNstates : TcpNstates;
+		if ((nn = ns + oc) >= al) {
+		    while ((nn + 5) > al) {
+			al += TCPUDPALLOC;
+		    }
+		    len = (MALLOC_S)(al * sizeof(char *));
+		    if (tx) {
+			if (!(UdpSt = (char **)realloc((MALLOC_P *)UdpSt, len)))
+			    goto no_IP_space;
+			UdpStAlloc = al;
+		    } else {
+			if (!(TcpSt = (char **)realloc((MALLOC_P *)TcpSt, len)))
+			    goto no_IP_space;
+			TcpStAlloc = al;
+		    }
+		    for (i = 0, j = oc; i < oc; i++, j++) {
+			if (tx) {
+			    if (i < UdpNstates)
+				UdpSt[j] = UdpSt[i];
+			    UdpSt[i] = (char *)NULL;
+			} else {
+			    if (i < TcpNstates)
+				TcpSt[j] = TcpSt[i];
+			    TcpSt[i] = (char *)NULL;
+			}
+		    }
+		    if (tx)
+			UdpNstates += oc;
+		    else
+			TcpNstates += oc;
+		}
+	    }
+	    if (tx)
+		UdpStOff = off;
+	    else
+		TcpStOff = off;
+	}
+/*
+ * Enter name as {Tc|Ud}pSt[nr + {Tc|Ud}pStOff].
+ *
+ * Allocate space, as required.
+ */
+	al = tx ? UdpStAlloc : TcpStAlloc;
+	off = tx ? UdpStOff : TcpStOff;
+	nn = nr + off + 1;
+	if (nn > al) {
+	    i = tx ? UdpNstates : TcpNstates;
+	    while ((nn + 5) > al) {
+		al += TCPUDPALLOC;
+	    }
+	    len = (MALLOC_S)(al * sizeof(char *));
+	    if (tx) {
+		if (UdpSt)
+		    UdpSt = (char **)realloc((MALLOC_P *)UdpSt, len);
+		else
+		    UdpSt = (char **)malloc(len);
+		if (!UdpSt) {
+
+no_IP_space:
+
+		    (void) fprintf(stderr, "%s: no %s state space\n", Pn, ty);
+		    Exit(1);
+		}
+		UdpNstates = nn;
+		UdpStAlloc = al;
+	    } else {
+		if (TcpSt)
+		    TcpSt = (char **)realloc((MALLOC_P *)TcpSt, len);
+		else
+		    TcpSt = (char **)malloc(len);
+		if (!TcpSt)
+		    goto no_IP_space;
+		TcpNstates = nn;
+		TcpStAlloc = al;
+	    }
+	    while (i < al) {
+		if (tx)
+		    UdpSt[i] = (char *)NULL;
+		else
+		    TcpSt[i] = (char *)NULL;
+		i++;
+	    }
+	} else {
+	    if (tx) {
+		if (nn > UdpNstates)
+		    UdpNstates = nn;
+	    } else {
+		if (nn > TcpNstates)
+		    TcpNstates = nn;
+	    }
+	}
+	if (tx) {
+	    if (UdpSt[nr + UdpStOff]) {
+
+dup_IP_state:
+
+		(void) fprintf(stderr,
+		    "%s: duplicate %s state %d (already %s): %s\n",
+		    Pn, ty, nr,
+		    tx ? UdpSt[nr + UdpStOff] : TcpSt[nr + TcpStOff],
+		    nm);
+	 	Exit(1);
+	    }
+	    UdpSt[nr + UdpStOff] = cp;
+	} else {
+	    if (TcpSt[nr + TcpStOff])
+		goto dup_IP_state;
+	    TcpSt[nr + TcpStOff] = cp;
+	}
+#endif	/* defined(USE_LIB_PRINT_TCPTPI) */
+
+}
+
+
+/*
+ * enter_nm() - enter name in local file structure
+ */
+
+void
+enter_nm(m)
+	char *m;
+{
+	char *mp;
+
+	if (!m || *m == '\0')
+	    return;
+	if (!(mp = mkstrcpy(m, (MALLOC_S *)NULL))) {
+	    (void) fprintf(stderr, "%s: no more nm space at PID %d for: ",
+		Pn, Lp->pid);
+	    safestrprt(m, stderr, 1);
+	    Exit(1);
+	}
+	if (Lf->nm)
+	    (void) free((FREE_P *)Lf->nm);
+	Lf->nm = mp;
+}
+
+
+/*
+ * Exit() - do a clean exit()
+ */
+
+void
+Exit(xv)
+	int xv;				/* exit() value */
+{
+	(void) childx();
+
+#if	defined(HASDCACHE)
+	if (DCrebuilt && !Fwarn)
+	    (void) fprintf(stderr, "%s: WARNING: %s was updated.\n",
+		Pn, DCpath[DCpathX]);
+#endif	/* defined(HASDCACHE) */
+
+	exit(xv);
+}
+
+
+#if	defined(HASNLIST)
+/*
+ * get_Nl_value() - get Nl value for nickname
+ */
+
+int
+get_Nl_value(nn, d, v)
+	char *nn;			/* nickname of requested entry */
+	struct drive_Nl *d;		/* drive_Nl table that built Nl
+					 * (if NULL, use Build_Nl) */
+	KA_T *v;			/* returned value (if NULL,
+					 * return nothing) */
+{
+	int i;
+
+	if (!Nl || !Nll)
+	    return(-1);
+	if (!d)
+	    d = Build_Nl;
+	for (i = 0; d->nn; d++, i++) {
+	    if (strcmp(d->nn, nn) == 0) {
+		if (v)
+		    *v = (KA_T)Nl[i].n_value;
+		return(i);
+	    }
+	}
+	return(-1);
+}
+#endif	/* defined(HASNLIST) */
+
+
+/*
+ * handleint() - handle an interrupt
+ */
+
+#if	defined(HASINTSIGNAL)
+static int
+#else
+static void
+#endif
+
+/* ARGSUSED */
+
+handleint(sig)
+	int sig;
+{
+	longjmp(Jmp_buf, 1);
+}
+
+
+/*
+ * hashbyname() - hash by name
+ */
+
+int
+hashbyname(nm, mod)
+	char *nm;			/* pointer to NUL-terminated name */
+	int mod;			/* hash modulus */
+{
+	int i, j;
+
+	for (i = j = 0; *nm; nm++) {
+	    i ^= (int)*nm << j;
+	    if (++j > 7)
+		j = 0;
+	}
+	return(((int)(i * 31415)) & (mod - 1));
+}
+
+
+/*
+ * is_nw_addr() - is this network address selected?
+ */
+
+int
+is_nw_addr(ia, p, af)
+	unsigned char *ia;		/* Internet address */
+	int p;				/* port */
+	int af;				/* address family -- e.g., AF_INET,
+					 * AF_INET6 */
+{
+	struct nwad *n;
+
+	if (!(n = Nwad))
+	    return(0);
+	for (; n; n = n->next) {
+	    if (n->proto) {
+		if (strcasecmp(n->proto, Lf->iproto) != 0)
+		    continue;
+	    }
+	    if (af && n->af && af != n->af)
+		continue;
+
+#if	defined(HASIPv6)
+	    if (af == AF_INET6) {
+		if (n->a[15] || n->a[14] || n->a[13] || n->a[12]
+		||  n->a[11] || n->a[10] || n->a[9]  || n->a[8]
+		||  n->a[7]  || n->a[6]  || n->a[5]  || n->a[4]
+		||  n->a[3]  || n->a[2]  || n->a[1]  || n->a[0]) {
+		    if (ia[15] != n->a[15] || ia[14] != n->a[14]
+		    ||  ia[13] != n->a[13] || ia[12] != n->a[12]
+		    ||  ia[11] != n->a[11] || ia[10] != n->a[10]
+		    ||  ia[9]  != n->a[9]  || ia[8]  != n->a[8]
+		    ||  ia[7]  != n->a[7]  || ia[6]  != n->a[6]
+		    ||  ia[5]  != n->a[5]  || ia[4]  != n->a[4]
+		    ||  ia[3]  != n->a[3]  || ia[2]  != n->a[2]
+		    ||  ia[1]  != n->a[1]  || ia[0]  != n->a[0])
+			continue;
+		}
+	    } else if (af == AF_INET)
+#endif	/* defined(HASIPv6) */
+
+	    {
+		if (n->a[3] || n->a[2] || n->a[1] || n->a[0]) {
+		    if (ia[3] != n->a[3] || ia[2] != n->a[2]
+		    ||  ia[1] != n->a[1] || ia[0] != n->a[0])
+			continue;
+		}
+	    }
+
+#if	defined(HASIPv6)
+	    else
+		continue;
+#endif	/* defined(HASIPv6) */
+
+	    if (n->sport == -1 || (p >= n->sport && p <= n->eport)) {
+		n->f = 1;
+		return(1);
+	    }
+	}
+	return(0);
+}
+
+
+/*
+ * mkstrcpy() - make a string copy in malloc()'d space
+ *
+ * return: copy pointer
+ *	   copy length (optional)
+ */
+
+char *
+mkstrcpy(src, rlp)
+	char *src;			/* source */
+	MALLOC_S *rlp;			/* returned length pointer (optional)
+					 * The returned length is an strlen()
+					 * equivalent */
+{
+	MALLOC_S len;
+	char *ns;
+
+	len = (MALLOC_S)(src ? strlen(src) : 0);
+	ns = (char *)malloc(len + 1);
+	if (ns) {
+	    if (src)
+		(void) snpf(ns, len + 1, "%s", src);
+	    else
+		*ns = '\0';
+	}
+	if (rlp)
+	    *rlp = len;
+	return(ns);
+}
+
+
+/*
+ * mkstrcat() - make a catenated copy of up to three strings under optional
+ *		string-by-string count control
+ *
+ * return: copy pointer
+ *	   copy string length (optional)
+ */
+
+char *
+mkstrcat(s1, l1, s2, l2, s3, l3, clp)
+	char *s1;			/* source string 1 */
+	int l1;				/* length of string 1 (-1 if none) */
+	char *s2;			/* source string 2 */
+	int l2;				/* length of string 2 (-1 if none) */
+	char *s3;			/* source string 3 (optional) */
+	int l3	;			/* length of string 3 (-1 if none) */
+	MALLOC_S *clp;			/* pointer to return of copy length
+					 * (optional) */
+{
+	MALLOC_S cl, len1, len2, len3;
+	char *cp;
+
+	if (s1)
+	    len1 = (MALLOC_S)((l1 >= 0) ? l1 : strlen(s1));
+	else
+	    len1 = (MALLOC_S)0;
+	if (s2)
+	    len2 = (MALLOC_S)((l2 >= 0) ? l2 : strlen(s2));
+	else
+	    len2 = (MALLOC_S)0;
+	if (s3)
+	    len3 = (MALLOC_S)((l3 >= 0) ? l3 : strlen(s3));
+	else
+	    len3 = (MALLOC_S)0;
+	cl = len1 + len2 + len3;
+	if ((cp = (char *)malloc(cl + 1))) {
+	    char *tp = cp;
+
+	    if (s1 && len1) {
+		(void) strncpy(tp, s1, len1);
+		tp += len1;
+	    }
+	    if (s2 && len2) {
+		(void) strncpy(tp, s2, len2);
+		tp += len2;
+	    }
+	    if (s3 && len3) {
+		(void) strncpy(tp, s3, len3);
+		tp += len3;
+	    }
+	    *tp = '\0';
+	}
+	if (clp)
+	    *clp = cl;
+	return(cp);
+}
+
+
+/*
+ * is_readable() -- is file readable
+ */
+
+int
+is_readable(path, msg)
+	char *path;			/* file path */
+	int msg;			/* issue warning message if 1 */
+{
+	if (access(path, R_OK) < 0) {
+	    if (!Fwarn && msg == 1)
+		(void) fprintf(stderr, ACCESSERRFMT, Pn, path, strerror(errno));
+	    return(0);
+	}
+	return(1);
+}
+
+
+/*
+ * lstatsafely() - lstat path safely (i. e., with timeout)
+ */
+
+int
+lstatsafely(path, buf)
+	char *path;			/* file path */
+	struct stat *buf;		/* stat buffer address */
+{
+	if (Fblock) {
+	    if (!Fwarn) 
+		(void) fprintf(stderr,
+		    "%s: avoiding stat(%s): -b was specified.\n",
+		    Pn, path);
+	    errno = EWOULDBLOCK;
+	    return(1);
+	}
+	return(doinchild(dolstat, path, (char *)buf, sizeof(struct stat)));
+}
+
+
+/*
+ * Readlink() - read and interpret file system symbolic links
+ */
+
+char *
+Readlink(arg)
+	char *arg;			/* argument to be interpreted */
+{
+	char abuf[MAXPATHLEN+1];
+	int alen;
+	char *ap;
+	char *argp1, *argp2;
+	int i, len, llen, slen;
+	char lbuf[MAXPATHLEN+1];
+	static char *op = (char *)NULL;
+	static int ss = 0;
+	char *s1;
+	static char **stk = (char **)NULL;
+	static int sx = 0;
+	char tbuf[MAXPATHLEN+1];
+/*
+ * See if avoiding kernel blocks.
+ */
+	if (Fblock) {
+	    if (!Fwarn) {
+		(void) fprintf(stderr, "%s: avoiding readlink(", Pn);
+		safestrprt(arg, stderr, 0);
+		(void) fprintf(stderr, "): -b was specified.\n");
+	    }
+	    op = (char *)NULL;
+	    return(arg);
+	}
+/*
+ * Save the original path.
+ */
+	if (!op)
+	    op = arg;
+/*
+ * Evaluate each component of the argument for a symbolic link.
+ */
+	for (alen = 0, ap = abuf, argp1 = argp2 = arg; *argp2; argp1 = argp2 ) {
+	    for (argp2 = argp1 + 1; *argp2 && *argp2 != '/'; argp2++)
+		;
+	    if ((len = argp2 - arg) >= (int)sizeof(tbuf)) {
+
+path_too_long:
+		if (!Fwarn) {
+		    (void) fprintf(stderr,
+			"%s: readlink() path too long: ", Pn);
+		    safestrprt(op ? op : arg, stderr, 1);
+		}
+		op = (char *)NULL;
+		return((char *)NULL);
+	    }
+	    (void) strncpy(tbuf, arg, len);
+	    tbuf[len] = '\0';
+	/*
+	 * Dereference a symbolic link.
+	 */
+	    if ((llen=doinchild(doreadlink,tbuf,lbuf,sizeof(lbuf) - 1)) >= 0) {
+
+	    /*
+	     * If the link is a new absolute path, replace
+	     * the previous assembly with it.
+	     */
+		if (lbuf[0] == '/') {
+		    (void) strncpy(abuf, lbuf, llen);
+		    ap = &abuf[llen];
+		    *ap = '\0';
+		    alen = llen;
+		    continue;
+		}
+		lbuf[llen] = '\0';
+		s1 = lbuf;
+	    } else {
+		llen = argp2 - argp1;
+		s1 = argp1;
+	    }
+	/*
+	 * Make sure two components are separated by a `/'.
+	 *
+	 * If the first component is not a link, don't force
+	 * a leading '/'.
+	 *
+	 * If the first component is a link and the source of
+	 * the link has a leading '/', force a leading '/'.
+	 */
+	    if (*s1 == '/')
+		slen = 1;
+	    else {
+		if (alen > 0) {
+
+		/*
+		 * This is not the first component.
+		 */
+		    if (abuf[alen - 1] == '/')
+			slen = 1;
+		    else
+			slen = 2;
+		} else {
+
+		/*
+		 * This is the first component.
+		 */
+		    if (s1 == lbuf && tbuf[0] == '/')
+			slen = 2;
+		    else
+			slen = 1;
+		}
+	    }
+	/*
+	 * Add to the path assembly.
+	 */
+	    if ((alen + llen + slen) >= (int)sizeof(abuf))
+		goto path_too_long;
+	    if (slen == 2)
+		*ap++ = '/';
+	    (void) strncpy(ap, s1, llen);
+	    ap += llen;
+	    *ap = '\0';
+	    alen += (llen + slen - 1);
+	}
+/*
+ * If the assembled path and argument are the same, free all but the
+ * last string in the stack, and return the argument.
+ */
+	if (strcmp(arg, abuf) == 0) {
+	    for (i = 0; i < sx; i++) {
+		if (i < (sx - 1))
+		    (void) free((FREE_P *)stk[i]);
+		stk[i] = (char *)NULL;
+	    }
+	    sx = 0;
+	    op = (char *)NULL;
+	    return(arg);
+	}
+/*
+ * If the assembled path and argument are different, add it to the
+ * string stack, then Readlink() it.
+ */
+	if (!(s1 = mkstrcpy(abuf, (MALLOC_S *)NULL))) {
+
+no_readlink_space:
+
+	    (void) fprintf(stderr, "%s: no Readlink string space for ", Pn);
+	    safestrprt(abuf, stderr, 1);
+	    Exit(1);
+	}
+	if (sx >= MAXSYMLINKS) {
+
+	/*
+	 * If there are too many symbolic links, report an error, clear
+	 * the stack, and return no path.
+	 */
+	    if (!Fwarn) {
+		(void) fprintf(stderr,
+		    "%s: too many (> %d) symbolic links in readlink() path: ",
+			Pn, MAXSYMLINKS);
+		safestrprt(op ? op : arg, stderr, 1);
+	    }
+	    for (i = 0; i < sx; i++) {
+		(void) free((FREE_P *)stk[i]);
+		stk[i] = (char *)NULL;
+	    }
+	    (void) free((FREE_P *)stk);
+	    stk = (char **)NULL;
+	    ss = sx = 0;
+	    op = (char *)NULL;
+	    return((char *)NULL);
+	}
+	if (++sx > ss) {
+	    if (!stk)
+		stk = (char **)malloc((MALLOC_S)(sizeof(char *) * sx));
+	    else
+		stk = (char **)realloc((MALLOC_P *)stk,
+					(MALLOC_S)(sizeof(char *) * sx));
+	    if (!stk)
+		goto no_readlink_space;
+	    ss = sx;
+	}
+	stk[sx - 1] = s1;
+	return(Readlink(s1));
+}
+
+
+#if	defined(HASSTREAMS)
+/*
+ * readstdata() - read stream's stdata structure
+ */
+
+int
+readstdata(addr, buf)
+	KA_T addr;			/* stdata address in kernel*/
+	struct stdata *buf;		/* buffer addess */
+{
+	if (!addr
+	||  kread(addr, (char *)buf, sizeof(struct stdata))) {
+	    (void) snpf(Namech, Namechl, "no stream data in %s",
+		print_kptr(addr, (char *)NULL, 0));
+	    return(1);
+	}
+	return(0);
+}
+
+
+/*
+ * readsthead() - read stream head
+ */
+
+int
+readsthead(addr, buf)
+	KA_T addr;			/* starting queue pointer in kernel */
+	struct queue *buf;		/* buffer for queue head */
+{
+	KA_T qp;
+
+	if (!addr) {
+	    (void) snpf(Namech, Namechl, "no stream queue head");
+	    return(1);
+	}
+	for (qp = addr; qp; qp = (KA_T)buf->q_next) {
+	    if (kread(qp, (char *)buf, sizeof(struct queue))) {
+		(void) snpf(Namech, Namechl, "bad stream queue link at %s",
+		    print_kptr(qp, (char *)NULL, 0));
+		return(1);
+	    }
+	}
+	return(0);
+}
+
+
+/*
+ * readstidnm() - read stream module ID name
+ */
+
+int
+readstidnm(addr, buf, len)
+	KA_T addr;			/* module ID name address in kernel */
+	char *buf;			/* receiving buffer address */
+	READLEN_T len;			/* buffer length */
+{
+	if (!addr || kread(addr, buf, len)) {
+	    (void) snpf(Namech, Namechl, "can't read module ID name from %s",
+		print_kptr(addr, (char *)NULL, 0));
+	    return(1);
+	}
+	return(0);
+}
+
+
+/*
+ * readstmin() - read stream's module info
+ */
+
+int
+readstmin(addr, buf)
+	KA_T addr;			/* module info address in kernel */
+	struct module_info *buf;	/* receiving buffer address */
+{
+	if (!addr || kread(addr, (char *)buf, sizeof(struct module_info))) {
+	    (void) snpf(Namech, Namechl, "can't read module info from %s",
+		print_kptr(addr, (char *)NULL, 0));
+	    return(1);
+	}
+	return(0);
+}
+
+
+/*
+ * readstqinit() - read stream's queue information structure
+ */
+
+int
+readstqinit(addr, buf)
+	KA_T addr;			/* queue info address in kernel */
+	struct qinit *buf;		/* receiving buffer address */
+{
+	if (!addr || kread(addr, (char *)buf, sizeof(struct qinit))) {
+	    (void) snpf(Namech, Namechl, "can't read queue info from %s",
+		print_kptr(addr, (char *)NULL, 0));
+	    return(1);
+	}
+	return(0);
+}
+#endif	/* HASSTREAMS */
+
+
+/*
+ * safepup() - safely print an unprintable character -- i.e., print it in a
+ *	       printable form
+ *
+ * return: char * to printable equivalent
+ *	   cl = strlen(printable equivalent)
+ */
+
+char *
+safepup(c, cl)
+	unsigned int c;			/* unprintable (i.e., !isprint())
+					 * character  and '\\' */
+	int *cl;			/* returned printable strlen -- NULL if
+					 * no return needed */
+{
+	int len;
+	char *rp;
+	static char up[8];
+
+	if (c < 0x20) {
+	    switch (c) {
+	    case '\b':
+		rp = "\\b";
+		break;
+	    case '\f':
+		rp = "\\f";
+		break;
+	    case '\n':
+		rp = "\\n";
+		break;
+	    case '\r':
+		rp = "\\r";
+		break;
+	    case '\t':
+		rp = "\\t";
+		break;
+	    default:
+		(void) snpf(up, sizeof(up), "^%c", c + 0x40);
+		rp = up;
+	    }
+	    len = 2;
+	} else if (c == 0xff) {
+	    rp = "^?";
+	    len = 2;
+	} else if (c == '\\') {
+	    rp = "\\\\";
+	    len = 2;
+	} else {
+	    (void) snpf(up, sizeof(up), "\\x%02x", (int)(c & 0xff));
+	    rp = up;
+	    len = 4;
+	}
+	if (cl)
+	    *cl = len;
+	return(rp);
+}
+
+
+/*
+ * safestrlen() - calculate a "safe" string length -- i.e., compute space for
+ *		  non-printable characters when printed in a printable form
+ */
+
+int
+safestrlen(sp, flags)
+	char *sp;			/* string pointer */
+	int flags;			/* flags:
+					 *   bit 0: 0 (0) = no NL
+					 *	    1 (1) = add trailing NL
+					 *	 1: 0 (0) = ' ' printable
+					 *	    1 (2) = ' ' not printable
+					 */
+{
+	char c;
+	int len = 0;
+
+	c = (flags & 2) ? ' ' : '\0';
+	if (sp) {
+	    for (; *sp; sp++) {
+		if (!isprint((unsigned char)*sp)
+		||  (*sp == '\\') || (*sp == c))
+		{
+		    if ((*sp < 0x20) || ((unsigned char)*sp == 0xff)
+		    ||  (*sp == '\\'))
+			len += 2;		/* length of \. or ^. form */
+		    else
+			len += 4;		/* length of "\x%02x" printf */
+		} else
+		    len++;
+	    }
+	}
+	return(len);
+}
+
+
+/*
+ * safestrprt() - print a string "safely" to the indicated stream -- i.e.,
+ *		  print unprintable characters in a printable form
+ */
+
+void
+safestrprt(sp, fs, flags)
+	char *sp;			/* string to print pointer pointer */
+	FILE *fs;			/* destination stream -- e.g., stderr
+					 * or stdout */
+	int flags;			/* flags:
+					 *   bit 0: 0 (0) = no NL
+					 *	    1 (1) = add trailing NL
+					 *	 1: 0 (0) = ' ' printable
+					 *	    1 (2) = ' ' not printable
+					 *	 2: 0 (0) = print string as is
+					 *	    1 (4) = surround string
+					 *		    with '"'
+					 *	 4: 0 (0) = print ending '\n'
+					 *	    1 (8) = don't print ending
+					 *		    '\n'
+					 */
+{
+	char c;
+	int lnc, lnt, sl;
+
+#if	defined(HASWIDECHAR)
+	wchar_t w;
+	int wcmx = MB_CUR_MAX;
+#else	/* !defined(HASWIDECHAR) */
+	static int wcmx = 1;
+#endif	/* defined(HASWIDECHAR) */
+
+	c = (flags & 2) ? ' ' : '\0';
+	if (flags & 4)
+	    putc('"', fs);
+	if (sp) {
+	    for (sl = strlen(sp); *sp; sl -= lnc, sp += lnc) {
+
+#if	defined(HASWIDECHAR)
+		if (wcmx > 1) {
+		    lnc = mblen(sp, sl);
+		    if (lnc > 1) {
+			if ((mbtowc(&w, sp, sl) == lnc) && iswprint(w)) {
+			    for (lnt = 0; lnt < lnc; lnt++) {
+				putc((int)*(sp + lnt), fs);
+			    }
+			} else {
+			    for (lnt = 0; lnt < lnc; lnt++) {
+			        fputs(safepup((unsigned int)*(sp + lnt),
+					      (int *)NULL), fs);
+			    }
+			}
+			continue;
+		    } else
+			lnc = 1;
+		} else
+		    lnc = 1;
+#else	/* !defined(HASWIDECHAR) */
+		lnc = 1;
+#endif	/* defined(HASWIDECHAR) */
+
+		if ((*sp != '\\') && isprint((unsigned char)*sp) && *sp != c)
+		    putc((int)(*sp & 0xff), fs);
+		else {
+		    if ((flags & 8) && (*sp == '\n') && !*(sp + 1))
+			break;
+		    fputs(safepup((unsigned int)*sp, (int *)NULL), fs);
+		}
+	    }
+	}
+	if (flags & 4)
+	    putc('"', fs);
+	if (flags & 1)
+	    putc('\n', fs);
+}
+
+
+/*
+ * safestrprtn() - print a specified number of characters from a string
+ *		   "safely" to the indicated stream
+ */
+
+void
+safestrprtn(sp, len, fs, flags)
+	char *sp;			/* string to print pointer pointer */
+	int len;			/* safe number of characters to
+					 * print */
+	FILE *fs;			/* destination stream -- e.g., stderr
+					 * or stdout */
+	int flags;			/* flags:
+					 *   bit 0: 0 (0) = no NL
+					 *	    1 (1) = add trailing NL
+					 *	 1: 0 (0) = ' ' printable
+					 *	    1 (2) = ' ' not printable
+					 *	 2: 0 (0) = print string as is
+					 *	    1 (4) = surround string
+					 *		    with '"'
+					 *	 4: 0 (0) = print ending '\n'
+					 *	    1 (8) = don't print ending
+					 *		    '\n'
+					 */
+{
+	char c, *up;
+	int cl, i;
+
+	if (flags & 4)
+	    putc('"', fs);
+	if (sp) {
+	    c = (flags & 2) ? ' ' : '\0';
+	    for (i = 0; i < len && *sp; sp++) {
+		if ((*sp != '\\') && isprint((unsigned char)*sp) && *sp != c) {
+		    putc((int)(*sp & 0xff), fs);
+		    i++;
+		} else {
+		    if ((flags & 8) && (*sp == '\n') && !*(sp + 1))
+			break;
+		    up = safepup((unsigned int)*sp, &cl);
+		    if ((i + cl) > len)
+			break;
+		    fputs(up, fs);
+		    i += cl;
+		}
+	    }
+	} else
+	    i = 0;
+	for (; i < len; i++)
+	    putc(' ', fs);
+	if (flags & 4)
+	    putc('"', fs);
+	if (flags & 1)
+	    putc('\n', fs);
+}
+
+
+/*
+ * statsafely() - stat path safely (i. e., with timeout)
+ */
+
+int
+statsafely(path, buf)
+	char *path;			/* file path */
+	struct stat *buf;		/* stat buffer address */
+{
+	if (Fblock) {
+	    if (!Fwarn) 
+		(void) fprintf(stderr,
+		    "%s: avoiding stat(%s): -b was specified.\n",
+		    Pn, path);
+	    errno = EWOULDBLOCK;
+	    return(1);
+	}
+	return(doinchild(dostat, path, (char *)buf, sizeof(struct stat)));
+}
+
+
+/*
+ * stkdir() - stack directory name
+ */
+
+void
+stkdir(p)
+	char *p;		/* directory path */
+{
+	MALLOC_S len;
+/*
+ * Provide adequate space for directory stack pointers.
+ */
+	if (Dstkx >= Dstkn) {
+	    Dstkn += 128;
+	    len = (MALLOC_S)(Dstkn * sizeof(char *));
+	    if (!Dstk)
+		Dstk = (char **)malloc(len);
+	    else
+		Dstk = (char **)realloc((MALLOC_P *)Dstk, len);
+	    if (!Dstk) {
+		(void) fprintf(stderr,
+		    "%s: no space for directory stack at: ", Pn);
+		safestrprt(p, stderr, 1);
+		Exit(1);
+	    }
+	}
+/*
+ * Allocate space for the name, copy it there and put its pointer on the stack.
+ */
+	if (!(Dstk[Dstkx] = mkstrcpy(p, (MALLOC_S *)NULL))) {
+	    (void) fprintf(stderr, "%s: no space for: ", Pn);
+	    safestrprt(p, stderr, 1);
+	    Exit(1);
+	}
+	Dstkx++;
+}
+
+
+/*
+ * x2dev() - convert hexadecimal ASCII string to device number
+ */
+
+char *
+x2dev(s, d)
+	char *s;			/* ASCII string */
+	dev_t *d;			/* device receptacle */
+{
+	char *cp, *cp1;
+	int n;
+	dev_t r;
+
+/*
+ * Skip an optional leading 0x.  Count the number of hex digits up to the end
+ * of the string, or to a space, or to a comma.  Return an error if an unknown
+ * character is encountered.  If the count is larger than (2 * sizeof(dev_t))
+ * -- e.g., because of sign extension -- ignore excess leading hex 0xf digits,
+ * but return an error if an excess leading digit isn't 0xf.
+ */
+	if  (strncasecmp(s, "0x", 2) == 0)
+		s += 2;
+	for (cp = s, n = 0; *cp; cp++, n++) {
+	    if (isdigit((unsigned char)*cp))
+		continue;
+	    if ((unsigned char)*cp >= 'a' && (unsigned char)*cp <= 'f')
+		continue;
+	    if ((unsigned char)*cp >= 'A' && (unsigned char)*cp <= 'F')
+		continue;
+	    if (*cp == ' ' || *cp == ',')
+		break;
+	    return((char *)NULL);
+	}
+	if (!n)
+	    return((char *)NULL);
+	if (n > (2 * (int)sizeof(dev_t))) {
+	    cp1 = s;
+	    s += (n - (2 * sizeof(dev_t)));
+	    while (cp1 < s) {
+		if (*cp1 != 'f' && *cp1 != 'F')
+		    return((char *)NULL);
+		cp1++;
+	    }
+	}
+/*
+ * Assemble the validated hex digits of the device number, starting at a point
+ * in the string relevant to sizeof(dev_t).
+ */
+	for (r = 0; s < cp; s++) {
+	    r = r << 4;
+	    if (isdigit((unsigned char)*s))
+		r |= (unsigned char)(*s - '0') & 0xf;
+	    else {
+		if (isupper((unsigned char)*s))
+		    r |= ((unsigned char)(*s - 'A') + 10) & 0xf;
+		else
+		    r |= ((unsigned char)(*s - 'a') + 10) & 0xf;
+	    }
+	}
+	*d = r;
+	return(s);
+}
diff --git a/OLD/print.c b/OLD/print.c
new file mode 100644
index 0000000000000000000000000000000000000000..c0af284f8e4be8af9e0161271ef437e72b4be00d
--- /dev/null
+++ b/OLD/print.c
@@ -0,0 +1,2821 @@
+/*
+ * print.c - common print support functions for lsof
+ */
+
+
+/*
+ * Copyright 1994 Purdue Research Foundation, West Lafayette, Indiana
+ * 47907.  All rights reserved.
+ *
+ * Written by Victor A. Abell
+ *
+ * This software is not subject to any license of the American Telephone
+ * and Telegraph Company or the Regents of the University of California.
+ *
+ * Permission is granted to anyone to use this software for any purpose on
+ * any computer system, and to alter it and redistribute it freely, subject
+ * to the following restrictions:
+ *
+ * 1. Neither the authors nor Purdue University are responsible for any
+ *    consequences of the use of this software.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ *    explicit claim or by omission.  Credit to the authors and Purdue
+ *    University must appear in documentation and sources.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ *    misrepresented as being the original software.
+ *
+ * 4. This notice may not be removed or altered.
+ */
+
+#ifndef lint
+static char copyright[] =
+"@(#) Copyright 1994 Purdue Research Foundation.\nAll rights reserved.\n";
+static char *rcsid = "$Id: print.c,v 1.54 2012/04/10 16:30:51 abe Exp $";
+#endif
+
+
+#include "lsof.h"
+
+
+/*
+ * Local definitions, structures and function prototypes
+ */
+
+#define HCINC		64		/* host cache size increase chunk */
+#define PORTHASHBUCKETS	128		/* port hash bucket count
+					 * !!MUST BE A POWER OF 2!! */
+#define	PORTTABTHRESH	10		/* threshold at which we will switch
+					 * from using getservbyport() to
+					 * getservent() -- see lkup_port()
+					 * and fill_porttab() */
+
+struct hostcache {
+	unsigned char a[MAX_AF_ADDR];	/* numeric address */
+	int af;				/* address family -- e.g., AF_INET
+					 * or AF_INET6 */
+	char *name;			/* name */
+};
+
+struct porttab {
+	int port;
+	MALLOC_S nl;			/* name length (excluding '\0') */
+	int ss;				/* service name status, 0 = lookup not
+					 * yet performed */
+	char *name;
+	struct porttab *next;
+};
+
+
+#if	defined(HASNORPC_H)
+static struct porttab **Pth[2] = { NULL, NULL };
+						/* port hash buckets:
+						 * Pth[0] for TCP service names
+						 * Pth[1] for UDP service names
+						 */
+#else	/* !defined(HASNORPC_H) */
+static struct porttab **Pth[4] = { NULL, NULL, NULL, NULL };
+						/* port hash buckets:
+						 * Pth[0] for TCP service names
+						 * Pth[1] for UDP service names
+						 * Pth[2] for TCP portmap info
+						 * Pth[3] for UDP portmap info
+						 */
+#endif	/* defined(HASNORPC_H) */
+
+#define HASHPORT(p)	(((((int)(p)) * 31415) >> 3) & (PORTHASHBUCKETS - 1))
+
+
+#if	!defined(HASNORPC_H)
+_PROTOTYPE(static void fill_portmap,(void));
+_PROTOTYPE(static void update_portmap,(struct porttab *pt, char *pn));
+#endif	/* !defined(HASNORPC_H) */
+
+_PROTOTYPE(static void fill_porttab,(void));
+_PROTOTYPE(static char *lkup_port,(int p, int pr, int src));
+_PROTOTYPE(static char *lkup_svcnam,(int h, int p, int pr, int ss));
+_PROTOTYPE(static int printinaddr,(void));
+
+
+/*
+ * endnm() - locate end of Namech
+ */
+
+char *
+endnm(sz)
+	size_t *sz;			/* returned remaining size */
+{
+	register char *s;
+	register size_t tsz;
+
+	for (s = Namech, tsz = Namechl; *s; s++, tsz--)
+		;
+	*sz = tsz;
+	return(s);
+}
+
+
+#if !defined(HASNORPC_H)
+/*
+ * fill_portmap() -- fill the RPC portmap program name table via a conversation
+ *		     with the portmapper
+ *
+ * The following copyright notice acknowledges that this function was adapted
+ * from getrpcportnam() of the source code of the OpenBSD netstat program.
+ */
+
+/*
+* Copyright (c) 1983, 1988, 1993
+*      The Regents of the University of California.  All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+* 1. Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the distribution.
+* 3. All advertising materials mentioning features or use of this software
+*    must display the following acknowledgement:
+*      This product includes software developed by the University of
+*      California, Berkeley and its contributors.
+* 4. Neither the name of the University nor the names of its contributors
+*    may be used to endorse or promote products derived from this software
+*    without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+* ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+* SUCH DAMAGE.
+*/
+
+static void
+fill_portmap()
+{
+	char buf[128], *cp, *nm;
+	CLIENT *c;
+	int h, port, pr;
+	MALLOC_S nl;
+	struct pmaplist *p = (struct pmaplist *)NULL;
+	struct porttab *pt;
+	struct rpcent *r;
+	struct TIMEVAL_LSOF tm;
+
+#if	!defined(CAN_USE_CLNT_CREATE)
+	struct hostent *he;
+	struct sockaddr_in ia;
+	int s = RPC_ANYSOCK;
+#endif	/* !defined(CAN_USE_CLNT_CREATE) */
+
+/*
+ * Construct structures for communicating with the portmapper.
+ */
+
+#if	!defined(CAN_USE_CLNT_CREATE)
+	zeromem(&ia, sizeof(ia));
+	ia.sin_family = AF_INET;
+	if ((he = gethostbyname("localhost")))
+	    MEMMOVE((caddr_t)&ia.sin_addr, he->h_addr, he->h_length);
+	ia.sin_port = htons(PMAPPORT);
+#endif	/* !defined(CAN_USE_CLNT_CREATE) */
+
+	tm.tv_sec = 60;
+	tm.tv_usec = 0;
+/*
+ * Get an RPC client handle.  Then ask for a dump of the port map.
+ */
+
+#if	defined(CAN_USE_CLNT_CREATE)
+	if (!(c = clnt_create("localhost", PMAPPROG, PMAPVERS, "tcp")))
+#else	/* !defined(CAN_USE_CLNT_CREATE) */
+	if (!(c = clnttcp_create(&ia, PMAPPROG, PMAPVERS, &s, 0, 0)))
+#endif	/* defined(CAN_USE_CLNT_CREATE) */
+
+	    return;
+	if (clnt_call(c, PMAPPROC_DUMP, XDR_VOID, NULL, XDR_PMAPLIST,
+		      (caddr_t)&p, tm)
+	!= RPC_SUCCESS) {
+	    clnt_destroy(c);
+	    return;
+	}
+/*
+ * Loop through the port map dump, creating portmap table entries from TCP
+ * and UDP members.
+ */
+	for (; p; p = p->pml_next) {
+	
+	/*
+	 * Determine the port map entry's protocol; ignore all but TCP and UDP.
+	 */
+	    if (p->pml_map.pm_prot == IPPROTO_TCP)
+		pr = 2;
+	    else if (p->pml_map.pm_prot == IPPROTO_UDP)
+		pr = 3;
+	    else
+		continue;
+	/*
+	 * See if there's already a portmap entry for this port.  If there is,
+	 * ignore this entry.
+	 */
+	    h = HASHPORT((port = (int)p->pml_map.pm_port));
+	    for (pt = Pth[pr][h]; pt; pt = pt->next) {
+		if (pt->port == port)
+		    break;
+	    }
+	    if (pt)
+		continue;
+	/*
+	 * Save the registration name or number.
+	 */
+	    cp = (char *)NULL;
+	    if ((r = (struct rpcent *)getrpcbynumber(p->pml_map.pm_prog))) {
+		if (r->r_name && strlen(r->r_name))
+		    cp = r->r_name;
+	    }
+	    if (!cp) {
+		(void) snpf(buf, sizeof(buf), "%lu",
+			    (unsigned long)p->pml_map.pm_prog);
+		cp = buf;
+	    }
+	    if (!strlen(cp))
+		continue;
+	/*
+	 * Allocate space for the portmap name entry and copy it there.
+	 */
+	    if (!(nm = mkstrcpy(cp, &nl))) {
+		(void) fprintf(stderr,
+		    "%s: can't allocate space for portmap entry: ", Pn);
+		safestrprt(cp, stderr, 1);
+		Exit(1);
+	    }
+	    if (!nl) {
+		(void) free((FREE_P *)nm);
+		continue;
+	    }
+	/*
+	 * Allocate and fill a porttab struct entry for the portmap table.
+	 * Link it to the head of its hash bucket, and make it the new head.
+	 */
+	    if (!(pt = (struct porttab *)malloc(sizeof(struct porttab)))) {
+		(void) fprintf(stderr,
+		    "%s: can't allocate porttab entry for portmap: ", Pn);
+		safestrprt(nm, stderr, 1);
+		Exit(1);
+	    }
+	    pt->name = nm;
+	    pt->nl = nl;
+	    pt->port = port;
+	    pt->next = Pth[pr][h];
+	    pt->ss = 0;
+	    Pth[pr][h] = pt;
+	}
+	clnt_destroy(c);
+}
+#endif	/* !defined(HASNORPC_H) */
+
+
+/*
+ * fill_porttab() -- fill the TCP and UDP service name port table with a
+ *		     getservent() scan
+ */
+
+static void
+fill_porttab()
+{
+	int h, p, pr;
+	MALLOC_S nl;
+	char *nm;
+	struct porttab *pt;
+	struct servent *se;
+
+	(void) endservent();
+/*
+ * Scan the services data base for TCP and UDP entries that have a non-null
+ * name associated with them.
+ */
+	(void) setservent(1);
+	while ((se = getservent())) {
+	    if (!se->s_name || !se->s_proto)
+		continue;
+	    if (strcasecmp(se->s_proto, "TCP") == 0)
+		pr = 0;
+	    else if (strcasecmp(se->s_proto, "UDP") == 0)
+		pr = 1;
+	    else
+		continue;
+	    if (!se->s_name || !strlen(se->s_name))
+		continue;
+	    p = ntohs(se->s_port);
+	/*
+	 * See if a port->service entry is already cached for this port and
+	 * prototcol.  If it is, leave it alone.
+	 */
+	    h = HASHPORT(p);
+	    for (pt = Pth[pr][h]; pt; pt = pt->next) {
+		if (pt->port == p)
+		    break;
+	    }
+	    if (pt)
+		continue;
+	/*
+	 * Add a new entry to the cache for this port and protocol.
+	 */
+	    if (!(nm = mkstrcpy(se->s_name, &nl))) {
+		(void) fprintf(stderr,
+		    "%s: can't allocate %d bytes for port %d name: %s\n",
+		    Pn, (int)(nl + 1), p, se->s_name);
+		Exit(1);
+	    }
+	    if (!nl) {
+		(void) free((FREE_P *)nm);
+		continue;
+	    }
+	    if (!(pt = (struct porttab *)malloc(sizeof(struct porttab)))) {
+		(void) fprintf(stderr,
+		    "%s: can't allocate porttab entry for port %d: %s\n",
+		    Pn, p, se->s_name);
+		Exit(1);
+	    }
+	    pt->name = nm;
+	    pt->nl = nl - 1;
+	    pt->port = p;
+	    pt->next = Pth[pr][h];
+	    pt->ss = 0;
+	    Pth[pr][h] = pt;
+	}
+	(void) endservent();
+}
+
+
+/*
+ * gethostnm() - get host name
+ */
+
+char *
+gethostnm(ia, af)
+	unsigned char *ia;		/* Internet address */
+	int af;				/* address family -- e.g., AF_INET
+					 * or AF_INET6 */
+{
+	int al = MIN_AF_ADDR;
+	char hbuf[256];
+	static struct hostcache *hc = (struct hostcache *)NULL;
+	static int hcx = 0;
+	char *hn, *np;
+	struct hostent *he = (struct hostent *)NULL;
+	int i, j;
+	MALLOC_S len;
+	static int nhc = 0;
+/*
+ * Search cache.
+ */
+
+#if	defined(HASIPv6)
+	if (af == AF_INET6)
+	    al = MAX_AF_ADDR;
+#endif	/* defined(HASIPv6) */
+
+	for (i = 0; i < hcx; i++) {
+	    if (af != hc[i].af)
+		continue;
+	    for (j = 0; j < al; j++) {
+		if (ia[j] != hc[i].a[j])
+		    break;
+	    }
+	    if (j >= al)
+		return(hc[i].name);
+	}
+/*
+ * If -n has been specified, construct a numeric address.  Otherwise, look up
+ * host name by address.  If that fails, or if there is no name in the returned
+ * hostent structure, construct a numeric version of the address.
+ */
+	if (Fhost)
+	    he = gethostbyaddr((char *)ia, al, af);
+	if (!he || !he->h_name) {
+
+#if	defined(HASIPv6)
+	    if (af == AF_INET6) {
+
+	    /*
+	     * Since IPv6 numeric addresses use `:' as a separator, enclose
+	     * them in brackets.
+	     */
+		hbuf[0] = '[';
+		if (!inet_ntop(af, ia, hbuf + 1, sizeof(hbuf) - 3)) {
+		    (void) snpf(&hbuf[1], (sizeof(hbuf) - 1),
+			"can't format IPv6 address]");
+		} else {
+		    len = strlen(hbuf);
+		    (void) snpf(&hbuf[len], sizeof(hbuf) - len, "]");
+		}
+	    } else
+#endif	/* defined(HASIPv6) */
+
+	    if (af == AF_INET)
+		(void) snpf(hbuf, sizeof(hbuf), "%u.%u.%u.%u", ia[0], ia[1],
+			    ia[2], ia[3]);
+	    else
+		(void) snpf(hbuf, sizeof(hbuf), "(unknown AF value: %d)", af);
+	    hn = hbuf;
+	} else
+	    hn = (char *)he->h_name;
+/*
+ * Allocate space for name and copy name to it.
+ */
+	if (!(np = mkstrcpy(hn, (MALLOC_S *)NULL))) {
+	    (void) fprintf(stderr, "%s: no space for host name: ", Pn);
+	    safestrprt(hn, stderr, 1);
+	    Exit(1);
+	}
+/*
+ * Add address/name entry to cache.  Allocate cache space in HCINC chunks.
+ */
+	if (hcx >= nhc) {
+	    nhc += HCINC;
+	    len = (MALLOC_S)(nhc * sizeof(struct hostcache));
+	    if (!hc)
+		hc = (struct hostcache *)malloc(len);
+	    else
+		hc = (struct hostcache *)realloc((MALLOC_P *)hc, len);
+	    if (!hc) {
+		(void) fprintf(stderr, "%s: no space for host cache\n", Pn);
+		Exit(1);
+	    }
+	}
+	hc[hcx].af = af;
+	for (i = 0; i < al; i++) {
+	    hc[hcx].a[i] = ia[i];
+	}
+	hc[hcx++].name = np;
+	return(np);
+}
+
+
+/*
+ * lkup_port() - look up port for protocol
+ */
+
+static char *
+lkup_port(p, pr, src)
+	int p;				/* port number */
+	int pr;				/* protocol index: 0 = tcp, 1 = udp */
+	int src;			/* port source: 0 = local
+					 *		1 = foreign */
+{
+	int h, nh;
+	MALLOC_S nl;
+	char *nm, *pn;
+	static char pb[128];
+	static int pm = 0;
+	struct porttab *pt;
+/*
+ * If the hash buckets haven't been allocated, do so.
+ */
+	if (!Pth[0]) {
+
+#if	defined(HASNORPC_H)
+	    nh = 2;
+#else	/* !defined(HASNORPC_H) */
+	    nh = FportMap ? 4 : 2;
+#endif	/* defined(HASNORPC_H) */
+
+	    for (h = 0; h < nh; h++) {
+		if (!(Pth[h] = (struct porttab **)calloc(PORTHASHBUCKETS,
+				sizeof(struct porttab *))))
+		{
+		    (void) fprintf(stderr,
+		      "%s: can't allocate %d bytes for %s %s hash buckets\n",
+		      Pn,
+		      (int)(2 * (PORTHASHBUCKETS * sizeof(struct porttab *))),
+		      (h & 1) ? "UDP" : "TCP",
+		      (h > 1) ? "portmap" : "port");
+		    Exit(1);
+		}
+	    }
+	}
+
+#if	!defined(HASNORPC_H)
+/*
+ * If we're looking up program names for portmapped ports, make sure the
+ * portmap table has been loaded.
+ */
+	if (FportMap && !pm) {
+	    (void) fill_portmap();
+	    pm++;
+	}
+#endif	/* !defined(HASNORPC_H) */
+
+/*
+ * Hash the port and see if its name has been cached.  Look for a local
+ * port first in the portmap, if portmap searching is enabled.
+ */
+	h = HASHPORT(p);
+
+#if	!defined(HASNORPC_H)
+	if (!src && FportMap) {
+	    for (pt = Pth[pr+2][h]; pt; pt = pt->next) {
+		if (pt->port != p)
+		    continue;
+		if (!pt->ss) {
+		    pn = Fport ? lkup_svcnam(h, p, pr, 0) : (char *)NULL;
+		    if (!pn) {
+			(void) snpf(pb, sizeof(pb), "%d", p);
+			pn = pb;
+		    }
+		    (void) update_portmap(pt, pn);
+		}
+		return(pt->name);
+	    }
+	}
+#endif	/* !defined(HASNORPC_H) */
+
+	for (pt = Pth[pr][h]; pt; pt = pt->next) {
+	    if (pt->port == p)
+		return(pt->name);
+	}
+/*
+ * Search for a possible service name, unless the -P option has been specified.
+ *
+ * If there is no service name, return a %d conversion.
+ *
+ * Don't cache %d conversions; a zero port number is a %d conversion that
+ * is represented by "*".
+ */
+	pn = Fport ? lkup_svcnam(h, p, pr, 1) : (char *)NULL;
+	if (!pn || !strlen(pn)) {
+	    if (p) {
+		(void) snpf(pb, sizeof(pb), "%d", p);
+		return(pb);
+	    } else
+		return("*");
+	}
+/*
+ * Allocate a new porttab entry for the TCP or UDP service name.
+ */
+	if (!(pt = (struct porttab *)malloc(sizeof(struct porttab)))) {
+	    (void) fprintf(stderr,
+		"%s: can't allocate porttab entry for port %d\n", Pn, p);
+	    Exit(1);
+	}
+/*
+ * Allocate space for the name; copy it to the porttab entry; and link the
+ * porttab entry to its hash bucket.
+ *
+ * Return a pointer to the name.
+ */
+	if (!(nm = mkstrcpy(pn, &nl))) {
+	    (void) fprintf(stderr,
+		"%s: can't allocate space for port name: ", Pn);
+	    safestrprt(pn, stderr, 1);
+	    Exit(1);
+	}
+	pt->name = nm;
+	pt->nl = nl;
+	pt->port = p;
+	pt->next = Pth[pr][h];
+	pt->ss = 0;
+	Pth[pr][h] = pt;
+	return(nm);
+}
+
+
+/*
+ * lkup_svcnam() - look up service name for port
+ */
+
+static char *
+lkup_svcnam(h, p, pr, ss)
+	int h;				/* porttab hash index */
+	int p;				/* port number */
+	int pr;				/* protocol: 0 = TCP, 1 = UDP */
+	int ss;				/* search status: 1 = Pth[pr][h]
+					 *		  already searched */
+{
+	static int fl[PORTTABTHRESH];
+	static int fln = 0;
+	static int gsbp = 0;
+	int i;
+	struct porttab *pt;
+	static int ptf = 0;
+	struct servent *se;
+/*
+ * Do nothing if -P has been specified.
+ */
+	if (!Fport)
+	    return((char *)NULL);
+
+	for (;;) {
+
+	/*
+	 * Search service name cache, if it hasn't already been done.
+	 * Return the name of a match.
+	 */
+	    if (!ss) {
+		for (pt = Pth[pr][h]; pt; pt = pt->next) {
+		    if (pt->port == p)
+			return(pt->name);
+		}
+	    }
+/*
+ * If fill_porttab() has been called, there is no service name.
+ *
+ * Do PORTTABTHRES getservbport() calls, remembering the failures, so they
+ * won't be repeated.
+ *
+ * After PORTABTHRESH getservbyport() calls, call fill_porttab() once,
+ */
+	    if (ptf)
+		break;
+	    if (gsbp < PORTTABTHRESH) {
+		for (i = 0; i < fln; i++) {
+		    if (fl[i] == p)
+			return((char *)NULL);
+		}
+		gsbp++;
+		if ((se = getservbyport(htons(p), pr ? "udp" : "tcp")))
+		    return(se->s_name);
+		if (fln < PORTTABTHRESH)
+		    fl[fln++] = p;
+		return((char *)NULL);
+	    }
+	    (void) fill_porttab();
+	    ptf++;
+	    ss = 0;
+	}
+	return((char *)NULL);
+}
+
+
+/*
+ * print_file() - print file
+ */
+
+void
+print_file()
+{
+	char buf[128];
+	char *cp = (char *)NULL;
+	dev_t dev;
+	int devs, len;
+
+	if (PrPass && !Hdr) {
+
+	/*
+	 * Print the header line if this is the second pass and the
+	 * header hasn't already been printed.
+	 */
+	    (void) printf("%-*.*s %*s", CmdColW, CmdColW, CMDTTL, PidColW,
+		PIDTTL);
+
+#if	defined(HASTASKS)
+	    if (TaskPrtFl)
+		(void) printf(" %*s", TidColW, TIDTTL);
+#endif	/* defined(HASTASKS) */
+
+#if	defined(HASZONES)
+	    if (Fzone)
+		(void) printf(" %-*s", ZoneColW, ZONETTL);
+#endif	/* defined(HASZONES) */
+
+#if	defined(HASSELINUX)
+	    if (Fcntx)
+		(void) printf(" %-*s", CntxColW, CNTXTTL);
+#endif /* defined(HASSELINUX) */
+
+#if	defined(HASPPID)
+	    if (Fppid)
+	 	(void) printf(" %*s", PpidColW, PPIDTTL);
+#endif	/* defined(HASPPID) */
+
+	    if (Fpgid)
+		(void) printf(" %*s", PgidColW, PGIDTTL);
+	    (void) printf(" %*s %*s   %*s",
+		UserColW, USERTTL,
+		FdColW - 2, FDTTL,
+		TypeColW, TYPETTL);
+
+#if	defined(HASFSTRUCT)
+	    if (Fsv) {
+
+# if	!defined(HASNOFSADDR)
+		if (Fsv & FSV_FA)
+		    (void) printf(" %*s", FsColW, FSTTL);
+# endif	/* !defined(HASNOFSADDR) */
+
+# if	!defined(HASNOFSCOUNT)
+		if (Fsv & FSV_CT)
+		    (void) printf(" %*s", FcColW, FCTTL);
+# endif	/* !defined(HASNOFSCOUNT) */
+
+# if	!defined(HASNOFSFLAGS)
+		if (Fsv & FSV_FG)
+		    (void) printf(" %*s", FgColW, FGTTL);
+# endif	/* !defined(HASNOFSFLAGS) */
+
+# if	!defined(HASNOFSNADDR)
+		if (Fsv & FSV_NI)
+		    (void) printf(" %*s", NiColW, NiTtl);
+# endif	/* !defined(HASNOFSNADDR) */
+
+	    }
+#endif	/* defined(HASFSTRUCT) */
+
+	    (void) printf(" %*s", DevColW, DEVTTL);
+	    if (Foffset)
+		(void) printf(" %*s", SzOffColW, OFFTTL);
+	    else if (Fsize)
+		(void) printf(" %*s", SzOffColW, SZTTL);
+	    else
+		(void) printf(" %*s", SzOffColW, SZOFFTTL);
+	    if (Fnlink)
+		(void) printf(" %*s", NlColW, NLTTL);
+	    (void) printf(" %*s %s\n", NodeColW, NODETTL, NMTTL);
+	    Hdr++;
+	}
+/*
+ * Size or print the command.
+ */
+	cp = (Lp->cmd && *Lp->cmd != '\0') ? Lp->cmd : "(unknown)";
+	if (!PrPass) {
+	    len = safestrlen(cp, 2);
+	    if (CmdLim && (len > CmdLim))
+		len = CmdLim;
+	    if (len > CmdColW)
+		CmdColW = len;
+	} else
+	    safestrprtn(cp, CmdColW, stdout, 2);
+/*
+ * Size or print the process ID.
+ */
+	if (!PrPass) {
+	    (void) snpf(buf, sizeof(buf), "%d", Lp->pid);
+	    if ((len = strlen(buf)) > PidColW)
+		PidColW = len;
+	} else
+	    (void) printf(" %*d", PidColW, Lp->pid);
+
+#if	defined(HASTASKS)
+/*
+ * Size or print task ID.
+ */
+	if (!PrPass) {
+	    if (Lp->tid) {
+		(void) snpf(buf, sizeof(buf), "%d", Lp->tid);
+		if ((len = strlen(buf)) > TidColW)
+		    TidColW = len;
+		TaskPrtFl = 1;
+	    }
+	} else if (TaskPrtFl) {
+	    if (Lp->tid)
+		(void) printf(" %*d", TidColW, Lp->tid);
+	    else
+		(void) printf(" %*s", TidColW, "");
+	}
+#endif	/* defined(HASTASKS) */
+
+#if	defined(HASZONES)
+/*
+ * Size or print the zone.
+ */
+	if (Fzone) {
+	    if (!PrPass) {
+		if (Lp->zn) {
+		    if ((len = strlen(Lp->zn)) > ZoneColW)
+			ZoneColW = len;
+		}
+	    } else
+		(void) printf(" %-*s", ZoneColW, Lp->zn ? Lp->zn : "");
+	}
+#endif	/* defined(HASZONES) */
+
+#if	defined(HASSELINUX)
+/*
+ * Size or print the context.
+ */
+	if (Fcntx) {
+	    if (!PrPass) {
+		if (Lp->cntx) {
+		    if ((len = strlen(Lp->cntx)) > CntxColW)
+			CntxColW = len;
+		}
+	    } else
+		(void) printf(" %-*s", CntxColW, Lp->cntx ? Lp->cntx : "");
+	}
+#endif	/* defined(HASSELINUX) */
+
+#if	defined(HASPPID)
+	if (Fppid) {
+
+	/*
+	 * Size or print the parent process ID.
+	 */
+	    if (!PrPass) {
+		(void) snpf(buf, sizeof(buf), "%d", Lp->ppid);
+		if ((len = strlen(buf)) > PpidColW)
+		    PpidColW = len;
+	    } else
+		(void) printf(" %*d", PpidColW, Lp->ppid);
+	}
+#endif	/* defined(HASPPID) */
+
+	if (Fpgid) {
+
+	/*
+	 * Size or print the process group ID.
+	 */
+	    if (!PrPass) {
+		(void) snpf(buf, sizeof(buf), "%d", Lp->pgid);
+		if ((len = strlen(buf)) > PgidColW)
+		    PgidColW = len;
+	    } else
+		(void) printf(" %*d", PgidColW, Lp->pgid);
+	}
+/*
+ * Size or print the user ID or login name.
+ */
+	if (!PrPass) {
+	    if ((len = strlen(printuid((UID_ARG)Lp->uid, NULL))) > UserColW)
+		UserColW = len;
+	} else
+	    (void) printf(" %*.*s", UserColW, UserColW,
+		printuid((UID_ARG)Lp->uid, NULL));
+/*
+ * Size or print the file descriptor, access mode and lock status.
+ */
+	if (!PrPass) {
+	    (void) snpf(buf, sizeof(buf), "%s%c%c",
+		Lf->fd,
+		(Lf->lock == ' ') ? Lf->access
+				  : (Lf->access == ' ') ? '-'
+							: Lf->access,
+		Lf->lock);
+	    if ((len = strlen(buf)) > FdColW)
+		FdColW = len;
+	} else
+	    (void) printf(" %*.*s%c%c", FdColW - 2, FdColW - 2, Lf->fd,
+		(Lf->lock == ' ') ? Lf->access
+				  : (Lf->access == ' ') ? '-'
+							: Lf->access,
+		Lf->lock);
+/*
+ * Size or print the type.
+ */
+	if (!PrPass) {
+	    if ((len = strlen(Lf->type)) > TypeColW)
+		TypeColW = len;
+	} else
+	    (void) printf(" %*.*s", TypeColW, TypeColW, Lf->type);
+
+#if	defined(HASFSTRUCT)
+/*
+ * Size or print the file structure address, file usage count, and node
+ * ID (address).
+ */
+
+	if (Fsv) {
+
+# if	!defined(HASNOFSADDR)
+	    if (Fsv & FSV_FA) {
+		cp =  (Lf->fsv & FSV_FA) ? print_kptr(Lf->fsa, buf, sizeof(buf))
+					 : "";
+		if (!PrPass) {
+		    if ((len = strlen(cp)) > FsColW)
+			FsColW = len;
+		} else
+		    (void) printf(" %*.*s", FsColW, FsColW, cp);
+		    
+	    }
+# endif	/* !defined(HASNOFSADDR) */
+
+# if	!defined(HASNOFSCOUNT)
+	    if (Fsv & FSV_CT) {
+		if (Lf->fsv & FSV_CT) {
+		    (void) snpf(buf, sizeof(buf), "%ld", Lf->fct);
+		    cp = buf;
+		} else
+		    cp = "";
+		if (!PrPass) {
+		    if ((len = strlen(cp)) > FcColW)
+			FcColW = len;
+		} else
+		    (void) printf(" %*.*s", FcColW, FcColW, cp);
+	    }
+# endif	/* !defined(HASNOFSCOUNT) */
+
+# if	!defined(HASNOFSFLAGS)
+	    if (Fsv & FSV_FG) {
+		if ((Lf->fsv & FSV_FG) && (FsvFlagX || Lf->ffg || Lf->pof))
+		    cp = print_fflags(Lf->ffg, Lf->pof);
+		else
+		    cp = "";
+		if (!PrPass) {
+		    if ((len = strlen(cp)) > FgColW)
+			FgColW = len;
+		} else
+		    (void) printf(" %*.*s", FgColW, FgColW, cp);
+	    }
+# endif	/* !defined(HASNOFSFLAGS) */
+
+# if	!defined(HASNOFSNADDR)
+	    if (Fsv & FSV_NI) {
+		cp = (Lf->fsv & FSV_NI) ? print_kptr(Lf->fna, buf, sizeof(buf))
+					: "";
+		if (!PrPass) {
+		    if ((len = strlen(cp)) > NiColW)
+			NiColW = len;
+		} else
+		    (void) printf(" %*.*s", NiColW, NiColW, cp);
+	    }
+# endif	/* !defined(HASNOFSNADDR) */
+
+	}
+#endif	/* defined(HASFSTRUCT) */
+
+/*
+ * Size or print the device information.
+ */
+
+	if (Lf->rdev_def) {
+	    dev = Lf->rdev;
+	    devs = 1;
+	} else if (Lf->dev_def) {
+	    dev = Lf->dev;
+	    devs = 1;
+	} else
+	    devs = 0;
+	if (devs) {
+
+#if	defined(HASPRINTDEV)
+	    cp = HASPRINTDEV(Lf, &dev);
+#else	/* !defined(HASPRINTDEV) */
+	    (void) snpf(buf, sizeof(buf), "%u,%u", GET_MAJ_DEV(dev),
+		GET_MIN_DEV(dev));
+	    cp = buf;
+#endif	/* defined(HASPRINTDEV) */
+
+	}
+
+	if (!PrPass) {
+	    if (devs)
+		len = strlen(cp);
+	    else if (Lf->dev_ch)
+		len = strlen(Lf->dev_ch);
+	    else
+		len = 0;
+	    if (len > DevColW)
+		DevColW = len;
+	} else {
+	    if (devs)
+		(void) printf(" %*.*s", DevColW, DevColW, cp);
+	    else {
+		if (Lf->dev_ch)
+		    (void) printf(" %*.*s", DevColW, DevColW, Lf->dev_ch);
+		else
+		    (void) printf(" %*.*s", DevColW, DevColW, "");
+	    }
+	}
+/*
+ * Size or print the size or offset.
+ */
+	if (!PrPass) {
+	    if (Lf->sz_def) {
+
+#if	defined(HASPRINTSZ)
+		cp = HASPRINTSZ(Lf);
+#else	/* !defined(HASPRINTSZ) */
+		(void) snpf(buf, sizeof(buf), SzOffFmt_d, Lf->sz);
+		cp = buf;
+#endif	/* defined(HASPRINTSZ) */
+
+		len = strlen(cp);
+	    } else if (Lf->off_def) {
+
+#if	defined(HASPRINTOFF)
+		cp = HASPRINTOFF(Lf, 0);
+#else	/* !defined(HASPRINTOFF) */
+		(void) snpf(buf, sizeof(buf), SzOffFmt_0t, Lf->off);
+		cp = buf;
+#endif	/* defined(HASPRINTOFF) */
+
+		len = strlen(cp);
+		if (OffDecDig && len > (OffDecDig + 2)) {
+
+#if	defined(HASPRINTOFF)
+		    cp = HASPRINTOFF(Lf, 1);
+#else	/* !defined(HASPRINTOFF) */
+		    (void) snpf(buf, sizeof(buf), SzOffFmt_x, Lf->off);
+		    cp = buf;
+#endif	/* defined(HASPRINTOFF) */
+
+		    len = strlen(cp);
+		}
+	    } else
+		len = 0;
+	    if (len > SzOffColW)
+		SzOffColW = len;
+	} else {
+	    putchar(' ');
+	    if (Lf->sz_def)
+
+#if	defined(HASPRINTSZ)
+		(void) printf("%*.*s", SzOffColW, SzOffColW, HASPRINTSZ(Lf));
+#else	/* !defined(HASPRINTSZ) */
+		(void) printf(SzOffFmt_dv, SzOffColW, Lf->sz);
+#endif	/* defined(HASPRINTSZ) */
+
+	    else if (Lf->off_def) {
+
+#if	defined(HASPRINTOFF)
+		cp = HASPRINTOFF(Lf, 0);
+#else	/* !defined(HASPRINTOFF) */
+		(void) snpf(buf, sizeof(buf), SzOffFmt_0t, Lf->off);
+		cp = buf;
+#endif	/* defined(HASPRINTOFF) */
+
+		if (OffDecDig && (int)strlen(cp) > (OffDecDig + 2)) {
+
+#if	defined(HASPRINTOFF)
+		    cp = HASPRINTOFF(Lf, 1);
+#else	/* !defined(HASPRINTOFF) */
+		    (void) snpf(buf, sizeof(buf), SzOffFmt_x, Lf->off);
+		    cp = buf;
+#endif	/* defined(HASPRINTOFF) */
+
+		}
+		(void) printf("%*.*s", SzOffColW, SzOffColW, cp);
+	    } else
+		(void) printf("%*.*s", SzOffColW, SzOffColW, "");
+	}
+/*
+ * Size or print the link count.
+ */
+	if (Fnlink) {
+	    if (Lf->nlink_def) {
+		(void) snpf(buf, sizeof(buf), " %ld", Lf->nlink);
+		cp = buf;
+	   } else
+		cp = "";
+	    if (!PrPass) {
+		if ((len = strlen(cp)) > NlColW)
+		    NlColW = len;
+	    } else
+		(void) printf(" %*s", NlColW, cp);
+	}
+/*
+ * Size or print the inode information.
+ */
+	switch (Lf->inp_ty) {
+	case 1:
+
+#if	defined(HASPRINTINO)
+	    cp = HASPRINTINO(Lf);
+#else	/* !defined(HASPRINTINO) */
+	    (void) snpf(buf, sizeof(buf), InodeFmt_d, Lf->inode);
+	    cp = buf;
+#endif	/* defined(HASPRINTINO) */
+
+	    break;
+	case 2:
+	    if (Lf->iproto[0])
+		cp = Lf->iproto;
+	    else
+		cp = "";
+	    break;
+	case 3:
+	    (void) snpf(buf, sizeof(buf), InodeFmt_x, Lf->inode);
+	    cp = buf;
+	    break;
+	default:
+	    cp = "";
+	}
+	if (!PrPass) {
+	    if ((len = strlen(cp)) > NodeColW)
+		NodeColW = len;
+	} else {
+	    (void) printf(" %*.*s", NodeColW, NodeColW, cp);
+	}
+/*
+ * If this is the second pass, print the name column.  (It doesn't need
+ * to be sized.)
+ */
+	if (PrPass) {
+	    putchar(' ');
+
+#if	defined(HASPRINTNM)
+	    HASPRINTNM(Lf);
+#else	/* !defined(HASPRINTNM) */
+	    printname(1);
+#endif	/* defined(HASPRINTNM) */
+
+	}
+}
+
+
+/*
+ * printinaddr() - print Internet addresses
+ */
+
+static int
+printinaddr()
+{
+	int i, len, src;
+	char *host, *port;
+	int nl = Namechl - 1;
+	char *np = Namech;
+	char pbuf[32];
+/*
+ * Process local network address first.  If there's a foreign address,
+ * separate it from the local address with "->".
+ */
+	for (i = 0, *np = '\0'; i < 2; i++) {
+	    if (!Lf->li[i].af)
+		continue;
+	    host = port = (char *)NULL;
+	    if (i) {
+
+	    /*
+	     * If this is the foreign address, insert the separator.
+	     */
+		if (nl < 2)
+
+addr_too_long:
+
+		    {
+			(void) snpf(Namech, Namechl,
+			    "network addresses too long");
+			return(1);
+		    }
+		(void) snpf(np, nl, "->");
+		np += 2;
+		nl -= 2;
+	    }
+	/*
+	 * Convert the address to a host name.
+	 */
+
+#if	defined(HASIPv6)
+	    if ((Lf->li[i].af == AF_INET6
+	    &&   IN6_IS_ADDR_UNSPECIFIED(&Lf->li[i].ia.a6))
+	    ||  (Lf->li[i].af == AF_INET
+	    &&    Lf->li[i].ia.a4.s_addr == INADDR_ANY))
+		host ="*";
+	    else
+		host = gethostnm((unsigned char *)&Lf->li[i].ia, Lf->li[i].af);
+#else /* !defined(HASIPv6) */
+	    if (Lf->li[i].ia.a4.s_addr == INADDR_ANY)
+		host ="*";
+	    else
+		host = gethostnm((unsigned char *)&Lf->li[i].ia, Lf->li[i].af);
+#endif	/* defined(HASIPv6) */
+
+	/*
+	 * Process the port number.
+	 */
+	    if (Lf->li[i].p > 0) {
+
+		if (Fport
+
+#if	!defined(HASNORPC_H)
+		||  FportMap
+#endif	/* defined(HASNORPC_H) */
+
+		) {
+
+		/*
+		 * If converting port numbers to service names, or looking
+		 * up portmap program names and numbers, do so by protocol.
+		 *
+		 * Identify the port source as local if: 1) it comes from the
+		 * local entry (0) of the file's Internet address array; or
+		 * 2) it comes from  the foreign entry (1), and the foreign
+		 * Internet address matches the local one; or 3) it is the
+		 * loopback address 127.0.0.1.  (Test 2 may not always work
+		 * -- e.g., on hosts with multiple interfaces.)
+		 */
+#if	!defined(HASNORPC_H)
+		    if ((src = i) && FportMap) {
+
+# if	defined(HASIPv6)
+			if (Lf->li[0].af == AF_INET6) {
+			    if (IN6_IS_ADDR_LOOPBACK(&Lf->li[i].ia.a6)
+			    ||  IN6_ARE_ADDR_EQUAL(&Lf->li[0].ia.a6,
+						   &Lf->li[1].ia.a6)
+			    )
+				src = 0;
+			} else
+# endif	/* defined(HASIPv6) */
+
+			if (Lf->li[0].af == AF_INET) {
+			    if (Lf->li[i].ia.a4.s_addr == htonl(INADDR_LOOPBACK)
+			    ||  Lf->li[0].ia.a4.s_addr == Lf->li[1].ia.a4.s_addr
+			    )
+				src = 0;
+			}
+		    }
+#endif	/* !defined(HASNORPC_H) */
+
+		    if (strcasecmp(Lf->iproto, "TCP") == 0)
+			port = lkup_port(Lf->li[i].p, 0, src);
+		    else if (strcasecmp(Lf->iproto, "UDP") == 0)
+			port = lkup_port(Lf->li[i].p, 1, src);
+		}
+		if (!port) {
+		    (void) snpf(pbuf, sizeof(pbuf), "%d", Lf->li[i].p);
+		    port = pbuf;
+		}
+	    } else if (Lf->li[i].p == 0)
+		port = "*";
+	/*
+	 * Enter the host name.
+	 */
+	    if (host) {
+		if ((len = strlen(host)) > nl)
+		    goto addr_too_long;
+		if (len) {
+		    (void) snpf(np, nl, "%s", host);
+		    np += len;
+		    nl -= len;
+		}
+	    }
+	/*
+	 * Enter the port number, preceded by a colon.
+	 */
+	    if (port) {
+		if (((len = strlen(port)) + 1) >= nl)
+		    goto addr_too_long;
+		(void) snpf(np, nl, ":%s", port);
+		np += len + 1;
+		nl -= len - 1;
+	    }
+	}
+	if (Namech[0]) {
+	    safestrprt(Namech, stdout, 0);
+	    return(1);
+	}
+	return(0);
+}
+
+
+/*
+ * print_init() - initialize for printing
+ */
+
+void
+print_init()
+{
+	PrPass = (Ffield || Fterse) ? 1 : 0;
+	CmdColW = strlen(CMDTTL);
+	DevColW = strlen(DEVTTL);
+	FdColW = strlen(FDTTL);
+	if (Fnlink)
+	    NlColW = strlen(NLTTL);
+	NmColW = strlen(NMTTL);
+	NodeColW = strlen(NODETTL);
+	PgidColW = strlen(PGIDTTL);
+	PidColW = strlen(PIDTTL);
+	PpidColW = strlen(PPIDTTL);
+	if (Fsize)
+	    SzOffColW = strlen(SZTTL);
+	else if (Foffset)
+	    SzOffColW = strlen(OFFTTL);
+	else
+	    SzOffColW = strlen(SZOFFTTL);
+	TaskPrtFl = 0;
+
+#if	defined(HASTASKS)
+	TidColW = strlen(TIDTTL);
+#endif	/* defined(HASTASKS) */
+
+	TypeColW = strlen(TYPETTL);
+	UserColW = strlen(USERTTL);
+
+#if	defined(HASFSTRUCT)
+
+# if	!defined(HASNOFSADDR)
+	FsColW = strlen(FSTTL);
+# endif	/* !defined(HASNOFSADDR) */
+
+# if	!defined(HASNOFSCOUNT)
+	FcColW = strlen(FCTTL);
+# endif	/* !defined(HASNOFSCOUNT) */
+
+# if	!defined(HASNOFSFLAGS)
+	FgColW = strlen(FGTTL);
+# endif	/* !defined(HASNOFSFLAGS) */
+
+# if	!defined(HASNOFSNADDR)
+	NiColW = strlen(NiTtl);
+# endif	/* !defined(HASNOFSNADDR) */
+#endif	/* defined(HASFSTRUCT) */
+
+#if	defined(HASSELINUX)
+	if (Fcntx)
+	    CntxColW = strlen(CNTXTTL);
+#endif	/* defined(HASSELINUX) */
+
+#if	defined(HASZONES)
+	if (Fzone)
+	    ZoneColW = strlen(ZONETTL);
+#endif	/* defined(HASZONES) */
+
+}
+
+
+#if	!defined(HASPRIVPRIPP)
+/*
+ * printiproto() - print Internet protocol name
+ */
+
+void
+printiproto(p)
+	int p;				/* protocol number */
+{
+	int i;
+	static int m = -1;
+	char *s;
+
+	switch (p) {
+
+#if	defined(IPPROTO_TCP)
+	case IPPROTO_TCP:
+	    s = "TCP";
+	    break;
+#endif	/* defined(IPPROTO_TCP) */
+
+#if	defined(IPPROTO_UDP)
+	case IPPROTO_UDP:
+	    s = "UDP";
+	    break;
+#endif	/* defined(IPPROTO_UDP) */
+
+#if	defined(IPPROTO_IP)
+# if	!defined(IPPROTO_HOPOPTS) || IPPROTO_IP!=IPPROTO_HOPOPTS
+	case IPPROTO_IP:
+	    s = "IP";
+	    break;
+# endif	/* !defined(IPPROTO_HOPOPTS) || IPPROTO_IP!=IPPROTO_HOPOPTS */
+#endif	/* defined(IPPROTO_IP) */
+
+#if	defined(IPPROTO_ICMP)
+	case IPPROTO_ICMP:
+	    s = "ICMP";
+	    break;
+#endif	/* defined(IPPROTO_ICMP) */
+
+#if	defined(IPPROTO_ICMPV6)
+	case IPPROTO_ICMPV6:
+	    s = "ICMPV6";
+	    break;
+#endif	/* defined(IPPROTO_ICMPV6) */
+
+#if	defined(IPPROTO_IGMP)
+	case IPPROTO_IGMP:
+	    s = "IGMP";
+	    break;
+#endif	/* defined(IPPROTO_IGMP) */
+
+#if	defined(IPPROTO_GGP)
+	case IPPROTO_GGP:
+	    s = "GGP";
+	    break;
+#endif	/* defined(IPPROTO_GGP) */
+
+#if	defined(IPPROTO_EGP)
+	case IPPROTO_EGP:
+	    s = "EGP";
+	    break;
+#endif	/* defined(IPPROTO_EGP) */
+
+#if	defined(IPPROTO_PUP)
+	case IPPROTO_PUP:
+	    s = "PUP";
+	    break;
+#endif	/* defined(IPPROTO_PUP) */
+
+#if	defined(IPPROTO_IDP)
+	case IPPROTO_IDP:
+	    s = "IDP";
+	    break;
+#endif	/* defined(IPPROTO_IDP) */
+
+#if	defined(IPPROTO_ND)
+	case IPPROTO_ND:
+	    s = "ND";
+	    break;
+#endif	/* defined(IPPROTO_ND) */
+
+#if	defined(IPPROTO_RAW)
+	case IPPROTO_RAW:
+	    s = "RAW";
+	    break;
+#endif	/* defined(IPPROTO_RAW) */
+
+#if	defined(IPPROTO_HELLO)
+	case IPPROTO_HELLO:
+	    s = "HELLO";
+	    break;
+#endif	/* defined(IPPROTO_HELLO) */
+
+#if	defined(IPPROTO_PXP)
+	case IPPROTO_PXP:
+	    s = "PXP";
+	    break;
+#endif	/* defined(IPPROTO_PXP) */
+
+#if	defined(IPPROTO_RAWIP)
+	case IPPROTO_RAWIP:
+	    s = "RAWIP";
+	    break;
+#endif	/* defined(IPPROTO_RAWIP) */
+
+#if	defined(IPPROTO_RAWIF)
+	case IPPROTO_RAWIF:
+	    s = "RAWIF";
+	    break;
+#endif	/* defined(IPPROTO_RAWIF) */
+
+#if	defined(IPPROTO_HOPOPTS)
+	case IPPROTO_HOPOPTS:
+	    s = "HOPOPTS";
+	    break;
+#endif	/* defined(IPPROTO_HOPOPTS) */
+
+#if	defined(IPPROTO_IPIP)
+	case IPPROTO_IPIP:
+	    s = "IPIP";
+	    break;
+#endif	/* defined(IPPROTO_IPIP) */
+
+#if	defined(IPPROTO_ST)
+	case IPPROTO_ST:
+	    s = "ST";
+	    break;
+#endif	/* defined(IPPROTO_ST) */
+
+#if	defined(IPPROTO_PIGP)
+	case IPPROTO_PIGP:
+	    s = "PIGP";
+	    break;
+#endif	/* defined(IPPROTO_PIGP) */
+
+#if	defined(IPPROTO_RCCMON)
+	case IPPROTO_RCCMON:
+	    s = "RCCMON";
+	    break;
+#endif	/* defined(IPPROTO_RCCMON) */
+
+#if	defined(IPPROTO_NVPII)
+	case IPPROTO_NVPII:
+	    s = "NVPII";
+	    break;
+#endif	/* defined(IPPROTO_NVPII) */
+
+#if	defined(IPPROTO_ARGUS)
+	case IPPROTO_ARGUS:
+	    s = "ARGUS";
+	    break;
+#endif	/* defined(IPPROTO_ARGUS) */
+
+#if	defined(IPPROTO_EMCON)
+	case IPPROTO_EMCON:
+	    s = "EMCON";
+	    break;
+#endif	/* defined(IPPROTO_EMCON) */
+
+#if	defined(IPPROTO_XNET)
+	case IPPROTO_XNET:
+	    s = "XNET";
+	    break;
+#endif	/* defined(IPPROTO_XNET) */
+
+#if	defined(IPPROTO_CHAOS)
+	case IPPROTO_CHAOS:
+	    s = "CHAOS";
+	    break;
+#endif	/* defined(IPPROTO_CHAOS) */
+
+#if	defined(IPPROTO_MUX)
+	case IPPROTO_MUX:
+	    s = "MUX";
+	    break;
+#endif	/* defined(IPPROTO_MUX) */
+
+#if	defined(IPPROTO_MEAS)
+	case IPPROTO_MEAS:
+	    s = "MEAS";
+	    break;
+#endif	/* defined(IPPROTO_MEAS) */
+
+#if	defined(IPPROTO_HMP)
+	case IPPROTO_HMP:
+	    s = "HMP";
+	    break;
+#endif	/* defined(IPPROTO_HMP) */
+
+#if	defined(IPPROTO_PRM)
+	case IPPROTO_PRM:
+	    s = "PRM";
+	    break;
+#endif	/* defined(IPPROTO_PRM) */
+
+#if	defined(IPPROTO_TRUNK1)
+	case IPPROTO_TRUNK1:
+	    s = "TRUNK1";
+	    break;
+#endif	/* defined(IPPROTO_TRUNK1) */
+
+#if	defined(IPPROTO_TRUNK2)
+	case IPPROTO_TRUNK2:
+	    s = "TRUNK2";
+	    break;
+#endif	/* defined(IPPROTO_TRUNK2) */
+
+#if	defined(IPPROTO_LEAF1)
+	case IPPROTO_LEAF1:
+	    s = "LEAF1";
+	    break;
+#endif	/* defined(IPPROTO_LEAF1) */
+
+#if	defined(IPPROTO_LEAF2)
+	case IPPROTO_LEAF2:
+	    s = "LEAF2";
+	    break;
+#endif	/* defined(IPPROTO_LEAF2) */
+
+#if	defined(IPPROTO_RDP)
+	case IPPROTO_RDP:
+	    s = "RDP";
+	    break;
+#endif	/* defined(IPPROTO_RDP) */
+
+#if	defined(IPPROTO_IRTP)
+	case IPPROTO_IRTP:
+	    s = "IRTP";
+	    break;
+#endif	/* defined(IPPROTO_IRTP) */
+
+#if	defined(IPPROTO_TP)
+	case IPPROTO_TP:
+	    s = "TP";
+	    break;
+#endif	/* defined(IPPROTO_TP) */
+
+#if	defined(IPPROTO_BLT)
+	case IPPROTO_BLT:
+	    s = "BLT";
+	    break;
+#endif	/* defined(IPPROTO_BLT) */
+
+#if	defined(IPPROTO_NSP)
+	case IPPROTO_NSP:
+	    s = "NSP";
+	    break;
+#endif	/* defined(IPPROTO_NSP) */
+
+#if	defined(IPPROTO_INP)
+	case IPPROTO_INP:
+	    s = "INP";
+	    break;
+#endif	/* defined(IPPROTO_INP) */
+
+#if	defined(IPPROTO_SEP)
+	case IPPROTO_SEP:
+	    s = "SEP";
+	    break;
+#endif	/* defined(IPPROTO_SEP) */
+
+#if	defined(IPPROTO_3PC)
+	case IPPROTO_3PC:
+	    s = "3PC";
+	    break;
+#endif	/* defined(IPPROTO_3PC) */
+
+#if	defined(IPPROTO_IDPR)
+	case IPPROTO_IDPR:
+	    s = "IDPR";
+	    break;
+#endif	/* defined(IPPROTO_IDPR) */
+
+#if	defined(IPPROTO_XTP)
+	case IPPROTO_XTP:
+	    s = "XTP";
+	    break;
+#endif	/* defined(IPPROTO_XTP) */
+
+#if	defined(IPPROTO_DDP)
+	case IPPROTO_DDP:
+	    s = "DDP";
+	    break;
+#endif	/* defined(IPPROTO_DDP) */
+
+#if	defined(IPPROTO_CMTP)
+	case IPPROTO_CMTP:
+	    s = "CMTP";
+	    break;
+#endif	/* defined(IPPROTO_CMTP) */
+
+#if	defined(IPPROTO_TPXX)
+	case IPPROTO_TPXX:
+	    s = "TPXX";
+	    break;
+#endif	/* defined(IPPROTO_TPXX) */
+
+#if	defined(IPPROTO_IL)
+	case IPPROTO_IL:
+	    s = "IL";
+	    break;
+#endif	/* defined(IPPROTO_IL) */
+
+#if	defined(IPPROTO_IPV6)
+	case IPPROTO_IPV6:
+	    s = "IPV6";
+	    break;
+#endif	/* defined(IPPROTO_IPV6) */
+
+#if	defined(IPPROTO_SDRP)
+	case IPPROTO_SDRP:
+	    s = "SDRP";
+	    break;
+#endif	/* defined(IPPROTO_SDRP) */
+
+#if	defined(IPPROTO_ROUTING)
+	case IPPROTO_ROUTING:
+	    s = "ROUTING";
+	    break;
+#endif	/* defined(IPPROTO_ROUTING) */
+
+#if	defined(IPPROTO_FRAGMENT)
+	case IPPROTO_FRAGMENT:
+	    s = "FRAGMNT";
+	    break;
+#endif	/* defined(IPPROTO_FRAGMENT) */
+
+#if	defined(IPPROTO_IDRP)
+	case IPPROTO_IDRP:
+	    s = "IDRP";
+	    break;
+#endif	/* defined(IPPROTO_IDRP) */
+
+#if	defined(IPPROTO_RSVP)
+	case IPPROTO_RSVP:
+	    s = "RSVP";
+	    break;
+#endif	/* defined(IPPROTO_RSVP) */
+
+#if	defined(IPPROTO_GRE)
+	case IPPROTO_GRE:
+	    s = "GRE";
+	    break;
+#endif	/* defined(IPPROTO_GRE) */
+
+#if	defined(IPPROTO_MHRP)
+	case IPPROTO_MHRP:
+	    s = "MHRP";
+	    break;
+#endif	/* defined(IPPROTO_MHRP) */
+
+#if	defined(IPPROTO_BHA)
+	case IPPROTO_BHA:
+	    s = "BHA";
+	    break;
+#endif	/* defined(IPPROTO_BHA) */
+
+#if	defined(IPPROTO_ESP)
+	case IPPROTO_ESP:
+	    s = "ESP";
+	    break;
+#endif	/* defined(IPPROTO_ESP) */
+
+#if	defined(IPPROTO_AH)
+	case IPPROTO_AH:
+	    s = "AH";
+	    break;
+#endif	/* defined(IPPROTO_AH) */
+
+#if	defined(IPPROTO_INLSP)
+	case IPPROTO_INLSP:
+	    s = "INLSP";
+	    break;
+#endif	/* defined(IPPROTO_INLSP) */
+
+#if	defined(IPPROTO_SWIPE)
+	case IPPROTO_SWIPE:
+	    s = "SWIPE";
+	    break;
+#endif	/* defined(IPPROTO_SWIPE) */
+
+#if	defined(IPPROTO_NHRP)
+	case IPPROTO_NHRP:
+	    s = "NHRP";
+	    break;
+#endif	/* defined(IPPROTO_NHRP) */
+
+#if	defined(IPPROTO_NONE)
+	case IPPROTO_NONE:
+	    s = "NONE";
+	    break;
+#endif	/* defined(IPPROTO_NONE) */
+
+#if	defined(IPPROTO_DSTOPTS)
+	case IPPROTO_DSTOPTS:
+	    s = "DSTOPTS";
+	    break;
+#endif	/* defined(IPPROTO_DSTOPTS) */
+
+#if	defined(IPPROTO_AHIP)
+	case IPPROTO_AHIP:
+	    s = "AHIP";
+	    break;
+#endif	/* defined(IPPROTO_AHIP) */
+
+#if	defined(IPPROTO_CFTP)
+	case IPPROTO_CFTP:
+	    s = "CFTP";
+	    break;
+#endif	/* defined(IPPROTO_CFTP) */
+
+#if	defined(IPPROTO_SATEXPAK)
+	case IPPROTO_SATEXPAK:
+	    s = "SATEXPK";
+	    break;
+#endif	/* defined(IPPROTO_SATEXPAK) */
+
+#if	defined(IPPROTO_KRYPTOLAN)
+	case IPPROTO_KRYPTOLAN:
+	    s = "KRYPTOL";
+	    break;
+#endif	/* defined(IPPROTO_KRYPTOLAN) */
+
+#if	defined(IPPROTO_RVD)
+	case IPPROTO_RVD:
+	    s = "RVD";
+	    break;
+#endif	/* defined(IPPROTO_RVD) */
+
+#if	defined(IPPROTO_IPPC)
+	case IPPROTO_IPPC:
+	    s = "IPPC";
+	    break;
+#endif	/* defined(IPPROTO_IPPC) */
+
+#if	defined(IPPROTO_ADFS)
+	case IPPROTO_ADFS:
+	    s = "ADFS";
+	    break;
+#endif	/* defined(IPPROTO_ADFS) */
+
+#if	defined(IPPROTO_SATMON)
+	case IPPROTO_SATMON:
+	    s = "SATMON";
+	    break;
+#endif	/* defined(IPPROTO_SATMON) */
+
+#if	defined(IPPROTO_VISA)
+	case IPPROTO_VISA:
+	    s = "VISA";
+	    break;
+#endif	/* defined(IPPROTO_VISA) */
+
+#if	defined(IPPROTO_IPCV)
+	case IPPROTO_IPCV:
+	    s = "IPCV";
+	    break;
+#endif	/* defined(IPPROTO_IPCV) */
+
+#if	defined(IPPROTO_CPNX)
+	case IPPROTO_CPNX:
+	    s = "CPNX";
+	    break;
+#endif	/* defined(IPPROTO_CPNX) */
+
+#if	defined(IPPROTO_CPHB)
+	case IPPROTO_CPHB:
+	    s = "CPHB";
+	    break;
+#endif	/* defined(IPPROTO_CPHB) */
+
+#if	defined(IPPROTO_WSN)
+	case IPPROTO_WSN:
+	    s = "WSN";
+	    break;
+#endif	/* defined(IPPROTO_WSN) */
+
+#if	defined(IPPROTO_PVP)
+	case IPPROTO_PVP:
+	    s = "PVP";
+	    break;
+#endif	/* defined(IPPROTO_PVP) */
+
+#if	defined(IPPROTO_BRSATMON)
+	case IPPROTO_BRSATMON:
+	    s = "BRSATMN";
+	    break;
+#endif	/* defined(IPPROTO_BRSATMON) */
+
+#if	defined(IPPROTO_WBMON)
+	case IPPROTO_WBMON:
+	    s = "WBMON";
+	    break;
+#endif	/* defined(IPPROTO_WBMON) */
+
+#if	defined(IPPROTO_WBEXPAK)
+	case IPPROTO_WBEXPAK:
+	    s = "WBEXPAK";
+	    break;
+#endif	/* defined(IPPROTO_WBEXPAK) */
+
+#if	defined(IPPROTO_EON)
+	case IPPROTO_EON:
+	    s = "EON";
+	    break;
+#endif	/* defined(IPPROTO_EON) */
+
+#if	defined(IPPROTO_VMTP)
+	case IPPROTO_VMTP:
+	    s = "VMTP";
+	    break;
+#endif	/* defined(IPPROTO_VMTP) */
+
+#if	defined(IPPROTO_SVMTP)
+	case IPPROTO_SVMTP:
+	    s = "SVMTP";
+	    break;
+#endif	/* defined(IPPROTO_SVMTP) */
+
+#if	defined(IPPROTO_VINES)
+	case IPPROTO_VINES:
+	    s = "VINES";
+	    break;
+#endif	/* defined(IPPROTO_VINES) */
+
+#if	defined(IPPROTO_TTP)
+	case IPPROTO_TTP:
+	    s = "TTP";
+	    break;
+#endif	/* defined(IPPROTO_TTP) */
+
+#if	defined(IPPROTO_IGP)
+	case IPPROTO_IGP:
+	    s = "IGP";
+	    break;
+#endif	/* defined(IPPROTO_IGP) */
+
+#if	defined(IPPROTO_DGP)
+	case IPPROTO_DGP:
+	    s = "DGP";
+	    break;
+#endif	/* defined(IPPROTO_DGP) */
+
+#if	defined(IPPROTO_TCF)
+	case IPPROTO_TCF:
+	    s = "TCF";
+	    break;
+#endif	/* defined(IPPROTO_TCF) */
+
+#if	defined(IPPROTO_IGRP)
+	case IPPROTO_IGRP:
+	    s = "IGRP";
+	    break;
+#endif	/* defined(IPPROTO_IGRP) */
+
+#if	defined(IPPROTO_OSPFIGP)
+	case IPPROTO_OSPFIGP:
+	    s = "OSPFIGP";
+	    break;
+#endif	/* defined(IPPROTO_OSPFIGP) */
+
+#if	defined(IPPROTO_SRPC)
+	case IPPROTO_SRPC:
+	    s = "SRPC";
+	    break;
+#endif	/* defined(IPPROTO_SRPC) */
+
+#if	defined(IPPROTO_LARP)
+	case IPPROTO_LARP:
+	    s = "LARP";
+	    break;
+#endif	/* defined(IPPROTO_LARP) */
+
+#if	defined(IPPROTO_MTP)
+	case IPPROTO_MTP:
+	    s = "MTP";
+	    break;
+#endif	/* defined(IPPROTO_MTP) */
+
+#if	defined(IPPROTO_AX25)
+	case IPPROTO_AX25:
+	    s = "AX25";
+	    break;
+#endif	/* defined(IPPROTO_AX25) */
+
+#if	defined(IPPROTO_IPEIP)
+	case IPPROTO_IPEIP:
+	    s = "IPEIP";
+	    break;
+#endif	/* defined(IPPROTO_IPEIP) */
+
+#if	defined(IPPROTO_MICP)
+	case IPPROTO_MICP:
+	    s = "MICP";
+	    break;
+#endif	/* defined(IPPROTO_MICP) */
+
+#if	defined(IPPROTO_SCCSP)
+	case IPPROTO_SCCSP:
+	    s = "SCCSP";
+	    break;
+#endif	/* defined(IPPROTO_SCCSP) */
+
+#if	defined(IPPROTO_ETHERIP)
+	case IPPROTO_ETHERIP:
+	    s = "ETHERIP";
+	    break;
+#endif	/* defined(IPPROTO_ETHERIP) */
+
+#if	defined(IPPROTO_ENCAP)
+# if	!defined(IPPROTO_IPIP) || IPPROTO_IPIP!=IPPROTO_ENCAP
+	case IPPROTO_ENCAP:
+	    s = "ENCAP";
+	    break;
+# endif	/* !defined(IPPROTO_IPIP) || IPPROTO_IPIP!=IPPROTO_ENCAP */
+#endif	/* defined(IPPROTO_ENCAP) */
+
+#if	defined(IPPROTO_APES)
+	case IPPROTO_APES:
+	    s = "APES";
+	    break;
+#endif	/* defined(IPPROTO_APES) */
+
+#if	defined(IPPROTO_GMTP)
+	case IPPROTO_GMTP:
+	    s = "GMTP";
+	    break;
+#endif	/* defined(IPPROTO_GMTP) */
+
+#if	defined(IPPROTO_DIVERT)
+	case IPPROTO_DIVERT:
+	    s = "DIVERT";
+	    break;
+#endif	/* defined(IPPROTO_DIVERT) */
+
+	default:
+	    s = (char *)NULL;
+	}
+	if (s)
+	    (void) snpf(Lf->iproto, sizeof(Lf->iproto), "%.*s", IPROTOL-1, s);
+	else {	
+	    if (m < 0) {
+		for (i = 0, m = 1; i < IPROTOL-2; i++)
+		    m *= 10;
+	    }
+	    if (m > p)
+		(void) snpf(Lf->iproto, sizeof(Lf->iproto), "%d?", p);
+	    else
+		(void) snpf(Lf->iproto, sizeof(Lf->iproto), "*%d?", p % (m/10));
+	}
+}
+#endif	/* !defined(HASPRIVPRIPP) */
+
+
+/*
+ * printname() - print output name field
+ */
+
+void
+printname(nl)
+	int nl;				/* NL status */
+{
+
+#if	defined(HASNCACHE)
+	char buf[MAXPATHLEN];
+	char *cp;
+	int fp;
+#endif	/* defined(HASNCACHE) */
+
+	int ps = 0;
+
+	if (Lf->nm && Lf->nm[0]) {
+
+	/*
+	 * Print the name characters, if there are some.
+	 */
+	    safestrprt(Lf->nm, stdout, 0);
+	    ps++;
+	    if (!Lf->li[0].af && !Lf->li[1].af)
+		goto print_nma;
+	}
+	if (Lf->li[0].af || Lf->li[1].af) {
+	    if (ps)
+		putchar(' ');
+	/*
+	 * If the file has Internet addresses, print them.
+	 */
+	    if (printinaddr())
+		ps++;
+	    goto print_nma;
+	}
+	if (((Lf->ntype == N_BLK) || (Lf->ntype == N_CHR))
+	&&  Lf->dev_def && Lf->rdev_def
+	&&  printdevname(&Lf->dev, &Lf->rdev, 0, Lf->ntype))
+	{
+
+	/*
+	 * If this is a block or character device and it has a name, print it.
+	 */
+	    ps++;
+	    goto print_nma;
+	}
+	if (Lf->is_com) {
+
+	/*
+	 * If this is a common node, print that fact.
+	 */
+	    (void) fputs("COMMON: ", stdout);
+	    ps++;
+	    goto print_nma;
+	}
+
+#if	defined(HASPRIVNMCACHE)
+	if (HASPRIVNMCACHE(Lf)) {
+	    ps++;
+	    goto print_nma;
+	}
+#endif	/* defined(HASPRIVNMCACHE) */
+
+	if (Lf->lmi_srch) {
+	    struct mounts *mp;
+	/*
+	 * Do a deferred local mount info table search for the file system
+	 * (mounted) directory name and inode number, and mounted device name.
+	 */
+	    for (mp = readmnt(); mp; mp = mp->next) {
+		if (Lf->dev == mp->dev) {
+		    Lf->fsdir = mp->dir;
+		    Lf->fsdev = mp->fsname;
+
+#if	defined(HASFSINO)
+		    Lf->fs_ino = mp->inode;
+#endif	/* defined(HASFSINO) */
+
+		    break;
+		}
+	    }
+	    Lf->lmi_srch = 0;
+	}
+	if (Lf->fsdir || Lf->fsdev) {
+
+	/*
+	 * Print the file system directory name, device name, and
+	 * possible path name components.
+	 */
+
+#if	!defined(HASNCACHE) || HASNCACHE<2
+	    if (Lf->fsdir) {
+		safestrprt(Lf->fsdir, stdout, 0);
+		ps++;
+	    }
+#endif	/* !defined(HASNCACHE) || HASNCACHE<2 */
+
+#if	defined(HASNCACHE)
+
+# if	HASNCACHE<2
+	    if (Lf->na) {
+		if (NcacheReload) {
+
+#  if	defined(NCACHELDPFX)
+		    NCACHELDPFX
+#  endif	/* defined(NCACHELDPFX) */
+
+		    (void) ncache_load();
+
+#  if	defined(NCACHELDSFX)
+		    NCACHELDSFX
+#  endif	/* defined(NCACHELDSFX) */
+
+		    NcacheReload = 0;
+		}
+		if ((cp = ncache_lookup(buf, sizeof(buf), &fp))) {
+		    char *cp1; 
+
+		    if (*cp == '\0')
+			goto print_nma;
+		    if (fp && Lf->fsdir) {
+			if (*cp != '/') {
+			    cp1 = strrchr(Lf->fsdir, '/');
+			    if (cp1 == (char *)NULL ||  *(cp1 + 1) != '\0')
+				putchar('/');
+			    }
+		    } else
+			(void) fputs(" -- ", stdout);
+		    safestrprt(cp, stdout, 0);
+		    ps++;
+		    goto print_nma;
+		}
+	    }
+# else	/* HASNCACHE>1 */
+	    if (NcacheReload) {
+
+#  if	defined(NCACHELDPFX)
+		    NCACHELDPFX
+#  endif	/* defined(NCACHELDPFX) */
+
+		(void) ncache_load();
+
+#  if	defined(NCACHELDSFX)
+		    NCACHELDSFX
+#  endif	/* defined(NCACHELDSFX) */
+
+		NcacheReload = 0;
+	    }
+	    if ((cp = ncache_lookup(buf, sizeof(buf), &fp))) {
+		if (fp) {
+		    safestrprt(cp, stdout, 0);
+		    ps++;
+		} else {
+		    if (Lf->fsdir) {
+			safestrprt(Lf->fsdir, stdout, 0);
+			ps++;
+		    }
+		    if (*cp) {
+			(void) fputs(" -- ", stdout);
+			safestrprt(cp, stdout, 0);
+			ps++;
+		    }
+		}
+		goto print_nma;
+	    }
+	    if (Lf->fsdir) {
+		safestrprt(Lf->fsdir, stdout, 0);
+		ps++;
+	    }
+# endif	/* HASNCACHE<2 */
+#endif	/* defined(HASNCACHE) */
+
+	    if (Lf->fsdev) {
+		if (Lf->fsdir)
+		    (void) fputs(" (", stdout);
+		else
+		    (void) putchar('(');
+		safestrprt(Lf->fsdev, stdout, 0);
+		(void) putchar(')');
+		ps++;
+	    }
+	}
+/*
+ * Print the NAME column addition, if there is one.  If there isn't
+ * make sure a NL is printed, as requested.
+ */
+
+print_nma:
+
+	if (Lf->nma) {
+	    if (ps)
+		putchar(' ');
+	    safestrprt(Lf->nma, stdout, 0);
+	    ps++;
+	}
+/*
+ * If this file has TCP/IP state information, print it.
+ */
+	if (!Ffield && Ftcptpi
+	&&  (Lf->lts.type >= 0
+
+#if	defined(HASTCPTPIQ)
+	||   ((Ftcptpi & TCPTPI_QUEUES) && (Lf->lts.rqs || Lf->lts.sqs))
+#endif	/* defined(HASTCPTPIQ) */
+
+#if	defined(HASTCPTPIW)
+	||   ((Ftcptpi & TCPTPI_WINDOWS) && (Lf->lts.rws || Lf->lts.wws))
+#endif	/* defined(HASTCPTPIW) */
+
+	)) {
+	    if (ps)
+		putchar(' ');
+	    (void) print_tcptpi(0);
+	}
+	if (nl)
+	    putchar('\n');
+}
+
+
+/*
+ * printrawaddr() - print raw socket address
+ */
+
+void
+printrawaddr(sa)
+	struct sockaddr *sa;		/* socket address */
+{
+	char *ep;
+	size_t sz;
+
+	ep = endnm(&sz);
+	(void) snpf(ep, sz, "%u/%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u",
+	    sa->sa_family,
+	    (unsigned char)sa->sa_data[0],
+	    (unsigned char)sa->sa_data[1],
+	    (unsigned char)sa->sa_data[2],
+	    (unsigned char)sa->sa_data[3],
+	    (unsigned char)sa->sa_data[4],
+	    (unsigned char)sa->sa_data[5],
+	    (unsigned char)sa->sa_data[6],
+	    (unsigned char)sa->sa_data[7],
+	    (unsigned char)sa->sa_data[8],
+	    (unsigned char)sa->sa_data[9],
+	    (unsigned char)sa->sa_data[10],
+	    (unsigned char)sa->sa_data[11],
+	    (unsigned char)sa->sa_data[12],
+	    (unsigned char)sa->sa_data[13]);
+}
+
+
+/*
+ * printsockty() - print socket type
+ */
+
+char *
+printsockty(ty)
+	int ty;				/* socket type -- e.g., from so_type */
+{
+	static char buf[64];
+	char *cp;
+
+	switch (ty) {
+
+#if	defined(SOCK_STREAM)
+	case SOCK_STREAM:
+	    cp = "STREAM";
+	    break;
+#endif	/* defined(SOCK_STREAM) */
+
+#if	defined(SOCK_STREAM)
+	case SOCK_DGRAM:
+	    cp = "DGRAM";
+	    break;
+#endif	/* defined(SOCK_DGRAM) */
+
+#if	defined(SOCK_RAW)
+	case SOCK_RAW:
+	    cp = "RAW";
+	    break;
+#endif	/* defined(SOCK_RAW) */
+
+#if	defined(SOCK_RDM)
+	case SOCK_RDM:
+	    cp = "RDM";
+	    break;
+#endif	/* defined(SOCK_RDM) */
+
+#if	defined(SOCK_SEQPACKET)
+	case SOCK_SEQPACKET:
+	    cp = "SEQPACKET";
+	    break;
+#endif	/* defined(SOCK_SEQPACKET) */
+
+	default:
+	    (void) snpf(buf, sizeof(buf), "SOCK_%#x", ty);
+	    return(buf);
+	}
+	(void) snpf(buf, sizeof(buf), "SOCK_%s", cp);
+	return(buf);
+}
+
+
+/*
+ * printuid() - print User ID or login name
+ */
+
+char *
+printuid(uid, ty)
+	UID_ARG uid;			/* User IDentification number */
+	int *ty;			/* returned UID type pointer (NULL
+					 * (if none wanted).  If non-NULL
+					 * then: *ty = 0 = login name
+					 *	     = 1 = UID number */
+{
+	int i;
+	struct passwd *pw;
+	struct stat sb;
+	static struct stat sbs;
+	static struct uidcache {
+	    uid_t uid;
+	    char nm[LOGINML+1];
+	    struct uidcache *next;
+	} **uc = (struct uidcache **)NULL;
+	struct uidcache *up, *upn;
+	static char user[USERPRTL+1];
+
+	if (Futol) {
+	    if (CkPasswd) {
+
+	    /*
+	     * Get the mtime and ctime of /etc/passwd, as required.
+	     */
+		if (stat("/etc/passwd", &sb) != 0) {
+		    (void) fprintf(stderr, "%s: can't stat(/etc/passwd): %s\n",
+			Pn, strerror(errno));
+		    Exit(1);
+		}
+	    }
+	/*
+	 * Define the UID cache, if necessary.
+	 */
+	    if (!uc) {
+		if (!(uc = (struct uidcache **)calloc(UIDCACHEL,
+						sizeof(struct uidcache *))))
+		{
+		    (void) fprintf(stderr,
+			"%s: no space for %d byte UID cache hash buckets\n",
+			Pn, (int)(UIDCACHEL * (sizeof(struct uidcache *))));
+		    Exit(1);
+		}
+		if (CkPasswd) {
+		    sbs = sb;
+		    CkPasswd = 0;
+		}
+	    }
+	/*
+	 * If it's time to check /etc/passwd and if its the mtime/ctime has
+	 * changed, destroy the existing UID cache.
+	 */
+	    if (CkPasswd) {
+		if (sbs.st_mtime != sb.st_mtime || sbs.st_ctime != sb.st_ctime)
+		{
+		    for (i = 0; i < UIDCACHEL; i++) {
+			if ((up = uc[i])) {
+			    do {
+				upn = up->next;
+				(void) free((FREE_P *)up);
+			    } while ((up = upn) != (struct uidcache *)NULL);
+			    uc[i] = (struct uidcache *)NULL;
+			}
+		    }
+		    sbs = sb;
+		}
+		CkPasswd = 0;
+	    }
+	/*
+	 * Search the UID cache.
+	 */
+	    i = (int)((((unsigned long)uid * 31415L) >> 7) & (UIDCACHEL - 1));
+	    for (up = uc[i]; up; up = up->next) {
+		if (up->uid == (uid_t)uid) {
+		    if (ty)
+			*ty = 0;
+		    return(up->nm);
+		}
+	    }
+	/*
+	 * The UID is not in the cache.
+	 *
+	 * Look up the login name from the UID for a new cache entry.
+	 */
+	    if (!(pw = getpwuid((uid_t)uid))) {
+		if (!Fwarn) {
+		    (void) fprintf(stderr, "%s: no pwd entry for UID %lu\n",
+			Pn, (unsigned long)uid);
+		}
+	    } else {
+
+	    /*
+	     * Allocate and fill a new cache entry.  Link it to its hash bucket.
+	     */
+		if (!(upn = (struct uidcache *)malloc(sizeof(struct uidcache))))
+		{
+		    (void) fprintf(stderr,
+			"%s: no space for UID cache entry for: %lu, %s)\n",
+			Pn, (unsigned long)uid, pw->pw_name);
+		    Exit(1);
+		}
+		(void) strncpy(upn->nm, pw->pw_name, LOGINML);
+		upn->nm[LOGINML] = '\0';
+		upn->uid = (uid_t)uid;
+		upn->next = uc[i];
+		uc[i] = upn;
+		if (ty)
+		    *ty = 0;
+		return(upn->nm);
+	    }
+	}
+/*
+ * Produce a numeric conversion of the UID.
+ */
+	(void) snpf(user, sizeof(user), "%*lu", USERPRTL, (unsigned long)uid);
+	if (ty)
+	    *ty = 1;
+	return(user);
+}
+
+
+/*
+ * printunkaf() - print unknown address family
+ */
+
+void
+printunkaf(fam, ty)
+	int fam;			/* unknown address family */
+	int ty;				/* output type: 0 = terse; 1 = full */
+{
+	char *p, *s;
+
+	p = "";
+	switch (fam) {
+
+#if	defined(AF_UNSPEC)
+	case AF_UNSPEC:
+	    s = "UNSPEC";
+	    break;
+#endif	/* defined(AF_UNSPEC) */
+
+#if	defined(AF_UNIX)
+	case AF_UNIX:
+	    s = "UNIX";
+	    break;
+#endif	/* defined(AF_UNIX) */
+
+#if	defined(AF_INET)
+	case AF_INET:
+	    s = "INET";
+	    break;
+#endif	/* defined(AF_INET) */
+
+#if	defined(AF_INET6)
+	case AF_INET6:
+	    s = "INET6";
+	    break;
+#endif	/* defined(AF_INET6) */
+
+#if	defined(AF_IMPLINK)
+	case AF_IMPLINK:
+	    s = "IMPLINK";
+	    break;
+#endif	/* defined(AF_IMPLINK) */
+
+#if	defined(AF_PUP)
+	case AF_PUP:
+	    s = "PUP";
+	    break;
+#endif	/* defined(AF_PUP) */
+
+#if	defined(AF_CHAOS)
+	case AF_CHAOS:
+	    s = "CHAOS";
+	    break;
+#endif	/* defined(AF_CHAOS) */
+
+#if	defined(AF_NS)
+	case AF_NS:
+	    s = "NS";
+	    break;
+#endif	/* defined(AF_NS) */
+
+#if	defined(AF_ISO)
+	case AF_ISO:
+	    s = "ISO";
+	    break;
+#endif	/* defined(AF_ISO) */
+
+#if	defined(AF_NBS)
+# if	!defined(AF_ISO) || AF_NBS!=AF_ISO
+	case AF_NBS:
+	    s = "NBS";
+	    break;
+# endif	/* !defined(AF_ISO) || AF_NBS!=AF_ISO */
+#endif	/* defined(AF_NBS) */
+
+#if	defined(AF_ECMA)
+	case AF_ECMA:
+	    s = "ECMA";
+	    break;
+#endif	/* defined(AF_ECMA) */
+
+#if	defined(AF_DATAKIT)
+	case AF_DATAKIT:
+	    s = "DATAKIT";
+	    break;
+#endif	/* defined(AF_DATAKIT) */
+
+#if	defined(AF_CCITT)
+	case AF_CCITT:
+	    s = "CCITT";
+	    break;
+#endif	/* defined(AF_CCITT) */
+
+#if	defined(AF_SNA)
+	case AF_SNA:
+	    s = "SNA";
+	    break;
+#endif	/* defined(AF_SNA) */
+
+#if	defined(AF_DECnet)
+	case AF_DECnet:
+	    s = "DECnet";
+	    break;
+#endif	/* defined(AF_DECnet) */
+
+#if	defined(AF_DLI)
+	case AF_DLI:
+	    s = "DLI";
+	    break;
+#endif	/* defined(AF_DLI) */
+
+#if	defined(AF_LAT)
+	case AF_LAT:
+	    s = "LAT";
+	    break;
+#endif	/* defined(AF_LAT) */
+
+#if	defined(AF_HYLINK)
+	case AF_HYLINK:
+	    s = "HYLINK";
+	    break;
+#endif	/* defined(AF_HYLINK) */
+
+#if	defined(AF_APPLETALK)
+	case AF_APPLETALK:
+	    s = "APPLETALK";
+	    break;
+#endif	/* defined(AF_APPLETALK) */
+
+#if	defined(AF_BSC)
+	case AF_BSC:
+	    s = "BSC";
+	    break;
+#endif	/* defined(AF_BSC) */
+
+#if	defined(AF_DSS)
+	case AF_DSS:
+	    s = "DSS";
+	    break;
+#endif	/* defined(AF_DSS) */
+
+#if	defined(AF_ROUTE)
+	case AF_ROUTE:
+	    s = "ROUTE";
+	    break;
+#endif	/* defined(AF_ROUTE) */
+
+#if	defined(AF_RAW)
+	case AF_RAW:
+	    s = "RAW";
+	    break;
+#endif	/* defined(AF_RAW) */
+
+#if	defined(AF_LINK)
+	case AF_LINK:
+	    s = "LINK";
+	    break;
+#endif	/* defined(AF_LINK) */
+
+#if	defined(pseudo_AF_XTP)
+	case pseudo_AF_XTP:
+	    p = "pseudo_";
+	    s = "XTP";
+	    break;
+#endif	/* defined(pseudo_AF_XTP) */
+
+#if	defined(AF_RMP)
+	case AF_RMP:
+	    s = "RMP";
+	    break;
+#endif	/* defined(AF_RMP) */
+
+#if	defined(AF_COIP)
+	case AF_COIP:
+	    s = "COIP";
+	    break;
+#endif	/* defined(AF_COIP) */
+
+#if	defined(AF_CNT)
+	case AF_CNT:
+	    s = "CNT";
+	    break;
+#endif	/* defined(AF_CNT) */
+
+#if	defined(pseudo_AF_RTIP)
+	case pseudo_AF_RTIP:
+	    p = "pseudo_";
+	    s = "RTIP";
+	    break;
+#endif	/* defined(pseudo_AF_RTIP) */
+
+#if	defined(AF_NETMAN)
+	case AF_NETMAN:
+	    s = "NETMAN";
+	    break;
+#endif	/* defined(AF_NETMAN) */
+
+#if	defined(AF_INTF)
+	case AF_INTF:
+	    s = "INTF";
+	    break;
+#endif	/* defined(AF_INTF) */
+
+#if	defined(AF_NETWARE)
+	case AF_NETWARE:
+	    s = "NETWARE";
+	    break;
+#endif	/* defined(AF_NETWARE) */
+
+#if	defined(AF_NDD)
+	case AF_NDD:
+	    s = "NDD";
+	    break;
+#endif	/* defined(AF_NDD) */
+
+#if	defined(AF_NIT)
+# if	!defined(AF_ROUTE) || AF_ROUTE!=AF_NIT
+	case AF_NIT:
+	    s = "NIT";
+	    break;
+# endif	/* !defined(AF_ROUTE) || AF_ROUTE!=AF_NIT */
+#endif	/* defined(AF_NIT) */
+
+#if	defined(AF_802)
+# if	!defined(AF_RAW) || AF_RAW!=AF_802
+	case AF_802:
+	    s = "802";
+	    break;
+# endif	/* !defined(AF_RAW) || AF_RAW!=AF_802 */
+#endif	/* defined(AF_802) */
+
+#if	defined(AF_X25)
+	case AF_X25:
+	    s = "X25";
+	    break;
+#endif	/* defined(AF_X25) */
+
+#if	defined(AF_CTF)
+	case AF_CTF:
+	    s = "CTF";
+	    break;
+#endif	/* defined(AF_CTF) */
+
+#if	defined(AF_WAN)
+	case AF_WAN:
+	    s = "WAN";
+	    break;
+#endif	/* defined(AF_WAN) */
+
+#if	defined(AF_OSINET)
+# if	defined(AF_INET) && AF_INET!=AF_OSINET
+	case AF_OSINET:
+	    s = "OSINET";
+	    break;
+# endif	/* defined(AF_INET) && AF_INET!=AF_OSINET */
+#endif	/* defined(AF_OSINET) */
+
+#if	defined(AF_GOSIP)
+	case AF_GOSIP:
+	    s = "GOSIP";
+	    break;
+#endif	/* defined(AF_GOSIP) */
+
+#if	defined(AF_SDL)
+	case AF_SDL:
+	    s = "SDL";
+	    break;
+#endif	/* defined(AF_SDL) */
+
+#if	defined(AF_IPX)
+	case AF_IPX:
+	    s = "IPX";
+	    break;
+#endif	/* defined(AF_IPX) */
+
+#if	defined(AF_SIP)
+	case AF_SIP:
+	    s = "SIP";
+	    break;
+#endif	/* defined(AF_SIP) */
+
+#if	defined(psuedo_AF_PIP)
+	case psuedo_AF_PIP:
+	    p = "pseudo_";
+	    s = "PIP";
+	    break;
+#endif	/* defined(psuedo_AF_PIP) */
+
+#if	defined(AF_OTS)
+	case AF_OTS:
+	    s = "OTS";
+	    break;
+#endif	/* defined(AF_OTS) */
+
+#if	defined(pseudo_AF_BLUE)
+	case pseudo_AF_BLUE:	/* packets for Blue box */
+	    p = "pseudo_";
+	    s = "BLUE";
+	    break;
+#endif	/* defined(pseudo_AF_BLUE) */
+
+#if	defined(AF_NDRV)	/* network driver raw access */
+	case AF_NDRV:
+	    s = "NDRV";
+	    break;
+#endif	/* defined(AF_NDRV) */
+
+#if	defined(AF_SYSTEM)	/* kernel event messages */
+	case AF_SYSTEM:
+	    s = "SYSTEM";
+	    break;
+#endif	/* defined(AF_SYSTEM) */
+
+#if	defined(AF_USER)
+	case AF_USER:
+	    s = "USER";
+	    break;
+#endif	/* defined(AF_USER) */
+
+#if	defined(pseudo_AF_KEY)
+	case pseudo_AF_KEY:
+	    p = "pseudo_";
+	    s = "KEY";
+	    break;
+#endif	/* defined(pseudo_AF_KEY) */
+
+#if	defined(AF_KEY)		/* Security Association DB socket */
+	case AF_KEY:			
+	    s = "KEY";
+	    break;
+#endif	/* defined(AF_KEY) */
+
+#if	defined(AF_NCA)		/* NCA socket */
+	case AF_NCA:			
+	    s = "NCA";
+	    break;
+#endif	/* defined(AF_NCA) */
+
+#if	defined(AF_POLICY)		/* Security Policy DB socket */
+	case AF_POLICY:
+	    s = "POLICY";
+	    break;
+#endif	/* defined(AF_POLICY) */
+
+#if	defined(AF_PPP)		/* PPP socket */
+	case AF_PPP:			
+	    s = "PPP";
+	    break;
+#endif	/* defined(AF_PPP) */
+
+	default:
+	    if (!ty)
+		(void) snpf(Namech, Namechl, "%#x", fam);
+	    else
+		(void) snpf(Namech, Namechl,
+		    "no further information on family %#x", fam);
+	    return;
+	}
+	if (!ty)
+	    (void) snpf(Namech, Namechl, "%sAF_%s", p, s);
+	else
+	    (void) snpf(Namech, Namechl, "no further information on %sAF_%s",
+		p, s);
+	return;
+}
+
+
+#if	!defined(HASNORPC_H)
+/*
+ * update_portmap() - update a portmap entry with its port number or service
+ *		      name
+ */
+
+static void
+update_portmap(pt, pn)
+	struct porttab *pt;		/* porttab entry */
+	char *pn;			/* port name */
+{
+	MALLOC_S al, nl;
+	char *cp;
+
+	if (pt->ss)
+	    return;
+	if (!(al = strlen(pn))) {
+	    pt->ss = 1;
+	    return;
+	}
+	nl = al + pt->nl + 2;
+	if (!(cp = (char *)malloc(nl + 1))) {
+	    (void) fprintf(stderr,
+		"%s: can't allocate %d bytes for portmap name: %s[%s]\n",
+		Pn, (int)(nl + 1), pn, pt->name);
+	    Exit(1);
+	}
+	(void) snpf(cp, nl + 1, "%s[%s]", pn, pt->name);
+	(void) free((FREE_P *)pt->name);
+	pt->name = cp;
+	pt->nl = nl;
+	pt->ss = 1;
+}
+#endif	/* !defined(HASNORPC_H) */
diff --git a/OLD/proc.c b/OLD/proc.c
new file mode 100644
index 0000000000000000000000000000000000000000..e181994b44407a8d0a618f6402fa99d9870a345a
--- /dev/null
+++ b/OLD/proc.c
@@ -0,0 +1,1384 @@
+/*
+ * proc.c - common process and file structure functions for lsof
+ */
+
+
+/*
+ * Copyright 1994 Purdue Research Foundation, West Lafayette, Indiana
+ * 47907.  All rights reserved.
+ *
+ * Written by Victor A. Abell
+ *
+ * This software is not subject to any license of the American Telephone
+ * and Telegraph Company or the Regents of the University of California.
+ *
+ * Permission is granted to anyone to use this software for any purpose on
+ * any computer system, and to alter it and redistribute it freely, subject
+ * to the following restrictions:
+ *
+ * 1. Neither the authors nor Purdue University are responsible for any
+ *    consequences of the use of this software.
+ *
+ * 2. The origin of this software must not be misrepresented, either by
+ *    explicit claim or by omission.  Credit to the authors and Purdue
+ *    University must appear in documentation and sources.
+ *
+ * 3. Altered versions must be plainly marked as such, and must not be
+ *    misrepresented as being the original software.
+ *
+ * 4. This notice may not be removed or altered.
+ */
+
+#ifndef lint
+static char copyright[] =
+"@(#) Copyright 1994 Purdue Research Foundation.\nAll rights reserved.\n";
+static char *rcsid = "$Id: proc.c,v 1.49 2015/07/07 20:16:58 abe Exp abe $";
+#endif
+
+
+#include "lsof.h"
+
+
+/*
+ * add_nma() - add to NAME column addition
+ */
+
+void
+add_nma(cp, len)
+	char *cp;			/* string to add */
+	int len;			/* string length */
+{
+	int nl;
+
+	if (!cp || !len)
+	    return;
+	if (Lf->nma) {
+	    nl = (int) strlen(Lf->nma);
+	    Lf->nma = (char *) realloc((MALLOC_P *)Lf->nma,
+				       (MALLOC_S)(len + nl + 2));
+	} else {
+	    nl = 0;
+	    Lf->nma = (char *) malloc((MALLOC_S)(len + 1));
+	}
+	if (!Lf->nma) {
+	    (void) fprintf(stderr, "%s: no name addition space: PID %ld, FD %s",
+		Pn, (long)Lp->pid, Lf->fd);
+	    Exit(1);
+	}
+	if (nl) {
+	    Lf->nma[nl] = ' ';
+	    (void) strncpy(&Lf->nma[nl + 1], cp, len);
+	    Lf->nma[nl + 1 + len] = '\0';
+	} else {
+	    (void) strncpy(Lf->nma, cp, len);
+	    Lf->nma[len] = '\0';
+	}
+}
+
+
+#if	defined(HASFSTRUCT)
+_PROTOTYPE(static char *alloc_fflbuf,(char **bp, int *al, int lr));
+
+
+/*
+ * alloc_fflbuf() - allocate file flags print buffer
+ */
+
+static char *
+alloc_fflbuf(bp, al, lr)
+	char **bp;			/* current buffer pointer */
+	int *al;			/* current allocated length */
+	int lr;				/* length required */
+{
+	int sz;
+
+	sz = (int)(lr + 1);		/* allocate '\0' space */
+	if (*bp && (sz <= *al))
+	    return(*bp);
+	if (*bp)
+	    *bp = (char *)realloc((MALLOC_P *)*bp, (MALLOC_S)sz);
+	else
+	    *bp = (char *)malloc((MALLOC_S)sz);
+	if (!*bp) {
+	    (void) fprintf(stderr, "%s: no space (%d) for print flags\n",
+		Pn, sz);
+	    Exit(1);
+	}
+	*al = sz;
+	return(*bp);
+}
+#endif	/* defined(HASFSTRUCT) */
+
+
+/*
+ * alloc_lfile() - allocate local file structure space
+ */
+
+void
+alloc_lfile(nm, num)
+	char *nm;			/* file descriptor name (may be NULL) */
+	int num;			/* file descriptor number -- -1 if
+					 * none */
+{
+	int fds;
+
+	if (Lf) {
+/*
+ * If reusing a previously allocated structure, release any allocated
+ * space it was using.
+ */
+	    if (Lf->dev_ch)
+		(void) free((FREE_P *)Lf->dev_ch);
+	    if (Lf->nm)
+		(void) free((FREE_P *)Lf->nm);
+	    if (Lf->nma)
+		(void) free((FREE_P *)Lf->nma);
+
+#if	defined(HASLFILEADD) && defined(CLRLFILEADD)
+	    CLRLFILEADD(Lf)
+#endif	/* defined(HASLFILEADD) && defined(CLRLFILEADD) */
+
+/*
+ * Othwerise, allocate a new structure.
+ */
+	} else if (!(Lf = (struct lfile *)malloc(sizeof(struct lfile)))) {
+	    (void) fprintf(stderr, "%s: no local file space at PID %d\n",
+		Pn, Lp->pid);
+	    Exit(1);
+	}
+/*
+ * Initialize the structure.
+ */
+	Lf->access = Lf->lock = ' ';
+	Lf->dev_def = Lf->inp_ty = Lf->is_com = Lf->is_nfs = Lf->is_stream
+		    = Lf->lmi_srch = Lf->nlink_def = Lf->off_def = Lf->sz_def
+		    = Lf->rdev_def
+		    = (unsigned char)0;
+	Lf->li[0].af = Lf->li[1].af = 0;
+	Lf->lts.type = -1;
+	Lf->nlink = 0l;
+
+#if	defined(HASMNTSTAT)
+	Lf->mnt_stat = (unsigned char)0;
+#endif	/* defined(HASMNTSTAT) */
+
+#if	defined(HASEPTOPTS)
+	Lf->chend = 0;
+#endif	/* defined(HASEPTOPTS) */
+
+#if	defined(HASSOOPT)
+	Lf->lts.kai = Lf->lts.ltm = 0;
+	Lf->lts.opt = Lf->lts.qlen = Lf->lts.qlim = Lf->lts.pqlen
+		    = (unsigned int)0;
+	Lf->lts.rbsz = Lf->lts.sbsz = (unsigned long)0;
+	Lf->lts.qlens = Lf->lts.qlims = Lf->lts.pqlens = Lf->lts.rbszs
+		      = Lf->lts.sbszs = (unsigned char)0;
+#endif	/* defined(HASSOOPT) */
+
+#if	defined(HASSOSTATE)
+	Lf->lts.ss = 0;
+#endif	/* defined(HASSOSTATE) */
+
+#if	defined(HASTCPOPT)
+	Lf->lts.mss = (unsigned long)0;
+	Lf->lts.msss = (unsigned char)0;
+	Lf->lts.topt = (unsigned int)0;
+#endif	/* defined(HASTCPOPT) */
+
+#if	defined(HASTCPTPIQ)
+	Lf->lts.rqs = Lf->lts.sqs = (unsigned char)0;
+#endif	/* defined(HASTCPTPIQ) */
+
+#if	defined(HASTCPTPIW)
+	Lf->lts.rws = Lf->lts.wws = (unsigned char)0;
+#endif	/* defined(HASTCPTPIW) */
+
+#if	defined(HASFSINO)
+	Lf->fs_ino = 0;
+#endif	/* defined(HASFSINO) */
+
+#if	defined(HASVXFS) && defined(HASVXFSDNLC)
+	Lf->is_vxfs = 0;
+#endif	/* defined(HASVXFS) && defined(HASVXFSDNLC) */
+
+	Lf->inode = (INODETYPE)0;
+	Lf->off = (SZOFFTYPE)0;
+	if (Lp->pss & PS_PRI)
+	    Lf->sf = Lp->sf;
+	else
+	    Lf->sf = 0;
+	Lf->iproto[0] = Lf->type[0] = '\0';
+	if (nm) {
+	    (void) strncpy(Lf->fd, nm, FDLEN - 1);
+	    Lf->fd[FDLEN - 1] = '\0';
+	} else if (num >= 0) {
+	    if (num < 10000)
+		(void) snpf(Lf->fd, sizeof(Lf->fd), "%4d", num);
+	    else
+		(void) snpf(Lf->fd, sizeof(Lf->fd), "*%03d", num % 1000);
+	} else
+	    Lf->fd[0] = '\0';
+	Lf->dev_ch = Lf->fsdir = Lf->fsdev = Lf->nm = Lf->nma = (char *)NULL;
+	Lf->ch = -1;
+
+#if	defined(HASNCACHE) && HASNCACHE<2
+	Lf->na = (KA_T)NULL;
+#endif	/* defined(HASNCACHE) && HASNCACHE<2 */
+
+	Lf->next = (struct lfile *)NULL;
+	Lf->ntype = Ntype = N_REGLR;
+	Namech[0] = '\0';
+
+#if	defined(HASFSTRUCT)
+	Lf->fct = Lf->ffg = Lf->pof = (long)0;
+	Lf->fna = (KA_T)NULL;
+	Lf->fsv = (unsigned char)0;
+#endif	/* defined(HASFSTRUCT) */
+
+#if	defined(HASLFILEADD) && defined(SETLFILEADD)
+/*
+ * Do local initializations.
+ */
+	SETLFILEADD
+#endif	/* defined(HASLFILEADD) && defined(SETLFILEADD) */
+
+/*
+ * See if the file descriptor has been selected.
+ */
+	if (!Fdl || (!nm && num < 0))
+	    return;
+	fds = ck_fd_status(nm, num);
+	switch (FdlTy) {
+	case 0:			/* inclusion list */
+	    if (fds == 2)
+		Lf->sf |= SELFD;
+	    break;
+	case 1:			/* exclusion list */
+	    if (fds != 1)
+		Lf->sf |= SELFD;
+	}
+}
+
+
+/*
+ * alloc_lproc() - allocate local proc structure space
+ */
+
+void
+alloc_lproc(pid, pgid, ppid, uid, cmd, pss, sf)
+	int pid;			/* Process ID */
+	int pgid;			/* process group ID */
+	int ppid;			/* parent process ID */
+	UID_ARG uid;			/* User ID */
+	char *cmd;			/* command */
+	int pss;			/* process select state */
+	int sf;				/* process select flags */
+{
+	static int sz = 0;
+
+	if (!Lproc) {
+	    if (!(Lproc = (struct lproc *)malloc(
+			  (MALLOC_S)(LPROCINCR * sizeof(struct lproc)))))
+	    {
+		(void) fprintf(stderr,
+		    "%s: no malloc space for %d local proc structures\n",
+		    Pn, LPROCINCR);
+		Exit(1);
+	    }
+	    sz = LPROCINCR;
+	} else if ((Nlproc + 1) > sz) {
+	    sz += LPROCINCR;
+	    if (!(Lproc = (struct lproc *)realloc((MALLOC_P *)Lproc,
+			  (MALLOC_S)(sz * sizeof(struct lproc)))))
+	    {
+		(void) fprintf(stderr,
+		    "%s: no realloc space for %d local proc structures\n",
+		    Pn, sz);
+		Exit(1);
+	    }
+	}
+	Lp = &Lproc[Nlproc++];
+	Lp->pid = pid;
+
+#if	defined(HASEPTOPTS)
+	Lp->ept = 0;
+#endif	/* defined(HASEPTOPTS) */
+
+#if	defined(HASTASKS)
+	Lp->tid = 0;
+	Lp->tcmd = (char *)NULL;
+#endif	/* defined(HASTASKS) */
+
+	Lp->pgid = pgid;
+	Lp->ppid = ppid;
+	Lp->file = (struct lfile *)NULL;
+	Lp->sf = (short)sf;
+	Lp->pss = (short)pss;
+	Lp->uid = (uid_t)uid;
+/*
+ * Allocate space for the full command name and copy it there.
+ */
+	if (!(Lp->cmd = mkstrcpy(cmd, (MALLOC_S *)NULL))) {
+	    (void) fprintf(stderr, "%s: PID %d, no space for command name: ",
+		Pn, pid);
+	    safestrprt(cmd, stderr, 1);
+	    Exit(1);
+	}
+
+#if	defined(HASZONES)
+/*
+ * Clear the zone name pointer.  The dialect's own code will set it.
+ */
+	Lp->zn = (char *)NULL;
+#endif	/* defined(HASZONES) */
+ 
+#if	defined(HASSELINUX)
+/*
+ * Clear the security context pointer.  The dialect's own code will
+ * set it.
+ */
+	Lp->cntx = (char *)NULL;
+#endif	/* defined(HASSELINUX) */
+
+}
+
+
+/*
+ * ck_fd_status() - check FD status
+ *
+ * return: 0 == FD is neither included nor excluded
+ *	   1 == FD is excluded
+ *	   2 == FD is included
+ */
+
+extern int
+ck_fd_status(nm, num)
+	char *nm;			/* file descriptor name (may be NULL) */
+	int num;			/* file descriptor number -- -1 if
+					 * none */
+{
+	char *cp;
+	struct fd_lst *fp;
+
+	if (!(fp = Fdl) || (!nm && num < 0))
+	    return(0);
+	if ((cp = nm)) {
+	    while (*cp && *cp == ' ')
+		cp++;
+	}
+/*
+ * Check for an exclusion match.
+ */
+	if (FdlTy == 1) {
+	    for (; fp; fp = fp->next) {
+		if (cp) {
+		    if (fp->nm && strcmp(fp->nm, cp) == 0)
+			return(1);
+		    continue;
+		}
+		if (num >= fp->lo && num <= fp->hi)
+		    return(1);
+	    }
+	    return(0);
+	}
+/*
+ * If Fdl isn't an exclusion list, check for an inclusion match.
+ */
+	for (; fp; fp = fp->next) {
+	    if (cp) {
+		if (fp->nm && strcmp(fp->nm, cp) == 0)
+		    return(2);
+		continue;
+	    }
+	    if (num >= fp->lo && num <= fp->hi)
+		return(2);
+	}
+	return(0);
+}
+
+
+/*
+ * comppid() - compare PIDs
+ */
+
+int
+comppid(a1, a2)
+	COMP_P *a1, *a2;
+{
+	struct lproc **p1 = (struct lproc **)a1;
+	struct lproc **p2 = (struct lproc **)a2;
+
+	if ((*p1)->pid < (*p2)->pid)
+	    return(-1);
+	if ((*p1)->pid > (*p2)->pid)
+	    return(1);
+
+#if	defined(HASTASKS)
+	if ((*p1)->tid < (*p2)->tid)
+	    return(-1);
+	if ((*p1)->tid > (*p2)->tid)
+	    return(1);
+#endif	/* defined(HASTASKS) */
+
+	return(0);
+}
+
+
+/*
+ * ent_inaddr() - enter Internet addresses
+ */
+
+void
+ent_inaddr(la, lp, fa, fp, af)
+	unsigned char *la;		/* local Internet address */
+	int lp;				/* local port */
+	unsigned char *fa;		/* foreign Internet address -- may
+					 * be NULL to indicate no foreign
+					 * address is known */
+	int fp;				/* foreign port */
+	int af;				/* address family -- e.g, AF_INET,
+					 * AF_INET */
+{
+	int m;
+
+	if (la) {
+	    Lf->li[0].af = af;
+
+#if	defined(HASIPv6)
+	    if (af == AF_INET6)
+		Lf->li[0].ia.a6 = *(struct in6_addr *)la;
+	    else
+#endif	/* defined(HASIPv6) */
+
+		Lf->li[0].ia.a4 = *(struct in_addr *)la;
+	    Lf->li[0].p = lp;
+	} else
+	    Lf->li[0].af = 0;
+	if (fa) {
+	    Lf->li[1].af = af;
+
+#if	defined(HASIPv6)
+	    if (af == AF_INET6)
+		Lf->li[1].ia.a6 = *(struct in6_addr *)fa;
+	    else
+#endif	/* defined(HASIPv6) */
+
+		Lf->li[1].ia.a4 = *(struct in_addr *)fa;
+	    Lf->li[1].p = fp;
+	} else
+	    Lf->li[1].af = 0;
+/*
+ * If network address matching has been selected, check both addresses.
+ */
+	if ((Selflags & SELNA) && Nwad) {
+	    m = (fa && is_nw_addr(fa, fp, af)) ? 1 : 0;
+	    m |= (la && is_nw_addr(la, lp, af)) ? 1 : 0;
+	    if (m)
+		Lf->sf |= SELNA;
+	}
+}
+
+
+/*
+ * examine_lproc() - examine local process
+ *
+ * return: 1 = last process
+ */
+
+int
+examine_lproc()
+{
+	int sbp = 0;
+
+	if (RptTm)
+	    return(0);
+/*
+ * List the process if the process is selected and:
+ *
+ *	o  listing is limited to a single PID selection -- this one;
+ *
+ *	o  listing is selected by an ANDed option set (not all options)
+ *	   that includes a single PID selection -- this one.
+ */
+	if ((Lp->sf & SELPID) && !AllProc) {
+	    if ((Selflags == SELPID)
+	    ||  (Fand && (Selflags & SELPID))) {
+		sbp = 1;
+		Npuns--;
+	    }
+	}
+	if (Lp->pss && Npid == 1 && sbp) {
+	    print_init();
+	    (void) print_proc();
+	    PrPass++;
+	    if (PrPass < 2)
+		(void) print_proc();
+	    Lp->pss = 0;
+	}
+/*
+ * Deprecate an unselected (or listed) process.
+ */
+	if ( ! Lp->pss) {
+	    (void) free_lproc(Lp);
+	    Nlproc--;
+	}
+/*
+ * Indicate last-process if listing is limited to PID selections,
+ * and all selected processes have been listed.
+ */
+	return((sbp && Npuns == 0) ? 1 : 0);
+}
+
+
+/*
+ * free_lproc() - free lproc entry and its associated malloc'd space
+ */
+
+void
+free_lproc(lp)
+	struct lproc *lp;
+{
+	struct lfile *lf, *nf;
+
+	for (lf = lp->file; lf; lf = nf) {
+	    if (lf->dev_ch) {
+		(void) free((FREE_P *)lf->dev_ch);
+		lf->dev_ch = (char *)NULL;
+	    }
+	    if (lf->nm) {
+		(void) free((FREE_P *)lf->nm);
+		lf->nm = (char *)NULL;
+	    }
+	    if (lf->nma) {
+		(void) free((FREE_P *)lf->nma);
+		lf->nma = (char *)NULL;
+	    }
+
+#if	defined(HASLFILEADD) && defined(CLRLFILEADD)
+	    CLRLFILEADD(lf)
+#endif	/* defined(HASLFILEADD) && defined(CLRLFILEADD) */
+
+	    nf = lf->next;
+	    (void) free((FREE_P *)lf);
+	}
+	lp->file = (struct lfile *)NULL;
+	if (lp->cmd) {
+	    (void) free((FREE_P *)lp->cmd);
+	    lp->cmd = (char *)NULL;
+	}
+
+#if	defined(HASTASKS)
+	if (lp->tcmd) {
+	    (void) free((FREE_P *)lp->tcmd);
+	    lp->tcmd = (char *)NULL;
+	}
+#endif	/* defined(HASTASKS) */
+
+}
+
+
+/*
+ * is_cmd_excl() - is command excluded?
+ */
+
+int
+is_cmd_excl(cmd, pss, sf)
+	char *cmd;			/* command name */
+	short *pss;			/* process state */
+	short *sf;			/* process select flags */
+{
+	int i;
+	struct str_lst *sp;
+/*
+ * See if the command is excluded by a "-c^<command>" option.
+ */
+	if (Cmdl && Cmdnx) {
+	    for (sp = Cmdl; sp; sp = sp->next) {
+		if (sp->x && !strncmp(sp->str, cmd, sp->len))
+		    return(1);
+	    }
+	}
+/*
+ * The command is not excluded if no command selection was requested,
+ * or if its name matches any -c <command> specification.
+ * 
+ */
+	if ((Selflags & SELCMD) == 0)
+	    return(0);
+	for (sp = Cmdl; sp; sp = sp->next) {
+	    if (!sp->x && !strncmp(sp->str, cmd, sp->len)) {
+		sp->f = 1;
+		*pss |= PS_PRI;
+		*sf |= SELCMD;
+		return(0);
+	    }
+	}
+/*
+ * The command name doesn't match any -c <command> specification.  See if it
+ * matches a -c /RE/[bix] specification.
+ */
+	for (i = 0; i < NCmdRxU; i++) {
+	    if (!regexec(&CmdRx[i].cx, cmd, 0, NULL, 0)) {
+		CmdRx[i].mc = 1;
+		*pss |= PS_PRI;
+		*sf |= SELCMD;
+		return(0);
+	    }
+	}
+/*
+ * The command name matches no -c specification.
+ *
+ * It's excluded if the only selection condition is command name,
+ * or if command name selection is part of an ANDed set.
+ */
+	if (Selflags == SELCMD)
+	    return(1);
+	return (Fand ? 1 : 0);
+}
+
+
+/*
+ * is_file_sel() - is file selected?
+ */
+
+int
+is_file_sel(lp, lf)
+	struct lproc *lp;		/* lproc structure pointer */
+	struct lfile *lf;		/* lfile structure pointer */
+{
+	if (!lf || !lf->sf)
+	    return(0);
+	if (Lf->sf & SELEXCLF)
+	    return(0);
+
+#if	defined(HASSECURITY) && defined(HASNOSOCKSECURITY)
+	if (Myuid && (Myuid != lp->uid)) {
+	    if (!(lf->sf & (SELNA | SELNET)))
+		return(0);
+	}
+#endif	/* defined(HASSECURITY) && defined(HASNOSOCKSECURITY) */
+
+	if (AllProc)
+	    return(1);
+	if (Fand && ((lf->sf & Selflags) != Selflags))
+	    return(0);
+	return(1);
+}
+
+
+/*
+ * is_proc_excl() - is process excluded?
+ */
+
+int
+
+#if	defined(HASTASKS)
+is_proc_excl(pid, pgid, uid, pss, sf, tid)
+#else	/* !defined(HASTASKS) */
+is_proc_excl(pid, pgid, uid, pss, sf)
+#endif	/* defined(HASTASKS) */
+
+	int pid;			/* Process ID */
+	int pgid;			/* process group ID */
+	UID_ARG uid;			/* User ID */
+	short *pss;			/* process select state for lproc */
+	short *sf;			/* select flags for lproc */
+
+#if	defined(HASTASKS)
+	int tid;			/* task ID (not a task if zero) */
+#endif	/* defined(HASTASKS) */
+
+{
+	int i, j;
+
+	*pss = *sf = 0;
+
+#if	defined(HASSECURITY)
+/*
+ * The process is excluded by virtue of the security option if it
+ * isn't owned by the owner of this lsof process, unless the
+ * HASNOSOCKSECURITY option is also specified.  In that case the
+ * selected socket files of any process may be listed.
+ */
+# if	!defined(HASNOSOCKSECURITY)
+	if (Myuid && Myuid != (uid_t)uid)
+	    return(1);
+# endif	/* !defined(HASNOSOCKSECURITY) */
+#endif	/* defined(HASSECURITY) */
+
+/*
+ * If the excluding of process listing by UID has been specified, see if the
+ * owner of this process is excluded.
+ */
+	if (Nuidexcl) {
+	    for (i = j = 0; (i < Nuid) && (j < Nuidexcl); i++) {
+		if (!Suid[i].excl)
+		    continue;
+		if (Suid[i].uid == (uid_t)uid)
+		    return(1);
+		j++;
+	    }
+	}
+/*
+ * If the excluding of process listing by PGID has been specified, see if this
+ * PGID is excluded.
+ */
+	if (Npgidx) {
+	    for (i = j = 0; (i < Npgid) && (j < Npgidx); i++) {
+		if (!Spgid[i].x)
+		    continue;
+		if (Spgid[i].i == pgid)
+		    return(1);
+		j++;
+	    }
+	}
+/*
+ * If the excluding of process listing by PID has been specified, see if this
+ * PID is excluded.
+ */
+	if (Npidx) {
+	    for (i = j = 0; (i < Npid) && (j < Npidx); i++) {
+		if (!Spid[i].x)
+		    continue;
+		if (Spid[i].i == pid)
+		    return(1);
+		j++;
+	    }
+	}
+/*
+ * If the listing of all processes is selected, then this one is not excluded.
+ *
+ * However, if HASSECURITY and HASNOSOCKSECURITY are both specified, exclude
+ * network selections from the file flags, so that the tests in is_file_sel()
+ * work as expected.
+ */
+	if (AllProc) {
+	    *pss = PS_PRI;
+
+#if	defined(HASSECURITY) && defined(HASNOSOCKSECURITY)
+	    *sf = SelAll & ~(SELNA | SELNET);
+#else	/* !defined(HASSECURITY) || !defined(HASNOSOCKSECURITY) */
+	    *sf = SelAll;
+#endif	/* defined(HASSECURITY) && defined(HASNOSOCKSECURITY) */
+
+	    return(0);
+	}
+/*
+ * If the listing of processes has been specified by process group ID, see
+ * if this one is included or excluded.
+ */
+	if (Npgidi && (Selflags & SELPGID)) {
+	    for (i = j = 0; (i < Npgid) && (j < Npgidi); i++) {
+		if (Spgid[i].x)
+		    continue;
+		if (Spgid[i].i == pgid) {
+		    Spgid[i].f = 1;
+		    *pss = PS_PRI;
+		    *sf = SELPGID;
+		    if (Selflags == SELPGID)
+			return(0);
+		    break;
+		}
+		j++;
+	    }
+	    if ((Selflags == SELPGID) && !*sf)
+		return(1);
+	}
+/*
+ * If the listing of processes has been specified by PID, see if this one is
+ * included or excluded.
+ */
+	if (Npidi && (Selflags & SELPID)) {
+	    for (i = j = 0; (i < Npid) && (j < Npidi); i++) {
+		if (Spid[i].x)
+		    continue;
+		if (Spid[i].i == pid) {
+		    Spid[i].f = 1;
+		    *pss = PS_PRI;
+		    *sf |= SELPID;
+		    if (Selflags == SELPID)
+			return(0);
+		    break;
+		}
+		j++;
+	    }
+	    if ((Selflags == SELPID) && !*sf)
+		return(1);
+	}
+/*
+ * If the listing of processes has been specified by UID, see if the owner of
+ * this process has been included.
+ */
+	if (Nuidincl && (Selflags & SELUID)) {
+	    for (i = j = 0; (i < Nuid) && (j < Nuidincl); i++) {
+		if (Suid[i].excl)
+		    continue;
+		if (Suid[i].uid == (uid_t)uid) {
+		    Suid[i].f = 1;
+		    *pss = PS_PRI;
+		    *sf |= SELUID;
+		    if (Selflags == SELUID)
+			return(0);
+		    break;
+		}
+		j++;
+	    }
+	    if (Selflags == SELUID && (*sf & SELUID) == 0)
+		return(1);
+	}
+
+#if	defined(HASTASKS)
+	if ((Selflags & SELTASK) && tid) {
+
+	/*
+	 * This is a task and tasks are selected.
+	 */
+	    *pss = PS_PRI;
+	    *sf |= SELTASK;
+	    if ((Selflags == SELTASK)
+	    ||  (Fand && ((*sf & Selflags) == Selflags)))
+		return(0);
+	}
+#endif	/* defined(HASTASKS) */
+
+/*
+ * When neither the process group ID, nor the PID, nor the task, nor the UID
+ * is selected:
+ *
+ *	If list option ANDing of process group IDs, PIDs, UIDs or tasks is
+ *	specified, the process is excluded;
+ *
+ *	Otherwise, it's not excluded by the tests of this function.
+ */
+	if ( ! *sf)
+	    return((Fand && (Selflags & (SELPGID|SELPID|SELUID|SELTASK)))
+		   ? 1 : 0);
+/*
+ * When the process group ID, PID, task or UID is selected and the process
+ * group ID, PID, task or UID list option has been specified:
+ *
+ *	If list option ANDing has been specified, and the correct
+ *	combination of selections are in place, reply that the process is no
+ *	excluded;
+ * or
+ *	If list option ANDing has not been specified, reply that the
+ *	process is not excluded by the tests of this function.
+ */
+	if (Selflags & (SELPGID|SELPID|SELUID|SELTASK)) {
+	    if (Fand)
+		return(((Selflags & (SELPGID|SELPID|SELUID|SELTASK)) != *sf)
+			? 1 : 0);
+	    return(0);
+	}
+/*
+ * Finally, when neither the process group ID, nor the PID, nor the UID, nor
+ * the task is selected, and no applicable list option has been specified:
+ *
+ *	If list option ANDing has been specified, this process is
+ *	excluded;
+ *
+ *	Otherwise, it isn't excluded by the tests of this function.
+ */
+	return(Fand ? 1 : 0);
+}
+
+
+/*
+ * link_lfile() - link local file structures
+ */
+
+void
+link_lfile()
+{
+	if (Lf->sf & SELEXCLF)
+	    return;
+
+#if	defined(HASEPTOPTS)
+/*
+ * If endpoint info has been requested, clear the SELPINFO flag from the local
+ * pipe file structure, since it was set only to insure this file would be
+ * linked.  While this might leave no file selection flags set, a later call
+ * to the process_pinfo() function might set some.  Also set the EPT_PIPE flag.
+ */
+	if (FeptE) {
+	    if (Lf->sf & SELPINFO) {
+		Lp->ept |= EPT_PIPE;
+		Lf->sf &= ~SELPINFO;
+	    }
+
+# if	defined(HASUXSOCKEPT)
+/*
+ * Process UNIX socket endpoint files the same way by clearing the SELUXINFO
+ * flag and setting the EPT_UXS flag, letting a later call to process_uxsinfo()
+ * set selection flags.
+ */
+	    if (Lf->sf & SELUXSINFO) {
+		Lp->ept |= EPT_UXS;
+		Lf->sf &= ~SELUXSINFO;
+	    }
+# endif	/* defined(HASUXSOCKEPT) */
+
+	}
+#endif	/* defined(HASEPTOPTS) */
+
+	if (Lf->sf)
+	    Lp->pss |= PS_SEC;
+	if (Plf)
+	    Plf->next = Lf;
+	else
+	    Lp->file = Lf;
+	Plf = Lf;
+	if (Fnet && (Lf->sf & SELNET))
+	    Fnet = 2;
+	if (Fnfs && (Lf->sf & SELNFS))
+	    Fnfs = 2;
+	if (Ftask && (Lf->sf & SELTASK))
+	    Ftask = 2;
+	Lf = (struct lfile *)NULL;
+}
+
+
+#if	defined(HASEPTOPTS)
+/*
+ * process_pinfo() -- process pipe info, adding it to selected files and
+ *		      selecting pipe end files (if requested)
+ */
+
+void
+process_pinfo(f)
+	int f;				/* function:
+					 *     0 == process selected pipe
+					 *     1 == process end point
+					 */
+{
+	struct lproc *ep;		/* pipe endpoint process */
+	struct lfile *ef;		/* pipe endpoint file */
+	int i;				/* temporary index */
+	char nma[1024];			/* name addition buffer */
+	pxinfo_t *pp;			/* previous pipe info */
+	
+	if (!FeptE)
+	    return;
+	for (Lf = Lp->file; Lf; Lf = Lf->next) {
+	    if ((Lf->ntype != N_FIFO) || (Lf->inp_ty != 1))
+		continue;
+	    pp = (pxinfo_t *)NULL;
+	    switch(f) {
+	    case 0:
+
+	    /*
+	     * Process already selected pipe file.
+	     */
+		if (is_file_sel(Lp, Lf)) {
+
+		/*
+		 * This file has been selected by some criterion other than
+		 * its being a pipe.  Look up the pipe's endpoints.
+		 */
+		    do {
+			if ((pp = find_pendinfo(Lf, pp))) {
+
+			/*
+			 * This pipe endpoint is linked to the selected pipe
+			 * file.  Add its PID and FD to the name column
+			 * addition.
+			 */
+			    ep = &Lproc[pp->lpx];
+			    ef = pp->lf;
+			    for (i = 0; i < (FDLEN - 1); i++) {
+				if (ef->fd[i] != ' ')
+				    break;
+			    }
+			    (void) snpf(nma, sizeof(nma) - 1, "%d,%.*s,%s%c",
+				ep->pid, CmdLim, ep->cmd,&ef->fd[i],
+				ef->access);
+			    (void) add_nma(nma, strlen(nma));
+			    if (FeptE == 2) {
+
+			    /*
+			     * Endpoint files have been selected, so mark this
+			     * one for selection later. Set the type to PIPE.
+			     */
+				ef->chend = CHEND_PIPE;
+				ep->ept |= EPT_PIPE_END;
+			    }
+			    pp = pp->next;
+			}
+		    } while (pp);
+		}
+		break;
+	    case 1:
+		if (!is_file_sel(Lp, Lf) && (Lf->chend & CHEND_PIPE)) {
+
+		/*
+		 * This is an unselected end point file.  Select it and add
+		 * its end point information to its name column addition.
+		 */
+		    Lf->sf = Selflags;
+		    Lp->pss |= PS_SEC;
+		    do {
+			if ((pp = find_pendinfo(Lf, pp))) {
+			    ep = &Lproc[pp->lpx];
+			    ef = pp->lf;
+			    for (i = 0; i < (FDLEN - 1); i++) {
+				if (ef->fd[i] != ' ')
+				    break;
+			    }
+			    (void) snpf(nma, sizeof(nma) - 1, "%d,%.*s,%s%c",
+				ep->pid, CmdLim, ep->cmd, &ef->fd[i],
+				ef->access);
+			    (void) add_nma(nma, strlen(nma));
+			    pp = pp->next;
+			}
+		    } while (pp);
+		}
+		break;
+	    }
+	}
+}
+#endif	/* defined(HASEPTOPTS) */
+
+
+#if	defined(HASFSTRUCT)
+/*
+ * print_fflags() - print interpreted f_flag[s]
+ */
+
+char *
+print_fflags(ffg, pof)
+	long ffg;		/* file structure's flags value */
+	long pof;		/* process open files flags value */
+{
+	int al, ct, fx;
+	static int bl = 0;
+	static char *bp = (char *)NULL;
+	char *sep;
+	int sepl;
+	struct pff_tab *tp;
+	long wf;
+	char xbuf[64];
+/*
+ * Reduce the supplied flags according to the definitions in Pff_tab[] and
+ * Pof_tab[].
+ */
+	for (ct = fx = 0; fx < 2; fx++) {
+	    if (fx == 0) {
+		sep = "";
+		sepl = 0;
+		tp = Pff_tab;
+		wf = ffg;
+	    } else {
+		sep = ";";
+		sepl = 1;
+		tp = Pof_tab;
+		wf = pof;
+	    }
+	    for (; wf && !FsvFlagX; ct += al ) {
+		while (tp->nm) {
+		    if (wf & tp->val)
+			break;
+		    tp++;
+		}
+		if (!tp->nm)
+		    break;
+		al = (int)strlen(tp->nm) + sepl;
+		bp = alloc_fflbuf(&bp, &bl, al + ct);
+		(void) snpf(bp + ct, al + 1, "%s%s", sep, tp->nm);
+		sep = ",";
+		sepl = 1;
+		wf &= ~(tp->val);
+	    }
+	/*
+	 * If flag bits remain, print them in hex.  If hex output was
+	 * specified with +fG, print all flag values, including zero,
+	 * in hex.
+	 */
+	    if (wf || FsvFlagX) {
+		(void) snpf(xbuf, sizeof(xbuf), "0x%lx", wf);
+		al = (int)strlen(xbuf) + sepl;
+		bp = alloc_fflbuf(&bp, &bl, al + ct);
+		(void) snpf(bp + ct, al + 1, "%s%s", sep, xbuf);
+		ct += al;
+	    }
+	}
+/*
+ * Make sure there is at least a NUL terminated reply.
+ */
+	if (!bp) {
+	    bp = alloc_fflbuf(&bp, &bl, 0);
+	    *bp = '\0';
+	}
+	return(bp);
+}
+#endif	/* defined(HASFSTRUCT) */
+
+
+/*
+ * print_proc() - print process
+ */
+
+int
+print_proc()
+{
+	char buf[128], *cp;
+	int lc, len, st, ty;
+	int rv = 0;
+	unsigned long ul;
+/*
+ * If nothing in the process has been selected, skip it.
+ */
+	if (!Lp->pss)
+	    return(0);
+	if (Fterse) {
+	    if (Lp->pid == LastPid)		/* eliminate duplicates */
+		return(0);
+	    LastPid = Lp->pid;
+	/*
+	 * The mode is terse and something in the process appears to have
+	 * been selected.  Make sure of that by looking for a selected file,
+	 * so that the HASSECURITY and HASNOSOCKSECURITY option combination
+	 * won't produce a false positive result.
+	 */
+	    for (Lf = Lp->file; Lf; Lf = Lf->next) {
+		if (is_file_sel(Lp, Lf)) {
+		    (void) printf("%d\n", Lp->pid);
+		    return(1);
+		}
+	    }
+	    return(0);
+	}
+/*
+ * If fields have been selected, output the process-only ones, provided
+ * that some file has also been selected.
+ */
+	if (Ffield) {
+	    for (Lf = Lp->file; Lf; Lf = Lf->next) {
+		if (is_file_sel(Lp, Lf))
+		    break;
+	    }
+	    if (!Lf)
+		return(rv);
+	    rv = 1;
+	    (void) printf("%c%d%c", LSOF_FID_PID, Lp->pid, Terminator);
+
+#if	defined(HASTASKS)
+	    if (FieldSel[LSOF_FIX_TID].st && Lp->tid)
+		(void) printf("%c%d%c", LSOF_FID_TID, Lp->tid, Terminator);
+	    if (FieldSel[LSOF_FIX_TCMD].st && Lp->tcmd)
+		(void) printf("%c%s%c", LSOF_FID_TCMD, Lp->tcmd, Terminator);
+#endif	/* defined(HASTASKS) */
+
+#if	defined(HASZONES)
+	    if (FieldSel[LSOF_FIX_ZONE].st && Fzone && Lp->zn)
+		(void) printf("%c%s%c", LSOF_FID_ZONE, Lp->zn, Terminator);
+#endif	/* defined(HASZONES) */
+ 
+#if	defined(HASSELINUX)
+	    if (FieldSel[LSOF_FIX_CNTX].st && Fcntx && Lp->cntx && CntxStatus)
+		(void) printf("%c%s%c", LSOF_FID_CNTX, Lp->cntx, Terminator);
+#endif	/* defined(HASSELINUX) */
+
+	    if (FieldSel[LSOF_FIX_PGID].st && Fpgid)
+		(void) printf("%c%d%c", LSOF_FID_PGID, Lp->pgid, Terminator);
+
+#if	defined(HASPPID)
+	    if (FieldSel[LSOF_FIX_PPID].st && Fppid)
+		(void) printf("%c%d%c", LSOF_FID_PPID, Lp->ppid, Terminator);
+#endif	/* defined(HASPPID) */
+
+	    if (FieldSel[LSOF_FIX_CMD].st) {
+		putchar(LSOF_FID_CMD);
+		safestrprt(Lp->cmd ? Lp->cmd : "(unknown)", stdout, 0);
+		putchar(Terminator);
+	    }
+	    if (FieldSel[LSOF_FIX_UID].st)
+		(void) printf("%c%d%c", LSOF_FID_UID, (int)Lp->uid, Terminator);
+	    if (FieldSel[LSOF_FIX_LOGIN].st) {
+		cp = printuid((UID_ARG)Lp->uid, &ty);
+		if (ty == 0)
+		    (void) printf("%c%s%c", LSOF_FID_LOGIN, cp, Terminator);
+	    }
+	    if (Terminator == '\0')
+		putchar('\n');
+	}
+/*
+ * Print files.
+ */
+	for (Lf = Lp->file; Lf; Lf = Lf->next) {
+	    if (!is_file_sel(Lp, Lf))
+		continue;
+	    rv = 1;
+	/*
+	 * If no field output selected, print dialect-specific formatted
+	 * output.
+	 */
+	    if (!Ffield) {
+		print_file();
+		continue;
+	    }
+	    lc = st = 0;
+	    if (FieldSel[LSOF_FIX_FD].st) {
+
+	    /*
+	     * Skip leading spaces in the file descriptor.  Print the field
+	     * identifier even if there are no characters after leading
+	     * spaces.
+	     */
+		for (cp = Lf->fd; *cp == ' '; cp++)
+		    ;
+		(void) printf("%c%s%c", LSOF_FID_FD, cp, Terminator);
+		lc++;
+	    }
+	/*
+	 * Print selected fields.
+	 */
+	    if (FieldSel[LSOF_FIX_ACCESS].st) {
+		(void) printf("%c%c%c",
+		    LSOF_FID_ACCESS, Lf->access, Terminator);
+		lc++;
+	    }
+	    if (FieldSel[LSOF_FIX_LOCK].st) {
+		(void) printf("%c%c%c", LSOF_FID_LOCK, Lf->lock, Terminator);
+		lc++;
+	    }
+	    if (FieldSel[LSOF_FIX_TYPE].st) {
+		for (cp = Lf->type; *cp == ' '; cp++)
+		    ;
+		if (*cp) {
+		    (void) printf("%c%s%c", LSOF_FID_TYPE, cp, Terminator);
+		    lc++;
+		}
+	    }
+
+#if	defined(HASFSTRUCT)
+	    if (FieldSel[LSOF_FIX_FA].st && (Fsv & FSV_FA)
+	    &&  (Lf->fsv & FSV_FA)) {
+		(void) printf("%c%s%c", LSOF_FID_FA,
+		    print_kptr(Lf->fsa, (char *)NULL, 0), Terminator);
+		lc++;
+	    }
+	    if (FieldSel[LSOF_FIX_CT].st && (Fsv & FSV_CT)
+	    &&  (Lf->fsv & FSV_CT)) {
+		(void) printf("%c%ld%c", LSOF_FID_CT, Lf->fct, Terminator);
+		lc++;
+	    }
+	    if (FieldSel[LSOF_FIX_FG].st && (Fsv & FSV_FG)
+	    &&  (Lf->fsv & FSV_FG) && (FsvFlagX || Lf->ffg || Lf->pof)) {
+		(void) printf("%c%s%c", LSOF_FID_FG,
+		    print_fflags(Lf->ffg, Lf->pof), Terminator);
+		lc++;
+	    }
+	    if (FieldSel[LSOF_FIX_NI].st && (Fsv & FSV_NI)
+	    &&  (Lf->fsv & FSV_NI)) {
+		(void) printf("%c%s%c", LSOF_FID_NI,
+		    print_kptr(Lf->fna, (char *)NULL, 0), Terminator);
+		lc++;
+	    }
+#endif	/* defined(HASFSTRUCT) */
+
+	    if (FieldSel[LSOF_FIX_DEVCH].st && Lf->dev_ch && Lf->dev_ch[0]) {
+		for (cp = Lf->dev_ch; *cp == ' '; cp++)
+		    ;
+		if (*cp) {
+		    (void) printf("%c%s%c", LSOF_FID_DEVCH, cp, Terminator);
+		    lc++;
+		}
+	    }
+	    if (FieldSel[LSOF_FIX_DEVN].st && Lf->dev_def) {
+		if (sizeof(unsigned long) > sizeof(dev_t))
+		    ul = (unsigned long)((unsigned int)Lf->dev);
+		else
+		    ul = (unsigned long)Lf->dev;
+		(void) printf("%c0x%lx%c", LSOF_FID_DEVN, ul, Terminator);
+		lc++;
+	    }
+	    if (FieldSel[LSOF_FIX_RDEV].st && Lf->rdev_def) {
+		if (sizeof(unsigned long) > sizeof(dev_t))
+		    ul = (unsigned long)((unsigned int)Lf->rdev);
+		else
+		    ul = (unsigned long)Lf->rdev;
+		(void) printf("%c0x%lx%c", LSOF_FID_RDEV, ul, Terminator);
+		lc++;
+	    }
+	    if (FieldSel[LSOF_FIX_SIZE].st && Lf->sz_def) {
+		putchar(LSOF_FID_SIZE);
+
+#if	defined(HASPRINTSZ)
+		cp = HASPRINTSZ(Lf);
+#else	/* !defined(HASPRINTSZ) */
+		(void) snpf(buf, sizeof(buf), SzOffFmt_d, Lf->sz);
+		cp = buf;
+#endif	/* defined(HASPRINTSZ) */
+
+		(void) printf("%s", cp);
+		putchar(Terminator);
+		lc++;
+	    }
+	    if (FieldSel[LSOF_FIX_OFFSET].st && Lf->off_def) {
+		putchar(LSOF_FID_OFFSET);
+
+#if	defined(HASPRINTOFF)
+		cp = HASPRINTOFF(Lf, 0);
+#else	/* !defined(HASPRINTOFF) */
+		(void) snpf(buf, sizeof(buf), SzOffFmt_0t, Lf->off);
+		cp = buf;
+#endif	/* defined(HASPRINTOFF) */
+
+		len = strlen(cp);
+		if (OffDecDig && len > (OffDecDig + 2)) {
+
+#if	defined(HASPRINTOFF)
+		    cp = HASPRINTOFF(Lf, 1);
+#else	/* !defined(HASPRINTOFF) */
+		    (void) snpf(buf, sizeof(buf), SzOffFmt_x, Lf->off);
+		    cp = buf;
+#endif	/* defined(HASPRINTOFF) */
+
+		}
+		(void) printf("%s", cp);
+		putchar(Terminator);
+		lc++;
+	    }
+	    if (FieldSel[LSOF_FIX_INODE].st && Lf->inp_ty == 1) {
+		putchar(LSOF_FID_INODE);
+		(void) printf(InodeFmt_d, Lf->inode);
+		putchar(Terminator);
+		lc++;
+	    }
+	    if (FieldSel[LSOF_FIX_NLINK].st && Lf->nlink_def) {
+		(void) printf("%c%ld%c", LSOF_FID_NLINK, Lf->nlink, Terminator);
+		lc++;
+	    }
+	    if (FieldSel[LSOF_FIX_PROTO].st && Lf->inp_ty == 2) {
+		for (cp = Lf->iproto; *cp == ' '; cp++)
+		    ;
+		if (*cp) {
+		    (void) printf("%c%s%c", LSOF_FID_PROTO, cp, Terminator);
+		    lc++;
+		}
+	    }
+	    if (FieldSel[LSOF_FIX_STREAM].st && Lf->nm && Lf->is_stream) {
+		if (strncmp(Lf->nm, "STR:", 4) == 0
+		||  strcmp(Lf->iproto, "STR") == 0) {
+		    putchar(LSOF_FID_STREAM);
+		    printname(0);
+		    putchar(Terminator);
+		    lc++;
+		    st++;
+		}
+	    }
+	    if (st == 0 && FieldSel[LSOF_FIX_NAME].st) {
+		putchar(LSOF_FID_NAME);
+		printname(0);
+		putchar(Terminator);
+		lc++;
+	    }
+	    if (Lf->lts.type >= 0 && FieldSel[LSOF_FIX_TCPTPI].st) {
+		print_tcptpi(0);
+		lc++;
+	    }
+	    if (Terminator == '\0' && lc)
+		putchar('\n');
+	}
+	return(rv);
+}
diff --git a/OLD/zipme b/OLD/zipme
new file mode 100755
index 0000000000000000000000000000000000000000..33faade95ad23bd43ccdca9450089e91d8de3f2c
--- /dev/null
+++ b/OLD/zipme
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+# zipme -- make a bzip2'd tar archive of ~/src/lsof4
+
+cd $HOME/src/lsof4
+V=`sed '/VN/s/.ds VN \(.*\)/\1/' $HOME/src/lsof4/version`
+if test $? -ne 0
+then
+  echo $V
+  exit 1
+fi
+cd ..
+T=lsof${V}.tar.bz2
+rm -f $T
+tar cf - lsof4 | bzip2 -c > $T
+ls -l $T
diff --git a/README.md b/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..b7b5c3dca9e9acc1eb9eac83cb352b446262a4c4
--- /dev/null
+++ b/README.md
@@ -0,0 +1,45 @@
+<!-- Use "lsof-legacy" in cirrus and coveralls because of historical reason  -->
+[![Cirrus CI FreeBSD 11 Build Status](https://api.cirrus-ci.com/github/lsof-org/lsof-legacy.svg?task=freebsd11&branch=master)](https://cirrus-ci.com/github/lsof-org/lsof-legacy)
+[![Cirrus CI FreeBSD 12 Build Status](https://api.cirrus-ci.com/github/lsof-org/lsof-legacy.svg?task=freebsd12&branch=master)](https://cirrus-ci.com/github/lsof-org/lsof-legacy)
+[![Travis CI Linux Build Status](https://travis-ci.org/lsof-org/lsof.svg?branch=master)](https://travis-ci.org/lsof-org/lsof)
+[![Coveralls Linux Coverage Status on Travis CI](https://coveralls.io/repos/github/lsof-org/lsof-legacy/badge.svg?branch=master)](https://coveralls.io/github/lsof-org/lsof-legacy?branch=master)
+
+# lsof
+lsof-org at GitHub team takes over the maintainership of lsof
+originally maintained by Vic Abell. This repository is for maintaining
+the final source tree of lsof inherited from Vic. "legacy" branch
+keeps the original source tree. We will not introduce any changes to
+the "legacy" branch. This branch is just for reference.
+
+"master" branch is used for maintenance. Bug fixes and enhancements go
+to "master" branch.
+
+lsof has supported many OSes. A term "dialect" represents code for
+supporting a OSes. Because of limitted resources, we will maintain the
+part of them. The current status of maintaince is as follows:
+
+<dl>
+<dt>freebsd</dt>
+<dd>partially maintained, and tested on Cirrus CI</dd>
+<dt>linux</dt>
+<dd>fully maintained, and tested on Travis CI</dd>
+<dt>darwin</dt>
+<dd>not maintained, but tested on Travis CI</dd>
+</dl>
+
+If you are interested in maintaining a dialect, let us know via the
+issue tracker of GitHub (https://github.com/lsof-org/lsof).  If
+we cannot find a volunteer for a dialect, we will remove the dialect.
+
+Many texts in the source tree still refers purdue.edu as the home of
+lsof development. It should be https://github.com/lsof-org/lsof, the
+new home. The updating is in progress.
+
+We are running another repository, lsof-org/"lsof-linux" derived from
+lsof-4.91 that is also released by Vic. To the repository, we have
+introduced some new features and fixes for building specific to
+GNU/Linux. We will merge the fruits of "lsof-linux" repository to this
+repository incrementally. If you are using GNU/Linux, you may want to
+use the code in "lsof-linux" repository.
+
+lsof-org at GitHub team
diff --git a/arg.c b/arg.c
index 537192781242cab7671d87009eba27466013b542..edbcc825a1beb3383452055dd187dca579d4caaa 100644
--- a/arg.c
+++ b/arg.c
@@ -772,8 +772,10 @@ enter_efsys(e, rdlnk)
  * Enter file system path on list, avoiding duplicates.
  */
 	for (ep = Efsysl; ep; ep = ep->next) {
-	   if (!strcmp(ep->path, path))
-		return(0);
+	   if (!strcmp(ep->path, path)) {
+		(void)free((FREE_P *)path);
+		return (0);
+	   }
 	}
 	if (!(ep = (efsys_list_t *)malloc((MALLOC_S)(sizeof(efsys_list_t))))) {
 	   (void) fprintf(stderr, "%s: no space for \"-e %s\" entry\n",
diff --git a/check.bash b/check.bash
new file mode 100755
index 0000000000000000000000000000000000000000..2e6374816f14a4310ca86a2eaecb06d9058993ac
--- /dev/null
+++ b/check.bash
@@ -0,0 +1,17 @@
+set -ex
+
+echo $1
+echo $BASH_VERSION
+shopt
+export -p
+
+./lsof -v
+
+#
+# check that the version numbers are updated
+#
+expected_version=$(sed '/VN/s/.ds VN \([0-9.a-z]*\)/\1/' ./version)
+actual_version=$(./lsof -v 2>&1 | sed -ne 's/^ *revision: *\([0-9.a-z]*\)/\1/p')
+dist_version=$(sed -ne 's/^\([0-9][0-9.a-z]*\)		.*$/\1/p' 00DIST | tail -1)
+test "${expected_version}" = "${actual_version}"
+test "${expected_version}" = "${dist_version}"
diff --git a/debian/changelog b/debian/changelog
index 0761f833609a6082c5906635c8d67bcf56ca2d5a..0a8a432fe76ba600d3edf35aef85d24e9cf8e6e8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,24 @@
+lsof (4.93.2+dfsg-1.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * debian/rules
+    - Use soelim to fix unreadable manpage. It depends groff-base.
+      Thanks Roderich Schupp (Closes: #950601)
+
+ -- Kentaro Hayashi <kenhys@xdump.org>  Thu, 19 Nov 2020 21:35:27 +0900
+
+lsof (4.93.2+dfsg-1) unstable; urgency=low
+
+  * New upstream release.
+  * Now hosted on github with a new upstream; update new upstream urls
+    in debian/copyright, debian/watch, etc.
+  * Drop the ancient debian/repack* stuff, use uscan's repack instead.
+  * include ftbfs patch for newer glibc. Thanks Mathieu! (closes: #926716)
+  * Override manpage install in debian/rules to make manpage match command
+    name; need to fix upstream.
+
+ -- Andres Salomon <dilinger@debian.org>  Tue, 03 Sep 2019 13:52:06 +0000
+
 lsof (4.91+dfsg-1co1) apertis; urgency=medium
 
   * debian/patches/majorminor: Fix ftbfs due to missing major/minor
diff --git a/debian/control b/debian/control
index a50395a2755cf0af4a557fa51749c5c94f31b9f0..0f27557b1e8532beee183f2d1b0ee3dc1dcf8a32 100644
--- a/debian/control
+++ b/debian/control
@@ -2,11 +2,9 @@ Source: lsof
 Section: utils
 Priority: standard
 Maintainer: Andres Salomon <dilinger@debian.org>
-Build-Depends: debhelper (>= 8.0.0), libselinux1-dev [linux-any]
+Build-Depends: debhelper (>= 8.0.0), libselinux1-dev [linux-any], groff-base
 Standards-Version: 3.9.6
-Homepage: http://people.freebsd.org/~abe/
-Vcs-Git: git://anonscm.debian.org/collab-maint/lsof.git
-Vcs-Browser: https://anonscm.debian.org/cgit/collab-maint/lsof.git
+Homepage: https://github.com/lsof-org/lsof
 
 Package: lsof
 Architecture: any
diff --git a/debian/copyright b/debian/copyright
index 384effea45ed4b9455a968a1a5b0a08e2bc6d1dd..401237e6b6678e95c4416db3aa73d79652596696 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -1,14 +1,9 @@
 Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
 Upstream-Name: lsof
-Upstream-Contact: https://lists.rcac.purdue.edu/listinfo/lsof-l
-Source: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/
-Comment: The following changes were made to the upstream tarball:
- 1.) The directory dialects/uw was removed for being non-DFSG
- and not needed in Debian.
- 2.) The main source was a tarball within a tarball. Only the innermost
- tarball has been retained.
- 3.) The top-level directory has been stripped away as it embedded the
- version number making packaging more difficult.
+Source: https://github.com/lsof-org/lsof
+Files-Excluded: dialects/uw
+Comment: We remove everything in dialects/uw because it isn't needed
+ for Debian, and also claims to be proprietary SCO code.
 
 Files: *
 Copyright: Purdue Research Foundation, West Lafayette, Indiana 47907 2002 - 2011
@@ -22,6 +17,7 @@ Copyright:
  2004-2009, Norbert Tretkowski <nobse@debian.org>
  2012, Raoul Gunnar Borenius <borenius@dfn.de>
  2012, Nicholas Bamber <nicholas@periapt.co.uk>
+ 2018-2019, Andres Salomon <dilinger@debian.org>
 License: BSD-4-clause
 
 Files: dialects/freebsd/include/procfs/pfsnode.h
diff --git a/debian/patches/ftbfs b/debian/patches/ftbfs
new file mode 100644
index 0000000000000000000000000000000000000000..7b8ded2212efd734abcb6dc4fcb9d8fdee393ab3
--- /dev/null
+++ b/debian/patches/ftbfs
@@ -0,0 +1,44 @@
+Description: fix ftbfs with newer glibc in sid
+ Newer versions of glibc cause a fail to build due to some linux header
+ changes. This needs to go upstream.
+Author: Mathieu Trudel-Lapierre <cyphermox@ubuntu.com>
+Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=926716
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+Index: lsof-4.93.2/tests/LTlib.c
+===================================================================
+--- lsof-4.93.2.orig/tests/LTlib.c
++++ lsof-4.93.2/tests/LTlib.c
+@@ -231,26 +231,32 @@ _PROTOTYPE(static X2DEV_T x2dev,(char *x
+  */
+ 
+ #if	!defined(major_S)
++#include <sys/sysmacros.h>
+ #define	major_S		major
+ #endif	/* defined(major_S) */
+ 
+ #if	!defined(minor_S)
++#include <sys/sysmacros.h>
+ #define	minor_S		minor
+ #endif	/* defined(minor_S) */
+ 
+ #if	!defined(unit_S)
++#include <sys/sysmacros.h>
+ #define	unit_S(x)	0
+ #endif	/* defined(unit_S) */
+ 
+ #if	!defined(major_X)
++#include <sys/sysmacros.h>
+ #define	major_X(dp, em)	major(x2dev(dp, em))
+ #endif	/* defined(major_X) */
+ 
+ #if	!defined(minor_X)
++#include <sys/sysmacros.h>
+ #define	minor_X(dp, em)	minor(x2dev(dp, em))
+ #endif	/* defined(minor_X) */
+ 
+ #if	!defined(unit_X)
++#include <sys/sysmacros.h>
+ #define	unit_X(dp, em)	0
+ #endif	/* defined(unit_X) */
+ 
diff --git a/debian/patches/manpage b/debian/patches/manpage
index f15bbc725e945d8f29e015b18ed6191c00affea4..18359f1fdc53801a06c4fb3801a2b08006633918 100644
--- a/debian/patches/manpage
+++ b/debian/patches/manpage
@@ -6,10 +6,10 @@ Author: Raoul Gunnar Borenius <borenius@dfn.de>
 Reviewed-by: Nicholas Bamber <nicholas@periapt.co.uk>
 Forwarded: no
 Last-Update: 2012-04-17
-Index: lsof_4.91_src/lsof.8
+Index: lsof-4.93.2/Lsof.8
 ===================================================================
---- lsof_4.91_src.orig/lsof.8
-+++ lsof_4.91_src/lsof.8
+--- lsof-4.93.2.orig/Lsof.8
++++ lsof-4.93.2/Lsof.8
 @@ -12,7 +12,7 @@ lsof \- list open files
  [
  .B \-?abChlnNOPRtUvVX
@@ -19,7 +19,7 @@ Index: lsof_4.91_src/lsof.8
  ] [
  .BI \-c " c"
  ] [
-@@ -223,19 +223,19 @@ options, or it might represent the
+@@ -220,19 +220,19 @@ options, or it might represent the
  field identifier character following the
  .B \-F
  option.
@@ -43,7 +43,7 @@ Index: lsof_4.91_src/lsof.8
  When in doubt, use separate options with appropriate prefixes.
  .TP \w'names'u+4
  .B \-? \-h
-@@ -416,9 +416,9 @@ Mixed lists are not permitted.
+@@ -413,9 +413,9 @@ Mixed lists are not permitted.
  .IP
  A file descriptor number range may be in the set as long as
  neither member is empty, both members are numbers, and the ending
@@ -55,7 +55,7 @@ Index: lsof_4.91_src/lsof.8
  .IP
  Multiple file descriptor numbers are joined in a single ORed set before
  participating in AND option selection.
-@@ -485,7 +485,7 @@ See the
+@@ -482,7 +482,7 @@ See the
  section and the sections that follow it for more information on this
  option.
  .IP
@@ -64,7 +64,7 @@ Index: lsof_4.91_src/lsof.8
  must be followed by a function letter; the function letter may optionally
  be followed by a path name.
  .I Lsof
-@@ -737,7 +737,7 @@ When
+@@ -734,7 +734,7 @@ When
  .B \-f
  is specified by itself, all path name arguments will be taken to be
  simple files.
@@ -73,7 +73,7 @@ Index: lsof_4.91_src/lsof.8
  for open files with a `/' path name, not all open files in the `/'
  (root) file system.
  .IP
-@@ -747,15 +747,15 @@ and
+@@ -744,15 +744,15 @@ and
  .B \-f
  are properly terminated and aren't followed by a character (e.g., of
  the file or file system name) that might be taken as a parameter.
@@ -92,7 +92,7 @@ Index: lsof_4.91_src/lsof.8
  .fi
  .IP
  The listing of information from kernel file structures, requested with the
-@@ -1015,7 +1015,7 @@ Here are some sample addresses:
+@@ -1012,7 +1012,7 @@ Here are some sample addresses:
  .nf
  
  .br
@@ -101,7 +101,7 @@ Index: lsof_4.91_src/lsof.8
  .br
  	TCP:25 \- TCP and port 25
  .br
-@@ -1028,10 +1028,10 @@ Here are some sample addresses:
+@@ -1025,10 +1025,10 @@ Here are some sample addresses:
  .br
  	TCP@lsof.itap:513 \- TCP, port 513 and host name lsof.itap
  .br
@@ -114,7 +114,7 @@ Index: lsof_4.91_src/lsof.8
  .br
  	:time \- either TCP, UDP or UDPLITE time service port
  .fi
-@@ -1086,7 +1086,7 @@ inhibits the conversion of user ID numbe
+@@ -1083,7 +1083,7 @@ inhibits the conversion of user ID numbe
  It is also useful when login name lookup is working improperly or slowly.
  .TP \w'names'u+4
  .BI +|\-L " [l]"
@@ -123,7 +123,7 @@ Index: lsof_4.91_src/lsof.8
  counts, where they are available \- e.g., they aren't available
  for sockets, or most FIFOs and pipes.
  .IP
-@@ -1300,9 +1300,9 @@ Thus, for example, to direct
+@@ -1297,9 +1297,9 @@ Thus, for example, to direct
  to display offset at all times with a decimal digit count of 10, use:
  .IP
  .nf
@@ -135,16 +135,16 @@ Index: lsof_4.91_src/lsof.8
  .fi
  .IP
  The default number of digits allowed after ``0t'' is normally 8,
-@@ -1497,7 +1497,7 @@ Or, for example, to list network files w
+@@ -1494,7 +1494,7 @@ Or, for example, to list network files w
  Idle, use:
  .IP
  .nf
--	\-iUDP -sUDP:Idle
-+	\-iUDP \-sUDP:Idle
+-	\-iUDP -sUDP:^Idle
++	\-iUDP \-sUDP:^Idle
  .fi
  .IP
  State names vary with UNIX dialects, so it's not possible to
-@@ -1604,7 +1604,7 @@ selection characters \- the displaying o
+@@ -1601,7 +1601,7 @@ selection characters \- the displaying o
  and it must be explicitly selected again in the characters following
  .BR \-T .
  (In effect, then, the default is equivalent to
@@ -153,7 +153,7 @@ Index: lsof_4.91_src/lsof.8
  For example, if queue lengths and state are desired, use
  .BR \-Tqs .
  .IP
-@@ -1715,14 +1715,14 @@ may not report that it failed to find a
+@@ -1712,14 +1712,14 @@ may not report that it failed to find a
  option or compile\-time option prevents the listing of the open file
  containing the located search item.
  .IP
@@ -170,7 +170,7 @@ Index: lsof_4.91_src/lsof.8
  .IP
  The
  .I lsof
-@@ -1752,13 +1752,13 @@ links and|or file system mount points en
+@@ -1749,13 +1749,13 @@ links and|or file system mount points en
  scanning the directory (\fB+d\fP) or directory tree (\fB+D\fP).
  .IP
  If
@@ -186,7 +186,7 @@ Index: lsof_4.91_src/lsof.8
  or '+'.
  .IP
  The optional 'f' parameter enables file system mount point cross\-over
-@@ -1948,7 +1948,7 @@ option and before the start of the file
+@@ -1945,7 +1945,7 @@ option and before the start of the file
  These are path names of specific files to list.
  Symbolic links are resolved before use.
  The first name may be separated from the preceding options with
@@ -195,7 +195,7 @@ Index: lsof_4.91_src/lsof.8
  .IP
  If a
  .I name
-@@ -2390,10 +2390,10 @@ option.
+@@ -2387,10 +2387,10 @@ option.
  SECURITY\-CONTEXT
  is the SELinux security context.
  This column must be selected with the
@@ -208,7 +208,7 @@ Index: lsof_4.91_src/lsof.8
  option is inhibited when SELinux is disabled in the running Linux
  kernel.
  .TP
-@@ -3008,7 +3008,7 @@ or the name of a character special or bl
+@@ -3005,7 +3005,7 @@ or the name of a character special or bl
  .IP
  or the local and remote Internet addresses of a network file;
  the local host name or IP number is followed by a colon (':'), the
@@ -217,7 +217,7 @@ Index: lsof_4.91_src/lsof.8
  IP addresses may be reported as numbers or names, depending on the
  .BR +|\-M ,
  .BR \-n ,
-@@ -3041,13 +3041,13 @@ or the local and remote mount point name
+@@ -3038,13 +3038,13 @@ or the local and remote mount point name
  .IP
  or ``STR'', followed by the stream name;
  .IP
@@ -235,7 +235,7 @@ Index: lsof_4.91_src/lsof.8
  name as
  .I lsof
  can find in the kernel's name cache for selected dialects
-@@ -3055,7 +3055,7 @@ can find in the kernel's name cache for
+@@ -3052,7 +3052,7 @@ can find in the kernel's name cache for
  .B "KERNEL NAME CACHE"
  section for more information.);
  .IP
@@ -244,7 +244,7 @@ Index: lsof_4.91_src/lsof.8
  .IP
  or ``COMMON:'', followed by the vnode device information structure's
  device name, for a Solaris common vnode;
-@@ -3096,7 +3096,7 @@ by the transmit and receive queue sizes,
+@@ -3093,7 +3093,7 @@ by the transmit and receive queue sizes,
  .IP
  or ``dgram'' or ``stream'' for the type UnixWare 7.1.1 and above in\-kernel
  UNIX domain sockets, followed by a colon (':') and the local path name
@@ -253,7 +253,7 @@ Index: lsof_4.91_src/lsof.8
  socket address in hexadecimal when available;
  .IP
  or the association value, association index, endpoint value, local address,
-@@ -3110,9 +3110,9 @@ file to be attached to another with
+@@ -3107,9 +3107,9 @@ file to be attached to another with
  .I lsof
  will add ``(FA:<address1><direction><address2>)'' to the NAME column.
  <address1> and <address2> are hexadecimal vnode addresses.
@@ -265,7 +265,7 @@ Index: lsof_4.91_src/lsof.8
  fattach'ed to <address2>.
  <address1> may be omitted if it already appears in the DEVICE column.
  .PP
-@@ -3593,7 +3593,7 @@ for file systems from its mount table, u
+@@ -3590,7 +3590,7 @@ for file systems from its mount table, u
  incantation to see if it reports any alternate device numbers:
  .PP
  .IP
@@ -274,7 +274,7 @@ Index: lsof_4.91_src/lsof.8
  .PP
  Look for standard error file warning messages that
  begin ``assuming "dev=xxxx" from ...''.
-@@ -3612,7 +3612,7 @@ reports the complete paths it finds in t
+@@ -3609,7 +3609,7 @@ reports the complete paths it finds in t
  If
  .I lsof
  can't report all components in a path, it reports in the NAME column
@@ -283,7 +283,7 @@ Index: lsof_4.91_src/lsof.8
  space, and the name components it has located, separated by
  the `/' character.
  .PP
-@@ -4185,32 +4185,32 @@ lsof
+@@ -4182,32 +4182,32 @@ lsof
  .PP
  To list all open Internet, x.25 (HP\-UX), and UNIX domain files, use:
  .IP
@@ -322,7 +322,7 @@ Index: lsof_4.91_src/lsof.8
  .PP
  To list all open files on device /dev/hd4, use:
  .IP
-@@ -4222,7 +4222,7 @@ lsof /u/abe/foo
+@@ -4219,7 +4219,7 @@ lsof /u/abe/foo
  .PP
  To send a SIGHUP to the processes that have /u/abe/bar open, use:
  .IP
@@ -331,7 +331,7 @@ Index: lsof_4.91_src/lsof.8
  .PP
  To find any open file, including an open UNIX domain socket file,
  with the name
-@@ -4238,27 +4238,27 @@ the device number for
+@@ -4235,27 +4235,27 @@ the device number for
  .IR /nfs/mount/point ,
  use:
  .IP
@@ -364,7 +364,7 @@ Index: lsof_4.91_src/lsof.8
  .PP
  To list the current working directory of processes running a command that
  is exactly four characters long and has an 'o' or 'O' in character three,
-@@ -4266,31 +4266,31 @@ use this regular expression form of the
+@@ -4263,31 +4263,31 @@ use this regular expression form of the
  .BI \-c " c"
  option:
  .IP
diff --git a/debian/patches/series b/debian/patches/series
index dcc2cfe37881d610b143e820601ea7a720974420..9f127059e4db127101f422533f65a36f38ddeb2a 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,4 +3,4 @@ examples
 tests
 obsolete
 preset-ccdate
-majorminor
+ftbfs
diff --git a/debian/repack.stub b/debian/repack.stub
deleted file mode 100644
index 76b65bd86c7f95039915e96314a311e18546ea7d..0000000000000000000000000000000000000000
--- a/debian/repack.stub
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/bin/sh
-
-: <<=cut
-=pod
-
-=head1 NAME
-
-repack.stub - script to repack upstream tarballs from uscan
-
-=head1 INSTRUCTIONS
-
-put this in debian/repack.stub and add "debian sh debian/repack.stub" to
-the end of the line in debian/watch. you will also need to add a version
-mangle to debian/watch.
-
-then create a debian/repack.local. this is a shell script that is
-sourced under "set -e", so be careful to check returns codes.
-
-=head1 FUNCTIONS
-
-=over 4
-
-=item rm
-
-rm is replaced by a function that does some magic ("rm -rv" by default), but also changes MANIFEST if $MANIFEST is 1
-
-=item mv
-
-mv is replaced by a function that just does mv (by default), but also changes MANIFEST if $MANIFEST is 1
-
-=item requires_version
-
-requires_version is there for future usage for requiring certain versions of the script
-
-=back
-
-=head1 VARIABLES
-
-=over 4
-
-=item SUFFIX
-
-defaults to +dfsg
-
-what to append to the upstream version
-
-=item RM_OPTS
-
-defaults to -vrf
-
-options to pass to rm
-
-=item MANIFEST
-
-defaults to 0, set to 1 to turn on.
-
-this will manipulate MANIFEST files in CPAN tarballs.
-
-=item UP_BASE
-
-this is the directory where the upstream source is.
-
-=back
-
-=cut
-
-if [ -z "$REPACK_SH" ]; then
-    if [ -f ../../scripts/repack.sh ]; then
-        REPACK_SH=../../scripts/repack.sh
-    fi
-    if [ -z "$REPACK_SH" ] && which repack.sh > /dev/null; then
-        REPACK_SH=$(which repack.sh)
-    fi
-fi
-
-if [ ! -f "$REPACK_SH" ]; then
-    echo "Couldn't find a repack.sh. please put it in your PATH, put it at ../../scripts/repack.sh, or put it somewhere else and set the REPACK_SH variable"
-    echo "You can get it from http://anonscm.debian.org/gitweb/?p=pkg-perl/scripts.git;a=blob_plain;f=repack.sh;hb=HEAD"
-    exit 1
-fi
-
-exec "$REPACK_SH" "$@"
diff --git a/debian/rules b/debian/rules
index 05288f52ebc7b080dfaac0725065447ecb2a6aef..def6e7a3cea470fefe12d2ca4def2efe0e36c00f 100755
--- a/debian/rules
+++ b/debian/rules
@@ -51,6 +51,11 @@ override_dh_auto_configure:
 override_dh_installchangelogs:
 	dh_installchangelogs 00DIST
 
+override_dh_installman:
+	soelim Lsof.8 > lsof.8
+	dh_installman --
+	rm -f lsof.8
+
 override_dh_auto_test:
 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
 	cd tests && make test && make opt && cd -
diff --git a/debian/watch b/debian/watch
index aaf0ab3cbd978ffe3baa71b10dabe29ea08b4779..6e392816934e914901164e5111d936a3b0f20b2e 100644
--- a/debian/watch
+++ b/debian/watch
@@ -1,11 +1,4 @@
-version=3
-opts=dversionmangle=s/\+dfsg\d*$//,pasv \
-    ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_([\d.]+)\.tar\.gz \
-    debian sh debian/repack.stub
-opts=dversionmangle=s/\+dfsg\d*$//,pasv \
-    ftp://ftp.fu-berlin.de/pub/unix/tools/lsof/lsof_([\d.]+)\.tar\.gz \
-    debian sh debian/repack.stub
-opts=dversionmangle=s/\+dfsg\d*$//,pasv \
-    ftp://sunsite.ualberta.ca/pub/Mirror/lsof/lsof_([\d.]+)\.tar\.gz \
-    debian sh debian/repack.stub
-
+version=4
+opts="dversionmangle=auto, repacksuffix=+dfsg" \
+    https://github.com/lsof-org/lsof/releases \
+    .*/(.+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
diff --git a/dialects/darwin/libproc/dfile.c b/dialects/darwin/libproc/dfile.c
index 6b99c66aae36e3ea07b404c5f2933bd85e87b54b..0156174ddd1f95e0c919c66e3eb596b5ca120f6c 100644
--- a/dialects/darwin/libproc/dfile.c
+++ b/dialects/darwin/libproc/dfile.c
@@ -43,7 +43,7 @@ static char *rcsid = "$Id: dfile.c,v 1.9 2018/02/14 14:27:57 abe Exp $";
 #include "lsof.h"
 
 #if	defined(PROC_FP_GUARDED)
-#extern	struct pff_tab	Pgf_tab[];
+extern	struct pff_tab	Pgf_tab[];
 #endif	/* defined(PROC_FP_GUARDED) */
 
 
diff --git a/dialects/freebsd/X b/dialects/freebsd/X
new file mode 100644
index 0000000000000000000000000000000000000000..ae06101971b38f49dfcc7d08ccf8fb17b61c7ab4
--- /dev/null
+++ b/dialects/freebsd/X
@@ -0,0 +1,7 @@
+#undef	bcmp		/* avoid _KERNEL conflict */
+#undef	bcopy		/* avoid _KERNEL conflict */
+#undef	bzero		/* avoid _KERNEL conflict */
+#undef	memcmp		/* avoid _KERNEL conflict */
+#undef	memcpy		/* avoid _KERNEL conflict */
+#undef	memmove		/* avoid _KERNEL conflict */
+#undef	memset		/* avoid _KERNEL conflict */
diff --git a/dialects/freebsd/dlsof.h b/dialects/freebsd/dlsof.h
index bcb59bc29766c1facadfe05ee3884441ce92a739..606a6de6de87bc83e29a7bca1365c52a8ace6cf3 100644
--- a/dialects/freebsd/dlsof.h
+++ b/dialects/freebsd/dlsof.h
@@ -31,7 +31,7 @@
 
 
 /*
- * $Id: dlsof.h,v 1.48 2018/02/14 14:26:03 abe Exp $
+ * $Id: dlsof.h,v 1.49 2018/07/14 12:14:55 abe Exp $
  */
 
 
@@ -87,6 +87,14 @@
 #define	boolean_t	int
 #  endif	/* defined(NEEDS_BOOLEAN_T) */
 
+#  if defined(NEEDS_DEVICE_T)
+/*
+ * In FreeBSD 12 <sys/conf.h calls <sys/eventhandler.h> and it needs
+ * the device_t typedef.
+ */
+typedef	struct device	*device_t;
+#endif /* defined(NEEDS_DEVICE_T) */
+
 /*
  * Define KLD_MODULE to avoid the error "ARM_NMMUS is 0" from ARM's
  * <machine/cpuconf.h>.
@@ -488,7 +496,13 @@ struct vop_advlock_args { int dummy; };	/* to pacify lf_advlock() prototype */
 #  endif	/* FREEBSDV<5000 */
 # endif        /* FREEBSDV>=2020 */
 
+#undef	bcmp		/* avoid _KERNEL conflict */
+#undef	bcopy		/* avoid _KERNEL conflict */
 #undef	bzero		/* avoid _KERNEL conflict */
+#undef	memcmp		/* avoid _KERNEL conflict */
+#undef	memcpy		/* avoid _KERNEL conflict */
+#undef	memmove		/* avoid _KERNEL conflict */
+#undef	memset		/* avoid _KERNEL conflict */
 #include <string.h>
 
 
diff --git a/dialects/linux/dsock.c b/dialects/linux/dsock.c
index 0df77b1f3d7526ceedefae0d8dbb2061c69c2ca9..2ebf07e31386c85e7e7ed290ed67e67c2679e924 100644
--- a/dialects/linux/dsock.c
+++ b/dialects/linux/dsock.c
@@ -581,12 +581,24 @@ clear_uxsinfo()
 	int h;				/* hash index */
 	uxsin_t *ui, *up;		/* remporary pointers */
 
+#if	defined(HASEPTOPTS) && defined(HASUXSOCKEPT)
+	pxinfo_t *pp, *pnp;
+#endif	/* defined(HASEPTOPTS) && defined(HASUXSOCKEPT) */
+
 	if (!Uxsin)
 	    return;
 	for (h = 0; h < INOBUCKS; h++) {
 	    if ((ui = Uxsin[h])) {
 		do {
 		    up = ui->next;
+
+#if	defined(HASEPTOPTS) && defined(HASUXSOCKEPT)
+		    for (pp = ui->pxinfo; pp; pp = pnp) {
+		        pnp = pp->next;
+		        (void) free((FREE_P *)pp);
+		    }
+#endif	/* defined(HASEPTOPTS) && defined(HASUXSOCKEPT) */
+
 		    if (ui->path)
 			(void) free((FREE_P *)ui->path);
 		    if (ui->pcb)
diff --git a/dialects/sun/distfile.kvm b/dialects/sun/distfile.kvm
new file mode 100644
index 0000000000000000000000000000000000000000..9559172ab623463f2e08cef332e9f27daf4897ae
--- /dev/null
+++ b/dialects/sun/distfile.kvm
@@ -0,0 +1,14 @@
+# $Id: distfile.kvm,v 1.1 94/05/03 16:04:00 abe Exp $
+#
+# distfile.kvm -- an assist to distributing SunOS objects that use -lkvm
+#
+# This distfile allows Sun4 systems to limit distribution of object files
+# to systems of like architecture, using the source architecture definition
+# in SKVM and the destination architecture definition in KVM.
+#
+# The path of the object to be distributed is defined in OBJPATH.
+
+ifelse(SKVM,KVM,
+`( OBJPATH ) -> ( HOST )
+	install -b ;
+')dnl
diff --git a/lsof.h b/lsof.h
index eea3822b34ee25aa0d15ee3f9d184ee9a9ea3d8e..44a2848b3b78f4d46d466aaf33abcbba466f4584 100644
--- a/lsof.h
+++ b/lsof.h
@@ -303,7 +303,12 @@ static struct utmp dummy_utmp;		/* to get login name length */
 # endif	/* !defined(LOGINML) */
 
 #define	LPROCINCR	128		/* Lproc[] allocation increment */
-#define	LSOF_URL	"ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/"
+#define	LSOF_GITHUB_URL	"https://github.com/lsof-org"
+#define	LSOF_REPO	"lsof"
+#define	LSOF_BRANCH	"master"
+#define	LSOF_REPO_URL	LSOF_GITHUB_URL "/" LSOF_REPO
+#define	LSOF_FAQ_URL	LSOF_REPO_URL "/blob/" LSOF_BRANCH "/00FAQ"
+#define	LSOF_MAN_URL	LSOF_REPO_URL "/blob/" LSOF_BRANCH "/Lsof.8"
 #define	MIN_AF_ADDR	sizeof(struct in_addr)
 					/* minimum AF_* address length */
 
diff --git a/lsof.man b/lsof.man
deleted file mode 100644
index 92ae414ec3b980f7b21f135faaab875adcfb78ff..0000000000000000000000000000000000000000
--- a/lsof.man
+++ /dev/null
@@ -1,3960 +0,0 @@
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-NAME
-     lsof - list open files
-
-SYNOPSIS
-     lsof [ -?abChlnNOPRtUvVX ] [ -A A ] [ -c c ] [ +c c ] [ +|-d
-     d ] [ +|-D D ] [ +|-e s ] [ +|-E ] [ +|-f [cfgGn] ] [ -F [f]
-     ] [ -g [s] ] [ -i [i] ] [ -k k ] [ -K k ] [  +|-L  [l]  ]  [
-     +|-m m ] [ +|-M ] [ -o [o] ] [ -p s ] [ +|-r [t[m<fmt>]] ] [
-     -s [p:s] ] [ -S [t] ] [ -T [t] ] [ -u s ] [ +|-w ] [ -x [fl]
-     ] [ -z [z] ] [ -Z [Z] ] [ -- ] [names]
-
-DESCRIPTION
-     Lsof revision 4.91 lists on its standard output file  infor-
-     mation  about  files  opened  by processes for the following
-     UNIX dialects:
-
-          Apple Darwin 9 and Mac OS X 10.[567]
-          FreeBSD 8.[234], 9.0 and 1[012].0 for AMD64-based systems
-          Linux 2.1.72 and above for x86-based systems
-          Solaris 9, 10 and 11
-
-     (See the DISTRIBUTION section of this manual page for infor-
-     mation on how to obtain the latest lsof revision.)
-
-     An open file may be a regular file,  a  directory,  a  block
-     special  file,  a  character special file, an executing text
-     reference, a library, a stream or a network  file  (Internet
-     socket, NFS file or UNIX domain socket.)  A specific file or
-     all the files in a file system may be selected by path.
-
-     Instead of a formatted display,  lsof  will  produce  output
-     that  can  be  parsed by other programs.  See the -F, option
-     description, and the OUTPUT FOR OTHER PROGRAMS  section  for
-     more information.
-
-     In addition to producing a single output list, lsof will run
-     in  repeat  mode.   In  repeat  mode it will produce output,
-     delay, then repeat the output operation until  stopped  with
-     an  interrupt  or  quit  signal.   See  the +|-r [t[m<fmt>]]
-     option description for more information.
-
-OPTIONS
-     In the absence of any options, lsof  lists  all  open  files
-     belonging to all active processes.
-
-     If any list request option is specified, other list requests
-     must  be  specifically  requested - e.g., if -U is specified
-     for the listing of UNIX socket files,  NFS  files  won't  be
-     listed  unless  -N  is  also specified; or if a user list is
-     specified with the -u  option,  UNIX  domain  socket  files,
-     belonging  to  users not in the list, won't be listed unless
-     the -U option is also specified.
-
-
-
-SunOS 5.9          Last change: Revision-4.91                   1
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-     Normally list options that are specifically stated are  ORed
-     -  i.e., specifying the -i option without an address and the
-     -ufoo option produces a listing  of  all  network  files  OR
-     files  belonging  to  processes  owned by user ``foo''.  The
-     exceptions are:
-
-     1) the `^' (negated) login name or user ID (UID),  specified
-        with the -u option;
-
-     2) the `^' (negated) process ID (PID), specified with the -p
-        option;
-
-     3) the `^' (negated) process group ID (PGID), specified with
-        the -g option;
-
-     4) the `^' (negated) command, specified with the -c option;
-
-     5) the (`^') negated TCP or UDP protocol state names, speci-
-        fied with the -s [p:s] option.
-
-     Since they represent exclusions, they  are  applied  without
-     ORing  or  ANDing and take effect before any other selection
-     criteria are applied.
-
-     The -a option may be used to AND the selections.  For  exam-
-     ple, specifying -a, -U, and -ufoo produces a listing of only
-     UNIX socket files that belong to  processes  owned  by  user
-     ``foo''.
-
-     Caution: the -a option causes all list selection options  to
-     be ANDed; it can't be used to cause ANDing of selected pairs
-     of selection options by placing it between them, even though
-     its  placement  there is acceptable.  Wherever -a is placed,
-     it causes the ANDing of all selection options.
-
-     Items of the  same  selection  set  -  command  names,  file
-     descriptors,  network  addresses,  process identifiers, user
-     identifiers, zone names, security contexts - are joined in a
-     single  ORed  set and applied before the result participates
-     in  ANDing.   Thus,  for  example,  specifying   -i@aaa.bbb,
-     -i@ccc.ddd,  -a,  and  -ufff,ggg  will select the listing of
-     files that belong to either login  ``fff''  OR  ``ggg''  AND
-     have network connections to either host aaa.bbb OR ccc.ddd.
-
-     Options may be grouped together following a single prefix --
-     e.g.,  the  option  set  ``-a -b -C'' may be stated as -abC.
-     However, since values are optional following +|-f,  -F,  -g,
-     -i, +|-L, -o, +|-r, -s, -S, -T, -x and -z.  when you have no
-     values for them be  careful  that  the  following  character
-     isn't  ambiguous.   For  example, -Fn might represent the -F
-     and -n options, or it might represent the n field identifier
-     character  following  the  -F  option.   When  ambiguity  is
-
-
-
-SunOS 5.9          Last change: Revision-4.91                   2
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-     possible, start a new option with a `-'  character  -  e.g.,
-     ``-F  -n''.   If  the next option is a file name, follow the
-     possibly ambiguous  option  with  ``--''  -  e.g.,  ``-F  --
-     name''.
-
-     Either the `+' or the `-' prefix may be applied to  a  group
-     of  options.   Options  that don't take on separate meanings
-     for each prefix - e.g., -i - may  be  grouped  under  either
-     prefix.   Thus,  for  example,  ``+M  -i''  may be stated as
-     ``+Mi'' and  the  group  means  the  same  as  the  separate
-     options.   Be  careful  of  prefix grouping when one or more
-     options in the group does take on  separate  meanings  under
-     different  prefixes  -  e.g.,  +|-M; ``-iM'' is not the same
-     request as ``-i +M''.  When in doubt, use  separate  options
-     with appropriate prefixes.
-
-     -? -h    These two equivalent options select a usage  (help)
-              output  list.   Lsof  displays  a shortened form of
-              this output when it detects an error in the options
-              supplied  to  it,  after  it has displayed messages
-              explaining each error.  (Escape the  `?'  character
-              as your shell requires.)
-
-     -a       causes list  selection  options  to  be  ANDed,  as
-              described above.
-
-     -A A     is available on systems configured  for  AFS  whose
-              AFS kernel code is implemented via dynamic modules.
-              It allows the lsof user to specify A as  an  alter-
-              nate  name  list file where the kernel addresses of
-              the dynamic modules might be found.  See  the  lsof
-              FAQ (The FAQ section gives its location.)  for more
-              information about dynamic modules,  their  symbols,
-              and how they affect lsof.
-
-     -b       causes lsof to avoid kernel  functions  that  might
-              block - lstat(2), readlink(2), and stat(2).
-
-              See the BLOCKS AND  TIMEOUTS  and  AVOIDING  KERNEL
-              BLOCKS  sections  for  information  on  using  this
-              option.
-
-     -c c     selects the listing of files for processes  execut-
-              ing  the command that begins with the characters of
-              c.  Multiple commands may be specified, using  mul-
-              tiple -c options.  They are joined in a single ORed
-              set before participating in AND option selection.
-
-              If c begins with a `^', then the following  charac-
-              ters  specify a command name whose processes are to
-              be ignored (excluded.)
-
-
-
-
-SunOS 5.9          Last change: Revision-4.91                   3
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-              If c begins and ends with a slash ('/'), the  char-
-              acters  between  the  slashes  are interpreted as a
-              regular expression.  Shell meta-characters  in  the
-              regular  expression must be quoted to prevent their
-              interpretation by the shell.  The closing slash may
-              be followed by these modifiers:
-
-
-                   b    the regular expression is a basic one.
-                   i    ignore the case of letters.
-                   x    the regular expression is an extended one
-                        (default).
-
-              See the lsof FAQ (The FAQ section gives  its  loca-
-              tion.)   for more information on basic and extended
-              regular expressions.
-
-              The simple command specification is  tested  first.
-              If  that test fails, the command regular expression
-              is applied.  If the simple command  test  succeeds,
-              the  command  regular  expression  test isn't made.
-              This may result in ``no command found for  regex:''
-              messages when lsof's -V option is specified.
-
-     +c w     defines the maximum number of initial characters of
-              the name, supplied by the UNIX dialect, of the UNIX
-              command associated with a process to be printed  in
-              the COMMAND column.  (The lsof default is nine.)
-
-              Note that many UNIX dialects do not supply all com-
-              mand  name  characters  to  lsof  in  the files and
-              structures from which lsof  obtains  command  name.
-              Often  dialects limit the number of characters sup-
-              plied in those sources.  For example, Linux  2.4.27
-              and  Solaris 9 both limit command name length to 16
-              characters.
-
-              If w is zero ('0'), all command characters supplied
-              to lsof by the UNIX dialect will be printed.
-
-              If w is less than the length of the  column  title,
-              ``COMMAND'', it will be raised to that length.
-
-     -C       disables the reporting of any path name  components
-              from  the kernel's name cache.  See the KERNEL NAME
-              CACHE section for more information.
-
-     +d s     causes lsof to search for  all  open  instances  of
-              directory  s  and the files and directories it con-
-              tains at its top level.  +d does  NOT  descend  the
-              directory  tree,  rooted at s.  The +D D option may
-              be used to request a  full-descent  directory  tree
-
-
-
-SunOS 5.9          Last change: Revision-4.91                   4
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-              search, rooted at directory D.
-
-              Processing of the +d option does  not  follow  sym-
-              bolic  links within s unless the -x or -x  l option
-              is also specified.  Nor does  it  search  for  open
-              files on file system mount points on subdirectories
-              of s unless the -x or -x  f option is  also  speci-
-              fied.
-
-              Note: the authority of the user of this option lim-
-              its  it  to  searching  for files that the user has
-              permission to examine with the system stat(2) func-
-              tion.
-
-     -d s     specifies a  list  of  file  descriptors  (FDs)  to
-              exclude from or include in the output listing.  The
-              file   descriptors    are    specified    in    the
-              comma-separated   set   s   -   e.g.,  ``cwd,1,3'',
-              ``^6,^2''.  (There should be no spaces in the set.)
-
-              The list is an exclusion list if all entries of the
-              set  begin with `^'.  It is an inclusion list if no
-              entry begins with `^'.  Mixed lists are not permit-
-              ted.
-
-              A file descriptor number range may be in the set as
-              long  as  neither member is empty, both members are
-              numbers, and the ending member is larger  than  the
-              starting  one  - e.g., ``0-7'' or ``3-10''.  Ranges
-              may be specified for exclusion if they have the `^'
-              prefix  - e.g., ``^0-7'' excludes all file descrip-
-              tors 0 through 7.
-
-              Multiple file descriptor numbers are  joined  in  a
-              single  ORed set before participating in AND option
-              selection.
-
-              When there are exclusion and inclusion  members  in
-              the set, lsof reports them as errors and exits with
-              a non-zero return code.
-
-              See the description of File Descriptor (FD)  output
-              values  in  the OUTPUT section for more information
-              on file descriptor names.
-
-     +D D     causes lsof to search for  all  open  instances  of
-              directory  D  and  all the files and directories it
-              contains to its complete depth.
-
-              Processing of the +D option does  not  follow  sym-
-              bolic  links within D unless the -x or -x  l option
-              is also specified.  Nor does  it  search  for  open
-
-
-
-SunOS 5.9          Last change: Revision-4.91                   5
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-              files on file system mount points on subdirectories
-              of D unless the -x or -x  f option is  also  speci-
-              fied.
-
-              Note: the authority of the user of this option lim-
-              its  it  to  searching  for files that the user has
-              permission to examine with the system stat(2) func-
-              tion.
-
-              Further note:  lsof may process this option  slowly
-              and  require a large amount of dynamic memory to do
-              it.  This is because it  must  descend  the  entire
-              directory  tree,  rooted  at D, calling stat(2) for
-              each file and directory, building a list of all the
-              files it finds, and searching that list for a match
-              with every open file.  When directory D  is  large,
-              these  steps  can  take  a  long  time, so use this
-              option prudently.
-
-     -D D     directs lsof's use of the device cache  file.   The
-              use  of  this  option is sometimes restricted.  See
-              the DEVICE CACHE FILE section and the sections that
-              follow it for more information on this option.
-
-              -D must be followed by a function letter; the func-
-              tion  letter  may  optionally be followed by a path
-              name.  Lsof recognizes these function letters:
-
-
-                   ? - report device cache file paths
-                   b - build the device cache file
-                   i - ignore the device cache file
-                   r - read the device cache file
-                   u - read and update the device cache file
-
-              The b, r, and u functions, accompanied  by  a  path
-              name,  are  sometimes restricted.  When these func-
-              tions are restricted, they will not appear  in  the
-              description of the -D option that accompanies -h or
-              -? option output.  See the DEVICE CACHE  FILE  sec-
-              tion  and  the  sections  that  follow  it for more
-              information on these  functions  and  when  they're
-              restricted.
-
-              The ? function  reports  the  read-only  and  write
-              paths  that lsof can use for the device cache file,
-              the names of any environment variables whose values
-              lsof  will  examine  when  forming the device cache
-              file path, and the format for the  personal  device
-              cache file path.  (Escape the `?' character as your
-              shell requires.)
-
-
-
-
-SunOS 5.9          Last change: Revision-4.91                   6
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-              When available, the b, r, and u  functions  may  be
-              followed  by  the  device  cache  file's path.  The
-              standard default  is  .lsof_hostname  in  the  home
-              directory  of  the real user ID that executes lsof,
-              but this could have been changed when lsof was con-
-              figured and compiled.  (The output of the -h and -?
-              options show the current  default  prefix  -  e.g.,
-              ``.lsof''.)   The  suffix,  hostname,  is the first
-              component of the host's name returned  by  gethost-
-              name(2).
-
-              When available, the  b  function  directs  lsof  to
-              build  a  new  device  cache file at the default or
-              specified path.
-
-              The i function directs lsof to ignore  the  default
-              device  cache file and obtain its information about
-              devices via direct calls to the kernel.
-
-              The r function directs  lsof  to  read  the  device
-              cache   at  the  default  or  specified  path,  but
-              prevents it from creating a new device  cache  file
-              when  none exists or the existing one is improperly
-              structured.  The r function, when specified without
-              a   path  name,  prevents  lsof  from  updating  an
-              incorrect or outdated device cache file, or  creat-
-              ing  a  new  one  in  its place.  The r function is
-              always available when it  is  specified  without  a
-              path  name  argument;  it  may be restricted by the
-              permissions of the lsof process.
-
-              When available, the u function directs lsof to read
-              the  device  cache file at the default or specified
-              path, if possible, and to rebuild it, if necessary.
-              This is the default device cache file function when
-              no -D option has been specified.
-
-     +|-e s   exempts the file system whose path name is  s  from
-              being subjected to kernel function calls that might
-              block.  The +e option exempts stat(2), lstat(2) and
-              most  readlink(2)  kernel  function  calls.  The -e
-              option exempts only  stat(2)  and  lstat(2)  kernel
-              function  calls.   Multiple  file  systems  may  be
-              specified with  separate  +|-e  specifications  and
-              each may have readlink(2) calls exempted or not.
-
-              This  option  is  currently  implemented  only  for
-              Linux.
-
-              CAUTION: this option can easily be  mis-applied  to
-              other  than the file system of interest, because it
-              uses path name rather than the more reliable device
-
-
-
-SunOS 5.9          Last change: Revision-4.91                   7
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-              and  inode  numbers.  (Device and inode numbers are
-              acquired via the potentially blocking stat(2)  ker-
-              nel  call  and  are thus not available, but see the
-              +|-m m option as a possible alternative way to sup-
-              ply  device  numbers.)   Use this option with great
-              care and fully specify the path name  of  the  file
-              system to be exempted.
-
-              When  open  files  on  exempted  file  systems  are
-              reported,  it  may  not  be  possible to obtain all
-              their  information.   Therefore,  some  information
-              columns will be blank, the characters ``UNKN'' pre-
-              face the values in the TYPE column, and the  appli-
-              cable  exemption  option is added in parentheses to
-              the end of the NAME column.   (Some  device  number
-              information  might be made available via the +|-m m
-              option.)
-
-     +|-E     +E specifies that Linux pipe, Linux UNIX socket and
-              Linux pseudoterminal files should be displayed with
-              endpoint information and the files of the endpoints
-              should  also  be displayed.  Note: UNIX socket file
-              endpoint information is  only  available  when  the
-              compile  flags  line  of  -v output contains HASUX-
-              SOCKEPT, and psudoterminal endpoint information  is
-              only available when the compile flags line contains
-              HASPTYEPT.
-
-              Pipe endpoint information is displayed in the  NAME
-              column in the form ``PID,cmd,FDmode'', where PID is
-              the endpoint process ID; cmd is the  endpoint  pro-
-              cess command; FD is the endpoint file's descriptor;
-              and mode is the endpoint file's access mode.
-
-              Pseudoterminal endpoint information is displayed in
-              the NAME column as ``->/dev/ptsmin PID,cmd,FDmode''
-              or ``PID,cmd,FDmode''.  The first  form  is  for  a
-              master device; the second, for a slave device.  min
-              is a slave device's minor device number;  and  PID,
-              cmd, FD and mode are the same as with pipe endpoint
-              information.  Note: psudoterminal endpoint informa-
-              tion  is only available when the compile flags line
-              of -V output contains HASPTYEPT.
-
-              UNIX socket file endpoint information is  displayed
-              in the NAME column in the form
-              ``type=TYPE ->INO=INODE PID,cmd,FDmode'',     where
-              TYPE is the socket type; INODE is the i-node number
-              of the connected socket; and PID, cmd, FD and  mode
-              are  the  same  as  with pipe endpoint information.
-              Note: UNIX  socket  file  endpoint  information  is
-              available  only  when  the compile flags line of -v
-
-
-
-SunOS 5.9          Last change: Revision-4.91                   8
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-              output contains HASUXSOCKEPT.
-
-              Multiple occurrences of this information can appear
-              in a file's NAME column.
-
-              -E specfies that Linux pipe and Linux  UNIX  socket
-              files  should  be  displayed with endpoint informa-
-              tion, but not the files of the endpoints.
-
-     +|-f [cfgGn]
-              f by itself clarifies how path name  arguments  are
-              to be interpreted.  When followed by c, f, g, G, or
-              n in any combination it specifies that the  listing
-              of  kernel  file  structure  information  is  to be
-              enabled (`+') or inhibited (`-').
-
-              Normally a path name argument is taken to be a file
-              system  name  if  it matches a mounted-on directory
-              name reported by mount(8), or if  it  represents  a
-              block device, named in the mount output and associ-
-              ated with a mounted directory  name.   When  +f  is
-              specified, all path name arguments will be taken to
-              be file system names, and lsof will complain if any
-              are not.  This can be useful, for example, when the
-              file system name (mounted-on device) isn't a  block
-              device.  This happens for some CD-ROM file systems.
-
-              When -f is specified by itself, all path name argu-
-              ments  will be taken to be simple files.  Thus, for
-              example, the ``-f -- /'' arguments direct  lsof  to
-              search for open files with a `/' path name, not all
-              open files in the `/' (root) file system.
-
-              Be careful to make sure +f and -f are properly ter-
-              minated  and  aren't followed by a character (e.g.,
-              of the file or file  system  name)  that  might  be
-              taken  as  a  parameter.   For  example, use ``--''
-              after +f and -f as in these examples.
-
-
-                   $ lsof +f -- /file/system/name
-                   $ lsof -f -- /file/name
-
-              The listing of information from kernel file  struc-
-              tures,  requested  with the +f [cfgGn] option form,
-              is normally inhibited,  and  is  not  available  in
-              whole or part for some dialects - e.g., /proc-based
-              Linux kernels below 2.6.22.  When the prefix  to  f
-              is a plus sign (`+'), these characters request file
-              structure information:
-
-
-
-
-
-SunOS 5.9          Last change: Revision-4.91                   9
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-                   c    file structure use count (not Linux)
-                   f    file structure address (not Linux)
-                   g    file flag abbreviations (Linux 2.6.22 and up)
-                   G    file flags in hexadecimal (Linux 2.6.22 and up)
-                   n    file structure node address (not Linux)
-
-              When the prefix is minus (`-') the same  characters
-              disable the listing of the indicated values.
-
-              File structure addresses, use  counts,  flags,  and
-              node  addresses  may be used to detect more readily
-              identical files inherited by  child  processes  and
-              identical  files  in  use  by  different processes.
-              Lsof column output can be sorted by output  columns
-              holding the values and listed to identify identical
-              file use, or lsof field output can be parsed by  an
-              AWK or Perl post-filter script, or by a C program.
-
-     -F f     specifies a character list,  f,  that  selects  the
-              fields  to be output for processing by another pro-
-              gram, and the character that terminates each output
-              field.  Each field to be output is specified with a
-              single  character  in  f.   The  field   terminator
-              defaults  to  NL,  but may be changed to NUL (000).
-              See the OUTPUT FOR OTHER  PROGRAMS  section  for  a
-              description  of the field identification characters
-              and the field output process.
-
-              When the field selection character list  is  empty,
-              all  standard  fields  are selected (except the raw
-              device field, security context and zone  field  for
-              compatibility  reasons) and the NL field terminator
-              is used.
-
-              When the field selection  character  list  contains
-              only  a zero (`0'), all fields are selected (except
-              the raw device field for compatibility reasons) and
-              the NUL terminator character is used.
-
-              Other combinations of fields and  their  associated
-              field  terminator character must be set with expli-
-              cit entries in f, as described in  the  OUTPUT  FOR
-              OTHER PROGRAMS section.
-
-              When a field selection character identifies an item
-              lsof  does not normally list - e.g., PPID, selected
-              with -R - specification of the  field  character  -
-              e.g.,  ``-FR''  -  also  selects the listing of the
-              item.
-
-              When the field selection  character  list  contains
-              the  single character `?', lsof will display a help
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  10
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-              list  of  the  field   identification   characters.
-              (Escape the `?' character as your shell requires.)
-
-     -g [s]   excludes or selects the listing of  files  for  the
-              processes  whose optional process group IDentifica-
-              tion (PGID) numbers are in the comma-separated  set
-              s  -  e.g., ``123'' or ``123,^456''.  (There should
-              be no spaces in the set.)
-
-              PGID  numbers  that  begin  with   `^'   (negation)
-              represent exclusions.
-
-              Multiple PGID numbers are joined in a  single  ORed
-              set  before  participating in AND option selection.
-              However, PGID exclusions are applied without  ORing
-              or  ANDing  and  take effect before other selection
-              criteria are applied.
-
-              The -g option also enables the  output  display  of
-              PGID  numbers.   When  specified without a PGID set
-              that's all it does.
-
-     -i [i]   selects the listing of files any of whose  Internet
-              address  matches the address specified in i.  If no
-              address is specified, this option selects the list-
-              ing of all Internet and x.25 (HP-UX) network files.
-
-              If -i4  or  -i6  is  specified  with  no  following
-              address,  only  files  of the indicated IP version,
-              IPv4 or IPv6, are displayed.  (An  IPv6  specifica-
-              tion  may  be  used  only  if the dialects supports
-              IPv6, as indicated by ``[46]'' and  ``IPv[46]''  in
-              lsof's  -h  or -? output.)  Sequentially specifying
-              -i4, followed by -i6 is the same as specifying  -i,
-              and vice-versa.  Specifying -i4, or -i6 after -i is
-              the same as specifying -i4 or -i6 by itself.
-
-              Multiple addresses (up to a limit of  100)  may  be
-              specified with multiple -i options.  (A port number
-              or service name range is counted as  one  address.)
-              They  are joined in a single ORed set before parti-
-              cipating in AND option selection.
-
-              An Internet address is specified in the form (Items
-              in square brackets are optional.):
-
-               [46][protocol][@hostname|hostaddr][:service|port]
-
-              where:
-                   46 specifies the IP version, IPv4 or IPv6
-                        that applies to the following address.
-                        '6' may be be specified only if the UNIX
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  11
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-                        dialect supports IPv6.  If neither '4' nor
-                        '6' is specified, the following address
-                        applies to all IP versions.
-                   protocol is a protocol name - TCP, UDP
-                   hostname is an Internet host name.  Unless a
-                        specific IP version is specified, open
-                        network files associated with host names
-                        of all versions will be selected.
-                   hostaddr is a numeric Internet IPv4 address in
-                        dot form; or an IPv6 numeric address in
-                        colon form, enclosed in brackets, if the
-                        UNIX dialect supports IPv6.  When an IP
-                        version is selected, only its numeric
-                        addresses may be specified.
-                   service is an /etc/services name - e.g., smtp -
-                        or a list of them.
-                   port is a port number, or a list of them.
-
-              IPv6 options may be used only if the  UNIX  dialect
-              supports  IPv6.   To  see  if  the dialect supports
-              IPv6, run lsof and specify  the  -h  or  -?  (help)
-              option.   If  the  displayed  description of the -i
-              option contains ``[46]'' and ``IPv[46]'',  IPv6  is
-              supported.
-
-              IPv4 host names and addresses may not be  specified
-              if  network  file selection is limited to IPv6 with
-              -i 6.  IPv6 host names and  addresses  may  not  be
-              specified  if  network file selection is limited to
-              IPv4 with -i 4.  When an open IPv4  network  file's
-              address  is  mapped  in  an  IPv6 address, the open
-              file's type will be IPv6, not IPv4, and its display
-              will be selected by '6', not '4'.
-
-              At least one address component -  4,  6,  protocol,
-              hostname,  hostaddr, or service - must be supplied.
-              The `@' character, leading the host  specification,
-              is always required; as is the `:', leading the port
-              specification.  Specify  either  hostname  or  hos-
-              taddr.   Specify  either  service name list or port
-              number list.  If a service name list is  specified,
-              the  protocol  may also need to be specified if the
-              TCP, UDP and UDPLITE port numbers for  the  service
-              name  are different.  Use any case - lower or upper
-              - for protocol.
-
-              Service names and port numbers may be combined in a
-              list  whose  entries  are  separated  by commas and
-              whose numeric range entries are separated by  minus
-              signs.   There  may  be no embedded spaces, and all
-              service names must belong to the  specified  proto-
-              col.   Since  service  names  may  contain embedded
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  12
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-              minus signs, the starting entry of a range can't be
-              a service name; it can be a port number, however.
-
-              Here are some sample addresses:
-
-                   -i6 - IPv6 only
-                   TCP:25 - TCP and port 25
-                   @1.2.3.4 - Internet IPv4 host address 1.2.3.4
-                   @[3ffe:1ebc::1]:1234 - Internet IPv6 host address
-                        3ffe:1ebc::1, port 1234
-                   UDP:who - UDP who service port
-                   TCP@lsof.itap:513 - TCP, port 513 and host name lsof.itap
-                   tcp@foo:1-10,smtp,99 - TCP, ports 1 through 10,
-                        service name smtp, port 99, host name foo
-                   tcp@bar:1-smtp - TCP, ports 1 through smtp, host bar
-                   :time - either TCP, UDP or UDPLITE time service port
-
-     -K k     selects  the  listing   of   tasks   (threads)   of
-              processes,  on dialects where task (thread) report-
-              ing is supported.  (If help output - i.e., the out-
-              put  of  the  -h or -? options - shows this option,
-              then task (thread) reporting is  supported  by  the
-              dialect.)
-
-              If -K is followed by a value, k, it must be  ``i''.
-              That  causes  lsof to ignore tasks, particularly in
-              the default, list-everything  case  when  no  other
-              options are specified.
-
-              When -K and -a are both specified on Linux, and the
-              tasks  of  a  main  process  are  selected by other
-              options, the main process will also  be  listed  as
-              though it were a task, but without a task ID.  (See
-              the description of the TID  column  in  the  OUTPUT
-              section.)
-
-              Where the FreeBSD  version  supports  threads,  all
-              threads will be listed with their IDs.
-
-              In general threads and tasks inherit the  files  of
-              the  caller, but may close some and open others, so
-              lsof always reports all the open files  of  threads
-              and tasks.
-
-     -k k     specifies a kernel name list file, k, in  place  of
-              /vmunix, /mach, etc.  -k is not available under AIX
-              on the IBM RISC/System 6000.
-
-     -l       inhibits the conversion of user ID numbers to login
-              names.  It is also useful when login name lookup is
-              working improperly or slowly.
-
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  13
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-     +|-L [l] enables (`+') or disables (`-') the listing of file
-              link  counts, where they are available - e.g., they
-              aren't available for sockets,  or  most  FIFOs  and
-              pipes.
-
-              When +L is specified without  a  following  number,
-              all  link counts will be listed.  When -L is speci-
-              fied (the default), no link counts will be listed.
-
-              When +L is followed by a number, only files  having
-              a  link count less than that number will be listed.
-              (No number may follow -L.)  A specification of  the
-              form  ``+L1'' will select open files that have been
-              unlinked.    A   specification    of    the    form
-              ``+aL1 <file_system>''  will  select  unlinked open
-              files on the specified file system.
-
-              For other link count comparisons, use field  output
-              (-F) and a post-processing script or program.
-
-     +|-m m   specifies  an  alternate  kernel  memory  file   or
-              activates mount table supplement processing.
-
-              The option form -m  m  specifies  a  kernel  memory
-              file,  m, in place of /dev/kmem or /dev/mem - e.g.,
-              a crash dump file.
-
-              The option form +m requests that a mount supplement
-              file  be  written to the standard output file.  All
-              other options are silently ignored.
-
-              There will be a line in the mount  supplement  file
-              for   each  mounted  file  system,  containing  the
-              mounted file system directory, followed by a single
-              space, followed by the device number in hexadecimal
-              "0x" format - e.g.,
-
-
-                   / 0x801
-
-              Lsof can use the mount supplement file to get  dev-
-              ice numbers for file systems when it can't get them
-              via stat(2) or lstat(2).
-
-              The option form +m m identifies m as a  mount  sup-
-              plement file.
-
-              Note: the +m and +m m options are not available for
-              all supported dialects.  Check the output of lsof's
-              -h or -? options to see if the +m and +m m  options
-              are available.
-
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  14
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-     +|-M     Enables (+) or disables (-) the reporting of  port-
-              mapper registrations for local TCP, UDP and UDPLITE
-              ports, where port mapping is supported.   (See  the
-              last  paragraph  of  this  option  description  for
-              information  about  where  portmapper  registration
-              reporting is supported.)
-
-              The default reporting  mode  is  set  by  the  lsof
-              builder  with  the  HASPMAPENABLED  #define  in the
-              dialect's machine.h header file;  lsof  is  distri-
-              buted  with the HASPMAPENABLED #define deactivated,
-              so portmapper reporting is disabled by default  and
-              must be requested with +M.  Specifying lsof's -h or
-              -? option will report the default mode.   Disabling
-              portmapper registration when it is already disabled
-              or enabling it when already enabled is  acceptable.
-              When  portmapper registration reporting is enabled,
-              lsof displays the portmapper registration (if  any)
-              for  local  TCP,  UDP  or  UDPLITE  ports in square
-              brackets immediately following the port numbers  or
-              service    names   -   e.g.,   ``:1234[name]''   or
-              ``:name[100083]''.   The  registration  information
-              may  be  a  name  or  number, depending on what the
-              registering program supplied to the portmapper when
-              it registered the port.
-
-              When portmapper registration reporting is  enabled,
-              lsof  may  run  a little more slowly or even become
-              blocked when access to the portmapper becomes cong-
-              ested  or  stopped.   Reverse the reporting mode to
-              determine if portmapper registration  reporting  is
-              slowing or blocking lsof.
-
-              For purposes of portmapper  registration  reporting
-              lsof considers a TCP, UDP or UDPLITE port local if:
-              it is found in the local  part  of  its  containing
-              kernel  structure;  or  if  it  is  located  in the
-              foreign part of its containing kernel structure and
-              the  local  and  foreign Internet addresses are the
-              same; or if it is located in the  foreign  part  of
-              its  containing  kernel  structure  and the foreign
-              Internet address  is  INADDR_LOOPBACK  (127.0.0.1).
-              This  rule  may make lsof ignore some foreign ports
-              on  machines  with  multiple  interfaces  when  the
-              foreign  Internet  address is on a different inter-
-              face from the local one.
-
-              See the lsof FAQ (The FAQ section gives  its  loca-
-              tion.)  for further discussion of portmapper regis-
-              tration reporting issues.
-
-              Portmapper registration reporting is supported only
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  15
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-              on  dialects  that  have  RPC  header files.  (Some
-              Linux distributions with GlibC  2.14  do  not  have
-              them.)   When  portmapper registration reporting is
-              supported, the -h or -? help output will  show  the
-              +|-M option.
-
-     -n       inhibits the conversion of network numbers to  host
-              names for network files.  Inhibiting conversion may
-              make lsof run faster.  It is also useful when  host
-              name lookup is not working properly.
-
-     -N       selects the listing of NFS files.
-
-     -o       directs lsof to display file offset at  all  times.
-              It  causes  the  SIZE/OFF output column title to be
-              changed to OFFSET.  Note:  on  some  UNIX  dialects
-              lsof  can't  obtain  accurate  or  consistent  file
-              offset information from its  kernel  data  sources,
-              sometimes just for particular kinds of files (e.g.,
-              socket files.)  Consult the lsof FAQ (The FAQ  sec-
-              tion gives its location.)  for more information.
-
-              The -o and -s options are mutually exclusive;  they
-              can't  both  be  specified.  When neither is speci-
-              fied, lsof displays whatever value - size or offset
-              -  is appropriate and available for the type of the
-              file.
-
-     -o o     defines the number of  decimal  digits  (o)  to  be
-              printed  after  the ``0t'' for a file offset before
-              the form is switched to ``0x...''.  An o  value  of
-              zero  (unlimited)  directs  lsof  to use the ``0t''
-              form for all offset output.
-
-              This option does NOT direct lsof to display  offset
-              at  all  times;  specify  -o  (without  a  trailing
-              number) to do that.  -o o only specifies the number
-              of  digits  after  ``0t''  in either mixed size and
-              offset or offset-only output.  Thus,  for  example,
-              to  direct lsof to display offset at all times with
-              a decimal digit count of 10, use:
-
-
-                   -o -o 10
-              or
-                   -oo10
-
-              The default number of digits allowed  after  ``0t''
-              is  normally  8,  but  may have been changed by the
-              lsof builder.  Consult the description of the -o  o
-              option  in  the  output  of  the -h or -? option to
-              determine the default that is in effect.
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  16
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-     -O       directs lsof to bypass  the  strategy  it  uses  to
-              avoid  being  blocked  by  some kernel operations -
-              i.e., doing them in forked  child  processes.   See
-              the  BLOCKS AND TIMEOUTS and AVOIDING KERNEL BLOCKS
-              sections for more information on kernel  operations
-              that may block lsof.
-
-              While use of this option will reduce  lsof  startup
-              overhead,  it  may also cause lsof to hang when the
-              kernel doesn't respond to  a  function.   Use  this
-              option cautiously.
-
-     -p s     excludes or selects the listing of  files  for  the
-              processes  whose  optional  process  IDentification
-              (PID) numbers are in the comma-separated  set  s  -
-              e.g., ``123'' or ``123,^456''.  (There should be no
-              spaces in the set.)
-
-              PID  numbers  that  begin   with   `^'   (negation)
-              represent exclusions.
-
-              Multiple process ID numbers are joined in a  single
-              ORed  set before participating in AND option selec-
-              tion.  However, PID exclusions are applied  without
-              ORing or ANDing and take effect before other selec-
-              tion criteria are applied.
-
-     -P       inhibits the conversion of  port  numbers  to  port
-              names for network files.  Inhibiting the conversion
-              may make lsof run a little faster.  It is also use-
-              ful when port name lookup is not working properly.
-
-     +|-r [t[m<fmt>]]
-              puts lsof in repeat mode.  There  lsof  lists  open
-              files  as  selected  by  other  options,  delays  t
-              seconds (default fifteen), then repeats  the  list-
-              ing,   delaying   and  listing  repetitively  until
-              stopped by a condition defined by the prefix to the
-              option.
-
-              If the prefix is a `-',  repeat  mode  is  endless.
-              Lsof  must  be terminated with an interrupt or quit
-              signal.
-
-              If the prefix is `+',  repeat  mode  will  end  the
-              first  cycle  no  open  files  are  listed - and of
-              course when lsof is stopped with  an  interrupt  or
-              quit  signal.   When  repeat  mode  ends because no
-              files are listed, the process  exit  code  will  be
-              zero  if  any  open files were ever listed; one, if
-              none were ever listed.
-
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  17
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-              Lsof marks the end of each listing:  if field  out-
-              put  is in progress (the -F, option has been speci-
-              fied), the default marker  is  `m';  otherwise  the
-              default marker is ``========''.  The marker is fol-
-              lowed by a NL character.
-
-              The optional "m<fmt>" argument specifies  a  format
-              for  the marker line.  The <fmt> characters follow-
-              ing `m' are interpreted as a  format  specification
-              to  the  strftime(3) function, when both it and the
-              localtime(3)  function   are   available   in   the
-              dialect's C library.  Consult the strftime(3) docu-
-              mentation for what may appear in its format specif-
-              ication.   Note that when field output is requested
-              with the -F option, <fmt>  cannot  contain  the  NL
-              format, ``%n''.  Note also that when <fmt> contains
-              spaces or other characters that affect the  shell's
-              interpretation  of  arguments, <fmt> must be quoted
-              appropriately.
-
-              Repeat mode reduces lsof startup overhead, so it is
-              more  efficient  to use this mode than to call lsof
-              repetitively from a shell script, for example.
-
-              To use repeat mode most efficiently, accompany +|-r
-              with specification of other lsof selection options,
-              so the amount of kernel  memory  access  lsof  does
-              will  be kept to a minimum.  Options that filter at
-              the process level - e.g., -c, -g, -p, -u - are  the
-              most efficient selectors.
-
-              Repeat mode is useful when coupled with field  out-
-              put   (see   the  -F,  option  description)  and  a
-              supervising awk or Perl script, or a C program.
-
-     -R       directs lsof to list the Parent Process IDentifica-
-              tion number in the PPID column.
-
-     -s [p:s] s alone directs lsof to display file  size  at  all
-              times.   It causes the SIZE/OFF output column title
-              to be changed to SIZE.  If the file does not have a
-              size, nothing is displayed.
-
-              The optional -s p:s  form  is  available  only  for
-              selected  dialects, and only when the -h or -? help
-              output lists it.
-
-              When the optional form is available, the s  may  be
-              followed by a protocol name (p), either TCP or UDP,
-              a colon (`:') and a comma-separated protocol  state
-              name list, the option causes open TCP and UDP files
-              to be excluded if their state name(s)  are  in  the
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  18
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-              list  (s)  preceded  by a `^'; or included if their
-              name(s) are not preceded by a `^'.
-
-              Dialects that support this option may support  only
-              one  protocol.   When  an  unsupported  protocol is
-              specified, a message will be  displayed  indicating
-              state names for the protocol are unavailable.
-
-              When an inclusion list  is  defined,  only  network
-              files  with state names in the list will be present
-              in the lsof output.   Thus,  specifying  one  state
-              name  means  that only network files with that lone
-              state name will be listed.
-
-              Case is unimportant in the protocol or state names,
-              but  there  may  be  no  spaces and the colon (`:')
-              separating the protocol name (p) and the state name
-              list (s) is required.
-
-              If only TCP and UDP files are to be listed, as con-
-              trolled by the specified exclusions and inclusions,
-              the -i option must be specified, too.   If  only  a
-              single  protocol's  files are to be listed, add its
-              name as an argument to the -i option.
-
-              For example, to list only network  files  with  TCP
-              state LISTEN, use:
-
-
-                   -iTCP -sTCP:LISTEN
-
-              Or, for example, to list network files with all UDP
-              states except Idle, use:
-
-
-                   -iUDP -sUDP:Idle
-
-              State names vary with UNIX dialects,  so  it's  not
-              possible  to  provide a complete list.  Some common
-              TCP state names are:  CLOSED, IDLE, BOUND,  LISTEN,
-              ESTABLISHED,   SYN_SENT,   SYN_RCDV,   ESTABLISHED,
-              CLOSE_WAIT,    FIN_WAIT1,    CLOSING,     LAST_ACK,
-              FIN_WAIT_2,  and  TIME_WAIT.   Two common UDP state
-              names are Unbound and Idle.
-
-              See the lsof FAQ (The FAQ section gives  its  loca-
-              tion.)  for more information on how to use protocol
-              state exclusion and inclusion, including examples.
-
-              The -o (without a following  decimal  digit  count)
-              and  -s  option  (without  a following protocol and
-              state name list) are mutually exclusive; they can't
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  19
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-              both be specified.  When neither is specified, lsof
-              displays whatever value  -  size  or  offset  -  is
-              appropriate and available for the type of file.
-
-              Since some types of files don't have true  sizes  -
-              sockets,  FIFOs,  pipes,  etc.  - lsof displays for
-              their sizes the content amounts in their associated
-              kernel buffers, if possible.
-
-     -S [t]   specifies an optional time-out  seconds  value  for
-              kernel   functions  -  lstat(2),  readlink(2),  and
-              stat(2)  -  that  might  otherwise  deadlock.   The
-              minimum for t is two; the default, fifteen; when no
-              value is specified, the default is used.
-
-              See the BLOCKS AND TIMEOUTS section for more infor-
-              mation.
-
-     -T [t]   controls the reporting of some TCP/TPI information,
-              also  reported by netstat(1), following the network
-              addresses.   In  normal  output   the   information
-              appears in parentheses, each item except TCP or TPI
-              state name identified by  a  keyword,  followed  by
-              `=', separated from others by a single space:
-
-
-                   <TCP or TPI state name>
-                   QR=<read queue length>
-                   QS=<send queue length>
-                   SO=<socket options and values>
-                   SS=<socket states>
-                   TF=<TCP flags and values>
-                   WR=<window read length>
-                   WW=<window write length>
-
-              Not all values are reported for all UNIX  dialects.
-              Items  values  (when  available) are reported after
-              the item name and '='.
-
-              When the field output mode is in effect (See OUTPUT
-              FOR  OTHER PROGRAMS.)  each item appears as a field
-              with a `T' leading character.
-
-              -T  with  no  following  key  characters   disables
-              TCP/TPI information reporting.
-
-              -T with following characters selects the  reporting
-              of specific TCP/TPI information:
-
-
-                   f    selects reporting of socket options,
-                        states and values, and TCP flags and
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  20
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-                        values.
-                   q    selects queue length reporting.
-                   s    selects connection state reporting.
-                   w    selects window size reporting.
-
-              Not  all  selections  are  enabled  for  some  UNIX
-              dialects.   State  may be selected for all dialects
-              and is reported by default.  The -h or -? help out-
-              put for the -T option will show what selections may
-              be used with the UNIX dialect.
-
-              When -T is used to select information - i.e., it is
-              followed  by one or more selection characters - the
-              displaying of state is disabled by default, and  it
-              must be explicitly selected again in the characters
-              following -T.  (In effect,  then,  the  default  is
-              equivalent  to -Ts.)  For example, if queue lengths
-              and state are desired, use -Tqs.
-
-              Socket options, socket states, some socket  values,
-              TCP  flags  and one TCP value may be reported (when
-              available in the UNIX dialect) in the form  of  the
-              names  that  commonly  appear  after SO_, so_, SS_,
-              TCP_  and TF_ in the dialect's header files -  most
-              often    <sys/socket.h>,    <sys/socketvar.h>   and
-              <netinet/tcp_var.h>.  Consult  those  header  files
-              for  the  meaning of the flags, options, states and
-              values.
-
-              ``SO=''  precedes  socket   options   and   values;
-              ``SS='',  socket states; and ``TF='', TCP flags and
-              values.
-
-              If a flag or option has a  value,  the  value  will
-              follow    an    '='   and   the   name   --   e.g.,
-              ``SO=LINGER=5'',   ``SO=QLIM=5'',   ``TF=MSS=512''.
-              The following seven values may be reported:
-
-
-                   Name
-                   Reported  Description (Common Symbol)
-
-                   KEEPALIVE keep alive time (SO_KEEPALIVE)
-                   LINGER    linger time (SO_LINGER)
-                   MSS       maximum segment size (TCP_MAXSEG)
-                   PQLEN          partial listen queue connections
-                   QLEN      established listen queue connections
-                   QLIM      established listen queue limit
-                   RCVBUF    receive buffer length (SO_RCVBUF)
-                   SNDBUF    send buffer length (SO_SNDBUF)
-
-              Details on what socket options and  values,  socket
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  21
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-              states,  and  TCP flags and values may be displayed
-              for particular UNIX dialects may be  found  in  the
-              answer  to  the  ``Why  doesn't  lsof report socket
-              options, socket states, and TCP  flags  and  values
-              for my dialect?'' and ``Why doesn't lsof report the
-              partial  listen  queue  connection  count  for   my
-              dialect?''  questions in the lsof FAQ (The FAQ sec-
-              tion gives its location.)
-
-     -t       specifies that lsof  should  produce  terse  output
-              with process identifiers only and no header - e.g.,
-              so that the output may be  piped  to  kill(1).   -t
-              selects the -w option.
-
-     -u s     selects the listing of files  for  the  user  whose
-              login   names   or  user  ID  numbers  are  in  the
-              comma-separated  set  s   -   e.g.,   ``abe'',   or
-              ``548,root''.   (There  should  be no spaces in the
-              set.)
-
-              Multiple login names or user ID numbers are  joined
-              in  a  single  ORed set before participating in AND
-              option selection.
-
-              If a login name or user ID is preceded by a `^', it
-              becomes a negation - i.e., files of processes owned
-              by the login name or user ID will never be  listed.
-              A  negated  login name or user ID selection is nei-
-              ther ANDed nor ORed with other  selections;  it  is
-              applied  before all other selections and absolutely
-              excludes the listing of the files of  the  process.
-              For  example, to direct lsof to exclude the listing
-              of  files  belonging  to  root  processes,  specify
-              ``-u^root'' or ``-u^0''.
-
-     -U       selects the listing of UNIX domain socket files.
-
-     -v       selects the listing of  lsof  version  information,
-              including:  revision  number;  when the lsof binary
-              was constructed; who  constructed  the  binary  and
-              where;  the  name of the compiler used to construct
-              the lsof binary; the version number of the compiler
-              when  readily  available;  the  compiler and loader
-              flags used to construct the lsof binary; and system
-              information,  typically  the  output  of uname's -a
-              option.
-
-     -V       directs lsof to indicate the items it was asked  to
-              list  and  failed  to  find  -  command names, file
-              names, Internet addresses or  files,  login  names,
-              NFS files, PIDs, PGIDs, and UIDs.
-
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  22
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-              When other options are ANDed to search options,  or
-              compile-time  options  restrict the listing of some
-              files, lsof may not report that it failed to find a
-              search  item  when  an ANDed option or compile-time
-              option prevents the listing of the open  file  con-
-              taining the located search item.
-
-              For example, ``lsof -V -iTCP@foobar -a -d 999'' may
-              not  report  a  failure  to  locate  open  files at
-              ``TCP@foobar'' and may not list any, if none have a
-              file descriptor number of 999.  A similar situation
-              arises when HASSECURITY and  HASNOSOCKSECURITY  are
-              defined  at compile time and they prevent the list-
-              ing of open files.
-
-     +|-w     Enables (+) or  disables  (-)  the  suppression  of
-              warning messages.
-
-              The lsof builder may choose to  have  warning  mes-
-              sages  disabled or enabled by default.  The default
-              warning message state is indicated in the output of
-              the  -h  or  -? option.  Disabling warning messages
-              when they are already  disabled  or  enabling  them
-              when already enabled is acceptable.
-
-              The -t option selects the -w option.
-
-     -x [fl]  may accompany the +d and +D options to direct their
-              processing to cross over symbolic links and|or file
-              system mount points encountered when  scanning  the
-              directory (+d) or directory tree (+D).
-
-              If -x is specified by itself  without  a  following
-              parameter,  cross-over  processing of both symbolic
-              links and file  system  mount  points  is  enabled.
-              Note that when -x is specified without a parameter,
-              the next argument must begin with '-' or '+'.
-
-              The optional  'f'  parameter  enables  file  system
-              mount  point  cross-over  processing; 'l', symbolic
-              link cross-over processing.
-
-              The -x option may not be supplied without also sup-
-              plying a +d or +D option.
-
-     -X       This is a dialect-specific option.
-
-         AIX:
-              This IBM AIX RISC/System 6000 option  requests  the
-              reporting  of executed text file and shared library
-              references.
-
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  23
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-              WARNING:  because  this  option  uses  the   kernel
-              readx()  function,  its  use  on  a busy AIX system
-              might cause an application process to hang so  com-
-              pletely  that it can neither be killed nor stopped.
-              I have never seen this happen or had  a  report  of
-              its happening, but I think there is a remote possi-
-              bility it could happen.
-
-              By default use of readx() is disabled.  On  AIX  5L
-              and  above  lsof may need setuid-root permission to
-              perform the actions this option requests.
-
-              The lsof builder may specify that the -X option  be
-              restricted to processes whose real UID is root.  If
-              that has been done, the -X option will  not  appear
-              in  the -h or -? help output unless the real UID of
-              the lsof process is root.  The default lsof distri-
-              bution  allows any UID to specify -X, so by default
-              it will appear in the help output.
-
-              When AIX readx() use is disabled, lsof may  not  be
-              able  to report information for all text and loader
-              file references, but it may also avoid exacerbating
-              an  AIX kernel directory search kernel error, known
-              as the Stale Segment ID bug.
-
-              The readx() function, used by  lsof  or  any  other
-              program  to  access some sections of kernel virtual
-              memory, can trigger the Stale Segment ID  bug.   It
-              can  cause  the  kernel's  dir_search() function to
-              believe erroneously that part of an in-memory  copy
-              of   a  file  system  directory  has  been  zeroed.
-              Another application process,  distinct  from  lsof,
-              asking  the  kernel to search the directory - e.g.,
-              by using open(2) - can cause dir_search()  to  loop
-              forever, thus hanging the application process.
-
-              Consult the lsof FAQ (The  FAQ  section  gives  its
-              location.)   and the 00README file of the lsof dis-
-              tribution for a more complete  description  of  the
-              Stale  Segment  ID  bug,  its APAR, and methods for
-              defining readx() use when compiling lsof.
-
-         Linux:
-              This Linux  option  requests  that  lsof  skip  the
-              reporting  of  information on all open TCP, UDP and
-              UDPLITE IPv4 and IPv6 files.
-
-              This Linux option is most useful  when  the  system
-              has  an extremely large number of open TCP, UDP and
-              UDPLITE files, the processing of whose  information
-              in  the  /proc/net/tcp*  and  /proc/net/udp*  files
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  24
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-              would take lsof a long time, and whose reporting is
-              not of interest.
-
-              Use this option with care and  only  when  you  are
-              sure  that the information you want lsof to display
-              isn't associated with  open  TCP,  UDP  or  UDPLITE
-              socket files.
-
-         Solaris 10 and above:
-              This Solaris  10  and  above  option  requests  the
-              reporting  of cached paths for files that have been
-              deleted - i.e., removed with rm(1) or unlink(2).
-
-              The  cached  path  is  followed   by   the   string
-              `` (deleted)''  to  indicate that the path by which
-              the file was opened has been deleted.
-
-              Because intervening changes  made  to  the  path  -
-              i.e.,  renames  with  mv(1)  or rename(2) - are not
-              recorded in the cached path, what lsof  reports  is
-              only the path by which the file was opened, not its
-              possibly different final path.
-
-     -z [z]   specifies how Solaris 10 and higher  zone  informa-
-              tion is to be handled.
-
-              Without a following argument - e.g.,  NO  z  -  the
-              option  specifies  that zone names are to be listed
-              in the ZONE output column.
-
-              The -z option may be followed by a  zone  name,  z.
-              That  causes  lsof  to  list  only  open  files for
-              processes in that zone.  Multiple -z z  option  and
-              argument  pairs  may be specified to form a list of
-              named zones.  Any open file of any process  in  any
-              of  the zones will be listed, subject to other con-
-              ditions specified by other options and arguments.
-
-     -Z [Z]   specifies how SELinux security contexts are  to  be
-              handled.  It and 'Z' field output character support
-              are inhibited when SELinux is disabled in the  run-
-              ning  Linux  kernel.  See OUTPUT FOR OTHER PROGRAMS
-              for more information on the 'Z' field output  char-
-              acter.
-
-              Without a following argument - e.g.,  NO  Z  -  the
-              option  specifies  that security contexts are to be
-              listed in the SECURITY-CONTEXT output column.
-
-              The -Z option may be followed by a  wildcard  secu-
-              rity  context  name,  Z.   That causes lsof to list
-              only open files  for  processes  in  that  security
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  25
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-              context.   Multiple  -Z Z option and argument pairs
-              may be specified to form a list  of  security  con-
-              texts.   Any open file of any process in any of the
-              security contexts will be listed, subject to  other
-              conditions  specified  by  other  options and argu-
-              ments.  Note that Z can be A:B:C or *:B:C or  A:B:*
-              or *:*:C to match against the A:B:C context.
-
-     --       The double minus sign option is a marker that  sig-
-              nals the end of the keyed options.  It may be used,
-              for example, when the first file name begins with a
-              minus  sign.   It may also be used when the absence
-              of a value for the last keyed option must be signi-
-              fied by the presence of a minus sign in the follow-
-              ing option and before the start of the file names.
-
-     names    These are path names of  specific  files  to  list.
-              Symbolic  links are resolved before use.  The first
-              name may be separated from  the  preceding  options
-              with the ``--'' option.
-
-              If a name is the mounted-on  directory  of  a  file
-              system  or the device of the file system, lsof will
-              list all the files open on the file system.  To  be
-              considered  a  file  system,  the name must match a
-              mounted-on directory name in  mount(8)  output,  or
-              match  the name of a block device associated with a
-              mounted-on directory name.  The +|-f option may  be
-              used to force lsof to consider a name a file system
-              identifier (+f) or a simple file (-f).
-
-              If name is a path to a directory that  is  not  the
-              mounted-on  directory  name of a file system, it is
-              treated just as a regular file is treated  -  i.e.,
-              its listing is restricted to processes that have it
-              open as a file or as a process-specific  directory,
-              such  as the root or current working directory.  To
-              request that lsof look  for  open  files  inside  a
-              directory name, use the +d s and +D D options.
-
-              If a name is the base name of a  family  of  multi-
-              plexed  files  - e.g, AIX's /dev/pt[cs] - lsof will
-              list all the associated multiplexed  files  on  the
-              device   that   are  open  -  e.g.,  /dev/pt[cs]/1,
-              /dev/pt[cs]/2, etc.
-
-              If a name is a UNIX domain socket name,  lsof  will
-              usually search for it by the characters of the name
-              alone - exactly as it is specified and is  recorded
-              in  the  kernel  socket  structure.   (See the next
-              paragraph for an exception to that rule for Linux.)
-              Specifying  a  relative  path  -  e.g., ./file - in
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  26
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-              place of the file's absolute path - e.g., /tmp/file
-              - won't work because lsof must match the characters
-              you specify with what it finds in the  kernel  UNIX
-              domain socket structures.
-
-              If a name is a Linux UNIX domain  socket  name,  in
-              one  case lsof is able to search for it by its dev-
-              ice and inode number, allowing name to be  a  rela-
-              tive  path.   The  case  requires that the absolute
-              path -- i.e., one beginning with a slash  ('/')  be
-              used  by  the  process that created the socket, and
-              hence be stored in the /proc/net/unix file; and  it
-              requires that lsof be able to obtain the device and
-              node  numbers  of  both  the   absolute   path   in
-              /proc/net/unix and name via successful stat(2) sys-
-              tem calls.  When those  conditions  are  met,  lsof
-              will  be  able to search for the UNIX domain socket
-              when some path to  it  is  is  specified  in  name.
-              Thus,  for example, if the path is /dev/log, and an
-              lsof search is initiated when the working directory
-              is /dev, then name could be ./log.
-
-              If a name is none of the above, lsof will list  any
-              open files whose device and inode match that of the
-              specified path name.
-
-              If you have also specified the -b option, the  only
-              names  you  may safely specify are file systems for
-              which your mount table  supplies  alternate  device
-              numbers.  See the AVOIDING KERNEL BLOCKS and ALTER-
-              NATE DEVICE NUMBERS sections for more information.
-
-              Multiple file names are joined in a single ORed set
-              before participating in AND option selection.
-
-AFS
-     Lsof  supports  the  recognition  of  AFS  files  for  these
-     dialects (and AFS versions):
-
-          AIX 4.1.4 (AFS 3.4a)
-          HP-UX 9.0.5 (AFS 3.4a)
-          Linux 1.2.13 (AFS 3.3)
-          Solaris 2.[56] (AFS 3.4a)
-
-     It may recognize  AFS  files  on  other  versions  of  these
-     dialects,  but  has not been tested there.  Depending on how
-     AFS is implemented, lsof may recognize AFS  files  in  other
-     dialects,  or may have difficulties recognizing AFS files in
-     the supported dialects.
-
-     Lsof may have trouble identifying all aspects of  AFS  files
-     in supported dialects when AFS kernel support is implemented
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  27
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-     via dynamic modules whose addresses do  not  appear  in  the
-     kernel's variable name list.  In that case, lsof may have to
-     guess at the identity of AFS files, and might not be able to
-     obtain volume information from the kernel that is needed for
-     calculating AFS volume node numbers.  When lsof  can't  com-
-     pute  volume  node  numbers,  it  reports  blank in the NODE
-     column.
-
-     The -A A option is available in some dialect implementations
-     of  lsof  for  specifying  the  name list file where dynamic
-     module kernel addresses may be found.  When this  option  is
-     available,  it  will  be  listed  in  the  lsof help output,
-     presented in response to the -h or -?
-
-     See the lsof FAQ (The FAQ section gives its location.)   for
-     more  information  about dynamic modules, their symbols, and
-     how they affect lsof options.
-
-     Because AFS path lookups don't seem to  participate  in  the
-     kernel's  name  cache  operations,  lsof can't identify path
-     name components for AFS files.
-
-SECURITY
-     Lsof has three features that may  cause  security  concerns.
-     First,  its  default  compilation mode allows anyone to list
-     all open files with it.  Second, by  default  it  creates  a
-     user-readable  and  user-writable  device  cache file in the
-     home directory of the real user ID that executes lsof.  (The
-     list-all-open-files  and  device  cache features may be dis-
-     abled when lsof is compiled.)  Third, its -k and -m  options
-     name alternate kernel name list or memory files.
-
-     Restricting the listing of all open files is  controlled  by
-     the  compile-time HASSECURITY and HASNOSOCKSECURITY options.
-     When HASSECURITY is defined, lsof will allow only  the  root
-     user  to  list  all  open files.  The non-root user may list
-     only open files of processes with the same user  IDentifica-
-     tion  number  as the real user ID number of the lsof process
-     (the one that its user logged on with).
-
-     However,  if  HASSECURITY  and  HASNOSOCKSECURITY  are  both
-     defined,  anyone  may  list open socket files, provided they
-     are selected with the -i option.
-
-     When HASSECURITY is not defined, anyone may  list  all  open
-     files.
-
-     Help output, presented in response to the -h or  -?  option,
-     gives  the  status  of the HASSECURITY and HASNOSOCKSECURITY
-     definitions.
-
-
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  28
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-     See the Security section of the 00README file  of  the  lsof
-     distribution  for  information  on  building  lsof  with the
-     HASSECURITY and HASNOSOCKSECURITY options enabled.
-
-     Creation and use of a user-readable and user-writable device
-     cache  file  is  controlled  by  the  compile-time HASDCACHE
-     option.  See the DEVICE CACHE FILE section and the  sections
-     that  follow  it for details on how its path is formed.  For
-     security considerations it is important to note that in  the
-     default  lsof  distribution, if the real user ID under which
-     lsof is executed is root, the  device  cache  file  will  be
-     written  in  root's home directory - e.g., / or /root.  When
-     HASDCACHE is not defined, lsof does not write or attempt  to
-     read a device cache file.
-
-     When HASDCACHE is defined, the lsof help  output,  presented
-     in response to the -h, -D?, or -? options, will provide dev-
-     ice cache file handling information.  When HASDCACHE is  not
-     defined, the -h or -? output will have no -D option descrip-
-     tion.
-
-     Before you decide to disable the device cache file feature -
-     enabling it improves the performance of lsof by reducing the
-     startup overhead of examining all  the  nodes  in  /dev  (or
-     /devices)  -  read the discussion of it in the 00DCACHE file
-     of the lsof distribution and the lsof FAQ (The  FAQ  section
-     gives its location.)
-
-     WHEN IN DOUBT, YOU CAN TEMPORARILY DISABLE THE  USE  OF  THE
-     DEVICE CACHE FILE WITH THE -Di OPTION.
-
-     When lsof user declares alternate kernel name list or memory
-     files  with  the  -k  and -m options, lsof checks the user's
-     authority to read them with access(2).  This is intended  to
-     prevent  whatever special power lsof's modes might confer on
-     it from letting it read files not  normally  accessible  via
-     the authority of the real user ID.
-
-OUTPUT
-     This section describes the information lsof lists  for  each
-     open  file.   See  the OUTPUT FOR OTHER PROGRAMS section for
-     additional information on output that can  be  processed  by
-     another program.
-
-     Lsof only outputs printable (declared so  by  isprint(3))  8
-     bit characters.  Non-printable characters are printed in one
-     of three forms:  the C ``\[bfrnt]'' form; the control  char-
-     acter `^' form (e.g., ``^@''); or hexadecimal leading ``\x''
-     form (e.g., ``\xab'').  Space is non-printable in  the  COM-
-     MAND column (``\x20'') and printable elsewhere.
-
-
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  29
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-     For some dialects  -  if  HASSETLOCALE  is  defined  in  the
-     dialect's  machine.h  header  file  -  lsof  will  print the
-     extended 8 bit characters of a language  locale.   The  lsof
-     process must be supplied a language locale environment vari-
-     able (e.g., LANG) whose value represents  a  known  language
-     locale  in  which  the  extended  characters  are considered
-     printable  by  isprint(3).   Otherwise  lsof  considers  the
-     extended  characters non-printable and prints them according
-     to its rules for  non-printable  characters,  stated  above.
-     Consult  your  dialect's setlocale(3) man page for the names
-     of other environment variables that may be used in place  of
-     LANG - e.g., LC_ALL, LC_CTYPE, etc.
-
-     Lsof's language locale support for  a  dialect  also  covers
-     wide  characters  -  e.g.,  UTF-8  -  when  HASSETLOCALE and
-     HASWIDECHAR are defined in the  dialect's  machine.h  header
-     file,  and  when a suitable language locale has been defined
-     in the appropriate environment variable for  the  lsof  pro-
-     cess.   Wide characters are printable under those conditions
-     if  iswprint(3)  reports  them  to  be.   If   HASSETLOCALE,
-     HASWIDECHAR  and  a suitable language locale aren't defined,
-     or if iswprint(3) reports wide characters that aren't print-
-     able,  lsof  considers the wide characters non-printable and
-     prints each of their 8  bits  according  to  its  rules  for
-     non-printable characters, stated above.
-
-     Consult the answers to the "Language locale  support"  ques-
-     tions  in the lsof FAQ (The FAQ section gives its location.)
-     for more information.
-
-     Lsof dynamically sizes the output columns each time it runs,
-     guaranteeing  that  each  column is a minimum size.  It also
-     guarantees that each column is separated from its  predeces-
-     sor by at least one space.
-
-     COMMAND    contains the first nine characters of the name of
-                the UNIX command associated with the process.  If
-                a non-zero w value  is  specified  to  the  +c  w
-                option,  the  column contains the first w charac-
-                ters of the name of the UNIX  command  associated
-                with  the  process  up to the limit of characters
-                supplied to lsof by the UNIX dialect.   (See  the
-                description  of  the +c w command or the lsof FAQ
-                for more information.  The FAQ section gives  its
-                location.)
-
-                If w is less than the length of the column title,
-                ``COMMAND'', it will be raised to that length.
-
-                If a zero w  value  is  specified  to  the  +c  w
-                option, the column contains all the characters of
-                the name of the UNIX command associated with  the
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  30
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-                process.
-
-                All command name  characters  maintained  by  the
-                kernel  in  its structures are displayed in field
-                output when the command name descriptor (`c')  is
-                specified.   See  the  OUTPUT  FOR OTHER COMMANDS
-                section for information on selecting field output
-                and the associated command name descriptor.
-
-     PID        is the Process IDentification number of the  pro-
-                cess.
-
-     TID        is the task (thread)  IDentification  number,  if
-                task  (thread)  reporting  is  supported  by  the
-                dialect and a task (thread) is being listed.  (If
-                help  output  -  i.e., the output of the -h or -?
-                options - shows this option, then  task  (thread)
-                reporting is supported by the dialect.)
-
-                A blank TID column in Linux indicates a process -
-                i.e., a non-task.
-
-     TASKCMD    is the task command name.  Generally this will be
-                the  same  as  the  process  named in the COMMAND
-                column,  but  some  task  implementations  (e.g.,
-                Linux) permit a task to change its command name.
-
-                The TASKCMD column width is subject to  the  same
-                size limitation as the COMMAND column.
-
-     ZONE       is the Solaris 10 and  higher  zone  name.   This
-                column must be selected with the -z option.
-
-     SECURITY-CONTEXT
-                is the SELinux  security  context.   This  column
-                must  be  selected with the -Z option.  Note that
-                the -Z option is inhibited when SELinux  is  dis-
-                abled in the running Linux kernel.
-
-     PPID       is the Parent Process  IDentification  number  of
-                the  process.   It  is only displayed when the -R
-                option has been specified.
-
-     PGID       is the process group IDentification number  asso-
-                ciated  with  the  process.  It is only displayed
-                when the -g option has been specified.
-
-     USER       is the user ID number or login name of  the  user
-                to  whom the process belongs, usually the same as
-                reported by ps(1).  However, on Linux USER is the
-                user  ID  number or login that owns the directory
-                in /proc where lsof finds information  about  the
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  31
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-                process.  Usually that is the same value reported
-                by ps(1), but may differ  when  the  process  has
-                changed  its  effective  user  ID.   (See  the -l
-                option description for information on when a user
-                ID number or login name is displayed.)
-
-     FD         is the File Descriptor number of the file or:
-
-
-                     cwd  current working directory;
-                     Lnn  library references (AIX);
-                     err  FD information error (see NAME column);
-                     jld  jail directory (FreeBSD);
-                     ltx  shared library text (code and data);
-                     Mxx  hex memory-mapped type number xx.
-                     m86  DOS Merge mapped file;
-                     mem  memory-mapped file;
-                     mmap memory-mapped device;
-                     pd   parent directory;
-                     rtd  root directory;
-                     tr   kernel trace file (OpenBSD);
-                     txt  program text (code and data);
-                     v86  VP/ix mapped file;
-
-                FD  is  followed  by  one  of  these  characters,
-                describing the mode under which the file is open:
-
-                     r for read access;
-                     w for write access;
-                     u for read and write access;
-                     space if mode unknown and no lock
-                          character follows;
-                     `-' if mode unknown and lock
-                          character follows.
-
-                The mode character is followed by  one  of  these
-                lock  characters,  describing  the  type  of lock
-                applied to the file:
-
-                     N for a Solaris NFS lock of unknown type;
-                     r for read lock on part of the file;
-                     R for a read lock on the entire file;
-                     w for a write lock on part of the file;
-                     W for a write lock on the entire file;
-                     u for a read and write lock of any length;
-                     U for a lock of unknown type;
-                     x for an SCO OpenServer Xenix lock  on  part
-                     of the file;
-                     X for an SCO OpenServer Xenix  lock  on  the
-                entire file;
-                     space if there is no lock.
-
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  32
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-                See the LOCKS section for more information on the
-                lock information character.
-
-                The FD column contents constitutes a single field
-                for parsing in post-processing scripts.
-
-     TYPE       is the type of the node associated with the  file
-                - e.g., GDIR, GREG, VDIR, VREG, etc.
-
-                or ``IPv4'' for an IPv4 socket;
-
-                or ``IPv6'' for an open IPv6 network file -  even
-                if  its  address  is  IPv4,  mapped  in  an  IPv6
-                address;
-
-                or ``ax25'' for a Linux AX.25 socket;
-
-                or ``inet'' for an Internet domain socket;
-
-                or ``lla'' for a HP-UX link level access file;
-
-                or ``rte'' for an AF_ROUTE socket;
-
-                or ``sock'' for a socket of unknown domain;
-
-                or ``unix'' for a UNIX domain socket;
-
-                or ``x.25'' for an HP-UX x.25 socket;
-
-                or ``BLK'' for a block special file;
-
-                or ``CHR'' for a character special file;
-
-                or ``DEL'' for a Linux map  file  that  has  been
-                deleted;
-
-                or ``DIR'' for a directory;
-
-                or ``DOOR'' for a VDOOR file;
-
-                or ``FIFO'' for a FIFO special file;
-
-                or ``KQUEUE'' for a BSD style kernel event  queue
-                file;
-
-                or ``LINK'' for a symbolic link file;
-
-                or ``MPB'' for a multiplexed block file;
-
-                or ``MPC'' for a multiplexed character file;
-
-                or ``NOFD'' for a Linux /proc/<PID>/fd  directory
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  33
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-                that  can't  be  opened  --  the  directory  path
-                appears in the NAME column, followed by an  error
-                message;
-
-                or ``PAS'' for a /proc/as file;
-
-                or ``PAXV'' for a /proc/auxv file;
-
-                or ``PCRE'' for a /proc/cred file;
-
-                or ``PCTL'' for a /proc control file;
-
-                or ``PCUR'' for the current /proc process;
-
-                or ``PCWD'' for a /proc  current  working  direc-
-                tory;
-
-                or ``PDIR'' for a /proc directory;
-
-                or ``PETY'' for a /proc executable type (etype);
-
-                or ``PFD'' for a /proc file descriptor;
-
-                or ``PFDR'' for a /proc  file  descriptor  direc-
-                tory;
-
-                or ``PFIL'' for an executable /proc file;
-
-                or ``PFPR'' for a /proc FP register set;
-
-                or ``PGD'' for a /proc/pagedata file;
-
-                or ``PGID'' for a /proc group notifier file;
-
-                or ``PIPE'' for pipes;
-
-                or ``PLC'' for a /proc/lwpctl file;
-
-                or ``PLDR'' for a /proc/lpw directory;
-
-                or ``PLDT'' for a /proc/ldt file;
-
-                or ``PLPI'' for a /proc/lpsinfo file;
-
-                or ``PLST'' for a /proc/lstatus file;
-
-                or ``PLU'' for a /proc/lusage file;
-
-                or ``PLWG'' for a /proc/gwindows file;
-
-                or ``PLWI'' for a /proc/lwpsinfo file;
-
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  34
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-                or ``PLWS'' for a /proc/lwpstatus file;
-
-                or ``PLWU'' for a /proc/lwpusage file;
-
-                or ``PLWX'' for a /proc/xregs file;
-
-                or ``PMAP'' for a /proc map file (map);
-
-                or ``PMEM'' for a /proc memory image file;
-
-                or ``PNTF'' for a /proc process notifier file;
-
-                or ``POBJ'' for a /proc/object file;
-
-                or ``PODR'' for a /proc/object directory;
-
-                or ``POLP'' for an old format /proc light  weight
-                process file;
-
-                or ``POPF'' for an old format /proc PID file;
-
-                or ``POPG'' for an old  format  /proc  page  data
-                file;
-
-                or ``PORT'' for a SYSV named pipe;
-
-                or ``PREG'' for a /proc register file;
-
-                or ``PRMP'' for a /proc/rmap file;
-
-                or ``PRTD'' for a /proc root directory;
-
-                or ``PSGA'' for a /proc/sigact file;
-
-                or ``PSIN'' for a /proc/psinfo file;
-
-                or ``PSTA'' for a /proc status file;
-
-                or ``PSXSEM'' for a POSIX semaphore file;
-
-                or ``PSXSHM'' for a POSIX shared memory file;
-
-                or ``PTS'' for a /dev/pts file;
-
-                or ``PUSG'' for a /proc/usage file;
-
-                or ``PW'' for a /proc/watch file;
-
-                or ``PXMP'' for a /proc/xmap file;
-
-                or ``REG'' for a regular file;
-
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  35
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-                or ``SMT'' for a shared memory transport file;
-
-                or ``STSO'' for a stream socket;
-
-                or ``UNNM'' for an unnamed type file;
-
-                or ``XNAM'' for an OpenServer Xenix special  file
-                of unknown type;
-
-                or ``XSEM'' for  an  OpenServer  Xenix  semaphore
-                file;
-
-                or ``XSD'' for an OpenServer  Xenix  shared  data
-                file;
-
-                or the four type number octets if the correspond-
-                ing name isn't known.
-
-     FILE-ADDR  contains the kernel file structure address when f
-                has been specified to +f;
-
-     FCT        contains the file reference count from the kernel
-                file structure when c has been specified to +f;
-
-     FILE-FLAG  when g or G has been specified to +f, this  field
-                contains  the contents of the f_flag[s] member of
-                the  kernel  file  structure  and  the   kernel's
-                per-process  open  file flags (if available); `G'
-                causes them to be displayed in hexadecimal;  `g',
-                as  short-hand  names; two lists may be displayed
-                with  entries  separated  by  commas,  the  lists
-                separated  by  a  semicolon (`;'); the first list
-                may contain short-hand names for f_flag[s] values
-                from the following table:
-
-
-                     AIO       asynchronous I/O (e.g., FAIO)
-                     AP        append
-                     ASYN      asynchronous I/O (e.g., FASYNC)
-                     BAS       block, test, and set in use
-                     BKIU      block if in use
-                     BL        use block offsets
-                     BSK       block seek
-                     CA        copy avoid
-                     CIO       concurrent I/O
-                     CLON      clone
-                     CLRD      CL read
-                     CR        create
-                     DF        defer
-                     DFI       defer IND
-                     DFLU      data flush
-                     DIR       direct
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  36
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-                     DLY       delay
-                     DOCL      do clone
-                     DSYN      data-only integrity
-                     DTY       must be a directory
-                     EVO       event only
-                     EX        open for exec
-                     EXCL      exclusive open
-                     FSYN      synchronous writes
-                     GCDF      defer during unp_gc() (AIX)
-                     GCMK      mark during unp_gc() (AIX)
-                     GTTY      accessed via /dev/tty
-                     HUP       HUP in progress
-                     KERN      kernel
-                     KIOC      kernel-issued ioctl
-                     LCK       has lock
-                     LG        large file
-                     MBLK      stream message block
-                     MK        mark
-                     MNT       mount
-                     MSYN      multiplex synchronization
-                     NATM      don't update atime
-                     NB        non-blocking I/O
-                     NBDR      no BDRM check
-                     NBIO      SYSV non-blocking I/O
-                     NBF       n-buffering in effect
-                     NC        no cache
-                     ND        no delay
-                     NDSY      no data synchronization
-                     NET       network
-                     NFLK      don't follow links
-                     NMFS      NM file system
-                     NOTO      disable background stop
-                     NSH       no share
-                     NTTY      no controlling TTY
-                     OLRM      OLR mirror
-                     PAIO      POSIX asynchronous I/O
-                     PP        POSIX pipe
-                     R         read
-                     RC        file and record locking cache
-                     REV       revoked
-                     RSH       shared read
-                     RSYN      read synchronization
-                     RW        read and write access
-                     SL        shared lock
-                     SNAP      cooked snapshot
-                     SOCK      socket
-                     SQSH      Sequent shared set on open
-                     SQSV      Sequent SVM set on open
-                     SQR       Sequent set repair on open
-                     SQS1      Sequent full shared open
-                     SQS2      Sequent partial shared open
-                     STPI      stop I/O
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  37
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-                     SWR       synchronous read
-                     SYN       file integrity while writing
-                     TCPM      avoid TCP collision
-                     TR        truncate
-                     W         write
-                     WKUP      parallel I/O synchronization
-                     WTG       parallel I/O synchronization
-                     VH        vhangup pending
-                     VTXT      virtual text
-                     XL        exclusive lock
-
-                this list of names was derived from F*  #define's
-                in dialect header files <fcntl.h>, <linux</fs.h>,
-                <sys/fcntl.c>,       <sys/fcntlcom.h>,        and
-                <sys/file.h>;  see  the  lsof.h header file for a
-                list showing the correspondence between the above
-                short-hand names and the header file definitions;
-
-                the second list (after the semicolon) may contain
-                short-hand names for kernel per-process open file
-                flags from this table:
-
-
-                     ALLC      allocated
-                     BR        the file has been read
-                     BHUP      activity stopped by SIGHUP
-                     BW        the file has been written
-                     CLSG      closing
-                     CX        close-on-exec (see fcntl(F_SETFD))
-                     LCK       lock was applied
-                     MP        memory-mapped
-                     OPIP      open pending - in progress
-                     RSVW      reserved wait
-                     SHMT      UF_FSHMAT set (AIX)
-                     USE       in use (multi-threaded)
-
-     NODE-ID    (or INODE-ADDR  for  some  dialects)  contains  a
-                unique  identifier for the file node (usually the
-                kernel vnode or inode address, but also occasion-
-                ally  a  concatenation of device and node number)
-                when n has been specified to +f;
-
-     DEVICE     contains the device numbers, separated by commas,
-                for  a character special, block special, regular,
-                directory or NFS file;
-
-                or ``memory'' for a memory file system node under
-                Tru64 UNIX;
-
-                or the address of the  private  data  area  of  a
-                Solaris socket stream;
-
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  38
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-                or a kernel reference address that identifies the
-                file  (The  kernel  reference address may be used
-                for FIFO's, for example.);
-
-                or the base address or device  name  of  a  Linux
-                AX.25 socket device.
-
-                Usually only the lower thirty two bits  of  Tru64
-                UNIX kernel addresses are displayed.
-
-     SIZE, SIZE/OFF, or OFFSET
-                is the size of the file or  the  file  offset  in
-                bytes.   A value is displayed in this column only
-                if it is available.  Lsof displays whatever value
-                - size or offset - is appropriate for the type of
-                the file and the version of lsof.
-
-                On some UNIX dialects lsof can't obtain  accurate
-                or  consistent  file  offset information from its
-                kernel data sources, sometimes just for  particu-
-                lar  kinds  of  files  (e.g.,  socket files.)  In
-                other cases, files don't have true sizes -  e.g.,
-                sockets,  FIFOs,  pipes  -  so  lsof displays for
-                their sizes the content amounts it finds in their
-                kernel  buffer  descriptors  (e.g., socket buffer
-                size counts or TCP/IP window sizes.)  Consult the
-                lsof  FAQ  (The  FAQ section gives its location.)
-                for more information.
-
-                The file size is displayed in decimal; the offset
-                is  normally  displayed in decimal with a leading
-                ``0t'' if it contains 8 digits or less; in  hexa-
-                decimal  with  a  leading  ``0x'' if it is longer
-                than 8 digits.  (Consult the -o o option descrip-
-                tion  for  information on when 8 might default to
-                some other value.)
-
-                Thus the leading ``0t'' and  ``0x''  identify  an
-                offset  when  the  column may contain both a size
-                and an offset (i.e., its title is SIZE/OFF).
-
-                If  the  -o  option  is  specified,  lsof  always
-                displays the file offset (or nothing if no offset
-                is available) and labels the column OFFSET.   The
-                offset  always  begins  with  ``0t'' or ``0x'' as
-                described above.
-
-                The lsof user can control the switch from  ``0t''
-                to  ``0x''  with  the  -o  o option.  Consult its
-                description for more information.
-
-                If  the  -s  option  is  specified,  lsof  always
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  39
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-                displays  the file size (or nothing if no size is
-                available) and labels the column  SIZE.   The  -o
-                and -s options are mutually exclusive; they can't
-                both be specified.
-
-                For files that don't have a fixed  size  -  e.g.,
-                don't reside on a disk device - lsof will display
-                appropriate information about the current size or
-                position  of  the  file if it is available in the
-                kernel structures that define the file.
-
-     NLINK      contains the file link count  when  +L  has  been
-                specified;
-
-     NODE       is the node number of a local file;
-
-                or the inode number of an NFS file in the  server
-                host;
-
-                or the Internet protocol type - e.g, ``TCP'';
-
-                or ``STR'' for a stream;
-
-                or ``CCITT'' for an HP-UX x.25 socket;
-
-                or the IRQ or  inode  number  of  a  Linux  AX.25
-                socket device.
-
-     NAME       is the name of the mount point and file system on
-                which the file resides;
-
-                or the name of a  file  specified  in  the  names
-                option   (after  any  symbolic  links  have  been
-                resolved);
-
-                or the name of a character special or block  spe-
-                cial device;
-
-                or the local and remote Internet addresses  of  a
-                network file; the local host name or IP number is
-                followed by a colon (':'), the port, ``->'',  and
-                the  two-part remote address; IP addresses may be
-                reported as numbers or names,  depending  on  the
-                +|-M,  -n,  and  -P options; colon-separated IPv6
-                numbers are enclosed  in  square  brackets;  IPv4
-                INADDR_ANY   and   IPv6   IN6_IS_ADDR_UNSPECIFIED
-                addresses, and zero port numbers are  represented
-                by  an  asterisk ('*'); a UDP destination address
-                may be followed by the  amount  of  time  elapsed
-                since  the  last  packet was sent to the destina-
-                tion; TCP, UDP and UDPLITE remote  addresses  may
-                be followed by TCP/TPI information in parentheses
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  40
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-                - state (e.g., ``(ESTABLISHED)'', ``(Unbound)''),
-                queue  sizes, and window sizes (not all dialects)
-                -  in  a  fashion  similar  to  what   netstat(1)
-                reports;  see  the  -T  option description or the
-                description of the TCP/TPI field  in  OUTPUT  FOR
-                OTHER  PROGRAMS  for  more  information on state,
-                queue size, and window size;
-
-                or the address or name of a UNIX  domain  socket,
-                possibly  including a stream clone device name, a
-                file system object's path name, local and foreign
-                kernel  addresses, socket pair information, and a
-                bound vnode address;
-
-                or the local and remote mount point names  of  an
-                NFS file;
-
-                or ``STR'', followed by the stream name;
-
-                or a stream character device  name,  followed  by
-                ``->''  and  the  stream name or a list of stream
-                module names, separated by ``->'';
-
-                or ``STR:'' followed by the SCO OpenServer stream
-                device and module names, separated by ``->'';
-
-                or system directory name, `` -- '', and  as  many
-                components  of  the path name as lsof can find in
-                the kernel's name  cache  for  selected  dialects
-                (See  the  KERNEL  NAME  CACHE  section  for more
-                information.);
-
-                or ``PIPE->'', followed by a Solaris kernel  pipe
-                destination address;
-
-                or ``COMMON:'',  followed  by  the  vnode  device
-                information   structure's   device  name,  for  a
-                Solaris common vnode;
-
-                or the address family, followed by a slash (`/'),
-                followed  by  fourteen comma-separated bytes of a
-                non-Internet raw socket address;
-
-                or the HP-UX x.25 local address, followed by  the
-                virtual  connection  number (if any), followed by
-                the remote address (if any);
-
-                or ``(dead)'' for disassociated Tru64 UNIX  files
-                - typically terminal files that have been flagged
-                with the TIOCNOTTY ioctl and closed by daemons;
-
-                or ``rd=<offset>'' and  ``wr=<offset>''  for  the
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  41
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-                values of the read and write offsets of a FIFO;
-
-                or ``clone n:/dev/event'' for SCO OpenServer file
-                clones  of  the /dev/event device, where n is the
-                minor device number of the file;
-
-                or ``(socketpair: n)'' for a Solaris  2.6,  8,  9
-                or   10   UNIX  domain  socket,  created  by  the
-                socketpair(3N) network function;
-
-                or ``no PCB'' for socket files that do not have a
-                protocol  block  associated with them, optionally
-                followed by ``, CANTSENDMORE'' if sending on  the
-                socket has been disabled, or ``, CANTRCVMORE'' if
-                receiving on the socket has been disabled  (e.g.,
-                by the shutdown(2) function);
-
-                or the local and remote addresses of a Linux  IPX
-                socket  file  in  the form <net>:[<node>:]<port>,
-                followed  in  parentheses  by  the  transmit  and
-                receive queue sizes, and the connection state;
-
-                or ``dgram'' or ``stream'' for the type  UnixWare
-                7.1.1  and  above  in-kernel UNIX domain sockets,
-                followed by a colon (':') and the local path name
-                when available, followed by ``->'' and the remote
-                path name or kernel socket address in hexadecimal
-                when available;
-
-                or the association value, association index, end-
-                point  value,  local  address, local port, remote
-                address and remote port for Linux SCTP sockets;
-
-                or ``protocol: '' followed by the Linux  socket's
-                protocol attribute.
-
-     For dialects that support a ``namefs'' file system, allowing
-     one  file  to  be attached to another with fattach(3C), lsof
-     will  add  ``(FA:<address1><direction><address2>)''  to  the
-     NAME  column.   <address1>  and  <address2>  are hexadecimal
-     vnode addresses.  <direction> will be ``<-''  if  <address2>
-     has   been   fattach'ed  to  this  vnode  whose  address  is
-     <address1>; and ``->'' if <address1>, the vnode  address  of
-     this  vnode,  has been fattach'ed to <address2>.  <address1>
-     may be omitted if it already appears in the DEVICE column.
-
-     Lsof may add two parenthetical notes to the NAME column  for
-     open  Solaris  10 files:  ``(?)'' if lsof considers the path
-     name of questionable accuracy; and ``(deleted)'' if  the  -X
-     option  has  been specified and lsof detects the open file's
-     path name has been deleted.  Consult the lsof FAQ  (The  FAQ
-     section  gives its location.)  for more information on these
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  42
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-     NAME column additions.
-
-LOCKS
-     Lsof can't  adequately  report  the  wide  variety  of  UNIX
-     dialect  file  locks in a single character.  What it reports
-     in a single character is a compromise between  the  informa-
-     tion  it  finds  in  the  kernel  and the limitations of the
-     reporting format.
-
-     Moreover, when a process holds several byte level locks on a
-     file,  lsof  only  reports  the  status of the first lock it
-     encounters.  If it is a byte level lock, then the lock char-
-     acter  will  be  reported in lower case - i.e., `r', `w', or
-     `x' - rather than the upper case equivalent reported  for  a
-     full file lock.
-
-     Generally lsof can  only  report  on  locks  held  by  local
-     processes  on local files.  When a local process sets a lock
-     on a remotely mounted (e.g., NFS) file,  the  remote  server
-     host  usually  records  the  lock  state.   One exception is
-     Solaris - at some patch levels of 2.3, and in  all  versions
-     above  2.4, the Solaris kernel records information on remote
-     locks in local structures.
-
-     Lsof has trouble reporting locks  for  some  UNIX  dialects.
-     Consult the BUGS section of this manual page or the lsof FAQ
-     (The FAQ section gives its location.)  for more information.
-
-OUTPUT FOR OTHER PROGRAMS
-     When the -F option is specified, lsof produces  output  that
-     is  suitable for processing by another program - e.g, an awk
-     or Perl script, or a C program.
-
-     Each unit of information is output in a field that is  iden-
-     tified with a leading character and terminated by a NL (012)
-     (or a NUL (000) if the 0 (zero) field  identifier  character
-     is  specified.)   The  data of the field follows immediately
-     after the field identification character and extends to  the
-     field terminator.
-
-     It is possible to think of field output as process and  file
-     sets.  A process set begins with a field whose identifier is
-     `p' (for process  IDentifier  (PID)).   It  extends  to  the
-     beginning  of  the  next  PID  field or the beginning of the
-     first file  set  of  the  process,  whichever  comes  first.
-     Included  in  the  process  set are fields that identify the
-     command, the process group IDentification (PGID) number, the
-     task  (thread)  ID  (TID),  and  the user ID (UID) number or
-     login name.
-
-     A file set begins with a field whose identifier is `f'  (for
-     file descriptor).  It is followed by lines that describe the
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  43
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-     file's access mode, lock state, type, device, size,  offset,
-     inode,  protocol,  name and stream module names.  It extends
-     to the beginning of the next file or process set,  whichever
-     comes first.
-
-     When the NUL (000) field terminator has been  selected  with
-     the 0 (zero) field identifier character, lsof ends each pro-
-     cess and file set with a NL (012) character.
-
-     Lsof always produces one field, the PID  (`p')  field.   All
-     other  fields  may be declared optionally in the field iden-
-     tifier character list that follows the -F  option.   When  a
-     field  selection  character identifies an item lsof does not
-     normally list - e.g., PPID, selected with -R - specification
-     of  the  field  character - e.g., ``-FR'' - also selects the
-     listing of the item.
-
-     It is entirely possible to select a set of fields that  can-
-     not  easily  be parsed - e.g., if the field descriptor field
-     is not selected, it may be difficult to identify file  sets.
-     To  help  you  avoid  this  difficulty, lsof supports the -F
-     option; it selects the output of all fields with NL termina-
-     tors  (the  -F0 option pair selects the output of all fields
-     with NUL terminators).  For compatibility reasons neither -F
-     nor -F0 select the raw device field.
-
-     These are the fields that lsof  will  produce.   The  single
-     character listed first is the field identifier.
-
-          a    file access mode
-          c    process command name (all characters from proc or
-               user structure)
-          C    file structure share count
-          d    file's device character code
-          D    file's major/minor device number (0x<hexadecimal>)
-          f    file descriptor (always selected)
-          F    file structure address (0x<hexadecimal>)
-          G    file flaGs (0x<hexadecimal>; names if +fg follows)
-          g    process group ID
-          i    file's inode number
-          K    tasK ID
-          k    link count
-          l    file's lock status
-          L    process login name
-          m    marker between repeated output
-          M    the task comMand name
-          n    file name, comment, Internet address
-          N    node identifier (ox<hexadecimal>
-          o    file's offset (decimal)
-          p    process ID (always selected)
-          P    protocol name
-          r    raw device number (0x<hexadecimal>)
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  44
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-          R    parent process ID
-          s    file's size (decimal)
-          S    file's stream identification
-          t    file's type
-          T    TCP/TPI information, identified by prefixes (the
-               `=' is part of the prefix):
-                   QR=<read queue size>
-                   QS=<send queue size>
-                   SO=<socket options and values> (not all dialects)
-                   SS=<socket states> (not all dialects)
-                   ST=<connection state>
-                   TF=<TCP flags and values> (not all dialects)
-                   WR=<window read size>  (not all dialects)
-                   WW=<window write size>  (not all dialects)
-               (TCP/TPI information isn't reported for all supported
-                 UNIX dialects. The -h or -? help output for the
-                 -T option will show what TCP/TPI reporting can be
-                 requested.)
-          u    process user ID
-          z    Solaris 10 and higher zone name
-          Z    SELinux security context (inhibited when SELinux is disabled)
-          0    use NUL field terminator character in place of NL
-          1-9  dialect-specific field identifiers (The output
-               of -F? identifies the information to be found
-               in dialect-specific fields.)
-
-     You can get on-line help information on these characters and
-     their  descriptions  by  specifying  the  -F?  option  pair.
-     (Escape the `?' character as your  shell  requires.)   Addi-
-     tional information on field content can be found in the OUT-
-     PUT section.
-
-     As an example, ``-F pcfn'' will select the process ID (`p'),
-     command  name  (`c'),  file  descriptor  (`f') and file name
-     (`n') fields with an NL  field  terminator  character;  ``-F
-     pcfn0''  selects the same output with a NUL (000) field ter-
-     minator character.
-
-     Lsof doesn't produce all fields for every  process  or  file
-     set,  only  those that are available.  Some fields are mutu-
-     ally exclusive: file device characters and file  major/minor
-     device  numbers;  file  inode number and protocol name; file
-     name and stream identification; file size and  offset.   One
-     or  the  other  member of these mutually exclusive sets will
-     appear in field output, but not both.
-
-     Normally lsof ends each field with  a  NL  (012)  character.
-     The  0 (zero) field identifier character may be specified to
-     change the field terminator character to a NUL (000).  A NUL
-     terminator  may  be  easier  to  process with xargs (1), for
-     example, or with programs whose quoting mechanisms  may  not
-     easily  cope  with  the  range  of  characters  in the field
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  45
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-     output.  When the NUL field terminator is in use, lsof  ends
-     each process and file set with a NL (012).
-
-     Three aids to producing programs that can process lsof field
-     output  are included in the lsof distribution.  The first is
-     a C header file, lsof_fields.h, that  contains  symbols  for
-     the  field  identification  characters,  indexes for storing
-     them in a table, and explanation strings that  may  be  com-
-     piled into programs.  Lsof uses this header file.
-
-     The second aid is a set of sample scripts that process field
-     output, written in awk, Perl 4, and Perl 5.  They're located
-     in the scripts subdirectory of the lsof distribution.
-
-     The third aid is the C library used for the lsof test suite.
-     The  test  suite  is  written  in C and uses field output to
-     validate the correct operation of lsof.  The library can  be
-     found  in  the  tests/LTlib.c file of the lsof distribution.
-     The library uses the first  aid,  the  lsof_fields.h  header
-     file.
-
-BLOCKS AND TIMEOUTS
-     Lsof can be blocked by some kernel functions that it uses  -
-     lstat(2),  readlink(2),  and  stat(2).   These functions are
-     stalled in the kernel, for example,  when  the  hosts  where
-     mounted NFS file systems reside become inaccessible.
-
-     Lsof attempts to break these blocks with  timers  and  child
-     processes, but the techniques are not wholly reliable.  When
-     lsof does manage to break a block, it will report the  break
-     with  an error message.  The messages may be suppressed with
-     the -t and -w options.
-
-     The default timeout value may be displayed with the -h or -?
-     option,  and  it may be changed with the -S [t] option.  The
-     minimum for t is two seconds, but  you  should  avoid  small
-     values,  since  slow  system  responsiveness can cause short
-     timeouts to expire unexpectedly and perhaps stop lsof before
-     it can produce any output.
-
-     When lsof has to break a block during its access of  mounted
-     file  system  information,  it  normally continues, although
-     with less information available to display about open files.
-
-     Lsof can also be directed to avoid the protection of  timers
-     and  child  processes  when  using the kernel functions that
-     might block by specifying the -O option.   While  this  will
-     allow  lsof  to start up with less overhead, it exposes lsof
-     completely to the kernel situations  that  might  block  it.
-     Use this option cautiously.
-
-
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  46
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-AVOIDING KERNEL BLOCKS
-     You can use the -b option to tell lsof to avoid using kernel
-     functions that would block.  Some cautions apply.
-
-     First, using this option usually requires that  your  system
-     supply  alternate  device  numbers  in  place  of the device
-     numbers that lsof would normally obtain  with  the  lstat(2)
-     and  stat(2)  kernel  functions.   See  the ALTERNATE DEVICE
-     NUMBERS section for more  information  on  alternate  device
-     numbers.
-
-     Second, you can't specify names for lsof  to  locate  unless
-     they're  file  system  names.  This is because lsof needs to
-     know the device and inode numbers of files listed with names
-     in  the  lsof  options, and the -b option prevents lsof from
-     obtaining  them.   Moreover,  since  lsof  only  has  device
-     numbers for the file systems that have alternates, its abil-
-     ity to locate files on file systems  depends  completely  on
-     the  availability  and  accuracy  of  the alternates.  If no
-     alternates are available,  or  if  they're  incorrect,  lsof
-     won't be able to locate files on the named file systems.
-
-     Third, if the names of your  file  system  directories  that
-     lsof  obtains  from  your  system's mount table are symbolic
-     links, lsof won't be able to resolve  the  links.   This  is
-     because  the  -b  option  causes  lsof  to  avoid the kernel
-     readlink(2) function it uses to resolve symbolic links.
-
-     Finally, using the -b option causes lsof  to  issue  warning
-     messages  when it needs to use the kernel functions that the
-     -b option directs it to avoid.  You can suppress these  mes-
-     sages  by specifying the -w option, but if you do, you won't
-     see the alternate device numbers  reported  in  the  warning
-     messages.
-
-ALTERNATE DEVICE NUMBERS
-     On some dialects, when lsof has to break a block because  it
-     can't  get  information  about a mounted file system via the
-     lstat(2) and stat(2) kernel functions, or because you speci-
-     fied  the -b option, lsof can obtain some of the information
-     it needs - the device number and possibly  the  file  system
-     type  - from the system mount table.  When that is possible,
-     lsof will report the device number it  obtained.   (You  can
-     suppress the report by specifying the -w option.)
-
-     You can assist this process if your mount table is supported
-     with  an  /etc/mtab  or  /etc/mnttab  file  that contains an
-     options field by  adding  a  ``dev=xxxx''  field  for  mount
-     points that do not have one in their options strings.  Note:
-     you must be able to edit the file - i.e., some mount  tables
-     like  recent  Solaris  /etc/mnttab or Linux /proc/mounts are
-     read-only and can't be modified.
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  47
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-     You may also be able to supply device numbers using  the  +m
-     and  +m  m  options,  provided  they  are  supported by your
-     dialect.  Check the output of lsof's -h or -? options to see
-     if the +m and +m m options are available.
-
-     The ``xxxx'' portion of the field is the  hexadecimal  value
-     of  the  file  system's  device number.  (Consult the st_dev
-     field of the output of the lstat(2)  and  stat(2)  functions
-     for  the  appropriate values for your file systems.)  Here's
-     an example from a Sun Solaris 2.6  /etc/mnttab  for  a  file
-     system remotely mounted via NFS:
-
-          nfs  ignore,noquota,dev=2a40001
-
-     There's an advantage to having ``dev=xxxx'' entries in  your
-     mount  table  file,  especially  for  file  systems that are
-     mounted from remote  NFS  servers.   When  a  remote  server
-     crashes  and  you want to identify its users by running lsof
-     on one of its clients, lsof probably won't be  able  to  get
-     output  from the lstat(2) and stat(2) functions for the file
-     system.  If it can obtain the file  system's  device  number
-     from  the  mount table, it will be able to display the files
-     open on the crashed NFS server.
-
-     Some  dialects  that  do  not  use  an  ASCII  /etc/mtab  or
-     /etc/mnttab  file  for  the mount table may still provide an
-     alternative device number in their  internal  mount  tables.
-     This  includes  AIX, Apple Darwin, FreeBSD, NetBSD, OpenBSD,
-     and Tru64 UNIX.  Lsof knows how to  obtain  the  alternative
-     device  number  for  these  dialects  and  uses  it when its
-     attempt to lstat(2) or stat(2) the file system is blocked.
-
-     If you're not sure your dialect  supplies  alternate  device
-     numbers for file systems from its mount table, use this lsof
-     incantation to  see  if  it  reports  any  alternate  device
-     numbers:
-
-          lsof -b
-
-     Look for standard error file  warning  messages  that  begin
-     ``assuming "dev=xxxx" from ...''.
-
-KERNEL NAME CACHE
-     Lsof is able to examine the kernel's name cache or use other
-     kernel  facilities  (e.g., the ADVFS 4.x tag_to_path() func-
-     tion under Tru64 UNIX) on some dialects for most file system
-     types,  excluding  AFS,  and extract recently used path name
-     components from it.  (AFS file system path lookups don't use
-     the  kernel's  name  cache;  some  Solaris  VxFS file system
-     operations apparently don't use it, either.)
-
-
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  48
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-     Lsof reports the complete paths it finds in the NAME column.
-     If lsof can't report all components in a path, it reports in
-     the NAME column the file system name, followed by  a  space,
-     two  `-'  characters, another space, and the name components
-     it has located, separated by the `/' character.
-
-     When lsof is run in repeat mode - i.e., with the  -r  option
-     specified - the extent to which it can report path name com-
-     ponents for the same file may  vary  from  cycle  to  cycle.
-     That's  because other running processes can cause the kernel
-     to remove entries from its name cache and replace them  with
-     others.
-
-     Lsof's use of the kernel name cache to identify the paths of
-     files  can lead it to report incorrect components under some
-     circumstances.  This can happen when the kernel  name  cache
-     uses  device and node number as a key (e.g., SCO OpenServer)
-     and a key on a rapidly changing file system is  reused.   If
-     the UNIX dialect's kernel doesn't purge the name cache entry
-     for a file when it is unlinked, lsof may find a reference to
-     the wrong entry in the cache.  The lsof FAQ (The FAQ section
-     gives its location.)  has more information  on  this  situa-
-     tion.
-
-     Lsof can report path name components for these dialects:
-
-          FreeBSD
-          HP-UX
-          Linux
-          NetBSD
-          NEXTSTEP
-          OpenBSD
-          OPENSTEP
-          SCO OpenServer
-          SCO|Caldera UnixWare
-          Solaris
-          Tru64 UNIX
-
-     Lsof can't report path name components for these dialects:
-
-          AIX
-
-     If you want to know why lsof can't  report  path  name  com-
-     ponents for some dialects, see the lsof FAQ (The FAQ section
-     gives its location.)
-
-DEVICE CACHE FILE
-     Examining all members of the /dev (or  /devices)  node  tree
-     with  stat(2) functions can be time consuming.  What's more,
-     the information that  lsof  needs  -  device  number,  inode
-     number, and path - rarely changes.
-
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  49
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-     Consequently, lsof normally maintains an ASCII text file  of
-     cached   /dev  (or  /devices)  information  (exception:  the
-     /proc-based Linux lsof where it's not  needed.)   The  local
-     system administrator who builds lsof can control the way the
-     device cache file  path  is  formed,  selecting  from  these
-     options:
-
-          Path from the -D option;
-          Path from an environment variable;
-          System-wide path;
-          Personal path (the default);
-          Personal path, modified by an environment variable.
-
-     Consult the output of the -h, -D? , or -? help  options  for
-     the  current state of device cache support.  The help output
-     lists the default read-mode device cache file path  that  is
-     in  effect  for  the  current  invocation  of lsof.  The -D?
-     option output lists the read-only  and  write  device  cache
-     file  paths,  the  names of any applicable environment vari-
-     ables, and the personal device cache path format.
-
-     Lsof can detect that the current device cache file has  been
-     accidentally  or  maliciously  modified by integrity checks,
-     including the computation and verification of a sixteen  bit
-     Cyclic  Redundancy  Check  (CRC) sum on the file's contents.
-     When lsof senses something wrong with the file, it issues  a
-     warning  and  attempts  to remove the current cache file and
-     create a new copy, but only to a path that the  process  can
-     legitimately write.
-
-     The path from which a lsof process may  attempt  to  read  a
-     device  cache  file may not be the same as the path to which
-     it can legitimately write.  Thus when lsof  senses  that  it
-     needs  to update the device cache file, it may choose a dif-
-     ferent path for writing it from the path from which it  read
-     an incorrect or outdated version.
-
-     If available, the -Dr option will inhibit the writing  of  a
-     new  device  cache file.  (It's always available when speci-
-     fied without a path name argument.)
-
-     When a new device is added to the system, the  device  cache
-     file  may  need  to  be  recreated.  Since lsof compares the
-     mtime of the device cache file with the mtime and  ctime  of
-     the  /dev (or /devices) directory, it usually detects that a
-     new device has been added; in that case lsof issues a  warn-
-     ing message and attempts to rebuild the device cache file.
-
-     Whenever lsof writes a device cache file, it sets its owner-
-     ship  to the real UID of the executing process, and its per-
-     mission modes to 0600,  this  restricting  its  reading  and
-     writing to the file's owner.
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  50
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-LSOF PERMISSIONS THAT AFFECT DEVICE CACHE FILE ACCESS
-     Two permissions of the lsof executable affect its ability to
-     access  device  cache files.  The permissions are set by the
-     local system administrator when lsof is installed.
-
-     The first and rarer permission  is  setuid-root.   It  comes
-     into effect when lsof is executed; its effective UID is then
-     root, while its real (i.e., that of the logged-on user)  UID
-     is  not.  The lsof distribution recommends that versions for
-     these dialects run setuid-root.
-
-          HP-UX 11.11 and 11.23
-          Linux
-
-     The second and more common permission is setgid.   It  comes
-     into  effect  when the effective group IDentification number
-     (GID) of the lsof process is set to one that can access ker-
-     nel memory devices - e.g., ``kmem'', ``sys'', or ``system''.
-
-     An  lsof  process  that  has   setgid   permission   usually
-     surrenders  the  permission after it has accessed the kernel
-     memory devices.  When it does  that,  lsof  can  allow  more
-     liberal device cache path formations.  The lsof distribution
-     recommends that versions for these dialects run  setgid  and
-     be allowed to surrender setgid permission.
-
-          AIX 5.[12] and 5.3-ML1
-          Apple Darwin 7.x Power Macintosh systems
-          FreeBSD 4.x, 4.1x, 5.x and [6789].x for x86-based systems
-          FreeBSD 5.x, [6789].x and 1[012].8for Alpha, AMD64 and Sparc64
-              based systems
-          HP-UX 11.00
-          NetBSD 1.[456], 2.x and 3.x for Alpha, x86, and SPARC-based
-              systems
-          NEXTSTEP 3.[13] for NEXTSTEP architectures
-          OpenBSD 2.[89] and 3.[0-9] for x86-based systems
-          OPENSTEP 4.x
-          SCO OpenServer Release 5.0.6 for x86-based systems
-          SCO|Caldera UnixWare 7.1.4 for x86-based systems
-          Solaris 2.6, 8, 9 and 10
-          Tru64 UNIX 5.1
-
-     (Note:  lsof for AIX 5L and above needs setuid-root  permis-
-     sion if its -X option is used.)
-
-     Lsof for these dialects does not support a device cache,  so
-     the  permissions  given to the executable don't apply to the
-     device cache file.
-
-          Linux
-
-
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  51
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-DEVICE CACHE FILE PATH FROM THE -D OPTION
-     The -D option provides limited means for specifying the dev-
-     ice  cache  file  path.   Its  ?  function  will  report the
-     read-only and write device cache file paths that  lsof  will
-     use.
-
-     When the -D b, r, and u functions are available, you can use
-     them  to  request that the cache file be built in a specific
-     location (b[path]); read but not rebuilt (r[path]); or  read
-     and  rebuilt  (u[path]).  The b, r, and u functions are res-
-     tricted under some conditions.  They are restricted when the
-     lsof  process is setuid-root.  The path specified with the r
-     function is always read-only, even when it is available.
-
-     The b, r, and u functions are also restricted when the  lsof
-     process  runs  setgid  and lsof doesn't surrender the setgid
-     permission.  (See the LSOF PERMISSIONS  THAT  AFFECT  DEVICE
-     CACHE FILE ACCESS section for a list of implementations that
-     normally don't surrender their setgid permission.)
-
-     A further -D function, i (for ignore), is always available.
-
-     When available, the b function tells  lsof  to  read  device
-     information  from  the  kernel with the stat(2) function and
-     build a device cache file at the indicated path.
-
-     When available, the r function tells lsof to read the device
-     cache  file, but not update it.  When a path argument accom-
-     panies -Dr, it names the device  cache  file  path.   The  r
-     function  is always available when it is specified without a
-     path name argument.  If lsof is not running setuid-root  and
-     surrenders  its  setgid permission, a path name argument may
-     accompany the r function.
-
-     When available, the u function tells lsof to attempt to read
-     and  use  the device cache file.  If it can't read the file,
-     or if it finds the contents of the file  incorrect  or  out-
-     dated, it will read information from the kernel, and attempt
-     to write an updated version of the device  cache  file,  but
-     only  to a path it considers legitimate for the lsof process
-     effective and real UIDs.
-
-DEVICE CACHE PATH FROM AN ENVIRONMENT VARIABLE
-     Lsof's second choice for the device cache file is  the  con-
-     tents  of  the LSOFDEVCACHE environment variable.  It avoids
-     this choice if the lsof process is setuid-root, or the  real
-     UID of the process is root.
-
-     A further restriction applies to a device  cache  file  path
-     taken from the LSOFDEVCACHE environment variable:  lsof will
-     not write a device cache file to the path if the  lsof  pro-
-     cess doesn't surrender its setgid permission.  (See the LSOF
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  52
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-     PERMISSIONS THAT AFFECT DEVICE CACHE FILE ACCESS section for
-     information  on  implementations  that don't surrender their
-     setgid permission.)
-
-     The local system administrator can disable the  use  of  the
-     LSOFDEVCACHE  environment  variable  or change its name when
-     building lsof.  Consult the output of -D? for  the  environ-
-     ment variable's name.
-
-SYSTEM-WIDE DEVICE CACHE PATH
-     The  local  system  administrator  may  choose  to  have   a
-     system-wide device cache file when building lsof.  That file
-     will generally be constructed by a special  system  adminis-
-     tration procedure when the system is booted or when the con-
-     tents of /dev or  /devices)  changes.   If  defined,  it  is
-     lsof's third device cache file path choice.
-
-     You can tell that a system-wide  device  cache  file  is  in
-     effect  for  your  local  installation by examining the lsof
-     help option output - i.e., the output  from  the  -h  or  -?
-     option.
-
-     Lsof will never write to the system-wide device  cache  file
-     path  by  default.   It  must  be explicitly named with a -D
-     function in a root-owned procedure.  Once the file has  been
-     written,  the  procedure must change its permission modes to
-     0644   (owner-read   and   owner-write,   group-read,    and
-     other-read).
-
-PERSONAL DEVICE CACHE PATH (DEFAULT)
-     The default device cache file path of the lsof  distribution
-     is  one  recorded in the home directory of the real UID that
-     executes lsof.  Added to the home directory is a second path
-     component of the form .lsof_hostname.
-
-     This is lsof's fourth device cache file path choice, and  is
-     usually  the  default.   If  a system-wide device cache file
-     path was defined when lsof was  built,  this  fourth  choice
-     will  be applied when lsof can't find the system-wide device
-     cache file.  This is the only time lsof uses two paths  when
-     reading the device cache file.
-
-     The hostname part of the second component is the  base  name
-     of  the  executing host, as returned by gethostname(2).  The
-     base name is defined to  be  the  characters  preceding  the
-     first `.'  in the gethostname(2) output, or all the gethost-
-     name(2) output if it contains no `.'.
-
-     The device cache file belongs to the user ID and is readable
-     and  writable  by  the  user  ID alone - i.e., its modes are
-     0600.  Each distinct real user ID on a given host that  exe-
-     cutes  lsof  has a distinct device cache file.  The hostname
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  53
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-     part of the path distinguishes  device  cache  files  in  an
-     NFS-mounted home directory into which device cache files are
-     written from several different hosts.
-
-     The personal device cache file path formed  by  this  method
-     represents  a  device  cache  file that lsof will attempt to
-     read, and will attempt to  write  should  it  not  exist  or
-     should its contents be incorrect or outdated.
-
-     The -Dr option without a path name argument will inhibit the
-     writing of a new device cache file.
-
-     The -D? option will list the format specification  for  con-
-     structing  the  personal device cache file.  The conversions
-     used in  the  format  specification  are  described  in  the
-     00DCACHE file of the lsof distribution.
-
-MODIFIED PERSONAL DEVICE CACHE PATH
-     If this option is defined by the local system  administrator
-     when  lsof is built, the LSOFPERSDCPATH environment variable
-     contents may be used to add a component of the personal dev-
-     ice cache file path.
-
-     The LSOFPERSDCPATH variable contents  are  inserted  in  the
-     path  at  the place marked by the local system administrator
-     with the ``%p'' conversion in the HASPERSDC format  specifi-
-     cation of the dialect's machine.h header file.  (It's placed
-     right after the home directory in the default lsof distribu-
-     tion.)
-
-     Thus, for example, if LSOFPERSDCPATH contains ``LSOF'',  the
-     home   directory   is   ``/Homes/abe'',  the  host  name  is
-     ``lsof.itap.purdue.edu'', and the HASPERSDC  format  is  the
-     default  (``%h/%p.lsof_%L''),  the  modified personal device
-     cache file path is:
-
-          /Homes/abe/LSOF/.lsof_vic
-
-     The LSOFPERSDCPATH environment variable is ignored when  the
-     lsof process is setuid-root or when the real UID of the pro-
-     cess is root.
-
-     Lsof will not write to a modified personal device cache file
-     path  if  the  lsof process doesn't surrender setgid permis-
-     sion.  (See the LSOF PERMISSIONS THAT  AFFECT  DEVICE  CACHE
-     FILE  ACCESS section for a list of implementations that nor-
-     mally don't surrender their setgid permission.)
-
-     If, for example, you want to create a sub-directory of  per-
-     sonal  device  cache  file paths by using the LSOFPERSDCPATH
-     environment variable to name it, and lsof doesn't  surrender
-     its setgid permission, you will have to allow lsof to create
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  54
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-     device cache files at the standard personal  path  and  move
-     them to your subdirectory with shell commands.
-
-     The local system administrator may: disable this option when
-     lsof  is  built; change the name of the environment variable
-     from LSOFPERSDCPATH to something else; change the  HASPERSDC
-     format  to  include  the  personal path component in another
-     place; or exclude  the  personal  path  component  entirely.
-     Consult  the  output  of  the -D? option for the environment
-     variable's name and the HASPERSDC format specification.
-
-DIAGNOSTICS
-     Errors are identified with messages on  the  standard  error
-     file.
-
-     Lsof returns a one (1) if any error was detected,  including
-     the  failure  to  locate command names, file names, Internet
-     addresses or files, login names, NFS files, PIDs, PGIDs,  or
-     UIDs  it  was asked to list.  If the -V option is specified,
-     lsof will indicate the search items it failed to list.
-
-     It returns a zero (0) if no errors were detected and  if  it
-     was  able  to  list some information about all the specified
-     search arguments.
-
-     When lsof cannot open access to /dev (or /devices) or one of
-     its  subdirectories,  or  get  information on a file in them
-     with stat(2), it issues a  warning  message  and  continues.
-     That  lsof  will  issue  warning messages about inaccessible
-     files in /dev (or /devices) is indicated in its help  output
-     -  requested  with the -h or >B -?  options -  with the mes-
-     sage:
-
-          Inaccessible /dev warnings are enabled.
-
-     The warning message may be suppressed with  the  -w  option.
-     It may also have been suppressed by the system administrator
-     when lsof was compiled by the setting of  the  WARNDEVACCESS
-     definition.   In this case, the output from the help options
-     will include the message:
-
-          Inaccessible /dev warnings are disabled.
-
-     Inaccessible device warning messages usually disappear after
-     lsof has created a working device cache file.
-
-EXAMPLES
-     For a more extensive set of examples, documented more fully,
-     see the 00QUICKSTART file of the lsof distribution.
-
-     To list all open files, use:
-
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  55
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-          lsof
-
-     To list all open Internet, x.25  (HP-UX),  and  UNIX  domain
-     files, use:
-
-          lsof -i -U
-
-     To list all open IPv4 network files in use  by  the  process
-     whose PID is 1234, use:
-
-          lsof -i 4 -a -p 1234
-
-     Presuming the UNIX dialect supports IPv6, to list only  open
-     IPv6 network files, use:
-
-          lsof -i 6
-
-     To list all files using any protocol on ports 513,  514,  or
-     515 of host wonderland.cc.purdue.edu, use:
-
-          lsof -i @wonderland.cc.purdue.edu:513-515
-
-     To list  all  files  using  any  protocol  on  any  port  of
-     mace.cc.purdue.edu  (cc.purdue.edu  is  the default domain),
-     use:
-
-          lsof -i @mace
-
-     To list all open files for login name ``abe'',  or  user  ID
-     1234, or process 456, or process 123, or process 789, use:
-
-          lsof -p 456,123,789 -u 1234,abe
-
-     To list all open files on device /dev/hd4, use:
-
-          lsof /dev/hd4
-
-     To find the process that has /u/abe/foo open, use:
-
-          lsof /u/abe/foo
-
-     To send a SIGHUP to the processes that have /u/abe/bar open,
-     use:
-
-          kill -HUP `lsof -t /u/abe/bar`
-
-     To find any open file, including an open UNIX domain  socket
-     file, with the name /dev/log, use:
-
-          lsof /dev/log
-
-
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  56
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-     To find processes with open files on  the  NFS  file  system
-     named  /nfs/mount/point  whose  server  is inaccessible, and
-     presuming your mount table supplies the  device  number  for
-     /nfs/mount/point, use:
-
-          lsof -b /nfs/mount/point
-
-     To do the preceding search with warning messages suppressed,
-     use:
-
-          lsof -bw /nfs/mount/point
-
-     To ignore the device cache file, use:
-
-          lsof -Di
-
-     To obtain PID and command name field output  for  each  pro-
-     cess,  file  descriptor,  file device number, and file inode
-     number for each file of each process, use:
-
-          lsof -FpcfDi
-
-     To list the files at descriptors 1 and 3  of  every  process
-     running  the  lsof  command  for  login  ID ``abe'' every 10
-     seconds, use:
-
-          lsof -c lsof -a -d 1 -d 3 -u abe -r10
-
-     To list the current working directory of processes running a
-     command  that is exactly four characters long and has an 'o'
-     or 'O' in character three, use this regular expression  form
-     of the -c c option:
-
-          lsof -c /^..o.$/i -a -d cwd
-
-     To find an IP  version  4  socket  file  by  its  associated
-     numeric dot-form address, use:
-
-          lsof -i@128.210.15.17
-
-     To find an IP version 6 socket file (when the  UNIX  dialect
-     supports IPv6) by its associated numeric colon-form address,
-     use:
-
-          lsof -i@[0:1:2:3:4:5:6:7]
-
-     To find an IP version 6 socket file (when the  UNIX  dialect
-     supports  IPv6)  by an associated numeric colon-form address
-     that has a run of zeroes in it - e.g., the loop-back address
-     - use:
-
-          lsof -i@[::1]
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  57
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-     To obtain a  repeat  mode  marker  line  that  contains  the
-     current time, use:
-
-          lsof -rm====%T====
-
-     To add spaces to the previous marker line, use:
-
-          lsof -r "m==== %T ===="
-
-BUGS
-     Since lsof reads kernel memory in its search for open files,
-     rapid  changes  in  kernel  memory may produce unpredictable
-     results.
-
-     When a file has multiple record locks, the lock status char-
-     acter (following the file descriptor) is derived from a test
-     of the first lock structure, not from any combination of the
-     individual  record locks that might be described by multiple
-     lock structures.
-
-     Lsof can't search for files with restrictive access  permis-
-     sions  by name unless it is installed with root set-UID per-
-     mission.  Otherwise it is limited to searching for files  to
-     which its user or its set-GID group (if any) has access per-
-     mission.
-
-     The display of the  destination  address  of  a  raw  socket
-     (e.g., for ping) depends on the UNIX operating system.  Some
-     dialects store the destination address in the  raw  socket's
-     protocol control block, some do not.
-
-     Lsof can't always represent Solaris device  numbers  in  the
-     same  way that ls(1) does.  For example, the major and minor
-     device numbers  that  the  lstat(2)  and  stat(2)  functions
-     report  for  the directory on which CD-ROM files are mounted
-     (typically /cdrom) are not the same  as  the  ones  that  it
-     reports  for  the  device  on which CD-ROM files are mounted
-     (typically /dev/sr0).  (Lsof reports the directory numbers.)
-
-     The support for /proc file systems is available only for BSD
-     and  Tru64  UNIX  dialects, Linux, and dialects derived from
-     SYSV R4 - e.g., FreeBSD, NetBSD, OpenBSD, Solaris, UnixWare.
-
-     Some /proc file items - device  number,  inode  number,  and
-     file size - are unavailable in some dialects.  Searching for
-     files in a /proc file system may require that the full  path
-     name be specified.
-
-     No text (txt)  file  descriptors  are  displayed  for  Linux
-     processes.   All  entries  for  files other than the current
-     working directory, the root directory,  and  numerical  file
-     descriptors are labeled mem descriptors.
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  58
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-     Lsof can't search  for  Tru64  UNIX  named  pipes  by  name,
-     because  their  kernel implementation of lstat(2) returns an
-     improper device number for a named pipe.
-
-     Lsof can't report fully or correctly on HP-UX  9.01,  10.20,
-     and  11.00  locks  because  of insufficient access to kernel
-     data or errors in the kernel data.  See the  lsof  FAQ  (The
-     FAQ section gives its location.)  for details.
-
-     The AIX SMT file type is a fabrication.  It's  made  up  for
-     file  structures  whose  type  (15) isn't defined in the AIX
-     /usr/include/sys/file.h header file.  One way to create such
-     file  structures  is to run X clients with the DISPLAY vari-
-     able set to ``:0.0''.
-
-     The +|-f[cfgGn] option is not  supported  under  /proc-based
-     Linux  lsof,  because it doesn't read kernel structures from
-     kernel memory.
-
-ENVIRONMENT
-     Lsof may access these environment variables.
-
-     LANG              defines a  language  locale.   See  setlo-
-                       cale(3)  for  the names of other variables
-                       that can be used in place of LANG -  e.g.,
-                       LC_ALL, LC_TYPE, etc.
-
-     LSOFDEVCACHE      defines the path to a device  cache  file.
-                       See the DEVICE CACHE PATH FROM AN ENVIRON-
-                       MENT VARIABLE section  for  more  informa-
-                       tion.
-
-     LSOFPERSDCPATH    defines the middle component of a modified
-                       personal  device cache file path.  See the
-                       MODIFIED PERSONAL DEVICE CACHE  PATH  sec-
-                       tion for more information.
-
-FAQ
-     Frequently-asked questions and their answers  (an  FAQ)  are
-     available in the 00FAQ file of the lsof distribution.
-
-     That  file  is  also  available  via  anonymous   ftp   from
-     lsof.itap.purdue.edu at pub/tools/unix/lsofFAQ.  The URL is:
-
-          ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/FAQ
-
-FILES
-     /dev/kmem         kernel virtual memory device
-
-     /dev/mem          physical memory device
-
-     /dev/swap         system paging device
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  59
-
-
-
-
-
-
-Maintenance Procedures                                    LSOF(8)
-
-
-
-     .lsof_hostname    lsof's  device  cache  file  (The  suffix,
-                       hostname,  is  the  first component of the
-                       host's name returned by gethostname(2).)
-
-AUTHORS
-     Lsof was written by Victor A.Abell <abe@purdue.edu> of  Pur-
-     due  University.   Many  others  have  contributed  to lsof.
-     They're listed in the 00CREDITS file of the  lsof  distribu-
-     tion.
-
-DISTRIBUTION
-     The latest distribution of lsof is available  via  anonymous
-     ftp  from  the  host  lsof.itap.purdue.edu.  You'll find the
-     lsof distribution in the pub/tools/unix/lsof directory.
-
-     You can also use this URL:
-
-          ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof
-
-     Lsof  is  also  mirrored   elsewhere.    When   you   access
-     lsof.itap.purdue.edu  and  change to its pub/tools/unix/lsof
-     directory, you'll be given a list of some mirror sites.  The
-     pub/tools/unix/lsof  directory also contains a more complete
-     list in its mirrors file.  Use mirrors with  caution  -  not
-     all mirrors always have the latest lsof revision.
-
-     Some  pre-compiled  Lsof  executables   are   available   on
-     lsof.itap.purdue.edu,  but  their  use is discouraged - it's
-     better that you build your own from  the  sources.   If  you
-     feel you must use a pre-compiled executable, please read the
-     cautions  that  appear  in   the   README   files   of   the
-     pub/tools/unix/lsof/binaries  subdirectories  and in the 00*
-     files of the distribution.
-
-     More information on the lsof distribution can  be  found  in
-     its  README.lsof_<version>  file.   If you intend to get the
-     lsof   distribution    and    build    it,    please    read
-     README.lsof_<version> and the other 00* files of the distri-
-     bution before sending questions to the author.
-
-SEE ALSO
-     Not all the following manual pages may exist in  every  UNIX
-     dialect to which lsof has been ported.
-
-     access(2), awk(1), crash(1), fattach(3C),  ff(1),  fstat(8),
-     fuser(1), gethostname(2), isprint(3), kill(1), localtime(3),
-     lstat(2),  modload(8),  mount(8),  netstat(1),   ofiles(8L),
-     perl(1),    ps(1),   readlink(2),   setlocale(3),   stat(2),
-     strftime(3), time(2), uname(1).
-
-
-
-
-
-
-SunOS 5.9          Last change: Revision-4.91                  60
-
-
-
diff --git a/misc.c b/misc.c
index 1682797abb987a3223ba658852a975da606b4767..1b2c2effe114a6434e55499969b3e0c1c467d43e 100644
--- a/misc.c
+++ b/misc.c
@@ -1212,8 +1212,10 @@ no_readlink_space:
 		stk[i] = (char *)NULL;
 	    }
 	    (void) free((FREE_P *)stk);
+	    (void) free((FREE_P *)s1);
 	    stk = (char **)NULL;
 	    ss = sx = 0;
+	    s1 = (char *)NULL;
 	    op = (char *)NULL;
 	    return((char *)NULL);
 	}
diff --git a/support/AIXDistrib b/support/AIXDistrib
new file mode 100755
index 0000000000000000000000000000000000000000..1d13db6270a47deacb90d5afa5605c3bf46b1a8d
--- /dev/null
+++ b/support/AIXDistrib
@@ -0,0 +1,14 @@
+#!/bin/ksh
+#
+# AIXDistrib -- make AIX distribution of lsof 4.x
+#
+# Usage: AIXDistrib [<suffix>]
+#
+#	 <suffix>	optional suffix for identification
+
+if test $# -gt 1
+then
+  echo "Usage: [<suffix>]"
+  exit 1
+fi
+$HOME/src/lsof4/support/GenericDistrib aix $1
diff --git a/support/DUDistrib b/support/DUDistrib
new file mode 100755
index 0000000000000000000000000000000000000000..a2bdd57d608b8ec0e1709e93e4a51e1c4875ee61
--- /dev/null
+++ b/support/DUDistrib
@@ -0,0 +1,14 @@
+#!/bin/ksh
+#
+# OSFDistrib -- make Digital UNIX (DEC OSF/1) distribution of lsof 4.x
+#
+# Usage: DUDistrib [<suffix>]
+#
+#	 <suffix>	optional suffix for identification
+
+if test $# -gt 1
+then
+  echo "Usage: [<suffix>]"
+  exit 1
+fi
+$HOME/src/lsof4/support/GenericDistrib du $1
diff --git a/support/DarwinDistrib b/support/DarwinDistrib
new file mode 100755
index 0000000000000000000000000000000000000000..9ade0128655d32dce614c0d51399d24502435872
--- /dev/null
+++ b/support/DarwinDistrib
@@ -0,0 +1,14 @@
+#!/bin/ksh
+#
+# DarwinDistrib -- make Apple Darwin distribution of lsof 4.x
+#
+# Usage: DarwindDistrib [<suffix>]
+#
+#	 <suffix>	optional suffix for identification
+
+if test $# -gt 1
+then
+  echo "Usage: [<suffix>]"
+  exit 1
+fi
+$HOME/src/lsof4/support/GenericDistrib2 darwin $1
diff --git a/support/Distfile.msrc b/support/Distfile.msrc
new file mode 100644
index 0000000000000000000000000000000000000000..2c175c305933dd2d2982197c6ab81e7f34922a31
--- /dev/null
+++ b/support/Distfile.msrc
@@ -0,0 +1,17 @@
+# $Id: Distfile.msrc,v 1.3 97/03/04 09:32:13 abe Exp $
+
+( . ) -> ( HOST )
+	except_pat ( /RCS /Makefile\$ /Distfile /Make\.host /dialects /Lsof.8 );
+	install ${INTO};
+
+( @Make.host@ ) -> ( HOST )
+	install -b ${INTO}/makefile;
+
+ifelse(
+HOSTTYPE,`IBMR2',`( ./dialects/aix ) -> ( HOST )
+	except_pat ( /RCS );
+	install ${INTO}/dialects/aix;',
+HOSTTYPE,`SUN5',`( ./dialects/sun ) -> ( HOST )
+	except_pat ( /RCS );
+	install ${INTO}/dialects/sun;',
+)dnl
diff --git a/support/FreeBSDDistrib b/support/FreeBSDDistrib
new file mode 100755
index 0000000000000000000000000000000000000000..b58a4a9d3ba4a21a8c5962a93a7980f4beeed40a
--- /dev/null
+++ b/support/FreeBSDDistrib
@@ -0,0 +1,14 @@
+#!/bin/ksh
+#
+# FreeBSDDistrib -- make FreeBSD distribution of lsof 4.x
+#
+# Usage: FreeBSDDistrib [<suffix>]
+#
+#	 <suffix>	optional suffix for identification
+
+if test $# -gt 1
+then
+  echo "Usage: [<suffix>]"
+  exit 1
+fi
+$HOME/src/lsof4/support/GenericDistrib2 freebsd $1
diff --git a/support/GPGDistrib b/support/GPGDistrib
new file mode 100755
index 0000000000000000000000000000000000000000..fc950e3ca298f165d58657fce2b1d4897ab8a5d0
--- /dev/null
+++ b/support/GPGDistrib
@@ -0,0 +1,493 @@
+#!/bin/ksh
+#
+# GPGDistrib -- make lsof 4.x GPG distribution files
+
+# Define DEBUG to 1 in the environment to skip to the README file construction.
+#
+# Usage: GPGDistrib [edition]
+#
+#	edition		optional edition suffix to add to version number
+#set -x	# DEBUG
+
+if test "X$DEBUG" = "X"
+then
+  DEBUG=0
+fi
+
+# Check for GPG pass phrase.
+
+if test $DEBUG -eq 0
+then
+  if test "X$PGPPASS" = "X"
+  then
+    echo "No GPG pass phrase is defined in the environment."
+    exit 1
+  fi
+fi
+
+# Change working directory.
+
+HD=$HOME/src/lsof4
+echo Changing to $HD
+cd $HD
+
+# Get version number.
+
+V=`sed '/VN/s/.ds VN \(.*\)/\1/' version`
+if test $? -ne 0
+then
+  echo $V
+  exit 1
+fi
+
+# Handle optional edition suffix.
+
+if test $# -gt 0
+then
+  if test $# -gt 1
+  then
+    echo "Usage: GPGDistrib [edition]"
+    exit 1
+  fi
+  V=${V}$1
+fi
+
+# Define directory and archive file names.
+
+CK=CHECKSUMS_${V}
+DN=lsof_${V}
+DT=${DN}.tar
+M=00MANIFEST
+MC=${DN}/manifest_check.${V}
+R=README.lsof_${V}
+RM=00.README.FIRST_${V}
+SF=support/lsof.README
+DSF=RELEASE.SUMMARY_${V}
+SN=${DN}_src
+SD=${DN}/$SN
+ST=${SN}.tar
+echo "Creating lsof ${V} GPG distribution ..."
+
+# Define source files to copy.
+
+F="00.README.FIRST 00CREDITS 00DCACHE 00DIALECTS 00DIST 00FAQ 00LSOF-L 00MANIFEST 00PORTING 00QUICKSTART 00README 00TEST 00XCONFIG AFSConfig ChangeLog Configure Customize Inventory dialects arg.c lib lsof.h lsof_fields.h main.c misc.c node.c print.c proc.c proto.h regex.h scripts store.c tests usage.c util.c version"
+MS=Lsof.8
+MD=${DN}/${SN}/lsof.8
+MF=${DN}/${SN}/lsof.man
+
+# Set exit cleanup trap.
+
+trap 'rm -rf support/$CK $DN; exit' 1 2 3 15
+
+# Create source directory.
+
+if test $DEBUG -eq 0
+then
+  echo Creating $DN and ${DN}/${SN}
+  rm -rf $DN
+  mkdir $DN
+  (cd $DN; mkdir $SN)
+  echo "Copying to ${SD}:\c"
+  for i in $F
+  do
+    echo " $i\c"
+    cp -rp $i $SD
+  done
+  echo " ... done"
+  echo "Removing extraneous stuff from lib ...\c"
+  find $SD/lib -name OLD -exec rm -rf {} \; > /dev/null 2>&1
+  find $SD/lib -name RCS -exec rm -rf {} \; > /dev/null 2>&1
+  find $SD/lib -name NEW -exec rm -rf {} \; > /dev/null 2>&1
+  rm -rf $SD/lib/Makefile
+  rm -rf $SD/lib/*.[oa]
+  echo " done"
+  echo "Removing extraneous stuff from dialects ...\c"
+  find $SD/dialects -name OLD -exec rm -rf {} \; > /dev/null 2>&1
+  find $SD/dialects -name RCS -exec rm -rf {} \; > /dev/null 2>&1
+  find $SD/dialects -name NEW -exec rm -rf {} \; > /dev/null 2>&1
+  find $SD/dialects -name Makefile.local -exec rm -f {} \; > /dev/null 2>&1
+  find $SD/dialects -name distfile.kvm -exec rm -f {} \; > /dev/null 2>&1
+  find $SD/dialects -name support -exec rm -rf {} \; > /dev/null 2>&1
+  echo " done"
+  echo "Removing extraneous stuff from scripts ...\c"
+  find $SD/scripts -name OLD -exec rm -rf {} \; > /dev/null 2>&1
+  find $SD/scripts -name RCS -exec rm -rf {} \; > /dev/null 2>&1
+  find $SD/scripts -name NEW -exec rm -rf {} \; > /dev/null 2>&1
+  echo " done"
+  echo "Removing extraneous stuff from tests ...\c"
+  find $SD/tests -name OLD -exec rm -rf {} \; > /dev/null 2>&1
+  find $SD/tests -name RCS -exec rm -rf {} \; > /dev/null 2>&1
+  find $SD/tests -name NEW -exec rm -rf {} \; > /dev/null 2>&1
+  rm -rf $SD/tests/config.* $SD/tests/*.o
+  rm -rf $SD/tests/LTbasic $SD/tests/LTbigf $SD/tests/LTdnlc
+  rm -rf $SD/tests/LTlock $SD/tests/LTnfs $SD/tests/LTnlink
+  rm -rf $SD/tests/LTsock $SD/tests/LTszoff $SD/tests/LTunix
+  echo " done"
+fi
+
+# Create manual page files.
+
+if test $DEBUG -eq 0
+then
+  echo Producing $MD
+  soelim < $MS > $MD
+  echo Producing $MF
+  nroff -man $MD | colcrt - | cat -s > $MF
+fi
+
+# Check distribution directory for completeness.
+
+if test $DEBUG -eq 0
+then
+  echo "Checking $SD for completeness"
+  rm -f $MC
+  (cd $SD; ls -FR) > $MC
+  diff $M $MC > /dev/null
+  if test $? -ne 0
+  then
+    (echo Some files may be missing.; echo diff $M $MC; diff $M $MC) | less
+    exit 1
+  fi
+fi
+
+# Create source distribution tar file.
+
+if test $DEBUG -eq 0
+then
+  echo Creating $ST in $DN
+  (cd $DN; tar cf $ST $SN; ls -l $ST)
+  echo Removing $SD
+  rm -rf $SD
+fi
+
+# Create source distribution README.lsof_<version> file.
+
+if test $DEBUG -eq 0
+then
+  echo Creating $R for $DT
+  rm -f ${DN}/$R
+  EO=${DN}/$R
+else
+  echo "==== The $R file ====="
+  EO=""
+fi
+cat > $EO << END_README_1
+
+                Information About This Lsof Distribution
+
+
+What You Have
+=============
+
+If you got this far without being confused, then you are probably
+familiar with the construction of the lsof distribution or you have
+read RELEASE.SUMMARY_${V}.  If either is the case, please skip to
+the Inventory section.  If you haven't read RELEASE.SUMMARY_${V},
+I suggest you do it now, because it explains how the lsof distribution
+is constructed and other useful things about lsof, including a
+summary of changes for the past few lsof revisions.
+
+Even though you may have thought you were getting lsof.tar.bz2,
+lsof.tar.gz or lsof.tar.Z with ftp, you really got ${DT}.bz2,
+${DT}.gz or ${DT}.Z.  That's because the triplet of
+lsof.tar.* files are symbolic links to their longer-named counterparts.
+
+The bzip2'd, gzip'd or compressed tar files with lsof_, followed by a
+number, are wrapper archives, designed to package the lsof source
+archive, this file, other documentation files, and a GPG authentication
+certificate together.
+
+The number, ${V}, is the lsof revision number.  When you bunzip2'd,
+gunzip'd or uncompressed ${DT}.* and used tar to unpack
+${DT}, you got: ${RM}, describing the contents
+of ${DN}; ${R}; ${ST}; and
+${ST}.sig.  All are identified with the revision number.
+You're reading ${R}.  ${ST}.sig is a GPG
+certificate that authenticates the lsof source archive,
+${ST}.
+
+After you read the Inventory and Security sections, and hopefully
+after you check the GPG certificate, unpack the ${ST}
+source archive and you will get a sub-directory, named ${SN},
+that contains the lsof ${V} source distribution.
+
+
+Inventory
+=========
+
+Once you have unpacked ${ST}.tar, you can check
+${SN} for completeness by changing to that sub-directory
+and running the Inventory script.  The ${SN}/Configure
+script runs the Inventory script, too.  The Configure script also
+calls a customization script, called Customize.  You can direct
+Configure to avoid calling Inventory and Customize with the -n
+option.
+
+See the Distribution Contents section of the 00DIST file and The
+Inventory Script section of the 00README file for more information
+on the contents of the lsof distribution, and the Configure,
+Customize and Inventory scripts.  The 00DIST and 00README files
+will be found in the ${SN} sub-directory you just created.
+
+
+Security
+========
+
+The md5 checksum for $ST is:
+
+END_README_1
+echo "  \c" >> $EO
+if test $DEBUG -eq 1
+then
+  echo "MD5 checksum of $ST would go here." >> $EO
+else
+  (cd $DN; md5 $ST) >> $EO
+fi
+cat >> $EO << END_README_2
+
+A good source for an MD5 checksum computation tool is the OpenSSL
+project whose work may be found at:
+
+  www.openssl.org
+
+You can use the openssl "dgst" operator to compute an MD5 checksum --
+e.g.,
+
+  $ openssl dgst -md5 $SN
+
+The old-style sum(1) checksum for $ST (Please read
+the next paragraph if you don't get this value.) is:
+
+END_README_2
+echo "  \c" >> $EO
+if test $DEBUG -eq 1
+then
+  echo "Sum checksum of $ST would go here." >> $EO
+else
+  sum -r ${DN}/$ST >> $EO
+fi
+cat >> $EO << END_README_3
+
+If your dialect's sum(1) program defaults to the new style algorithm
+(e.g., Solaris), you may have to use its -r option (or use the
+Solaris /usr/ucb/sum).  If your Unix dialect doesn't have a sum(1)
+program (e.g., FreeBSD, or NetBSD), use its cksum(1) program with
+the -o1 option to get an old-style checksum.  You may also need to
+ignore the block count, depending on the block size used on your
+your system (i.e., 512 or 1,024).  The sum(1) that produced the
+above checksum considers block size to be 512; in contrast the BSD
+cksum(1) programs' -o1 option considers block size to be 1,024.
+
+${ST}.sig is a GPG certificate file, using my public
+key.  My key may be available on some public key servers under the
+names:
+
+    Victor A. Abell <abe@cc.purdue.edu>
+ or
+    Victor A. Abell <abe@purdue.edu>
+
+You will also find it at:
+
+  ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/Victor_A_Abell.gpg
+
+Get my key and install it in your public key ring.
+
+Once my key is installed, use this command to check the certificate
+of $ST:
+
+    gpg --verify ${ST}.sig $ST
+
+If the certificate check isn't good, $ST is suspect.
+Report the problem to me via e-mail at <abe@purdue.edu>.
+
+If you don't have GPG, you can compare the md5 checksum of
+$ST to the value listed in this file.  However, that
+is a less reliable authentication method, since it can't detect
+changes to both $ST and the md5 checksum value listed
+in this tile.
+
+Other Security
+==============
+
+Signature information for the distribution file that contains
+this file may be found in the CHECKSUMS file that is located
+where the distribution file was found.
+
+
+Victor A. Abell <abe@purdue.edu>
+END_README_3
+
+date >> $EO
+
+# Create GPG certificate.
+
+if test $DEBUG -eq 0
+then
+  echo Creating ${ST}.sig in $DN
+  (cd $DN; rm -f ${ST}.sig; \
+   echo $PGPPASS | gpg -o ${ST}.sig --passphrase-fd 0 -b $ST; \
+   chmod 644 ${ST}.sig)
+fi
+
+# Construct distribution's 00.README_FIRST_<version> file.
+
+if test $DEBUG -eq 0
+then
+  echo Creating $RM for $DT
+  rm -f ${DN}/$RM
+  EO=${DN}/$RM
+else
+  echo ""
+  echo "==== The $RM file ====="
+  echo ""
+  EO=""
+fi
+echo "A tour of the lsof_${V} distribution:" > $EO
+echo "" >> $EO
+echo "  $RM is this file." >> $EO
+echo "" >> $EO
+echo "  $R contains distribution and security information." >> $EO
+echo "" >> $EO
+echo "  ${DSF} contains a summary of the lsof ${V}" >> $EO
+echo "  distribution." >> $EO
+echo "" >> $EO
+echo "  $ST is the lsof ${V} source tar archive." >> $EO
+echo "" >> $EO
+echo "  ${ST}.sig is a detached GPG certificate for" >> $EO
+echo "  ${ST}." >> $EO
+echo "" >> $EO
+echo "I suggest you follow these steps:" >> $EO
+echo "" >> $EO
+echo "1.  Read ${RM}." >> $EO
+echo "" >> $EO
+echo "2.  Read ${R} and follow its instructions to verify" >> $EO
+echo "    the authenticity of ${ST}." >> $EO
+echo "" >> $EO
+echo "3.  Unpack ${ST} -- use \`tar xf ${ST}\`." >> $EO
+echo "    That will produce an ${SN} sub-directory." >> $EO
+echo "" >> $EO
+echo "4.  Change to the ${SN} sub-directory and read its" >> $EO
+echo "    00.README.FIRST file." >> $EO
+echo "" >> $EO
+echo "Vic Abell <abe@purdue.edu>" >> $EO
+echo `date` >> $EO
+
+# Create distribution summary file.
+
+if test $DEBUG -eq 0
+then
+  echo Creating ${DN}/$DSF
+  rm -f ${DN}/$DSF
+  cp $SF ${DN}/$DSF
+else
+  echo Distribution summary file would be ${DN}/$DSF, copied from $SF.
+fi
+
+# Create distribution tar file, then bzip2, compress and gzip it.
+
+if test $DEBUG -eq 0
+then
+  rm -f $MC
+  echo Creating $DT
+  rm -f $DT ${DT}.bz2 ${DT}.gz ${DT}.Z
+  tar cf $DT $DN
+  ls -l $DT
+  echo Bzip2ing $DT
+  bzip2 -c $DT > support/${DT}.bz2
+  ls -l support/${DT}.bz2
+  echo Gzipping $DT
+  gzip -c $DT > support/${DT}.gz
+  ls -l support/${DT}.gz
+  echo Compressing $DT
+  compress < $DT > support/${DT}.Z
+  ls -l support/${DT}.Z
+  echo Removing $DN and $DT
+  rm -rf $DN $DT
+
+  # Create checksum files.
+
+  for i in bz2 gz Z
+  do
+    echo Creating ${DT}.${i}.sig
+    SIG=support/${DT}.${i}.sig
+    SRC=support/${DT}.${i}
+    rm -f $SIG
+    echo $PGPPASS | gpg -o $SIG --passphrase-fd 0 -b $SRC
+  done
+  echo Creating $CK
+  rm -f support/$CK
+  cat >> support/$CK << END_CKSUM_1
+
+                        Checksums for lsof_${V}
+
+This file was created when the official lsof ${V} distribution files
+were created.  It contains MD5 checksums and GPG certificate
+information for the lsof ${V} bzip2, gzip and compressed distribution
+files.
+
+There are additional opportunities to validate the lsof distribution
+with infomation found inside it.  Consult the file ${R}
+inside the distribution.
+
+MD5 Checksums
+=============
+
+The MD5 checksums are:
+
+END_CKSUM_1
+
+  for i in bz2 gz Z
+  do
+    echo "  \c" >> support/$CK
+    (cd support; md5 ${DT}.$i >> $CK)
+  done
+
+cat >> support/$CK << END_CKSUM_2
+
+GPG Certificates
+================
+
+The following files, found with the lsof distribution files, contain
+GPG certificates:
+
+  lsof.tar.bz2.sig or ${DT}.bz2.sig
+  lsof.tar.gz.sig  or ${DT}.gz.sig
+  lsof.tar.Z.sig   or ${DT}.Z.sig
+
+Validating a GPG certificate is the best way to make sure no one has
+tampered with a distribution file.
+
+Use the GPG certificate files with the GPG public key for:
+
+  Victor A. Abell <abe@purdue.edu>
+
+You may be able to find the key on some public key servers.  It is also
+available at:
+
+  ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/Victor_A_Abell.gpg
+
+Get the key and install it in your public key ring.  Once the key is
+installed, use one of these command forms to check the certificate of a
+distribution file:
+
+  gpg --verify ${DT}.<type>.sig ${DT}.<type>
+
+or
+
+  gpg --verify lsof.tar.<type>.sig lsof.tar.<type>
+
+Where <type> is bz2, gz or Z.
+
+Problems
+========
+
+If an MD5 or GPG check reveals a problem, please report it via e-mail
+to <abe@purdue.edu>.
+
+
+Vic Abell
+END_CKSUM_2
+date >> support/$CK
+(cd support; ls -l $CK)
+fi
+echo "all done"
diff --git a/support/GenericCopy b/support/GenericCopy
new file mode 100755
index 0000000000000000000000000000000000000000..a9f86a94a42fa38215448bd1f216bf427bb4a256
--- /dev/null
+++ b/support/GenericCopy
@@ -0,0 +1,88 @@
+#!/bin/ksh
+#
+# GenericCopy -- generically copy lsof 4.x sources to a specified destination
+#
+# Usage: GenericCopy <destination> <login> <dialect> [<directory>]
+#
+#	 <destination>	destination host
+#
+#	 <login>	login name at destination host
+#
+#	 <dialect>	dialect subdirectory name
+#
+#	 [<directory>]	directory if other than src/lsof4
+
+if test $# -lt 1 -o $? -gt 4
+then
+  echo "Usage: <destination> <login> <dialect> [<directory>]"
+  exit
+fi
+D=$1
+L=$2
+DSDIR=$3
+if test $# -eq 4
+then
+  DDIR=$4
+else
+  DDIR=src/lsof4
+fi
+
+# Set useful definitions.
+
+SDIR=src/lsof4
+F="00DIALECTS AFSConfig Configure Customize Inventory arg.c lsof_fields.h lsof.h main.c misc.c node.c print.c proc.c proto.h regex.h store.c usage.c util.c version"
+
+cd $HOME/$SDIR
+
+# Make sure the destination directories exist.
+
+rsh $D -l $L -n mkdir $DDIR $DDIR/dialects $DDIR/lib $DDIR/dialects/$DSDIR
+
+# Copy new base directory files to destination.
+
+rsh $D -l $L -n "(cd $DDIR; rm -f $F)"
+for i in $F
+do
+  rcp $i ${L}@${D}:${DDIR}
+  echo "$i \c"
+done
+echo ""
+
+# Remove old files in lib/ and dialects/<dialect>/.
+
+rsh $D -l $L -n "rm -rf $DDIR/lib/* $DDIR/dialects/$DSDIR/*"
+
+# Copy lib/*.
+
+cd lib
+echo "lib: \c"
+for i in *.c Makefile.skel
+do
+  if test ! -d $i
+  then
+    rcp $i ${L}@${D}:${DDIR}/lib
+    echo "$i \c"
+  fi
+done
+echo ""
+
+# Copy dialects/<dialect>/*.
+
+cd ../dialects/$DSDIR
+echo "dialects/$DSDIR: \c"
+for i in *
+do
+  if test -d $i
+  then
+    if test $i != OLD -a $i != NEW -a $i != RCS
+    then
+      rcp -r $i ${L}@${D}:${DDIR}/dialects/$DSDIR
+      echo "$i \c"
+    fi
+  else
+    rcp $i ${L}@${D}:${DDIR}/dialects/$DSDIR
+    echo "$i \c"
+  fi
+done
+echo ""
+echo "done"
diff --git a/support/GenericDistrib b/support/GenericDistrib
new file mode 100755
index 0000000000000000000000000000000000000000..3e1393f161cef17e9d93ad329d6dd3fcb258e344
--- /dev/null
+++ b/support/GenericDistrib
@@ -0,0 +1,70 @@
+#!/bin/ksh
+#
+# GenericDistrib -- generic lsof 4.x distribution gzip'd archive builder
+# GenericDistrib2 -- generic lsof 4.x distribution bzip2'd archive builder
+#
+# Usage: GenericDistrib <dialect> [<suffix>]
+#
+#	<dialect>	dialect's subdirectory name
+#
+#	[<suffix>]	optional suffix for version number
+
+cd $HOME/src/lsof4
+
+# Get version number.
+
+V=`sed '/VN/s/.ds VN \(.*\)/\1/' version`
+if test $? -ne 0
+then
+  echo $V
+  exit 1
+fi
+
+# Handle arguments.
+
+if test $# -lt 1 -o $# -gt 2
+then
+  echo "Usage: <dialect> [<suffix>]"
+  exit 1
+fi
+DIALECT=$1
+if test $# -eq 2
+then
+  V=${V}$2
+fi
+
+# Set variable names.
+
+DIR=lsof_${V}.${DIALECT}
+TAR=${DIR}.tar
+echo $0 | grep 2 > /dev/null
+if test $? -eq 0
+then
+  TARC=${TAR}.bz2
+  COMP=bzip2
+else
+  TARC=${TAR}.gz
+  COMP=gzip
+fi
+
+# Prepare for premature exit.
+
+trap 'rm -rf $DIR $TAR $TARC; exit' 1 2 3 15
+
+# Make a temporary directory with the relevant files in it and
+# create a gzip'd tar archive of it.
+
+rm -rf $TAR $TARC
+$HOME/src/lsof4/support/GenericSubdir $1 $2
+echo "Making $TAR ...\c"
+tar cf $TAR $DIR
+echo " done"
+ls -l $TAR
+echo "Removing $DIR ...\c"
+rm -rf $DIR
+echo " done"
+echo "$COMP $TAR ...\c"
+$COMP -c $TAR > support/$TARC
+echo " done"
+ls -l support/$TARC
+rm -f $TAR
diff --git a/support/GenericDistrib2 b/support/GenericDistrib2
new file mode 120000
index 0000000000000000000000000000000000000000..e2306c6a0d3142b70d743a2626aab89af354ba3b
--- /dev/null
+++ b/support/GenericDistrib2
@@ -0,0 +1 @@
+GenericDistrib
\ No newline at end of file
diff --git a/support/GenericRdist b/support/GenericRdist
new file mode 100755
index 0000000000000000000000000000000000000000..d001156fc313f0f750d75e2aa79a88f0f5e91e18
--- /dev/null
+++ b/support/GenericRdist
@@ -0,0 +1,80 @@
+#!/bin/ksh
+#
+# GenericRdist -- generically rdist lsof 4.x sources to a specified destination
+#
+# Usage: GenericRdist <destination> <dialect> <shell>
+#
+#	 <destination>	destination host
+#
+#	 <dialect>	dialect subdirectory name
+#
+#	 <shell>	remote shell -- rsh or ssh
+
+# Process arguments.
+
+if test $# -ne 3
+then
+  echo "Usage: <destination> <dialect> <shell>"
+  exit
+fi
+H=$1
+D=$2
+S=$3
+
+# Test the shell and define it's full path, as required.
+
+if test "X$S" = "Xrsh"
+then
+  SHP=""
+else
+  if test "X$S" = "Xssh"
+  then
+    SHP="-P /opt/openssh/bin/ssh"
+  else
+    echo "$S is not an acceptable shell; specify rsh or ssh."
+    exit
+  fi
+fi
+
+# Define the distfile and make sure it's removed on premature exit.
+
+R=/tmp/distfile.$$
+trap 'rm $R; exit 1' 1 2 3 15
+
+rm -f $R
+cat > $R << .DISTFILE
+. -> $H
+	except ( ./00.README.FIRST ./00DCACHE ./00DIST ./00FAQ );
+	except ( ./00PORTING ./00README ./00CREDITS ./00QUICKSTART );
+	except ( ./00LSOF-L ./00MANIFEST ./00XCONFIG ./.ck00MAN );
+	except ( ./00TEST ./.neverCust ./.neverInv );
+	except ( ./ChangeLog ./Makefile );
+	except ( ./lsof ./lsof32 ./lsof64 ./lsof_old /lsof_32.old );
+	except ( ./lsof_64.old ./Lsof.8 );
+	except ( ./ddev.c ./dfile.c ./dlsof.h ./dmnt.c ./dnode.c ./dnode1.c );
+	except ( ./dnode2.c ./dproc.c ./dproto.h ./dsock.c ./dstore.c );
+	except ( ./kernelbase.h ./machine.h ./version.h ./zipme );
+	except ( ./NEW ./OLD ./RCS ./dialects ./support ) ;
+	except ( ./make.out ./new ./old ./out ./X ./xxx ./errs ) ;
+	except ( ./lib/Makefile ./lib/RCS ./lib/OLD ./lib/NEW );
+	except ( ./scripts/OLD ./scripts/NEW ./scripts/RCS );
+	except ( ./scripts/00MANIFEST ./scripts/00README ) ;
+	except ( ./tests/OLD ./tests/NEW ./tests/RCS );
+	except ( ./tests/00README );
+	except ( ./tests/LTbasic ./tests/LTbigf ./tests/LTdnlc );
+	except ( ./tests/LTlock ./tests/LTnfs ./tests/LTnlink );
+	except ( ./tests/LTsock ./tests/LTszoff ./tests/LTunix );
+	except_pat ( \\.o\\$ \\.a\\$ ./tests/config\\. );
+	install src/lsof4;
+
+./dialects/$D -> $H
+	except ( ./dialects/$D/NEW );
+	except ( ./dialects/$D/OLD ./dialects/$D/RCS );
+	install src/lsof4/dialects/$D ;
+.DISTFILE
+
+# Do the actual distribution.
+
+(cd $HOME/src/lsof4; /usr/local/bin/rdist $SHP -f $R)
+rm $R
+echo done
diff --git a/support/GenericSubdir b/support/GenericSubdir
new file mode 100755
index 0000000000000000000000000000000000000000..3e6e2862ea378083b12164aaefd9eb7c26b6c7d7
--- /dev/null
+++ b/support/GenericSubdir
@@ -0,0 +1,100 @@
+#!/bin/ksh
+#
+# GenericSubdir -- create generic lsof 4.x distribution subdirectory
+#
+# Usage: GenericSubdir <dialect> [<suffix>]
+#
+#	<dialect>	dialect's subdirectory name
+#
+#	[<suffix>]	optional suffix for version number
+
+cd $HOME/src/lsof4
+
+# Get version number.
+
+V=`sed '/VN/s/.ds VN \(.*\)/\1/' version`
+if test $? -ne 0
+then
+  echo $V
+  exit 1
+fi
+
+# Handle arguments.
+
+if test $# -lt 1 -o $# -gt 2
+then
+  echo "Usage: <dialect> [<suffix>]"
+  exit 1
+fi
+DIALECT=$1
+if test $# -eq 2
+then
+  V=${V}$2
+fi
+
+# Set variable names.
+
+DIR=lsof_${V}.${DIALECT}
+F="00.README.FIRST 00CREDITS 00DCACHE 00DIALECTS 00DIST 00FAQ 00LSOF-L 00PORTING 00QUICKSTART 00README 00TEST 00XCONFIG AFSConfig ChangeLog Configure Customize Inventory arg.c lsof_fields.h lsof.h main.c misc.c node.c print.c proc.c proto.h regex.h store.c usage.c util.c version"
+MS=Lsof.8
+MD=lsof.8
+MF=lsof.man
+
+# Prepare for premature exit.
+
+trap 'rm -rf $DIR; exit' 1 2 3 15
+
+# Make a temporary directory and copy the relevant files to it.
+
+rm -rf $DIR
+mkdir $DIR
+echo "Copying:\c"
+for i in $F
+do
+  echo " $i\c"
+  cp -r $i $DIR
+done
+echo " ... done"
+echo "Copying lib ...\c"
+cp -r lib $DIR/lib
+echo " done"
+echo "Removing extraneous stuff from lib ...\c"
+rm -rf $DIR/lib/RCS $DIR/lib/OLD $DIR/lib/NEW
+rm -rf $DIR/lib/Makefile $DIR/lib/*.[oa]
+echo " done"
+mkdir $DIR/dialects
+echo "Copying dialects/${DIALECT} ...\c"
+cp -r dialects/${DIALECT} $DIR/dialects
+echo " done"
+echo "Removing extraneous stuff from dialects/${DIALECT} ...\c"
+rm -rf $DIR/dialects/${DIALECT}/distfile.kvm
+rm -rf $DIR/dialects/${DIALECT}/Makefile.LOCAL
+find ${DIR}/dialects -name OLD -exec rm -rf {} \; > /dev/null 2>&1
+find ${DIR}/dialects -name NEW -exec rm -rf {} \; > /dev/null 2>&1
+find ${DIR}/dialects -name support -exec rm -rf {} \; > /dev/null 2>&1
+find ${DIR}/dialects -name RCS -exec rm -rf {} \; > /dev/null 2>&1
+echo " done"
+echo "Copying scripts ...\c"
+cp -r scripts $DIR
+echo " done"
+echo "Removing extraneous stuff from scripts ...\c"
+rm -rf $DIR/scripts/NEW $DIR/scripts/OLD $DIR/scripts/RCS
+echo " done"
+echo "Copying tests ...\c"
+cp -r tests $DIR
+echo " done"
+echo "Removing extraneous stuff from tests ...\c"
+rm -rf $DIR/tests/NEW $DIR/tests/OLD $DIR/tests/RCS $DIR/tests/*.o
+rm -rf $DIR/tests/00README
+rm -rf $DIR/tests/config.* $DIR/tests/LTbasic $DIR/tests/LTbigf
+rm -rf $DIR/tests/LTdnlc $DIR/tests/LTlock $DIR/tests/LTnfs
+rm -rf $DIR/tests/LTnlink $DIR/tests/LTsock $DIR/tests/LTszoff
+rm -rf $DIR/tests/LTunix
+echo " done"
+echo "Producing $MD and $MF ...\c"
+soelim < $MS > $DIR/$MD
+nroff -man $MS | colcrt - | cat -s > $DIR/$MF
+echo " done"
+echo "Producing 00MANIFEST ...\c"
+(cd $DIR; ls -FR > 00MANIFEST)
+echo " done"
diff --git a/support/GitHub-release/00README b/support/GitHub-release/00README
new file mode 100644
index 0000000000000000000000000000000000000000..fd69bbecf36ed1e4919110ff3774f0e6c8fce34a
--- /dev/null
+++ b/support/GitHub-release/00README
@@ -0,0 +1,10 @@
+There are two files in this directory that document the release
+of lsof to GitHub by Purdue officials.
+
+ITaP	contains a release from Purdue's Vice President for
+	Information technology, Gerry McCartney.
+
+Purdue	contains a release from Purdue's Senior Intellectual
+	Property Officer, Ken L. Sandel.
+
+14 July 2018
diff --git a/support/GitHub-release/ITaP b/support/GitHub-release/ITaP
new file mode 100644
index 0000000000000000000000000000000000000000..e3026c4a8426cebee75dd49ec32ae39f4e8571ce
--- /dev/null
+++ b/support/GitHub-release/ITaP
@@ -0,0 +1,47 @@
+From:	McCartney, William G <mccart@purdue.edu>
+Sent:	Wednesday, June 27, 2018 16:35
+To:	Victor Abell
+Cc:	Vic Abell
+Subject:	RE: retiring lsof
+
+No objection at all Vic,  and thank you for so many years of valuable service to the community.   
+
+From one my senior people: “Lsof is one of the most amazing UNIX tools that retired PUCC 
+wizard Vic wrote and still supports. Github is a much better answer than running a server in 
+ITaP for it.”
+
+Best wishes,   Gerry-
+
+From: Victor Abell <vabell@lsof.comcastbiz.net>  
+Sent: Wednesday, June 27, 2018 5:06 AM 
+To: McCartney, William G <mccart@purdue.edu> 
+Cc: Vic Abell <abe@purdue.edu> 
+Subject: retiring lsof
+
+Gerry,
+
+Since I retired from ITaP in 2003, I have received support from ITaP
+to continue distributing lsof, the open source UNIX tool that I developed
+at PUCC and released in 1994.  That support extends to a Visiting
+Scholar appointment and a Sun Solaris system, lsof.itap.purdue.edu
+from which lsof is distributed.
+
+I am nearing 80 in age and it is time for me to end my support before
+circumstances do it for me.  I announced that intention to the lsof –l
+mailing list (lsof-l@lists.purdue.edu) and several readers replied that
+they would like to continue support by moving lsof to the GitHub
+open source development platform (https://github.com/).
+
+Because the lsof source code contains a Purdue Research Foundation
+copyright, I have been discussing the release with Joseph R. Kasper
+(JRKasper@prf.org) in Purdue’s Office of Technology Commercialization.
+Joe is supportive of the move, but asks if I have discussed it with anyone
+in ITaP.  Only Greg Veldman (gv@purdue.edu) , who has provided
+support for lsof.itap, has been aware of the GitHub request.
+I have been remiss in not contacting you about this.  Please excuse my
+omission and let me know if you have any objection to the release of
+lsof to GitHub.
+
+Regards,
+
+Vic Abell
diff --git a/support/GitHub-release/Purdue b/support/GitHub-release/Purdue
new file mode 100644
index 0000000000000000000000000000000000000000..872be726102b09e8e2ce3fbfe8ff2d55fa7ae163
--- /dev/null
+++ b/support/GitHub-release/Purdue
@@ -0,0 +1,157 @@
+From:	Sandel, Ken L. <sandel@purdue.edu>
+Sent:	Tuesday, July 10, 2018 14:28
+To:	Victor Abell
+Subject:	RE: One more question regarding GitHub release
+
+Vic,
+
+For clarity – I approved the release.  
+
+Ken
+
+Ken L. Sandel
+Senior Director, Sponsored Program Services
+Senior Intellectual Property Officer
+Purdue University
+610 Purdue Mall
+Hovde Hall Room 328
+West Lafayette, IN 47907
+sandel@purdue.edu
+(765) 494-1063 (office)
+(765) 426-2530 (cell)
+
+From: Kasper, Joseph R. <JRKasper@prf.org>  
+Sent: Tuesday, July 10, 2018 11:23 AM 
+To: Victor Abell <vabell@lsof.comcastbiz.net> 
+Cc: Sandel, Ken L. <sandel@purdue.edu> 
+Subject: RE: One more question regarding GitHub release
+
+Hi Vic,
+
+My apologies for not following up. Mr. Sandel approves the release on GitHub under the copyright 
+notice text currently in use.
+
+Best,
+Joe
+
+Joseph R. Kasper, Ph.D.
+Senior Business Development Manager & Director of Marketing
+Office of Technology Commercialization 
+765-588-3486
+jrkasper@prf.org
+Purdue Technology Center Aerospace
+1801 Newman Road
+West Lafayette, IN 47906
+www.innovation-entrepreneurship-purdue.com
+www.prf.org/otc/
+ 
+
+CONFIDENTIALITY NOTICE:  This email and any attachments are for the exclusive and confidential use of the intended recipient.  If you are not 
+the intended recipient, please do not read, distribute or take action in reliance upon this message.  If you have received this in error, please 
+notify us immediately by return email and promptly delete this message and its attachments from your computer system.  
+
+
+
+
+From: Victor Abell <vabell@lsof.comcastbiz.net>  
+Sent: Monday, July 9, 2018 8:26 PM 
+To: Kasper, Joseph R. <JRKasper@prf.org> 
+Subject: RE: One more question regarding GitHub release
+
+Joe,
+
+Has there been any word from Ken about the release
+of lsof to GitHub?
+
+Vic
+
+From: Kasper, Joseph R. [mailto:JRKasper@prf.org]  
+Sent: Thursday, June 28, 2018 1:15 PM 
+To: Victor Abell 
+Subject: RE: One more question regarding GitHub release
+
+Hi Vic,
+
+One more request. Ken would like a copy of the email from Gerry. If for any reason you aren’t 
+comfortable sending it to me, please contact Ken directly (765-494-1063, sandel@purdue.edu).
+
+If this last piece of information is satisfactory to Ken, I expect to get his approval.
+
+Thanks for your cooperation throughout this process.
+
+Best,
+Joe
+
+From: Victor Abell <vabell@lsof.comcastbiz.net>  
+Sent: Thursday, June 28, 2018 7:43 AM 
+To: Kasper, Joseph R. <JRKasper@prf.org> 
+Subject: RE: One more question regarding GitHub release
+
+Joe,
+
+I sent e-mail to Gerry McCartney and in his answer he
+says he has no objection.
+
+Vic
+
+From: Kasper, Joseph R. [mailto:JRKasper@prf.org]  
+Sent: Tuesday, June 26, 2018 4:03 PM 
+To: Victor Abell 
+Subject: RE: One more question regarding GitHub release
+
+Hi Vic,
+
+Thanks for the extra detail. I think it would put Ken’s mind at ease if you have Gerry’s blessing. Let me 
+know if you’ll reach out to him.
+
+Best,
+Joe
+
+From: Victor Abell <vabell@lsof.comcastbiz.net>  
+Sent: Tuesday, June 26, 2018 3:57 PM 
+To: Kasper, Joseph R. <JRKasper@prf.org> 
+Subject: RE: One more question regarding GitHub release
+
+Joe,
+
+I have had no communication with ITaP about the move to GitHub.
+The extent of their involvement with lsof has been minimal – the
+Visiting Scholar appointment and the maintenance of a distribution
+system.
+
+I know Gerry McCartney well.  Would it be helpful if I contacted
+him about the GitHub move?
+
+Vic
+
+From: Kasper, Joseph R. [mailto:JRKasper@prf.org]  
+Sent: Tuesday, June 26, 2018 3:44 PM 
+To: Vic Abell; Victor Abell 
+Subject: One more question regarding GitHub release
+
+Hi Vic,
+
+Ken Sandel, Senior IP Officer, just got back to me. He wants to know if the leadership of ITaP supports 
+the contribution to Github. Please let me know. If you have any communication to this effect that you 
+can forward to me, it would be helpful.
+
+Best,
+Joe
+
+Joseph R. Kasper, Ph.D.
+Business Development Manager
+Purdue Research Foundation
+Office of Technology Commercialization 
+765-588-3486
+jrkasper@prf.org
+Purdue Technology Center Aerospace
+1801 Newman Road
+West Lafayette, IN 47906
+www.innovation-entrepreneurship-purdue.com
+www.prf.org/otc/
+ 
+
+CONFIDENTIALITY NOTICE:  This email and any attachments are for the exclusive and confidential use of the intended recipient.  If you are not 
+the intended recipient, please do not read, distribute or take action in reliance upon this message.  If you have received this in error, please 
+notify us immediately by return email and promptly delete this message and its attachments from your computer system.  
+
diff --git a/support/HPUXDistrib b/support/HPUXDistrib
new file mode 100755
index 0000000000000000000000000000000000000000..082e253a2ffb718d3d530feb24085a81cf85c01a
--- /dev/null
+++ b/support/HPUXDistrib
@@ -0,0 +1,14 @@
+#!/bin/ksh
+#
+# HPUXDistrib -- make HP-UX distribution of lsof 4.x
+#
+# Usage: HPUXDistrib [<suffix>]
+#
+#	 <suffix>	optional suffix for identification
+
+if test $# -gt 1
+then
+  echo "Usage: [<suffix>]"
+  exit 1
+fi
+$HOME/src/lsof4/support/GenericDistrib hpux $1
diff --git a/support/LinuxDistrib b/support/LinuxDistrib
new file mode 100755
index 0000000000000000000000000000000000000000..6d410580c1f6bf9079d03c3d56abdbb14b147124
--- /dev/null
+++ b/support/LinuxDistrib
@@ -0,0 +1,14 @@
+#!/bin/ksh
+#
+# LinuxDistrib -- make Linux distribution of lsof 4.x
+#
+# Usage: LinuxDistrib [<suffix>]
+#
+#	 <suffix>	optional suffix for identification
+
+if test $# -gt 1
+then
+  echo "Usage: [<suffix>]"
+  exit 1
+fi
+$HOME/src/lsof4/support/GenericDistrib2 linux $1
diff --git a/support/N+OBSDDistrib b/support/N+OBSDDistrib
new file mode 100755
index 0000000000000000000000000000000000000000..b0fa2a335b695232965fa6d9aa3421049945343f
--- /dev/null
+++ b/support/N+OBSDDistrib
@@ -0,0 +1,14 @@
+#!/bin/ksh
+#
+# N+OBSDDistrib -- make NetBSD/OpenBSD distribution of lsof 4.x
+#
+# Usage: N+OBSDDistrib [<suffix>]
+#
+#	 <suffix>	optional suffix for identification
+
+if test $# -gt 1
+then
+  echo "Usage: [<suffix>]"
+  exit 1
+fi
+$HOME/src/lsof4/support/GenericDistrib2 n+obsd $1
diff --git a/support/N+OSDistrib b/support/N+OSDistrib
new file mode 100755
index 0000000000000000000000000000000000000000..cc35eabcf291fb229e71e60eed5f18c02d7dfefd
--- /dev/null
+++ b/support/N+OSDistrib
@@ -0,0 +1,14 @@
+#!/bin/ksh
+#
+# NOSDistrib -- make NEXTSTEP and OpenStep distribution of lsof 4.x
+#
+# Usage: NOSDistrib [<suffix>]
+#
+#	 <suffix>	optional suffix for identification
+
+if test $# -gt 1
+then
+  echo "Usage: [<suffix>]"
+  exit 1
+fi
+$HOME/src/lsof4/support/GenericDistrib n+os $1
diff --git a/support/NSDistrib b/support/NSDistrib
new file mode 100755
index 0000000000000000000000000000000000000000..ed72809e29d87be2d3b5206d309a6171d2ea5555
--- /dev/null
+++ b/support/NSDistrib
@@ -0,0 +1,14 @@
+#!/bin/ksh
+#
+# NSDistrib -- make NeXTSTEP distribution of lsof 4.x
+#
+# Usage: NSDistrib [<suffix>]
+#
+#	 <suffix>	optional suffix for identification
+
+if test $# -gt 1
+then
+  echo "Usage: [<suffix>]"
+  exit 1
+fi
+$HOME/src/lsof4/support/GenericDistrib ns $1
diff --git a/support/OSRDistrib b/support/OSRDistrib
new file mode 100755
index 0000000000000000000000000000000000000000..16c860c939fdf1cac7512510691c3c9836ef95a7
--- /dev/null
+++ b/support/OSRDistrib
@@ -0,0 +1,15 @@
+#!/bin/ksh
+#
+# OSRDistrib -- make SCO OpenServer distribution of lsof 4.x
+#
+# Usage: OSRDistrib [<suffix>]
+#
+#	 <suffix>	optional suffix for identification
+
+if test $# -gt 1
+then
+  echo "Usage: [<suffix>]"
+  exit 1
+fi
+cd $HOME/src/lsof4/support
+./GenericDistrib osr $1
diff --git a/support/SpecialRdist b/support/SpecialRdist
new file mode 100755
index 0000000000000000000000000000000000000000..eeaf21aa08d8fede5e687ba6b611185054fbbf66
--- /dev/null
+++ b/support/SpecialRdist
@@ -0,0 +1,74 @@
+#!/bin/ksh
+#
+# SpecialRdist -- specially rdist lsof 4.x sources to a specified destination
+#
+# Usage: GenericRdist <destination> <dialect> <shell>
+#
+#	 <destination>	destination host
+#
+#	 <dialect>	dialect subdirectory name
+#
+#	 <shell>	remote shell -- rsh or ssh
+
+# Process arguments.
+
+if test $# -ne 3
+then
+  echo "Usage: <destination> <dialect> <shell>"
+  exit
+fi
+H=$1
+D=$2
+S=$3
+
+# Test the shell and define it's full path, as required.
+
+if test "X$S" = "Xrsh"
+then
+  SHP=""
+else
+  if test "X$S" = "Xssh"
+  then
+    SHP="-P /opt/openssh/bin/ssh"
+  else
+    echo "$S is not an acceptable shell; specify rsh or ssh."
+    exit
+  fi
+fi
+
+# Define the distfile and make sure it's removed on premature exit.
+
+R=/tmp/distfile.$$
+trap 'rm $R; exit 1' 1 2 3 15
+
+rm -f $R
+echo ". -> $H" > $R
+echo "	except ( ./.ck00MAN );" >> $R
+echo "	except ( ./.neverCust ./.neverInv );" >> $R
+echo "	except ( ./Makefile ./ddev.c ./dfile.c ./dlsof.h ./dmnt.c );" >> $R
+echo "	except ( ./dnode.c ./dnode1.c ./dproc.c ./dproto.h ./dsock.c );" >> $R
+echo "	except ( ./dstore.c ./lib/Makefile ./lib/RCS ./lib/OLD ./lib/NEW );" >> $R
+echo "	except ( ./lsof ./machine.h ./version.h ./zipme );" >> $R
+echo "	except ( ./NEW ./OLD ./RCS ./dialects ./support ) ;" >> $R
+echo "	except ( ./new ./old ./X ./xxx ./errs ) ;" >> $R
+echo "	except ( ./scripts/OLD ./scripts/NEW ./scripts/RCS ) ;" >> $R
+echo "	except ( ./scripts/00MANIFEST ./scripts/00README ) ;" >> $R
+echo "	except ( ./tests/OLD ./tests/NEW ./tests/RCS ) ;" >> $R
+echo "	except ( ./tests/00README ) ;" >> $R
+echo "	except ( ./tests/LTbasic ./tests/LTbigf ./tests/LTdnlc ) ;" >> $R
+echo "	except ( ./tests/LTlock ./tests/LTnfs ./tests/LTnlink ) ;" >> $R
+echo "	except ( ./tests/LTsock ./tests/LTszoff ./tests/LTunix ) ;" >> $R
+echo "	except_pat ( \\\\./tests/config\\\\. );" >> $R
+echo "	except_pat ( \\\\.gz \\\\.o \\\\.a );" >> $R
+echo "	install src/lsof4 ;" >> $R
+echo "" >> $R
+echo "./dialects/$D -> $H" >> $R
+echo "	except ( ./dialects/$D/NEW );" >> $R
+echo "	except ( ./dialects/$D/OLD ./dialects/$D/RCS );" >> $R
+echo "	install src/lsof4/dialects/$D ;" >> $R
+
+# Do the actual distribution.
+
+(cd $HOME/src/lsof4; rdist $SHP -f $R)
+rm $R
+echo done
diff --git a/support/SunDistrib b/support/SunDistrib
new file mode 100755
index 0000000000000000000000000000000000000000..d569d5998d4d192a7805fc84778eb20cdf961309
--- /dev/null
+++ b/support/SunDistrib
@@ -0,0 +1,14 @@
+#!/bin/ksh
+#
+# SunDistrib -- make Solaris and SunOS distribution of lsof 4.x
+#
+# Usage: SunDistrib [<suffix>]
+#
+#	 <suffix>	optional suffix for identification
+
+if test $# -gt 1
+then
+  echo "Usage: [<suffix>]"
+  exit 1
+fi
+$HOME/src/lsof4/support/GenericDistrib2 sun $1
diff --git a/support/UWDistrib b/support/UWDistrib
new file mode 100755
index 0000000000000000000000000000000000000000..3710b7ea4b093eb9536172e5ef3121503536b28a
--- /dev/null
+++ b/support/UWDistrib
@@ -0,0 +1,15 @@
+#!/bin/ksh
+#
+# UWDistrib -- make SCO UnixWare distribution of lsof 4.x
+#
+# Usage: UWDistrib [<suffix>]
+#
+#	 <suffix>	optional suffix for identification
+
+if test $# -gt 1
+then
+  echo "Usage: [<suffix>]"
+  exit 1
+fi
+cd $HOME/src/lsof4/support
+./GenericDistrib2 uw $1
diff --git a/support/argtest b/support/argtest
new file mode 100755
index 0000000000000000000000000000000000000000..b84ffff8ccf3c5d80a7b30656815259dc33782bb
--- /dev/null
+++ b/support/argtest
@@ -0,0 +1,104 @@
+#!/bin/sh
+#
+# argtest -- test lsof arguments for stack overflows
+#
+# usage: argtest [path_to_lsof]
+#
+#   where:
+#	    path_to_lsof	optional *absolute* path to lsof (default
+#				${HOME}/src/lsof4/lsof)
+
+ARG_A=`pwd`/argtest_a.$$
+ARG_N=`pwd`/argtest_n.$$
+ERR=0
+SH=`pwd`/lsoftest.$$
+SH1=`pwd`/lsoftestc.$$
+T=`pwd`/argtest_tmp.$$
+T1=`pwd`/argtest_tmp1.$$
+trap 'rm -f $ARG_A $ARG_N $SH $SH1 $T $T1; exit 1' 1 2 3 15
+
+# Decide how to use echo.
+
+ECHO=`echo -n ""`
+if test "X$ECHO" = "X-n "
+then
+  EC="\c"
+  EO=""
+else
+  EC=""
+  EO="-n"
+fi
+
+# Establish the lsof path.
+
+if test $# -gt 0
+then
+  LSOF=$1
+else
+  LSOF=${HOME}/src/lsof4/lsof
+fi
+
+# Create temporary files that can be used as very large alphabetic
+# and numeric arguments.
+
+rm -f $ARG_A $T $T1
+echo $EO "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ012345678901$EC" > $T
+cp $T $T1
+for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
+do
+  cat $T >> $T1
+done
+cp $T1 $ARG_A
+for i in 1 2 3 4 5 6 7
+do
+  cat $T1 >> $ARG_A
+done
+rm -f $T $T1
+ls -l $ARG_A
+rm -f $ARG_N $T $T1
+echo $EO "0123456789012345678901234567890123456789012345678901234567890123$EC" > $T
+cp $T $T1
+for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
+do
+  cat $T >> $T1
+done
+cp $T1 $ARG_N
+for i in 1 2 3 4 5 6 7
+do
+  cat $T1 >> $ARG_N
+done
+rm -f $T $T1
+ls -l $ARG_N
+
+# Create a temporary shell script to execute lsof with options that require
+# arguments, and use the contents of $ARG_A and $ARG_N as the arguments.
+
+rm -f $SH $SH1
+echo "#!/bin/sh" > $SH
+echo "#!/bin/sh" > $SH1
+echo "$LSOF \$1 \`cat $ARG_A\`" >> $SH
+echo "$LSOF -c/\`cat $ARG_A\`/" >> $SH1
+echo "$LSOF \$1 \`cat $ARG_N\`" >> $SH
+echo "$LSOF -c/\`cat $ARG_N\`/" >> $SH1
+chmod +x $SH $SH1
+ls -l $SH $SH1
+
+for a in -A -c -c/ +c +d +D -e +e -f +f -F -g -i -i4 -i6 -i@ -i: -k +L -m +m -p -s -stcp: -sudp: -T -u -x -z -Z
+do
+  echo $EO "Testing: $a ... $EC"
+  if test "X$a" = "X-c/"
+  then
+    $SH1 2>&1 | egrep "Memory fault|Segmentation fault|Bus Error" > /dev/null 2>&1
+  else
+    $SH $a 2>&1 | egrep "Memory fault|Segmentation fault|Bus Error" > /dev/null 2>&1
+  fi
+  if test $? -eq 0
+  then
+    echo "!!!!FAILED!!!!"
+    ERR=1
+  else
+   echo "OK"
+  fi
+done
+rm -f $ARG_A $ARG_N $SH $SH1 core
+exit $ERR
diff --git a/support/binaries/README b/support/binaries/README
new file mode 100644
index 0000000000000000000000000000000000000000..37015e7f6a0781209328ecb97ff703d1502c0dac
--- /dev/null
+++ b/support/binaries/README
@@ -0,0 +1,27 @@
+
+			    Lsof Binaries
+
+I do not recommend that you use a pre-compiled lsof binary and I no
+longer provide any.
+
+It is important that you compile lsof for yourself from the distributed
+sources to allow its Configure script to tailor the binary to your
+system.
+
+    *************************************************************
+    * DON'T TRY TO USE AN LSOF BINARY, COMPILED FOR ONE UNIX OS *
+    * VERSION, ON ANOTHER.                                      *
+    *************************************************************
+
+On some UNIX dialects lsof versions may be even more restricted by
+architecture types.
+
+    *************************************************************
+    * AVOID USING BINARIES FOR LSOF REVISIONS BELOW 4.63.  THEY *
+    * ARE VULNERABLE TO THE STANDARD I/O DESCRIPTOR ATTACK.     *
+    * (See 00FAQ for more information.)                         *
+    *************************************************************
+
+
+Vic Abell
+April 15, 2008
diff --git a/support/contrib.00INDEX b/support/contrib.00INDEX
new file mode 100644
index 0000000000000000000000000000000000000000..89ab9e7ab549e9048b92e804bab1622543523742
--- /dev/null
+++ b/support/contrib.00INDEX
@@ -0,0 +1,22 @@
+
+	Index of Files in pub/tools/unix/lsof/contrib
+
+
+00INDEX			is this file.
+
+BSDI-1.1                contains information on a BSDI BSD/386 1.1
+			port to lsof 3.25 from Bob Thrush
+			<rd@tarpit.oau.org>.
+
+NCR                     a directory containing a complete distribution
+			of lsof 3.88 for NCR System Vr4 (3.0) releases
+			2.2.1 and 3.0.0, done by Boyd Roberts
+			<boyd@france3.fr>
+
+RT_PC.BSD4.3            contains information on a RT/PC BSD 4.3
+			port to lsof 3.24 from R. Bernstein
+			<rocky@panix.com>.
+
+
+Vic Abell
+February 20, 1997
diff --git a/support/contrib.README b/support/contrib.README
new file mode 100644
index 0000000000000000000000000000000000000000..3c6f84ee63f23706377ac46186a0e79e3136c05b
--- /dev/null
+++ b/support/contrib.README
@@ -0,0 +1,8 @@
+
+		    pub/tools/unix/lsof/contrib
+
+This subdirectory contains user-contributed patches, sources, and
+subdirectories for porting lsof to other Unix dialects.
+
+Vic Abell
+February 20, 1997
diff --git a/support/install-lsof b/support/install-lsof
new file mode 100755
index 0000000000000000000000000000000000000000..c518f32911b53b3c8cb2d6b5ba47146b456589eb
--- /dev/null
+++ b/support/install-lsof
@@ -0,0 +1,143 @@
+#!/bin/sh
+#
+# install-lsof <revision> -- install lsof <revision>
+
+DD=/var/ftpd/pub/tools/unix/lsof
+# DEBUG DD=/tmp/lsof	# DEBUG
+SD=$HOME/src/lsof4/support
+
+# Check for version specification.
+
+if test $# -ne 1
+then
+  echo "Usage: install-lsof <version>"
+  exit 1
+fi
+R=$1
+echo $R | grep '^4\.[0-9]*$' > /dev/null 2>&1
+if test $? -ne 0
+then
+  echo "<revision> must be 4.nn"
+  exit 1
+fi
+SR=`echo $R | sed 's/^4\.\([0-9]*\)$/\1/'`
+if test $SR -lt 73
+then
+  echo "Sub-revision must be 73 or greater."
+  exit 1
+fi
+PR=4.`expr $SR - 1`
+PPR=4.`expr $SR - 2`
+
+# Check for the presence of files for the new revision.
+
+err=0
+if test ! -f ${SD}/lsof_${R}.man
+then
+  echo "Creating lsof_${R}.man"
+  (cd $SD; ./makeman) > /dev/null
+fi
+for i in CHECKSUMS_$R ../00FAQ ../00DIST lsof_${R}.man lsof.00INDEX \
+	 lsof.README \
+	 lsof_${R}.tar.bz2 lsof_${R}.tar.bz2.sig \
+	 lsof_${R}.tar.gz lsof_${R}.tar.gz.sig \
+	 lsof_${R}.tar.Z  lsof_${R}.tar.Z.sig 
+do
+  if test ! -f ${SD}/$i
+  then
+    echo "${SD}/$i not found"
+    err=1
+  fi
+done
+
+# Check for the presence of files for the previous revision.
+
+for i in lsof_${PR}.man \
+	 lsof_${PR}.tar.bz2 \
+	 lsof_${PR}.tar.bz2.sig \
+	 lsof_${PR}.tar.gz \
+	 lsof_${PR}.tar.gz.sig \
+	 lsof_${PR}.tar.Z \
+	 lsof_${PR}.tar.Z.sig 
+do
+  if test ! -f ${DD}/$i
+  then
+    echo "${DD}/$i not found"
+    err=1
+  fi
+done
+
+# Quit if there are missing files.
+
+if test $err -ne 0
+then
+  echo "Quitting because of missing files"
+  exit 1
+fi
+
+# Archive previous revision files.
+
+for i in CHECKSUMS_$PR lsof_${PR}.man \
+	 lsof_${PR}.tar.bz2 lsof_${PR}.tar.bz2.sig \
+	 lsof_${PR}.tar.gz  lsof_${PR}.tar.gz.sig  \
+	 lsof_${PR}.tar.Z   lsof_${PR}.tar.Z.sig 
+do
+  if test -f ${DD}/$i
+  then
+    mv ${DD}/$i ${DD}/OLD
+  else
+    echo "No ${DD}/$i to archive"
+  fi
+done
+
+# Remove some previously archived files.  Save the gz archive and signature.
+
+for i in CHECKSUMS_$PPR lsof_${PPR}.man \
+	 lsof_${PPR}.tar.bz2  lsof_${PPR}.tar.bz2.sig  \
+	 lsof_${PPR}.tar.Z   lsof_${PPR}.tar.Z.sig 
+do
+  if test -f ${DD}/OLD/$i
+  then
+    echo "Removing ${DD}/OLD/$i"
+    rm -f ${DD}/OLD/$i
+  fi
+done
+
+# Install new files.
+
+for i in lsof.00INDEX lsof.README 
+do
+  echo "Installing $i"
+  rm -f $DD/$i
+  cp ${SD}/$i $DD
+  chmod 444 $DD/$i
+done
+rm -f ${DD}/00INDEX; mv ${DD}/lsof.00INDEX ${DD}/00INDEX
+rm -f ${DD}/README; mv ${DD}/lsof.README ${DD}/README
+for i in CHECKSUMS_$R lsof_${R}.man \
+	 lsof_${R}.tar.bz2 lsof_${R}.tar.bz2.sig \
+	 lsof_${R}.tar.gz lsof_${R}.tar.gz.sig \
+	 lsof_${R}.tar.Z  lsof_${R}.tar.Z.sig 
+do
+  echo "Installing $i"
+  rm -f $DD/$i
+  mv ${SD}/$i $DD
+  chmod 444 $DD/$i
+done
+(cd $DD; rm -f CHECKSUMS; ln -s CHECKSUMS_$R CHECKSUMS; ls -lL CHECKSUMS)
+(cd $DD; rm -f lsof_man; ln -s lsof_${R}.man lsof_man; ls -lL lsof_man)
+echo "Installing FAQ"
+rm -f ${DD}/FAQ; cp ${SD}/../00FAQ ${DD}/FAQ; chmod 644 ${DD}/FAQ
+rm -f ${DD}/ChangeLog; cp ${SD}/../00DIST ${DD}/ChangeLog; chmod 644 ${DD}/ChangeLog
+for i in bz2 gz Z
+do
+  rm -f ${DD}/lsof.tar.$i ${DD}/lsof.tar.${i}.sig
+  (cd $DD; ln -s lsof_${R}.tar.$i lsof.tar.$i)
+  (cd $DD; ln -s lsof_${R}.tar.${i}.sig lsof.tar.${i}.sig)
+  (cd $DD; ls -lL lsof.tar.$i lsof.tar.${i}.sig)
+done
+
+# Install binaries. (Disabled April 15, 2008.)
+
+#(cd $SD; rdist -f distfile.binaries)
+exit 0
diff --git a/support/install.log b/support/install.log
new file mode 100644
index 0000000000000000000000000000000000000000..bd6a15e4c669e5573c584eb57d7db02f1f2c82a4
--- /dev/null
+++ b/support/install.log
@@ -0,0 +1,156 @@
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/CHECKSUMS_4.84
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/lsof_4.84.man
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/lsof_4.84.tar.bz2
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/lsof_4.84.tar.bz2.sig
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/lsof_4.84.tar.Z
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/lsof_4.84.tar.Z.sig
+Installing lsof.00INDEX
+Installing lsof.README
+Installing CHECKSUMS_4.86
+Installing lsof_4.86.man
+Installing lsof_4.86.tar.bz2
+Installing lsof_4.86.tar.bz2.sig
+Installing lsof_4.86.tar.gz
+Installing lsof_4.86.tar.gz.sig
+Installing lsof_4.86.tar.Z
+Installing lsof_4.86.tar.Z.sig
+-r--r--r--   1 abe      pucc        1726 Apr 10 13:06 CHECKSUMS
+-r--r--r--   1 abe      pucc           0 Apr 10 13:01 lsof_man
+Installing FAQ
+-r--r--r--   1 abe      pucc      769231 Apr 10 13:06 lsof.tar.bz2
+-r--r--r--   1 abe      pucc         152 Apr 10 13:06 lsof.tar.bz2.sig
+-r--r--r--   1 abe      pucc     1079288 Apr 10 13:06 lsof.tar.gz
+-r--r--r--   1 abe      pucc         152 Apr 10 13:06 lsof.tar.gz.sig
+-r--r--r--   1 abe      pucc     1630733 Apr 10 13:06 lsof.tar.Z
+-r--r--r--   1 abe      pucc         152 Apr 10 13:06 lsof.tar.Z.sig
+Creating lsof_4.87.man
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/CHECKSUMS_4.85
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/lsof_4.85.man
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/lsof_4.85.tar.bz2
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/lsof_4.85.tar.bz2.sig
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/lsof_4.85.tar.Z
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/lsof_4.85.tar.Z.sig
+Installing lsof.00INDEX
+Installing lsof.README
+Installing CHECKSUMS_4.87
+Installing lsof_4.87.man
+Installing lsof_4.87.tar.bz2
+Installing lsof_4.87.tar.bz2.sig
+Installing lsof_4.87.tar.gz
+Installing lsof_4.87.tar.gz.sig
+Installing lsof_4.87.tar.Z
+Installing lsof_4.87.tar.Z.sig
+-r--r--r--   1 abe      pucc        1726 Jan  2 12:52 CHECKSUMS
+-r--r--r--   1 abe      pucc      151915 Jan  2 12:56 lsof_man
+Installing FAQ
+-r--r--r--   1 abe      pucc      773664 Jan  2 12:52 lsof.tar.bz2
+-r--r--r--   1 abe      pucc         152 Jan  2 12:52 lsof.tar.bz2.sig
+-r--r--r--   1 abe      pucc     1084323 Jan  2 12:52 lsof.tar.gz
+-r--r--r--   1 abe      pucc         152 Jan  2 12:52 lsof.tar.gz.sig
+-r--r--r--   1 abe      pucc     1632799 Jan  2 12:52 lsof.tar.Z
+-r--r--r--   1 abe      pucc         152 Jan  2 12:52 lsof.tar.Z.sig
+Creating lsof_4.88.man
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/CHECKSUMS_4.86
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/lsof_4.86.man
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/lsof_4.86.tar.bz2
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/lsof_4.86.tar.bz2.sig
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/lsof_4.86.tar.Z
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/lsof_4.86.tar.Z.sig
+Installing lsof.00INDEX
+Installing lsof.README
+Installing CHECKSUMS_4.88
+Installing lsof_4.88.man
+Installing lsof_4.88.tar.bz2
+Installing lsof_4.88.tar.bz2.sig
+Installing lsof_4.88.tar.gz
+Installing lsof_4.88.tar.gz.sig
+Installing lsof_4.88.tar.Z
+Installing lsof_4.88.tar.Z.sig
+-r--r--r--   1 abe      pucc        1726 Oct 14 12:04 CHECKSUMS
+-r--r--r--   1 abe      pucc      152630 Oct 14 12:12 lsof_man
+Installing FAQ
+-r--r--r--   1 abe      pucc      778563 Oct 14 12:04 lsof.tar.bz2
+-r--r--r--   1 abe      pucc         152 Oct 14 12:04 lsof.tar.bz2.sig
+-r--r--r--   1 abe      pucc     1090289 Oct 14 12:04 lsof.tar.gz
+-r--r--r--   1 abe      pucc         152 Oct 14 12:04 lsof.tar.gz.sig
+-r--r--r--   1 abe      pucc     1643851 Oct 14 12:04 lsof.tar.Z
+-r--r--r--   1 abe      pucc         152 Oct 14 12:04 lsof.tar.Z.sig
+Creating lsof_4.89.man
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/CHECKSUMS_4.87
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/lsof_4.87.man
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/lsof_4.87.tar.bz2
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/lsof_4.87.tar.bz2.sig
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/lsof_4.87.tar.Z
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/lsof_4.87.tar.Z.sig
+Installing lsof.00INDEX
+Installing lsof.README
+Installing CHECKSUMS_4.89
+Installing lsof_4.89.man
+Installing lsof_4.89.tar.bz2
+Installing lsof_4.89.tar.bz2.sig
+Installing lsof_4.89.tar.gz
+Installing lsof_4.89.tar.gz.sig
+Installing lsof_4.89.tar.Z
+Installing lsof_4.89.tar.Z.sig
+-r--r--r--   1 abe      pucc        1726 Jul 13 10:04 CHECKSUMS
+-r--r--r--   1 abe      pucc      153636 Jul 13 10:05 lsof_man
+Installing FAQ
+-r--r--r--   1 abe      pucc      784560 Jul 13 10:04 lsof.tar.bz2
+-r--r--r--   1 abe      pucc         152 Jul 13 10:04 lsof.tar.bz2.sig
+-r--r--r--   1 abe      pucc     1096819 Jul 13 10:04 lsof.tar.gz
+-r--r--r--   1 abe      pucc         152 Jul 13 10:04 lsof.tar.gz.sig
+-r--r--r--   1 abe      pucc     1649885 Jul 13 10:04 lsof.tar.Z
+-r--r--r--   1 abe      pucc         152 Jul 13 10:04 lsof.tar.Z.sig
+Creating lsof_4.90.man
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/CHECKSUMS_4.88
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/lsof_4.88.man
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/lsof_4.88.tar.bz2
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/lsof_4.88.tar.bz2.sig
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/lsof_4.88.tar.Z
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/lsof_4.88.tar.Z.sig
+Installing lsof.00INDEX
+Installing lsof.README
+Installing CHECKSUMS_4.90
+Installing lsof_4.90.man
+Installing lsof_4.90.tar.bz2
+Installing lsof_4.90.tar.bz2.sig
+Installing lsof_4.90.tar.gz
+Installing lsof_4.90.tar.gz.sig
+Installing lsof_4.90.tar.Z
+Installing lsof_4.90.tar.Z.sig
+-r--r--r--   1 abe      pucc        1726 Feb 14 15:33 CHECKSUMS
+-r--r--r--   1 abe      pucc      155331 Feb 15 13:12 lsof_man
+Installing FAQ
+-r--r--r--   1 abe      pucc      791758 Feb 14 15:32 lsof.tar.bz2
+-r--r--r--   1 abe      pucc         152 Feb 14 15:33 lsof.tar.bz2.sig
+-r--r--r--   1 abe      pucc     1104570 Feb 14 15:32 lsof.tar.gz
+-r--r--r--   1 abe      pucc         152 Feb 14 15:33 lsof.tar.gz.sig
+-r--r--r--   1 abe      pucc     1663473 Feb 14 15:33 lsof.tar.Z
+-r--r--r--   1 abe      pucc         152 Feb 14 15:33 lsof.tar.Z.sig
+sof: 44 = install-lsof 4.91
+Creating lsof_4.91.man
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/CHECKSUMS_4.89
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/lsof_4.89.man
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/lsof_4.89.tar.bz2
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/lsof_4.89.tar.bz2.sig
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/lsof_4.89.tar.Z
+Removing /var/ftpd/pub/tools/unix/lsof/OLD/lsof_4.89.tar.Z.sig
+Installing lsof.00INDEX
+Installing lsof.README
+Installing CHECKSUMS_4.91
+Installing lsof_4.91.man
+Installing lsof_4.91.tar.bz2
+Installing lsof_4.91.tar.bz2.sig
+Installing lsof_4.91.tar.gz
+Installing lsof_4.91.tar.gz.sig
+Installing lsof_4.91.tar.Z
+Installing lsof_4.91.tar.Z.sig
+-r--r--r--   1 abe      pucc        1726 Mar 26 17:56 CHECKSUMS
+-r--r--r--   1 abe      pucc      155331 Mar 26 18:00 lsof_man
+Installing FAQ
+-r--r--r--   1 abe      pucc      791734 Mar 26 17:56 lsof.tar.bz2
+-r--r--r--   1 abe      pucc         152 Mar 26 17:56 lsof.tar.bz2.sig
+-r--r--r--   1 abe      pucc     1104767 Mar 26 17:56 lsof.tar.gz
+-r--r--r--   1 abe      pucc         152 Mar 26 17:56 lsof.tar.gz.sig
+-r--r--r--   1 abe      pucc     1658305 Mar 26 17:56 lsof.tar.Z
+-r--r--r--   1 abe      pucc         152 Mar 26 17:56 lsof.tar.Z.sig
diff --git a/support/look_rlog b/support/look_rlog
new file mode 100755
index 0000000000000000000000000000000000000000..d1f86530bc16a761588e7f1693afa52df124121b
--- /dev/null
+++ b/support/look_rlog
@@ -0,0 +1,21 @@
+#!/bin/ksh
+#
+# look_rlog
+#set -v			# for DEBUGging
+
+if test $# -ne 2
+then
+  echo "$0 usage: file highest-revision"
+  exit 1
+fi
+if test ! -r RCS/${1},v
+then
+  echo "$0: no RCS/${1},v"
+  exit 1
+fi
+r=$2
+while test $r -gt 0
+do
+  (echo 1.$r; co -p1.$r $1) | less
+  r=`expr $r - 1`
+done
diff --git a/support/lsof-log.xls b/support/lsof-log.xls
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/support/lsof.00INDEX b/support/lsof.00INDEX
new file mode 100644
index 0000000000000000000000000000000000000000..7d1fe7e56b20696c60b4508b382e9ffd5b7962c7
--- /dev/null
+++ b/support/lsof.00INDEX
@@ -0,0 +1,128 @@
+
+	Index of Files and Directories in pub/tools/unix/lsof
+
+
+00INDEX			is this file.
+
+00LSOF-L		contains information on the lsof-l LISTSERV
+			mailing list for lsof.
+
+ChangeLog		contains information about changes to lsof, also
+			found in the 00DIST distribution notes file of
+			the lsof distribution.
+
+CHECKSUMS		contains information on external checksums for
+			the current lsof distribution files.
+
+FAQ			is the lsof FAQ, also found in the file 00FAQ
+			of the lsof distribution.
+
+			NOTE: this file is as current as possible.
+			Therefore it may contain information that
+			applies to an upcoming revision.  When in
+			doubt, send email to <abe@purdue.edu>.
+
+NEW/			is a directory that may sometimes contain
+			new information -- usually bzip2'd or gzip'd
+			tar files for ports to specific dialects that
+			are under development.  Please don't get
+			anything from this directory without contacting
+			me first.
+
+OLD/			is a directory that contains OLD lsof
+			distribution files.
+
+README			contains information on the lsof distribution.
+			This file is included in the lsof distribution
+			tar files, lsof.tar.bz2, lsof.tar.gz and
+			lsof.tar.Z.
+
+Victor_A_Abell.gpg      contains the GnuPG 5.0 public key for Victor
+			A. Abell (abe@purdue.edu).
+
+			MAY BE USED TO AUTHENTICATE THE LSOF
+			DISTRIBUTION AND BINARY FILES.
+
+Victor_A_Abell.pgp      contains the PGP 2.62 public key for Victor A.
+			Abell (abe@purdue.edu).
+
+			MAY BE USED TO AUTHENTICATE THE LSOF
+			DISTRIBUTION AND BINARY FILES.
+
+binaries/		is a directory tree that contains selected
+			lsof executables, not always for the latest
+			source distribution.  I strongly recommend
+			you avoid using one of these binaries and
+			build your own instead.
+
+contrib/		is a directory of user-contributed information
+			on porting lsof to other Unix dialects.
+
+lsof_man		is a symbolic link to the man page for the
+			current lsof revision.  This file is included
+			in the lsof distribution tar files,
+			lsof.tar.bz2, lsof.tar.gz and lsof.tar.Z.
+
+lsof.tar.bz2		is a symbolic link to the bzip2'd lsof
+			distribution tar archive for the latest
+			revision of lsof.  Consult the README file
+			in this directory for information on its
+			contents.
+
+lsof.tar.bz2.sig	is a symbolic link to the GPG authentication
+			certificate for lsof.tar.bz2.
+
+lsof.tar.gz		is a symbolic link to the gzip'd lsof
+			distribution tar archive for the latest
+			revision of lsof.  Consult the README file
+			in this directory for information on its
+			contents.
+
+lsof.tar.gz.sig		is a symbolic link to the GPG authentication
+			certificate for lsof.tar.gz.
+
+lsof.tar.Z		is a symbolic link to the compressed lsof
+			distribution tar archive for the latest
+			revision of lsof.  Consult the README file
+			in this directory for information on its
+			contents.
+
+lsof.tar.Z.sig		is a symbolic link to the GPG authentication
+			certificate for lsof.tar.Z.
+
+lsof_4.92.man		is the man page for the current lsof
+			distribution.
+
+lsof_4.92.tar.bz2	is the current bzip2'd lsof distribution.
+			Consult the README file in this directory for
+			information on its contents.
+
+lsof_4.92.tar.bz2.sig	is the GPG authentication certificate for
+			lsof_4.92.tar.bz2.
+
+lsof_4.92.tar.gz	is the current gzip'd lsof distribution.
+			Consult the README file in this directory for
+			information on its contents.
+
+lsof_4.92.tar.gz.sig	is the GPG authentication certificate for
+			lsof_4.92.tar.gz.
+
+lsof_4.92.tar.Z		is the current compressed lsof distribution.
+			Consult the README file in this directory for
+			information on its contents.
+
+lsof_4.92.tar.Z.sig	is the GPG authentication certificate for
+			lsof_4.92.tar.Z.
+
+mirrors			is a list of ftp sites where lsof is mirrored.
+
+patches/		contains lsof patches.
+
+solaris_kaddr_filters   contains a discussion of the Solaris kernel
+			address filters installed in lsof 4.50 and
+			above.  This file may also be found in
+			lsof_4.92/dialects/sun.
+
+
+Vic Abell <abe@purdue.edu>
+July 14, 2018
diff --git a/support/lsof.README b/support/lsof.README
new file mode 100644
index 0000000000000000000000000000000000000000..411a37282e3b2d90b22b0236cd1627ef390ecf01
--- /dev/null
+++ b/support/lsof.README
@@ -0,0 +1,326 @@
+		    lsof (LiSt Open Files) version 4
+			    (revision 4.92)
+
+
+    ********************************************************************
+    | The latest release of lsof is always available via anonymous ftp |
+    | from lsof.itap.purdue.edu.  Look in pub/tools/unix/lsof.         |
+    ********************************************************************
+
+******************************************************************************
+| CHECK THE PATCHES/ SUBDIRECTORY FOR FIXES TO THE LATEST LSOF DISTRIBUTION. |
+******************************************************************************
+
+ **************************************************************************
+ | AVOID USING PRE-BUILT LSOF BINARIES: SEE THE "PRE-BUILT LSOF BINARIES" |
+ |                 SECTION IN 00README FOR AN EXPLANATION.                |
+ **************************************************************************
+
+   **********************************************************************
+   | READ 00LSOF-L FOR INFORMATION ON THE LSOF-L LISTSERV MAILING LIST. |
+   **********************************************************************
+
+    *********************************************************************
+    |      CHECK 00FAQ BEFORE REPORTING BUGS TO <abe@purdue.edu>.       |
+    | 00FAQ ALSO AT: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/FAQ |
+    *********************************************************************
+
+    ********************************************************************
+    | IMPORTANT!  This README file explains how the lsof tar archive   |
+    | is assembled -- it's a "wrapper" tar archive.  Please read the   |
+    | explanation of its naming and construction, immediately          |
+    | following the initial list of supported dialects.                |
+    ********************************************************************
+
+
+Lsof version 4 lists open files for running UNIX processes.  It is a
+descendent of ofiles, fstat, and lsof versions 1, 2, and 3.  It has
+been tested recently on these UNIX dialects.
+
+	Apple Darwin 9 and Mac OS X 10.[567]
+	FreeBSD 8.[234], 9.0 and 1[012].0 for AMD64-based systems
+	Linux 2.1.72 and above for x86-based systems
+	Solaris 9, 10 and 11
+
+Lsof 4 may work on other versions of these dialects, but hasn't been
+tested there recently.  Lsof versions 2 and 3 are still available and
+may provide older dialect version support.  See the notes on them in
+this file.
+
+The pub/tools/unix/lsof/contrib directory on lsof.itap.purdue.edu also
+contains information on other ports.
+
+Version 4 of lsof is distributed as bzip2'd, gzip'd and compressed tar
+archives in the files:
+
+    ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof.tar.bz2
+  and
+    ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof.tar.gz
+  and
+    ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof.tar.Z
+
+These files are links to the current distribution, whose name includes
+the revision number:
+
+    ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof_<rev>.tar.bz2
+  and
+    ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof_<rev>.tar.gz
+  and
+    ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof_<rev>.tar.Z
+
+<rev> is the revision number -- e.g., 4.92.  These archives are called
+wrappers, because the lsof source tar archive, its GPG certificate
+(lsof_<rev>_src.tar.sig), and some documentation files are wrapped
+together inside them.  (The GPG certificate authenticates the source
+tar archive.)  A tar archive with: a ``.bz2'' suffix has been
+compressed with bzip2; ``.gz'', with gzip; and ``.Z'', with compress.
+
+When the wrapper tar is gunzip'd or uncompressed, and its tar archive
+contents are extracted, an lsof_4.92 subdirectory is created in the
+directory where the extraction was performed.  The lsof_4.92
+subdirectory contains these files:
+
+	00.README.FIRST		contains introductory distribution
+				information.
+
+	README.lsof_4.92	contains instructions for the
+				security-conscious on how to be
+				sure that no one has tampered with
+				the distribution.
+
+	RELEASE_SUMMARY_4.92	is this file.
+
+	lsof_4.92_src.tar       is a tar archive, containing the
+				lsof sources.  When extracted with
+				tar it creates a subdirectory named
+				lsof_4.92_src in the directory
+				where the extraction was performed.
+				The lsof source files will be found
+				in lsof_4.92_src.
+
+	lsof_4.92_src.tar.sig   is a GPG certificate, authenticating
+				the lsof_4.92_src.tar archive.  See the
+				README.lsof_4.92 file for more
+				information on GPG authentication of
+				lsof_4.92_src.tar.
+
+If you've obtained this file and an lsof distribution from a mirror
+site, please be aware that THE LATEST VERSION OF LSOF IS AVAILABLE VIA
+ANONYMOUS FTP FROM LSOF.ITAP.PURDUE.EDU IN THE PUB/TOOLS/UNIX/LSOF
+DIRECTORY.
+
+Patches to lsof distributions may be found in the patches/ sub-
+directory where you found lsof.tar.bz2, lsof.tar.gz or lsof.tar.Z.
+If there are any patches to the current distribution, they will be
+found in the patches/4.92/ branch.
+
+(If you need a copy of gunzip, look for it at prep.ai.mit.edu in
+pub/gnu/gzip*.)
+
+The March 26, 2018 revision (4.91): corrects a bug in the processing of Linux
+  PTY endpoint information.
+
+The June 6, 2018 revision (4.92:) is a FreeBSD-only revision; it corrects a bug
+  in the Configure script section that creates a local lockf_owner.h header
+  file; removes a <string,h> kernel header conflicts.
+
+Read the 00.README.FIRST in the lsof distribution first.
+
+Read the 00DIST distribution file for more details on feature additions
+and bug fixes.
+
+The 00README distribution file has build instructions, dialect
+descriptions, special feature discussions, and installation hints.
+
+The 00FAQ file contains a list of frequently asked questions and their
+answers.
+
+The 00DCACHE file explains device cache file path formation.
+
+The 00PORTING file contains information on porting lsof to other UNIX
+dialects.
+
+The 00QUICKSTART file gives a quick introduction to using lsof.
+
+The distribution files lsof.8 (nroff source) and lsof.man (nroff
+formatted output) contain the manual page for lsof; it is the only
+other documentation besides the source code (it's included).
+
+
+Version 4 Binaries
+==================
+
+Version 4 binaries for some revisions, dialects, and platforms may be
+found in pub/tools/unix/lsof/binaries.  Check the README files for
+exact descriptions.  Check the dialect-specific Makefiles for
+installation instructions.  CHECKSUMS and GPG certificates are provided
+for authentication.
+
+Please think very carefully before you decide to use a pre-built binary
+instead of making your own from the sources.  Here are some points to
+consider:
+
+1. Lsof must run setgid or setuid.  Are you willing to trust that
+   power to a binary you didn't construct yourself?
+
+2. Lsof binaries may be generated on a system whose configuration
+   header files differ from yours.  Under Digital UNIX (DEC OSF/1), for
+   example, lsof includes header files from the machine's configuration
+   directory, /sys/<name>.  Are you willing to gamble that your
+   configuration directory's header files match the ones used to
+   compile lsof?
+
+3. Lsof is often configured with specific options that are determined
+   from the configuration of the system on which it is configured --
+   e.g., Solaris patch level, dynamic loader libraries, etc.  Are you
+   sure that the lsof binary you retrieve will have been configured for
+   your system? If you get a binary that is misconfigured for you, it
+   may not work at all.
+
+If you haven't already guessed, I believe firmly that you should
+retrieve sources and build your own binary.  If you still want to use
+the distribution binaries, please authenticate what you retrieved with
+the GPG certificates; please compare checksums, too.
+
+
+Version 4 Checksums
+===================
+
+Security checksums -- both MD5 and sum(1) -- for revisions of lsof
+version 4 are contained in the README.lsof_<rev> files in the wrapper
+tar archives of pub/tools/unix/lsof.
+
+The CHECKSUMS file, found with the distribution archives, contains
+information on validating the archives with external MD5 checksums and
+external GPG certificates.
+
+
+GPG Certificates
+================
+
+The lsof wrapper tar archive includes a GPG certificate file in its
+contained lsof_4.71_src.tar.sig file.
+
+Binary files have detached GPG certificates that may be found in their
+directories with ".sig" extensions.
+
+The certificates are signed with my GPG public key, which may be found
+in the file:
+
+    ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/Victor_A_Abell.gpg
+
+My key may also be available at some public key servers,
+
+There is also authentication information in the CHECKSUMS file (a link
+to CHECKSUMS_<rev>), found with the lsof distribution files.  CHECKSUMS
+contains external MD5 checksums for the distribution files and
+information on using the external GPG certificates, found with the lsof
+distribution files.
+
+
+Old Dialect Support
+===================
+
+Remnants of source code and binaries for dialects for which lsof once
+provided support may be obtained by request.  Send the request to
+abe@purdue.edu.
+
+Dialects no longer supported include:
+
+	CDC EP/IX
+	MIPS RISC/os
+	Motorola V/88
+	Pyramid DC/OSx
+	Pyramid Reliant UNIX
+	Sequent DYNIX
+	SGI IRIX
+	SunOS 4.1.x
+	Ultrix
+
+Generally I drop support for a dialect when I no longer have access to
+a test system.
+
+
+Lsof Version 2
+==============
+
+The version 3 predecessor, revision 36 of version 2, is also available
+upon request.  Send the request to abe@purdue.edu.
+
+I recommend you avoid lsof version 2.  It's out of date and I no
+longer provide support for it.  (Versions 3 and 4 support more
+dialects, and have many enhancements, bug fixes, and improvements.)
+Version 2 was tested on the following UNIX dialects:
+
+	AIX 3.2.[1234] for the IBM RISC/System 6000
+	DEC OSF/1 1.[23] and 2.0 for the DEC Alpha
+	EP/IX 1.4.3 and 2.1.1 for the CDC 4680
+	ETAV 1.17 for the ETA-10P*
+	FreeBSD 1.0e for x86-based systems
+	HP-UX [789].x for HP systems
+	IRIX 4.0.5 and 5.1.1 for SGI systems
+	NEXTSTEP 2.1, 3.0, 3.1 for NeXT systems
+	Sequent Dynix 3.0.12 for Sequent Symmetry systems
+	SunOS 4.1.[123] for Sun 3 and 4 systems
+	SunOS 5.[13] (Solaris 2.[13]) for Sun 4 systems
+	Ultrix 2.2 and 4.2 for DEC systems
+
+(If you need a copy of gunzip, look for it at prep.ai.mit.edu in
+pub/gnu.)
+
+
+Version 2 Checksums
+===================
+
+MD5:
+	(OLD/lsof236tar.gz) = f8a1ab3971ea2f6a3ea16752f84409e8
+
+sum(1):
+	39996   106 OLD/lsof236tar.gz
+
+The file OLD/lsof236tar.gz.asc is a detached PGP certificate that may
+be used to authenticate OLD/lsof236tar.gz with my PGP public key.  You
+may find my PGP public key at:
+
+  ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/OLD/Victor_A_Abell.pgp
+    
+
+Lsof Version 3
+==============
+
+The last revision of lsof version 3, 3.88, may obtained by request.
+Send the request to abe@purdue.edu.
+
+I recommend version 4 over version 3.  It is the version I actively
+support.
+
+Lsof version 3 was tested on these UNIX dialects:
+
+	AIX 3.2.5, 4.1[.[1234]], and 4.2
+	BSDI BSD/OS 2.0, 2.0.1, and 2.1 for x86-based systems
+	DC/OSx 1.1 for Pyramid systems
+	Digital UNIX (DEC OSF/1) 2.0, 3.0, 3.2, and 4.0
+	EP/IX 2.1.1 for the CDC 4680
+	FreeBSD 1.1.5.1, 2.0, 2.0.5, 2.1, 2.1.5 for x86-based
+	    systems
+	HP-UX 8.x, 9.x, 10.01, 10.10, and 10.20
+	IRIX 5.2, 5.3, 6.0, 6.0.1, and 6.[124]
+	Linux 2.0.3[01] and 2.1.57 for x86-based systems
+	NetBSD 1.0, 1.1, and 1.2 for x86 and SPARC-based
+	    systems
+	NEXTSTEP 2.1 and 3.[0123] for NEXTSTEP architectures
+	OpenBSD 1.2 and 2.0 for x86-based systems
+	Reliant UNIX 5.43 for Pyramid systems
+	RISC/os 4.52 for MIPS R2000-based systems
+	SCO OpenServer 1.1, 3.0, and 5.0.[024] for x86-based 
+	    systems
+	SCO UnixWare 2.1 and 2.1.1 for x86-based systems
+	Sequent PTX 2.1.[1569], 4.0.[23], 4.1.[024], 4.2[.1],
+	    and 4.3
+	Solaris 2.[12345], 2.5.1, and 2.6-Beta
+	SunOS 4.1.x
+	Ultrix 4.2, 4.3, 4.4, and 4.5
+
+
+Vic Abell <abe@purdue.edu>
+July 14, 2018
diff --git a/support/makeman b/support/makeman
new file mode 100755
index 0000000000000000000000000000000000000000..d330abb446a5e8592a2272e24a4b915e23b021cd
--- /dev/null
+++ b/support/makeman
@@ -0,0 +1,46 @@
+#!/bin/ksh
+#
+# makman -- make lsof 4.x man page for ftp tree
+
+SD=${HOME}/src/lsof4
+cd $SD
+
+# Get version number.
+
+V=`sed '/VN/s/.ds VN \(.*\)/\1/' version`
+if test $? -ne 0
+then
+  echo $V
+  exit 1
+fi
+
+# Handle optional edition suffix.
+
+if test $# -gt 0
+then
+  if test $# -gt 1
+  then
+    echo "Usage: makeman [edition]"
+    exit 1
+  fi
+  V=${V}$1
+fi
+
+# Define man file names.
+
+MS=Lsof.8
+MD=${SD}/support/lsof.8
+MF=${SD}/support/lsof_${V}.man
+
+# Set exit cleanup trap.
+
+trap 'rm -rf $MD $MF; exit' 1 2 3 15
+
+# Create manual page files.
+
+echo Producing $MD
+soelim < $MS > $MD
+echo Producing $MF
+nroff -man $MD | colcrt - | cat -s > $MF
+rm -f $MD
+ls -l $MF
diff --git a/support/mentor b/support/mentor
new file mode 100755
index 0000000000000000000000000000000000000000..3c8b155aac8b291b18fabe02d260552d4df243a5
--- /dev/null
+++ b/support/mentor
@@ -0,0 +1,5 @@
+#!/bin/ksh
+#
+# mentor - rdist Sun sources to mentor.cc
+
+$HOME/src/lsof4/support/GenericRdist mentor sun ssh
diff --git a/support/mirrors b/support/mirrors
new file mode 100644
index 0000000000000000000000000000000000000000..4821f6f11114fe889dcf09485a78532025e3ece6
--- /dev/null
+++ b/support/mirrors
@@ -0,0 +1,9 @@
+Lsof is available via anonymous ftp from these mirror hosts.
+
+ ftp://ftp.fu-berlin.de/pub/unix/tools/lsof
+ ftp://sunsite.ualberta.ca/pub/Mirror/lsof
+ http://www.mirrorservice.org/sites/lsof.itap.purdue.edu/pub/tools/unix/lsof/
+ ftp://ftp.mirrorservice.org/sites/lsof.itap.purdue.edu/pub/tools/unix/lsof/
+
+
+WANT YOUR LSOF MIRROR LISTED HERE?  SEND E-MAIL TO <abe@purdue.edu>.
diff --git a/support/rdist.distrib b/support/rdist.distrib
new file mode 100755
index 0000000000000000000000000000000000000000..5afd53884c59208834885aa5f9bfab8216b17706
--- /dev/null
+++ b/support/rdist.distrib
@@ -0,0 +1,10 @@
+#!/bin/sh
+#
+# rdist.distrib - distribute lsof via rdist
+
+cd $HOME/src/lsof4
+for i in cloud mentor
+do
+        echo "::::: " $i " :::::"
+	support/$i
+done
diff --git a/usage.c b/usage.c
index 7edcfdea5bdb2722ddc5defb48f10a76b3125863..6707315574dae43d77e767003b383fd598dbef39 100644
--- a/usage.c
+++ b/usage.c
@@ -340,9 +340,9 @@ usage(xv, fh, version)
 
 	if (Fhelp || xv) {
 	    (void) fprintf(stderr, "%s %s\n latest revision: %s\n",
-		Pn, LSOF_VERSION, LSOF_URL);
-	    (void) fprintf(stderr, " latest FAQ: %sFAQ\n", LSOF_URL);
-	    (void) fprintf(stderr, " latest man page: %slsof_man\n", LSOF_URL);
+		Pn, LSOF_VERSION, LSOF_REPO_URL);
+	    (void) fprintf(stderr, " latest FAQ: %s\n", LSOF_FAQ_URL);
+	    (void) fprintf(stderr, " latest (non-formatted) man page: %s\n", LSOF_MAN_URL);
 	    (void) fprintf(stderr,
 		" usage: [-?ab%sh%slnNoOP%s%stUvV%s]",
 
@@ -919,11 +919,11 @@ usage(xv, fh, version)
 	 */
 	    (void) fprintf(stderr, "%s version information:\n", Pn);
 	    (void) fprintf(stderr, "    revision: %s\n", LSOF_VERSION);
-	    (void) fprintf(stderr, "    latest revision: %s\n", LSOF_URL);
-	    (void) fprintf(stderr, "    latest FAQ: %sFAQ\n",
-		LSOF_URL);
-	    (void) fprintf(stderr, "    latest man page: %slsof_man\n",
-		LSOF_URL);
+	    (void) fprintf(stderr, "    latest revision: %s\n", LSOF_REPO_URL);
+	    (void) fprintf(stderr, "    latest FAQ: %s\n",
+		LSOF_FAQ_URL);
+	    (void) fprintf(stderr, "    latest (non-formatted) man page: %s\n",
+		LSOF_MAN_URL);
 
 #if	defined(LSOF_CINFO)
 	    if ((cp = isnullstr(LSOF_CINFO)))
diff --git a/version b/version
index f2a18897ec03b9531021862e10b81287e2e487e9..2c2ab8dae9c158cb8b8bb1b41e977d265792ad14 100644
--- a/version
+++ b/version
@@ -1 +1 @@
-.ds VN 4.91
+.ds VN 4.93.2
diff --git a/zipme b/zipme
new file mode 100755
index 0000000000000000000000000000000000000000..33faade95ad23bd43ccdca9450089e91d8de3f2c
--- /dev/null
+++ b/zipme
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+# zipme -- make a bzip2'd tar archive of ~/src/lsof4
+
+cd $HOME/src/lsof4
+V=`sed '/VN/s/.ds VN \(.*\)/\1/' $HOME/src/lsof4/version`
+if test $? -ne 0
+then
+  echo $V
+  exit 1
+fi
+cd ..
+T=lsof${V}.tar.bz2
+rm -f $T
+tar cf - lsof4 | bzip2 -c > $T
+ls -l $T