summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJinWang An <jinwang.an@samsung.com>2021-12-28 10:01:55 +0900
committerJinWang An <jinwang.an@samsung.com>2021-12-28 10:01:55 +0900
commit87a741891d5e52c324ed5d956c04eab8d2714ad8 (patch)
treed612484aeffd2e836579654f04f496be45e1a2ab
parentfbf25342d5b67bf9e9776f4dcd011cf63c581cc2 (diff)
downloadlsof-87a741891d5e52c324ed5d956c04eab8d2714ad8.tar.gz
lsof-87a741891d5e52c324ed5d956c04eab8d2714ad8.tar.bz2
lsof-87a741891d5e52c324ed5d956c04eab8d2714ad8.zip
Imported Upstream version 4.89upstream/4.89
-rw-r--r--00CREDITS6
-rw-r--r--00DIST40
-rw-r--r--00PORTING24
-rw-r--r--00TEST3
-rwxr-xr-xConfigure107
-rw-r--r--dialects/darwin/libproc/Makefile9
-rw-r--r--dialects/darwin/libproc/dfile.c78
-rw-r--r--dialects/darwin/libproc/dlsof.h2
-rw-r--r--dialects/darwin/libproc/dproto.h2
-rw-r--r--dialects/darwin/libproc/dstore.c30
-rw-r--r--dialects/darwin/libproc/machine.h11
-rw-r--r--dialects/freebsd/dlsof.h10
-rw-r--r--dialects/freebsd/dnode.c3
-rw-r--r--dialects/freebsd/dnode2.c3
-rw-r--r--dialects/freebsd/dproc.c33
-rw-r--r--dialects/freebsd/dsock.c18
-rw-r--r--dialects/freebsd/machine.h16
-rw-r--r--dialects/linux/dfile.c2
-rw-r--r--dialects/linux/dlsof.h8
-rw-r--r--dialects/linux/dmnt.c4
-rw-r--r--dialects/linux/dnode.c31
-rw-r--r--dialects/linux/dproc.c25
-rw-r--r--dialects/linux/dsock.c510
-rw-r--r--dialects/sun/dnode.c19
-rw-r--r--lsof.893
-rw-r--r--lsof.h69
-rw-r--r--lsof.man1406
-rw-r--r--main.c30
-rw-r--r--proc.c76
-rw-r--r--proto.h8
-rw-r--r--store.c6
-rwxr-xr-xtests/Add2TestDB4
-rw-r--r--tests/TestDB3
-rw-r--r--version2
34 files changed, 1779 insertions, 912 deletions
diff --git a/00CREDITS b/00CREDITS
index e86a151..ca9194e 100644
--- a/00CREDITS
+++ b/00CREDITS
@@ -29,6 +29,7 @@ provided test systems where I was able to do development work.
Ric Anderson
Stuart Anderson
Michael Antlitz
+ Cato Auestad
Marc Auslander
Tigran Aivazian
Jos Backus
@@ -83,6 +84,7 @@ provided test systems where I was able to do development work.
Jon Champlin
Kris Chandrasekhar
Stephane Chazelas
+ Andrey Chernov
Albert Chin-A-Young
Bernt Christandl
Marc Christensen
@@ -163,6 +165,7 @@ provided test systems where I was able to do development work.
Brian L. Gentry
Dave Gilbert
Steve Ginsberg
+ Bjarni Ingi Gislason
Edwin Groothuis
Jin Guojun
Kurt Gollhardt
@@ -192,6 +195,7 @@ provided test systems where I was able to do development work.
Janet Hempstead
Michael Hennecke
Randolph J. Herber
+ Allen Hewes
Andrew Hill
Kurt Hillig
Steven Hinkle
@@ -533,4 +537,4 @@ and I apologize for the error.
Vic Abell <abe@purdue.edu>
-October 13, 2014
+July 7, 2015
diff --git a/00DIST b/00DIST
index bd1d700..bb66615 100644
--- a/00DIST
+++ b/00DIST
@@ -117,6 +117,7 @@
4.86, April 10, 2012
4.87, January 2, 2013
4.88, October 13, 2014
+ 4.89, July 7, 2015
Dialects Supported
@@ -4740,5 +4741,42 @@ Supplement Regenerated the 4.04 distribution to correct a non-
always selected, since it identifies the file set. The bug was
reported by Gary Plewa <gary.m.plewa-1@lowes.com>.
+4.89 July 7, 2015
+ Applied correction from Casper Dik <Casper.Dik@oracle.com> to
+ his patch for Solaris 11 that I applied incorrectly in revision
+ 4.88.
+
+ Updated for latest version of FreeBSD 11.0-CURRENT.
+
+ Compensated for a missing FreeBSD 10.0 typedef of bool on the
+ i386 architecture. Allen Hewes <rallenh@hotmail.com> provided
+ a test system. Andrey Chernov <ache@freebsd.org> provided
+ useful advice.
+
+ Improved tests/Add2TestDB script with a patch from Peter
+ Schiffer <pschiffe@redhat.com>. Added patches from Peter to
+ eliminate Linux gcc warnings. Updated Lsof.8 with improvements
+ supplied by Bjarni Ingi Gislason <bjarniig@rhi.hi.is>.
+
+ Changed FreeBSD global CFLAGS extraction per Terry Kennedy
+ <TERRY@tmk.com>. Also made sure -DNEEDS_BOOL_TYPEDEF is
+ #define'd when the resulting CFLAGS doesn't contain it. Terry
+ reported that need.
+
+ Improved Linux test for tcp.h in response to a report from
+ Cato Auestad <cato@cato.ninja>. Cato did the testing.
+
+ Fixed Linux UNIX socket search by name bug reported by
+ Stephane Chazelas <stephane.chazelas@gmail.com>.
+
+ Added Linux display of UNIX socket endpoint information with
+ code provided by Masatake YAMATO <yamato@redhat.com>. Peter
+ Schiffer <pschiffe@redhat.com> provided a test system.
+
+ Insured that type definitions from <vm/vm.h> were again made
+ visible to lsof on FreeBSD 11 after a system header file change
+ hid them.
+
+
Vic Abell <abe@purdue.edu>
-October 13, 2014
+July 7, 2015
diff --git a/00PORTING b/00PORTING
index e4dc550..a175d6c 100644
--- a/00PORTING
+++ b/00PORTING
@@ -789,6 +789,9 @@ possibilities
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.
@@ -1165,6 +1168,9 @@ possibilities
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.
@@ -1284,6 +1290,9 @@ possibilities
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.
@@ -1363,12 +1372,12 @@ possibilities
X option to processes whose real user ID
is root.
- HAS_ZFS indicates the dialect has support for the ZFS file
- system.
-
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
@@ -1423,12 +1432,19 @@ possibilities
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 --
@@ -1847,4 +1863,4 @@ keep in mind the private, one-man nature of current lsof support.
Vic Abell <abe@purdue.edu>
-October 13, 2014
+July 7, 2015
diff --git a/00TEST b/00TEST
index 5162be1..54f8d22 100644
--- a/00TEST
+++ b/00TEST
@@ -950,6 +950,7 @@ base, footprints, and the scripts that support them.
2.6.38-686
3.10.004
3.10.08
+ 3.10.0-229.1.2.el7
NEXTSTEP 3.1, gcc LTnfs
NetBSD 1.4.1, Alpha, gcc LTnfs
1.5x, x86, gcc LTnfs
@@ -1028,4 +1029,4 @@ I was unable to make the test suite run on the following dialects.
Vic Abell <abe@purdue.edu>
-October 13, 2014
+May 11, 2015
diff --git a/Configure b/Configure
index aba0f2d..e4a25a2 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.163 2014/10/13 22:31:08 abe Exp $
+# $Id: Configure,v 1.164 2015/07/07 20:16:58 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
@@ -889,13 +889,16 @@ case $LSOF_TGT in # {
11.*) # Mac OS X 10.7 (Lion)
LSOF_VERS=1100
;;
- 12.*) # Next Mac OS X
+ 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 11.0
- LSOF_VERS=1100
+ echo Assuming Darwin 12.0
+ LSOF_VERS=1200
;;
esac # }
fi # }
@@ -924,7 +927,7 @@ case $LSOF_TGT in # {
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)
+ 900|1000|1100|1200)
LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
LSOF_TMP1=""
LSOF_UNSUP=""
@@ -934,7 +937,7 @@ case $LSOF_TGT in # {
LSOF_CFGF="$LSOF_CFGF -DNEEDS_MACH_PORT_T"
fi # }
;;
- 1200)
+ 1300)
LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
LSOF_TMP1=""
;;
@@ -1633,32 +1636,31 @@ kernel generation process.
;;
esac # }
- # Get system CFLAGS from FREEBSD_MAKE_CONF (default=/etc/make.conf).
+ # Get system CFLAGS, if possible.
- if test "X$FREEBSD_MAKE_CONF" = "X" # {
- then
- FREEBSD_MAKE_CONF="/etc/make.conf"
- fi # }
- if test -r $FREEBSD_MAKE_CONF # {
- then
- 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"
+ 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"
+ 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.
@@ -2115,10 +2117,37 @@ LOCKF_OWNER4
then
LSOF_CFGF="$LSOF_CFGF -DNEEDS_BOOLEAN_T"
fi # }
- 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"
@@ -2868,6 +2897,17 @@ return(0); }
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
@@ -2888,6 +2928,13 @@ return(0); }
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"
;;
diff --git a/dialects/darwin/libproc/Makefile b/dialects/darwin/libproc/Makefile
index bda2623..6433004 100644
--- a/dialects/darwin/libproc/Makefile
+++ b/dialects/darwin/libproc/Makefile
@@ -1,7 +1,7 @@
# Darwin libproc-based lsof Makefile
#
-# $Id: Makefile,v 1.7 2009/03/25 19:21:37 abe Exp $
+# $Id: Makefile,v 1.7 2009/03/25 19:21:37 abe Exp abe $
PROG= lsof
@@ -9,6 +9,8 @@ BIN= ${DSTROOT}/usr/sbin
DOC= ${DSTROOT}/usr/share/man/man8
+DS= /usr/bin/dsymutil
+
I=/usr/include
S=/usr/include/sys
L=/usr/include/local
@@ -48,9 +50,12 @@ clean: FRC
(cd lib; ${MAKE} -f Makefile.skel clean)
install-strip: all FRC
- @if [ -n "${SYMROOT}" ]; then \
+ if [ -n "${SYMROOT}" ]; then \
mkdir -p ${SYMROOT}; \
cp -p ${PROG} ${SYMROOT}/${PROG}; \
+ if [ -x "${DS}" ]; then \
+ ${DS} -o ${SYMROOT}/${PROG}.dSYM ${SYMROOT}/${PROG}; \
+ fi \
fi
mkdir -p ${BIN}
install -c -s -m 755 -g ${GRP} ${PROG} ${BIN}
diff --git a/dialects/darwin/libproc/dfile.c b/dialects/darwin/libproc/dfile.c
index bd8d81a..d7705f6 100644
--- a/dialects/darwin/libproc/dfile.c
+++ b/dialects/darwin/libproc/dfile.c
@@ -36,7 +36,7 @@
#ifndef lint
static char copyright[] =
"@(#) Copyright 2005-2007 Apple Inc. and Purdue Research Foundation.\nAll rights reserved.\n";
-static char *rcsid = "$Id: dfile.c,v 1.8 2012/04/10 16:41:04 abe Exp $";
+static char *rcsid = "$Id: dfile.c,v 1.8 2012/04/10 16:41:04 abe Exp abe $";
#endif
@@ -74,7 +74,15 @@ enter_file_info(pfi)
if (Fsv & FSV_FG) {
Lf->ffg = (long)pfi->fi_openflags;
Lf->fsv |= FSV_FG;
+
+#if defined(PROC_FP_GUARDED)
+ if (pfi->fi_status & PROC_FP_GUARDED) {
+ Lf->guardflags = pfi->fi_guardflags;
+ }
+#endif /* defined(PROC_FP_GUARDED) */
+
}
+ Lf->pof = (long)pfi->fi_status;
}
@@ -110,6 +118,14 @@ enter_vnode_info(vip)
cp = "BLK";
Ntype = N_BLK;
break;
+
+#if defined(S_IFLNK)
+ case S_IFLNK:
+ cp = "LINK";
+ Ntype = N_REGLR;
+ break;
+#endif /* defined(S_IFLNK) */
+
case S_IFREG:
cp = "REG";
Ntype = N_REGLR;
@@ -246,13 +262,63 @@ void
print_nm(lf)
struct lfile *lf;
{
+ unsigned char extra = 0;
+
printname(0);
-#ifdef PROC_PIDLISTFILEPORTS
- if (lf->fileport) {
- (void) printf(" (fileport=0x%04x)", lf->fileport);
+
+#if defined(PROC_PIDLISTFILEPORTS)
+ if (lf->fileport)
+ extra++;
+#endif /* defined(PROC_PIDLISTFILEPORTS) */
+
+#if defined(PROC_FP_GUARDED)
+ if (lf->guardflags)
+ extra++;
+#endif /* defined(PROC_FP_GUARDED) */
+
+ if (extra)
+ (void) printf(" (");
+
+#if defined(PROC_PIDLISTFILEPORTS)
+ if (lf->fileport)
+ (void) printf("fileport=0x%04x", lf->fileport);
+#endif /* defined(PROC_PIDLISTFILEPORTS) */
+
+#if defined(PROC_FP_GUARDED)
+ if (extra > 1)
+ putchar(`,');
+ if (lf->guardflags) {
+ struct pff_tab *tp;
+ long gf;
+
+ (void) printf("guard=");
+ tp = Pgf_tab;
+ gf = lf->guardflags;
+ while (gf && !FsvFlagX) {
+ while (tp->nm) {
+ if (gf & tp->val)
+ break;
+ tp++;
+ }
+ if (!tp->nm)
+ break;
+ gf &= ~(tp->val);
+ (void) printf("%s%s", tp->nm, gf ? "," : "");
+ }
+ /*
+ * If flag bits remain, print them in hex. If hex output was
+ * specified with +fG, print all flag values, including zero,
+ * in hex.
+ */
+ if (gf || FsvFlagX)
+ (void) printf("0x%lx", gf);
}
-#endif /* PROC_PIDLISTFILEPORTS */
- putchar('\n');
+#endif /* defined(PROC_FP_GUARDED) */
+
+ if (extra)
+ (void) printf(")\n");
+ else
+ putchar('\n');
}
diff --git a/dialects/darwin/libproc/dlsof.h b/dialects/darwin/libproc/dlsof.h
index 142a073..c3a1c70 100644
--- a/dialects/darwin/libproc/dlsof.h
+++ b/dialects/darwin/libproc/dlsof.h
@@ -34,7 +34,7 @@
/*
- * $Id: dlsof.h,v 1.8 2012/04/10 16:41:04 abe Exp $
+ * $Id: dlsof.h,v 1.8 2012/04/10 16:41:04 abe Exp abe $
*/
diff --git a/dialects/darwin/libproc/dproto.h b/dialects/darwin/libproc/dproto.h
index 7f20f7d..88931d2 100644
--- a/dialects/darwin/libproc/dproto.h
+++ b/dialects/darwin/libproc/dproto.h
@@ -37,7 +37,7 @@
/*
- * $Id: dproto.h,v 1.6 2012/04/10 16:41:04 abe Exp $
+ * $Id: dproto.h,v 1.6 2012/04/10 16:41:04 abe Exp abe $
*/
_PROTOTYPE(extern void enter_file_info,(struct proc_fileinfo *pfi));
diff --git a/dialects/darwin/libproc/dstore.c b/dialects/darwin/libproc/dstore.c
index b538881..8727181 100644
--- a/dialects/darwin/libproc/dstore.c
+++ b/dialects/darwin/libproc/dstore.c
@@ -37,7 +37,7 @@
#ifndef lint
static char copyright[] =
"@(#) Copyright 2005 Apple Computer, Inc. and Purdue Research Foundation.\nAll rights reserved.\n";
-static char *rcsid = "$Id: dstore.c,v 1.4 2008/10/21 16:15:16 abe Exp $";
+static char *rcsid = "$Id: dstore.c,v 1.4 2008/10/21 16:15:16 abe Exp abe $";
#endif
@@ -74,6 +74,18 @@ struct pff_tab Pff_tab[] = {
struct pff_tab Pof_tab[] = {
+# if defined(PROC_FP_SHARED)
+ { (long)PROC_FP_SHARED, "SH" },
+# endif /* defined(PROC_FP_SHARED) */
+
+# if defined(PROC_FP_CLEXEC)
+ { (long)PROC_FP_CLEXEC, POF_CLOEXEC },
+# endif /* defined(PROC_FP_CLEXEC) */
+
+# if defined(PROC_FP_GUARDED)
+ { (long)PROC_FP_GUARDED,"GRD" },
+# endif /* defined(PROC_FP_GUARDED) */
+
# if defined(UF_CLOSING)
{ (long)UF_CLOSING, POF_CLOSING },
# endif /* defined(UF_CLOSING) */
@@ -89,3 +101,19 @@ struct pff_tab Pof_tab[] = {
{ (long)0, NULL }
};
#endif /* defined(HASFSTRUCT) */
+
+
+#if defined(PROC_FP_GUARDED)
+/*
+ * Pgf_tab[] - table for print process open file guard flags
+ */
+
+struct pff_tab Pgf_tab[] = {
+ { (long)PROC_FI_GUARD_CLOSE, "CLOSE" },
+ { (long)PROC_FI_GUARD_DUP, "DUP" },
+ { (long)PROC_FI_GUARD_SOCKET_IPC, "SOCKET" },
+ { (long)PROC_FI_GUARD_FILEPORT, "FILEPORT" },
+
+ { (long)0, NULL }
+};
+#endif /* defined(PROC_FP_GUARDED) */
diff --git a/dialects/darwin/libproc/machine.h b/dialects/darwin/libproc/machine.h
index 2bfa213..050a49a 100644
--- a/dialects/darwin/libproc/machine.h
+++ b/dialects/darwin/libproc/machine.h
@@ -35,7 +35,7 @@
/*
- * $Id: machine.h,v 1.10 2013/01/02 17:03:05 abe Exp $
+ * $Id: machine.h,v 1.10 2013/01/02 17:03:05 abe Exp abe $
*/
@@ -234,14 +234,17 @@
*/
#define HASLFILEADD char *V_path; \
- mach_port_t fileport;
+ mach_port_t fileport; \
+ uint32_t guardflags;
#define CLRLFILEADD(lf) if (lf->V_path) { \
(void) free((FREE_P *)lf->V_path); \
lf->V_path = (char *)NULL; \
} \
- lf->fileport = MACH_PORT_NULL;
+ lf->fileport = MACH_PORT_NULL; \
+ lf->guardflags = 0;
#define SETLFILEADD Lf->V_path = (char *)NULL; \
- Lf->fileport = MACH_PORT_NULL;
+ Lf->fileport = MACH_PORT_NULL; \
+ Lf->guardflags = 0;
/*
diff --git a/dialects/freebsd/dlsof.h b/dialects/freebsd/dlsof.h
index 2c9afe1..b075e6a 100644
--- a/dialects/freebsd/dlsof.h
+++ b/dialects/freebsd/dlsof.h
@@ -31,7 +31,7 @@
/*
- * $Id: dlsof.h,v 1.46 2014/10/13 22:25:07 abe Exp $
+ * $Id: dlsof.h,v 1.47 2015/07/07 20:23:43 abe Exp $
*/
@@ -340,6 +340,8 @@ struct vop_generic_args;
# endif /* FREEBSDV<5000 */
# endif /* FREEBSDV<2000 */
+#include <vm/vm.h>
+
#define _KERNEL
#define KERNEL
#include <sys/fcntl.h>
@@ -370,7 +372,9 @@ int open(const char *, int, ...);
#define pause pause_kernel_lsof
# endif /* !defined(HAS_PAUSE_SBT) */
+#define asprintf asprintf_kernel_lsof
#define setenv setenv_kernel_lsof
+#define vasprintf vasprintf_kernel_lsof
#define uintfptr_t int
#define _SYS_LIBKERN_H_
#include <sys/file.h>
@@ -380,6 +384,7 @@ int open(const char *, int, ...);
*/
#undef _SYS_LIBKERN_H_
+#undef asprintf_kernel_lsof
#undef intrmask_t_lsof
#undef log_kernel_lsof
@@ -388,6 +393,7 @@ int open(const char *, int, ...);
# endif /* !defined(HAS_PAUSE_SBT) */
#undef setenv_kernel_lsof
+#undef vasprintf_kernel_lsof
#undef uintfptr_t
#undef _KERNEL
#undef KERNEL
@@ -427,8 +433,6 @@ struct vop_advlock_args { int dummy; }; /* to pacify lf_advlock() prototype */
#include <sys/lockf.h>
# endif /* FREEBSDV<2000 */
-#include <vm/vm.h>
-
# if FREEBSDV>=2020
# if FREEBSDV>=4090
#define _KERNEL
diff --git a/dialects/freebsd/dnode.c b/dialects/freebsd/dnode.c
index 77682a4..84467cb 100644
--- a/dialects/freebsd/dnode.c
+++ b/dialects/freebsd/dnode.c
@@ -32,7 +32,7 @@
#ifndef lint
static char copyright[] =
"@(#) Copyright 1994 Purdue Research Foundation.\nAll rights reserved.\n";
-static char *rcsid = "$Id: dnode.c,v 1.43 2014/10/13 22:25:07 abe Exp $";
+static char *rcsid = "$Id: dnode.c,v 1.44 2015/07/07 20:23:43 abe Exp $";
#endif
@@ -820,6 +820,7 @@ process_overlaid_node:
#if defined(HAS_ZFS)
case VT_ZFS:
+ memset((void *)&zi, 0, sizeof(zfs_info_t));
if (!v->v_data
|| (zm = readzfsnode((KA_T)v->v_data, &zi,
((v->v_vflag & VV_ROOT) ? 1 : 0)))
diff --git a/dialects/freebsd/dnode2.c b/dialects/freebsd/dnode2.c
index 2ea9d24..4b6cf9a 100644
--- a/dialects/freebsd/dnode2.c
+++ b/dialects/freebsd/dnode2.c
@@ -35,7 +35,7 @@
#ifndef lint
static char copyright[] =
"@(#) Copyright 2008 Purdue Research Foundation.\nAll rights reserved.\n";
-static char *rcsid = "$Id: dnode2.c,v 1.5 2014/10/13 22:25:07 abe Exp $";
+static char *rcsid = "$Id: dnode2.c,v 1.6 2015/07/07 20:23:43 abe Exp $";
#endif
@@ -77,7 +77,6 @@ readzfsnode(za, zi, vr)
zfsvfs_t zv; /* znode's zfsvfs structure */
# endif /* defined(HAS_Z_PHYS) */
- memset((void *)zi, 0, sizeof(zfs_info_t));
if (!za
|| kread(za, (char *)&zn, sizeof(zn))
) {
diff --git a/dialects/freebsd/dproc.c b/dialects/freebsd/dproc.c
index c9eb92c..e2b2d0c 100644
--- a/dialects/freebsd/dproc.c
+++ b/dialects/freebsd/dproc.c
@@ -32,7 +32,7 @@
#ifndef lint
static char copyright[] =
"@(#) Copyright 1994 Purdue Research Foundation.\nAll rights reserved.\n";
-static char *rcsid = "$Id: dproc.c,v 1.18 2014/10/13 22:25:07 abe Exp $";
+static char *rcsid = "$Id: dproc.c,v 1.19 2015/07/07 20:23:43 abe Exp $";
#endif
#include "lsof.h"
@@ -127,6 +127,11 @@ gather_proc_info()
typedef struct file* ofb_t;
#endif /* defined(HAS_FILEDESCENT) */
+#if defined(HAS_FDESCENTTBL)
+ struct fdescenttbl fdt;
+ KA_T fa;
+#endif /* defined(HAS_FDESCENTTBL) */
+
static ofb_t *ofb = NULL;
static int ofbb = 0;
int pgid, pid;
@@ -295,8 +300,18 @@ gather_proc_info()
if (!p->P_FD
|| kread((KA_T)p->P_FD, (char *)&fd, sizeof(fd)))
continue;
+
+#if defined(HAS_FDESCENTTBL)
+ if (!fd.fd_files
+ || kread((KA_T)fd.fd_files, (char *)&fdt, sizeof(fdt)))
+ continue;
+ if (!fd.fd_refcnt || fd.fd_lastfile > fdt.fdt_nfiles)
+ continue;
+#else /* !defined(HAS_FDESCENTTBL) */
if (!fd.fd_refcnt || fd.fd_lastfile > fd.fd_nfiles)
continue;
+#endif /* defined(HAS_FDESCENTTBL) */
+
/*
* Allocate a local process structure.
*/
@@ -371,8 +386,15 @@ gather_proc_info()
/*
* Read open file structure pointers.
*/
+
+#if defined(HAS_FDESCENTTBL)
+ if ((nf = fdt.fdt_nfiles) <= 0)
+ continue;
+#else /* !defined(HAS_FDESCENTTBL) */
if (!fd.fd_ofiles || (nf = fd.fd_nfiles) <= 0)
continue;
+#endif /* defined(HAS_FDESCENTTBL) */
+
nb = (MALLOC_S)(sizeof(ofb_t) * nf);
if (nb > ofbb) {
if (!ofb)
@@ -386,8 +408,17 @@ gather_proc_info()
}
ofbb = nb;
}
+
+#if defined(HAS_FDESCENTTBL)
+ fa = (KA_T)fd.fd_files
+ + (KA_T)offsetof(struct fdescenttbl, fdt_ofiles);
+ if (kread(fa, (char *)ofb, nb))
+ continue;
+#else /* !defined(HAS_FDESCENTTBL) */
if (kread((KA_T)fd.fd_ofiles, (char *)ofb, nb))
continue;
+#endif /* defined(HAS_FDESCENTTBL) */
+
#if defined(HASFSTRUCT) && !defined(HAS_FILEDESCENT)
if (Fsv & FSV_FG) {
diff --git a/dialects/freebsd/dsock.c b/dialects/freebsd/dsock.c
index 6f8dd96..d942602 100644
--- a/dialects/freebsd/dsock.c
+++ b/dialects/freebsd/dsock.c
@@ -32,7 +32,7 @@
#ifndef lint
static char copyright[] =
"@(#) Copyright 1994 Purdue Research Foundation.\nAll rights reserved.\n";
-static char *rcsid = "$Id: dsock.c,v 1.29 2013/01/02 17:01:43 abe Exp $";
+static char *rcsid = "$Id: dsock.c,v 1.30 2015/07/07 20:23:43 abe Exp $";
#endif
@@ -68,6 +68,12 @@ static char *rcsid = "$Id: dsock.c,v 1.29 2013/01/02 17:01:43 abe Exp $";
# endif /* defined(HAS_NO_6PPCB) */
#endif /* defined(HASIPv6) */
+#if defined(HAS_SB_CCC)
+#define SOCK_CC sb_ccc
+#else /* !defined(HAS_SB_CCC) */
+#define SOCK_CC sb_cc
+#endif /* defined(HAS_SB_CCC) */
+
/*
* Local function prototypes
@@ -212,18 +218,18 @@ process_socket(sa)
*/
if (Fsize) {
if (Lf->access == 'r')
- Lf->sz = (SZOFFTYPE)s.so_rcv.sb_cc;
+ Lf->sz = (SZOFFTYPE)s.so_rcv.SOCK_CC;
else if (Lf->access == 'w')
- Lf->sz = (SZOFFTYPE)s.so_snd.sb_cc;
+ Lf->sz = (SZOFFTYPE)s.so_snd.SOCK_CC;
else
- Lf->sz = (SZOFFTYPE)(s.so_rcv.sb_cc + s.so_snd.sb_cc);
+ Lf->sz = (SZOFFTYPE)(s.so_rcv.SOCK_CC + s.so_snd.SOCK_CC);
Lf->sz_def = 1;
} else
Lf->off_def = 1;
#if defined(HASTCPTPIQ)
- Lf->lts.rq = s.so_rcv.sb_cc;
- Lf->lts.sq = s.so_snd.sb_cc;
+ Lf->lts.rq = s.so_rcv.SOCK_CC;
+ Lf->lts.sq = s.so_snd.SOCK_CC;
Lf->lts.rqs = Lf->lts.sqs = 1;
#endif /* defined(HASTCPTPIQ) */
diff --git a/dialects/freebsd/machine.h b/dialects/freebsd/machine.h
index 3089ef7..be1485a 100644
--- a/dialects/freebsd/machine.h
+++ b/dialects/freebsd/machine.h
@@ -31,7 +31,7 @@
/*
- * $Id: machine.h,v 1.38 2010/07/29 16:04:28 abe Exp $
+ * $Id: machine.h,v 1.39 2015/07/07 20:23:43 abe Exp $
*/
@@ -62,6 +62,20 @@
typedef __cpumask_t cpumask_t;
#endif /* defined(HASCPUMASK_T) */
+#if defined(NEEDS_BOOL_TYPEDEF)
+/*
+ * Under FreeBSD 10.0 on the i386 architecture the bool typedef is not defined
+ * unless <sys/types.h> is #included under _KERNEL. As explained with
+ * cpumask_t, #include'ing <sys/types.h> under _KERNEL causes other problems.
+ * Hence Configure specifies that bool be typedef'd here specifically for the
+ * i386 architecture on FreeBSD 10.0.
+ */
+# if __STDC_VERSION__<199901L && __GNUC__<3 && !defined(__INTEL_COMPILER)
+typedef int _Bool;
+# endif /*__STDC_VERSION__<199901L && __GNUC__<3 && !defined(__INTEL_COMPILER)*/
+typedef _Bool bool;
+#endif /* defined(NEEDS_BOOL_TYPEDEF) */
+
#include <sys/param.h>
diff --git a/dialects/linux/dfile.c b/dialects/linux/dfile.c
index 4a30737..e637258 100644
--- a/dialects/linux/dfile.c
+++ b/dialects/linux/dfile.c
@@ -32,7 +32,7 @@
#ifndef lint
static char copyright[] =
"@(#) Copyright 1997 Purdue Research Foundation.\nAll rights reserved.\n";
-static char *rcsid = "$Id: dfile.c,v 1.8 2012/04/10 16:39:50 abe Exp $";
+static char *rcsid = "$Id: dfile.c,v 1.8 2012/04/10 16:39:50 abe Exp abe $";
#endif
diff --git a/dialects/linux/dlsof.h b/dialects/linux/dlsof.h
index 8cca3c5..dc9a08f 100644
--- a/dialects/linux/dlsof.h
+++ b/dialects/linux/dlsof.h
@@ -31,7 +31,7 @@
/*
- * $Id: dlsof.h,v 1.22 2012/04/10 16:39:50 abe Exp $
+ * $Id: dlsof.h,v 1.23 2015/07/07 19:46:33 abe Exp $
*/
@@ -50,11 +50,11 @@
#include <unistd.h>
#include <netinet/in.h>
-# if defined(GLIBCV) || defined(__UCLIBC__)
+# if defined(GLIBCV) || defined(__UCLIBC__) || defined(NEEDS_NETINET_TCPH)
#include <netinet/tcp.h>
-# else /* !defined(GLIBCV) && !defined(__UCLIBC__) */
+# else /* !defined(GLIBCV) && !defined(__UCLIBC__) && !defined(NEEDS_NETINET_TCPH) */
#include <linux/tcp.h>
-# endif /* defined(GLIBCV) || defined(__UCLIBC__) */
+# endif /* defined(GLIBCV) || defined(__UCLIBC__) || defined(NEEDS_NETINET_TCPH) */
# if !defined(HASNORPC_H)
#include <rpc/rpc.h>
diff --git a/dialects/linux/dmnt.c b/dialects/linux/dmnt.c
index ab57bbb..3bbdd37 100644
--- a/dialects/linux/dmnt.c
+++ b/dialects/linux/dmnt.c
@@ -32,7 +32,7 @@
#ifndef lint
static char copyright[] =
"@(#) Copyright 1997 Purdue Research Foundation.\nAll rights reserved.\n";
-static char *rcsid = "$Id: dmnt.c,v 1.19 2012/04/10 16:39:50 abe Exp $";
+static char *rcsid = "$Id: dmnt.c,v 1.20 2015/07/07 19:47:31 abe Exp $";
#endif
@@ -378,7 +378,7 @@ getmntdev(dn, dnl, s, ss)
h = hash_mnt(dn);
for (mp = MSHash[h]; mp; mp = mp->next) {
if ((dnl == mp->dnl) && !strcmp(dn, mp->dn)) {
- memset((void *)s, 0, sizeof(struct stat));
+ zeromem((char *)s, sizeof(struct stat));
s->st_dev = mp->dev;
*ss |= SB_DEV;
return(1);
diff --git a/dialects/linux/dnode.c b/dialects/linux/dnode.c
index 5cf9223..b2cd77e 100644
--- a/dialects/linux/dnode.c
+++ b/dialects/linux/dnode.c
@@ -32,7 +32,7 @@
#ifndef lint
static char copyright[] =
"@(#) Copyright 1997 Purdue Research Foundation.\nAll rights reserved.\n";
-static char *rcsid = "$Id: dnode.c,v 1.24 2014/10/13 22:25:58 abe Exp $";
+static char *rcsid = "$Id: dnode.c,v 1.25 2015/07/07 19:46:33 abe Exp $";
#endif
@@ -84,11 +84,11 @@ _PROTOTYPE(static void enter_pinfo,(void));
/*
- * Locals storage
+ * Local storage
*/
#if defined(HASEPTOPTS)
-static pinfo_t **Pinfo = (pinfo_t **)NULL;
+static pxinfo_t **Pinfo = (pxinfo_t **)NULL;
#endif /* defined(HASEPTOPTS) */
@@ -124,7 +124,7 @@ void
clear_pinfo()
{
int h; /* hash index */
- pinfo_t *pi, *pp; /* temporary pointers */
+ pxinfo_t *pi, *pp; /* temporary pointers */
if (!Pinfo)
return;
@@ -135,7 +135,7 @@ clear_pinfo()
(void) free((FREE_P *)pi);
pi = pp;
} while (pi);
- Pinfo[h] = (pinfo_t *)NULL;
+ Pinfo[h] = (pxinfo_t *)NULL;
}
}
}
@@ -154,13 +154,14 @@ enter_pinfo()
int h; /* hash result */
struct lfile *lf; /* local file structure pointer */
struct lproc *lp; /* local proc structure pointer */
- pinfo_t *np, *pi, *pe; /* pipe info pointers */
+ pxinfo_t *np, *pi, *pe; /* pipe info pointers */
if (!Pinfo) {
/*
* Allocate pipe info hash buckets.
*/
- if (!(Pinfo = (pinfo_t **)calloc(PINFOBUCKS, sizeof(pinfo_t *)))) {
+ if (!(Pinfo = (pxinfo_t **)calloc(PINFOBUCKS, sizeof(pxinfo_t *))))
+ {
(void) fprintf(stderr,
"%s: no space for %d pipe info buckets\n", Pn, PINFOBUCKS);
Exit(1);
@@ -169,7 +170,7 @@ enter_pinfo()
/*
* Make sure this is a unique entry.
*/
- for (h = HASHPINFO(Lf->inode), pi = Pinfo[h], pe = (pinfo_t *)NULL;
+ for (h = HASHPINFO(Lf->inode), pi = Pinfo[h], pe = (pxinfo_t *)NULL;
pi;
pe = pi, pi = pi->next
) {
@@ -184,7 +185,7 @@ enter_pinfo()
* Allocate, fill and link a new pipe info structure to the end of
* the pipe inode hash chain.
*/
- if (!(np = (pinfo_t *)malloc(sizeof(pinfo_t)))) {
+ if (!(np = (pxinfo_t *)malloc(sizeof(pxinfo_t)))) {
(void) fprintf(stderr,
"%s: no space for pipeinfo, PID %d, FD %s\n",
Pn, Lp->pid, Lf->fd);
@@ -193,7 +194,7 @@ enter_pinfo()
np->ino = Lf->inode;
np->lf = Lf;
np->lpx = Lp - Lproc;
- np->next = (pinfo_t *)NULL;
+ np->next = (pxinfo_t *)NULL;
if (pe)
pe->next = np;
else
@@ -205,14 +206,14 @@ enter_pinfo()
* find_pendinfo() -- find pipe end info
*/
-pinfo_t *
+pxinfo_t *
find_pendinfo(lf, pp)
struct lfile *lf; /* pipe's lfile */
- pinfo_t *pp; /* previous pinfo (NULL == none) */
+ pxinfo_t *pp; /* previous pipe info (NULL == none) */
{
struct lfile *ef; /* pipe end local file structure */
int h; /* hash result */
- pinfo_t *pi; /* pipe info pointer */
+ pxinfo_t *pi; /* pipe info pointer */
if (Pinfo) {
if (pp)
@@ -230,7 +231,7 @@ find_pendinfo(lf, pp)
pi = pi->next;
}
}
- return((pinfo_t *)NULL);
+ return((pxinfo_t *)NULL);
}
#endif /* defined(HASEPTOPTS) */
@@ -580,7 +581,7 @@ process_proc_node(p, pbr, s, ss, l, ls)
Lf->inp_ty = 1;
#if defined(HASEPTOPTS)
- if (Lf->ntype == N_FIFO) {
+ if ((Lf->ntype == N_FIFO) && FeptE) {
(void) enter_pinfo();
Lf->sf |= SELPINFO;
}
diff --git a/dialects/linux/dproc.c b/dialects/linux/dproc.c
index b01b287..c250fcd 100644
--- a/dialects/linux/dproc.c
+++ b/dialects/linux/dproc.c
@@ -32,7 +32,7 @@
#ifndef lint
static char copyright[] =
"@(#) Copyright 1997 Purdue Research Foundation.\nAll rights reserved.\n";
-static char *rcsid = "$Id: dproc.c,v 1.28 2014/10/13 22:25:58 abe Exp $";
+static char *rcsid = "$Id: dproc.c,v 1.29 2015/07/07 19:46:33 abe Exp $";
#endif
#include "lsof.h"
@@ -840,14 +840,14 @@ process_id(idp, idpl, cmd, uid, pid, ppid, pgid, tid)
{
#if defined(HASEPTOPTS)
- if (!FpipeE)
+ if (!FeptE)
return(1);
#else /* !defined(HASEPTOPTS) */
return(1);
#endif /* defined(HASEPTOPTS) */
}
- if (Cckreg && !FpipeE) {
+ if (Cckreg && !FeptE) {
/*
* If conditional checking of regular files is enabled, enable
@@ -868,7 +868,7 @@ process_id(idp, idpl, cmd, uid, pid, ppid, pgid, tid)
alloc_lfile(CWD, -1);
if (getlinksrc(path, pbuf, sizeof(pbuf), (char **)NULL) < 1) {
if (!Fwarn) {
- (void) memset((void *)&sb, 0, sizeof(sb));
+ zeromem((char *)&sb, sizeof(sb));
lnk = ss = 0;
(void) snpf(nmabuf, sizeof(nmabuf), "(readlink: %s)",
strerror(errno));
@@ -917,7 +917,7 @@ process_id(idp, idpl, cmd, uid, pid, ppid, pgid, tid)
alloc_lfile(RTD, -1);
if (getlinksrc(path, pbuf, sizeof(pbuf), (char **)NULL) < 1) {
if (!Fwarn) {
- (void) memset((void *)&sb, 0, sizeof(sb));
+ zeromem((char *)&sb, sizeof(sb));
(void) snpf(nmabuf, sizeof(nmabuf), "(readlink: %s)",
strerror(errno));
nmabuf[sizeof(nmabuf) - 1] = '\0';
@@ -963,7 +963,7 @@ process_id(idp, idpl, cmd, uid, pid, ppid, pgid, tid)
(void) make_proc_path(idp, idpl, &path, &pathl, "exe");
alloc_lfile("txt", -1);
if (getlinksrc(path, pbuf, sizeof(pbuf), (char **)NULL) < 1) {
- (void) memset((void *)&sb, 0, sizeof(sb));
+ zeromem((void *)&sb, sizeof(sb));
if (!Fwarn) {
if ((errno != ENOENT) || uid) {
(void) snpf(nmabuf, sizeof(nmabuf), "(readlink: %s)",
@@ -1085,7 +1085,7 @@ process_id(idp, idpl, cmd, uid, pid, ppid, pgid, tid)
(void) make_proc_path(dpath, i, &path, &pathl, fp->d_name);
(void) alloc_lfile((char *)NULL, fd);
if (getlinksrc(path, pbuf, sizeof(pbuf), &rest) < 1) {
- (void) memset((void *)&sb, 0, sizeof(sb));
+ zeromem((char *)&sb, sizeof(sb));
lnk = ss = 0;
if (!Fwarn) {
(void) snpf(nmabuf, sizeof(nmabuf), "(readlink: %s)",
@@ -1325,10 +1325,10 @@ process_proc_map(p, s, ss)
* exempt file system) or stat(2) failed, so manufacture a partial
* stat(2) reply from the process' maps file entry.
*
- * If the file has been deleted, reset its type to "DEL"; otherwise
- * generate a stat() error name addition.
+ * If the file has been deleted, reset its type to "DEL";
+ * otherwise generate a stat() error name addition.
*/
- (void) memset((void *)&sb, 0, sizeof(sb));
+ zeromem((char *)&sb, sizeof(sb));
sb.st_dev = dev;
sb.st_ino = (ino_t)inode;
sb.st_mode = S_IFREG;
@@ -1377,7 +1377,7 @@ process_proc_map(p, s, ss)
(void) add_nma(nmabuf, strlen(nmabuf));
}
}
- (void) memset((void *)&sb, 0, sizeof(sb));
+ zeromem((char *)&sb, sizeof(sb));
sb.st_dev = dev;
sb.st_ino = (ino_t)inode;
sb.st_mode = S_IFREG;
@@ -1438,7 +1438,6 @@ read_id_stat(p, id, cmd, ppid, pgid)
static char *cbf = (char *)NULL;
static MALLOC_S cbfa = 0;
FILE *fs;
- MALLOC_S nl;
static char *vbuf = (char *)NULL;
static size_t vsz = (size_t)0;
/*
@@ -1600,7 +1599,7 @@ statEx(p, s, ss)
* If a stat() on a trimmed result succeeded, form partial results containing
* only the device and raw device numbers.
*/
- memset((void *)s, 0, sizeof(struct stat));
+ zeromem((char *)s, sizeof(struct stat));
if (st) {
errno = 0;
s->st_dev = sb.st_dev;
diff --git a/dialects/linux/dsock.c b/dialects/linux/dsock.c
index 5a7cd50..b3b45c4 100644
--- a/dialects/linux/dsock.c
+++ b/dialects/linux/dsock.c
@@ -32,7 +32,7 @@
#ifndef lint
static char copyright[] =
"@(#) Copyright 1997 Purdue Research Foundation.\nAll rights reserved.\n";
-static char *rcsid = "$Id: dsock.c,v 1.40 2014/10/13 22:25:58 abe Exp $";
+static char *rcsid = "$Id: dsock.c,v 1.41 2015/07/07 19:46:33 abe Exp $";
#endif
@@ -40,6 +40,22 @@ static char *rcsid = "$Id: dsock.c,v 1.40 2014/10/13 22:25:58 abe Exp $";
#include <sys/xattr.h>
+#if defined(HASEPTOPTS) && defined(HASUXSOCKEPT)
+/*
+ * UNIX endpoint definitions
+ */
+
+#include <sys/socket.h> /* for AF_NETLINK */
+#include <linux/rtnetlink.h> /* for NETLINK_INET_DIAG */
+#include <linux/sock_diag.h> /* for SOCK_DIAG_BY_FAMILY */
+#include <linux/unix_diag.h> /* for unix_diag_req */
+#include <string.h> /* memset */
+#include <stdint.h> /* for unt8_t */
+#include <unistd.h> /* for getpagesize */
+#define SOCKET_BUFFER_SIZE (getpagesize() < 8192L ? getpagesize() : 8192L)
+#endif /* defined(HASEPTOPTS) && defined(HASUXSOCKEPT) */
+
+
/*
* Local definitions
*/
@@ -146,18 +162,6 @@ struct tcp_udp6 { /* IPv6 TCP and UDP socket
};
#endif /* defined(HASIPv6) */
-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 */
- struct uxsin *next;
-};
-
/*
* Local static values
@@ -237,7 +241,7 @@ static char *UDPpath = (char *)NULL; /* path to UDP /proc information */
static char *UDPLITEpath = (char *)NULL;
/* path to UDPLITE /proc information */
static char *UNIXpath = (char *)NULL; /* path to UNIX /proc information */
-static struct uxsin **Uxsin = (struct uxsin **)NULL;
+static uxsin_t **Uxsin = (uxsin_t **)NULL;
/* UNIX socket info, hashed by inode */
@@ -246,6 +250,17 @@ static struct uxsin **Uxsin = (struct uxsin **)NULL;
*/
_PROTOTYPE(static struct ax25sin *check_ax25,(INODETYPE i));
+
+#if defined(HASEPTOPTS) && defined(HASUXSOCKEPT)
+_PROTOTYPE(static void enter_uxsinfo,(uxsin_t *up));
+_PROTOTYPE(static void fill_uxicino,(INODETYPE si, INODETYPE sc));
+_PROTOTYPE(static void fill_uxpino,(INODETYPE si, INODETYPE pi));
+_PROTOTYPE(static int get_diagmsg,(int sockfd));
+_PROTOTYPE(static void get_uxpeeri,(void));
+_PROTOTYPE(static void parse_diag,(struct unix_diag_msg *dm, int len));
+_PROTOTYPE(static void prt_uxs,(uxsin_t *p, int mk));
+#endif /* defined(HASEPTOPTS) && defined(HASUXSOCKEPT) */
+
_PROTOTYPE(static struct icmpin *check_icmp,(INODETYPE i));
_PROTOTYPE(static struct ipxsin *check_ipx,(INODETYPE i));
_PROTOTYPE(static struct nlksin *check_netlink,(INODETYPE i));
@@ -253,7 +268,7 @@ _PROTOTYPE(static struct packin *check_pack,(INODETYPE i));
_PROTOTYPE(static struct rawsin *check_raw,(INODETYPE i));
_PROTOTYPE(static struct sctpsin *check_sctp,(INODETYPE i));
_PROTOTYPE(static struct tcp_udp *check_tcpudp,(INODETYPE i, char **p));
-_PROTOTYPE(static struct uxsin *check_unix,(INODETYPE i));
+_PROTOTYPE(static uxsin_t *check_unix,(INODETYPE i));
_PROTOTYPE(static void get_ax25,(char *p));
_PROTOTYPE(static void get_icmp,(char *p));
_PROTOTYPE(static void get_ipx,(char *p));
@@ -540,19 +555,19 @@ check_tcpudp6(i, p)
* check_unix() - check for UNIX domain socket
*/
-static struct uxsin *
+static uxsin_t *
check_unix(i)
INODETYPE i; /* socket file's inode number */
{
int h;
- struct uxsin *up;
+ uxsin_t *up;
h = INOHASH(i);
for (up = Uxsin[h]; up; up = up->next) {
if (i == up->inode)
return(up);
}
- return((struct uxsin *)NULL);
+ return((uxsin_t *)NULL);
}
@@ -729,6 +744,394 @@ get_ax25(p)
}
(void) fclose(as);
}
+
+
+#if defined(HASEPTOPTS) && defined(HASUXSOCKEPT)
+/*
+ * enter_uxsinfo() -- enter unix socket info
+ * entry Lf = local file structure pointer
+ * Lp = local process structure pointer
+ */
+
+static void
+enter_uxsinfo (up)
+ uxsin_t *up;
+{
+ pxinfo_t *pi; /* pxinfo_t structure pointer */
+ struct lfile *lf; /* local file structure pointer */
+ struct lproc *lp; /* local proc structure pointer */
+ pxinfo_t *np; /* new pxinfo_t structure pointer */
+
+ for (pi = up->pxinfo; pi; pi = pi->next) {
+ lf = pi->lf;
+ lp = &Lproc[pi->lpx];
+ if (pi->ino == Lf->inode) {
+ if ((lp->pid == Lp->pid) && !strcmp(lf->fd, Lf->fd))
+ return;
+ }
+ }
+ if (!(np = (pxinfo_t *)malloc(sizeof(pxinfo_t)))) {
+ (void) fprintf(stderr,
+ "%s: no space for pipeinfo in uxsinfo, PID %d\n",
+ Pn, Lp->pid);
+ Exit(1);
+ }
+ np->ino = Lf->inode;
+ np->lf = Lf;
+ np->lpx = Lp - Lproc;
+ np->next = up->pxinfo;
+ up->pxinfo = np;
+}
+
+
+/*
+ * fill_uxicino() -- fill incoming connection inode number
+ */
+
+static void
+fill_uxicino (si, ic)
+ INODETYPE si; /* UNIX socket inode number */
+ INODETYPE ic; /* incomining UNIX socket connection
+ * inode number */
+{
+ uxsin_t *psi; /* pointer to socket's information */
+ uxsin_t *pic; /* pointer to incoming connection's
+ * information */
+
+ if ((psi = check_unix(si))) {
+ if (psi->icstat || psi->icons)
+ return;
+ if ((pic = check_unix(ic))) {
+ psi->icstat = 1;
+ psi->icons = pic;
+ }
+ }
+}
+
+
+/*
+ * fill_uxpino() -- fill in UNIX socket's peer inode number
+ */
+
+static void
+fill_uxpino(si, pi)
+ INODETYPE si; /* UNIX socket inode number */
+ INODETYPE pi; /* UNIX socket peer's inode number */
+{
+ uxsin_t *pp, *up;
+
+ if ((up = check_unix(si))) {
+ if (!up->peer) {
+ if (pp = check_unix(pi))
+ up->peer = pp;
+ }
+ }
+}
+
+
+/*
+ * find_uxepti(lf) -- find UNIX socket endpoint info
+ */
+
+uxsin_t *
+find_uxepti(lf)
+ struct lfile *lf; /* pipe's lfile */
+{
+ uxsin_t *up;
+
+ up = check_unix(lf->inode);
+ return(up ? up->peer: (uxsin_t *)NULL);
+}
+
+
+/*
+ * get_diagmsg() -- get UNIX socket's diag message
+ */
+
+static int
+get_diagmsg(sockfd)
+ int sockfd; /* socket's file descriptor */
+{
+ struct msghdr msg; /* message header */
+ struct nlmsghdr nlh; /* header length */
+ struct unix_diag_req creq; /* connection request */
+ struct sockaddr_nl sa; /* netlink socket address */
+ struct iovec iov[2]; /* I/O vector */
+/*
+ * Build and send message to socket's file descriptor, asking for its
+ * diagnostic message.
+ */
+ zeromem((char *)&msg, sizeof(msg));
+ zeromem((char *)&sa, sizeof(sa));
+ zeromem((char *)&nlh, sizeof(nlh));
+ zeromem((char *)&creq, sizeof(creq));
+ sa.nl_family = AF_NETLINK;
+ creq.sdiag_family = AF_UNIX;
+ creq.sdiag_protocol = 0;
+ memset((void *)&creq.udiag_states, -1, sizeof(creq.udiag_states));
+ creq.udiag_ino = (INODETYPE)0;
+ creq.udiag_show = UDIAG_SHOW_PEER|UDIAG_SHOW_ICONS;
+ nlh.nlmsg_len = NLMSG_LENGTH(sizeof(creq));
+ nlh.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST;
+ nlh.nlmsg_type = SOCK_DIAG_BY_FAMILY;
+ iov[0].iov_base = (void *)&nlh;
+ iov[0].iov_len = sizeof(nlh);
+ iov[1].iov_base = (void *) &creq;
+ iov[1].iov_len = sizeof(creq);
+ msg.msg_name = (void *) &sa;
+ msg.msg_namelen = sizeof(sa);
+ msg.msg_iov = iov;
+ msg.msg_iovlen = 2;
+ return(sendmsg(sockfd, &msg, 0));
+}
+
+
+/*
+ * get_uxpeeri() - get UNIX socket peer inode information
+ */
+
+static void
+get_uxpeeri()
+{
+ struct unix_diag_msg *dm; /* pointer to diag message */
+ struct nlmsghdr *hp; /* netlink structure header pointer */
+ int nb = 0; /* number of bytes */
+ int ns = 0; /* netlink socket */
+ uint8_t rb[SOCKET_BUFFER_SIZE]; /* receive buffer */
+ int rl = 0; /* route info length */
+/*
+ * Get a netlink socket.
+ */
+ if ((ns = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_SOCK_DIAG)) == -1) {
+ (void) fprintf(stderr, "%s: netlink socket error: %s\n",
+ Pn, strerror(errno));
+ Exit(1);
+ }
+/*
+ * Request peer information.
+ */
+ if (get_diagmsg(ns) < 0) {
+ (void) fprintf(stderr, "%s: netlink peer request error: %s\n",
+ Pn, strerror(errno));
+ goto get_uxpeeri_exit;
+ }
+/*
+ * Receive peer information.
+ */
+ while (1) {
+ if ((nb = recv(ns, rb, sizeof(rb), 0)) <= 0)
+ goto get_uxpeeri_exit;
+ hp = (struct nlmsghdr *)rb;
+ while (NLMSG_OK(hp, nb)) {
+ if(hp->nlmsg_type == NLMSG_DONE)
+ goto get_uxpeeri_exit;
+ if(hp->nlmsg_type == NLMSG_ERROR) {
+ (void) fprintf(stderr,
+ "%s: netlink UNIX socket msg peer info error\n", Pn);
+ goto get_uxpeeri_exit;
+ }
+ dm = (struct unix_diag_msg *)NLMSG_DATA(hp);
+ rl = hp->nlmsg_len - NLMSG_LENGTH(sizeof(*dm));
+ parse_diag(dm, rl);
+ hp = NLMSG_NEXT(hp, nb);
+ }
+ }
+
+get_uxpeeri_exit:
+
+ (void) close(ns);
+}
+
+
+/*
+ * parse_diag() -- parse UNIX diag message
+ */
+
+static void
+parse_diag(dm, len)
+ struct unix_diag_msg *dm; /* pointer to diag message */
+ int len; /* message length */
+{
+ struct rtattr *rp; /* route info pointer */
+ int i; /* tmporary index */
+ int icct; /* incoming connection count */
+ uint32_t *icp; /* incoming connection pointer */
+ uint32_t inoc, inop; /* inode numbers */
+
+ if (!dm || (dm->udiag_family != AF_UNIX) || !(inop = dm->udiag_ino)
+ || (len <= 0)
+ ) {
+ return;
+ }
+ rp = (struct rtattr *)(dm + 1);
+/*
+ * Process route information.
+ */
+ while (RTA_OK(rp, len)) {
+ switch (rp->rta_type) {
+ case UNIX_DIAG_PEER:
+ if (len < 4) {
+ (void) fprintf(stderr,
+ "%s: unix_diag: msg length (%d) < 4)\n", Pn, len);
+ return;
+ }
+ if ((inoc = *(uint32_t *)RTA_DATA(rp))) {
+ fill_uxpino((INODETYPE)inop, (INODETYPE)inoc);
+ fill_uxpino((INODETYPE)inoc, (INODETYPE)inop);
+ }
+ break;
+ case UNIX_DIAG_ICONS:
+ icct = RTA_PAYLOAD(rp),
+ icp = (uint32_t *)RTA_DATA(rp);
+
+ for (i = 0; i < icct; i += sizeof(uint32_t), icp++) {
+ fill_uxicino((INODETYPE)inop, (INODETYPE)*icp);
+ }
+ }
+ rp = RTA_NEXT(rp, len);
+ }
+}
+
+
+/*
+ * prt_uxs() -- print UNIX socket information
+ */
+
+static void
+prt_uxs(p, mk)
+ uxsin_t *p; /* peer info */
+ int mk; /* 1 == mark for later processing */
+{
+ struct lproc *ep; /* socket endpoint process */
+ struct lfile *ef; /* socket endpoint file */
+ int i; /* temporary index */
+ int len; /* string length */
+ char nma[1024]; /* character buffer */
+ pxinfo_t *pp; /* previous pipe info of socket */
+
+ (void) strcpy(nma, "->INO=");
+ len = (int)strlen(nma);
+ (void) snpf(&nma[len], sizeof(nma) - len - 1, InodeFmt_d, p->inode);
+ (void) add_nma(nma, strlen(nma));
+ for (pp = p->pxinfo; pp; pp = pp->next) {
+
+ /*
+ * Add a linked socket's PID, command name 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 (mk && FeptE == 2) {
+
+ /*
+ * Endpoint files have been selected, so mark this
+ * one for selection later.
+ */
+ ef->chend = CHEND_UXS;
+ ep->ept |= EPT_UXS_END;
+ }
+ }
+}
+
+
+/*
+ * process_uxsinfo() -- process UNIX socket information, adding it to selected
+ * UNIX socket files and selecting UNIX socket end point
+ * files (if requested)
+ */
+
+void
+process_uxsinfo(f)
+ int f; /* function:
+ * 0 == process selected socket
+ * 1 == process socket end point
+ */
+{
+ uxsin_t *p; /* peer UNIX socket info pointer */
+ uxsin_t *tp; /* temporary UNIX socket info pointer */
+
+ if (!FeptE)
+ return;
+ for (Lf = Lp->file; Lf; Lf = Lf->next) {
+ if (strcmp(Lf->type, "unix"))
+ continue;
+ switch (f) {
+ case 0:
+
+ /*
+ * Process already selected socket.
+ */
+ if (is_file_sel(Lp, Lf)) {
+
+ /*
+ * This file has been selected by some criterion other than its
+ * being a socket. Look up the socket's endpoints.
+ */
+ p = find_uxepti(Lf);
+ if (p && p->inode)
+ prt_uxs(p, 1);
+ if ((tp = check_unix(Lf->inode))) {
+ if (tp->icons) {
+ if (tp->icstat) {
+ p = tp->icons;
+ while (p != tp) {
+ if (p && p->inode)
+ prt_uxs(p, 1);
+ p = p->icons;
+ }
+ } else {
+ for (p = tp->icons; !p->icstat; p = p->icons)
+ ; /* DO NOTHING */
+ if (p->icstat && p->inode)
+ prt_uxs (p, 1);
+ }
+ }
+ }
+ }
+ break;
+ case 1:
+ if (!is_file_sel(Lp, Lf) && (Lf->chend & CHEND_UXS)) {
+
+ /*
+ * This is an unselected end point UNIX socket file. Select it
+ * and add its end point information to peer's name column
+ * addition.
+ */
+ Lf->sf = Selflags;
+ Lp->pss |= PS_SEC;
+ p = find_uxepti(Lf);
+ if (p && p->inode)
+ prt_uxs(p, 0);
+ else if ((tp = check_unix(Lf->inode))) {
+ if (tp->icons) {
+ if (tp->icstat) {
+ p = tp->icons;
+ while (p != tp) {
+ if (p && p->inode)
+ prt_uxs(p, 0);
+ p = p->icons;
+ }
+ } else {
+ for (p = tp->icons; !p->icstat; p = p->icons)
+ ; /* DO NOTHING */
+ if (p->icstat && p->inode)
+ prt_uxs(p, 0);
+ }
+ }
+ }
+ }
+ break;
+ }
+ }
+}
+#endif /* defined(HASEPTOPTS) && defined(HASUXSOCKEPT) */
/*
@@ -744,8 +1147,7 @@ get_icmp(p)
int h;
INODETYPE inode;
struct icmpin *np, *icmpp;
- unsigned long pr;
- MALLOC_S lal, ral, spl;
+ MALLOC_S lal, ral;
static char *vbuf = (char *)NULL;
static size_t vsz = (size_t)0;
FILE *xs;
@@ -1811,7 +2213,7 @@ get_tcpudp(p, pr, clr)
*/
TcpUdp_bucks = INOBUCKS;
if ((fs = fopen(SockStatPath, "r"))) {
- while(fgets(buf, sizeof(buf) - 1, fs)) {
+ while (fgets(buf, sizeof(buf) - 1, fs)) {
if (get_fields(buf, (char *)NULL, &fp, (int *)NULL, 0) != 3)
continue;
if (!fp[0] || strcmp(fp[0], "sockets:")
@@ -1842,7 +2244,7 @@ get_tcpudp(p, pr, clr)
if (!(fs = open_proc_stream(p, "r", &vbuf, &vsz, 0)))
return;
nf = 12;
- while(fgets(buf, sizeof(buf) - 1, fs)) {
+ while (fgets(buf, sizeof(buf) - 1, fs)) {
if (get_fields(buf,
(nf == 12) ? (char *)NULL : ":",
&fp, (int *)NULL, 0)
@@ -2131,7 +2533,7 @@ get_tcpudp6(p, pr, clr)
TcpUdp6_bucks = INOBUCKS;
h = i = nf = 0;
if ((fs = fopen(SockStatPath6, "r"))) {
- while(fgets(buf, sizeof(buf) - 1, fs)) {
+ while (fgets(buf, sizeof(buf) - 1, fs)) {
if (get_fields(buf, (char *)NULL, &fp, (int *)NULL, 0) != 3)
continue;
if (!fp[0]
@@ -2174,7 +2576,7 @@ get_tcpudp6(p, pr, clr)
if (!(fs = open_proc_stream(p, "r", &vbuf, &vsz, 0)))
return;
nf = 12;
- while(fgets(buf, sizeof(buf) - 1, fs)) {
+ while (fgets(buf, sizeof(buf) - 1, fs)) {
if (get_fields(buf,
(nf == 12) ? (char *)NULL : ":",
&fp, (int *)NULL, 0)
@@ -2281,11 +2683,16 @@ get_unix(p)
int h, nf;
INODETYPE inode;
MALLOC_S len;
- struct uxsin *np, *up;
+ uxsin_t *np, *up;
FILE *us;
uint32_t ty;
static char *vbuf = (char *)NULL;
static size_t vsz = (size_t)0;
+
+#if defined(HASEPTOPTS) && defined(HASUXSOCKEPT)
+ pxinfo_t *pp, *pnp;
+#endif /* defined(HASEPTOPTS) && defined(HASUXSOCKEPT) */
+
/*
* Do second time cleanup or first time setup.
*/
@@ -2293,20 +2700,28 @@ get_unix(p)
for (h = 0; h < INOBUCKS; h++) {
for (up = Uxsin[h]; up; up = np) {
np = up->next;
+
+#if defined(HASEPTOPTS) && defined(HASUXSOCKEPT)
+ for (pp = up->pxinfo; pp; pp = pnp) {
+ pnp = pp->next;
+ (void) free((FREE_P *)pp);
+ }
+#endif /* defined(HASEPTOPTS) && defined(HASUXSOCKEPT) */
+
if (up->path)
(void) free((FREE_P *)up->path);
if (up->pcb)
(void) free((FREE_P *)up->pcb);
(void) free((FREE_P *)up);
}
- Uxsin[h] = (struct uxsin *)NULL;
+ Uxsin[h] = (uxsin_t *)NULL;
}
} else {
- Uxsin = (struct uxsin **)calloc(INOBUCKS, sizeof(struct uxsin *));
+ Uxsin = (uxsin_t **)calloc(INOBUCKS, sizeof(uxsin_t *));
if (!Uxsin) {
(void) fprintf(stderr,
"%s: can't allocate %d bytes for Unix socket info\n",
- Pn, (int)(INOBUCKS * sizeof(struct uxsin *)));
+ Pn, (int)(INOBUCKS * sizeof(uxsin_t *)));
}
}
/*
@@ -2394,13 +2809,14 @@ get_unix(p)
* Allocate and fill a Unix socket info structure; link it to its
* hash bucket.
*/
- if (!(up = (struct uxsin *)malloc(sizeof(struct uxsin)))) {
+ if (!(up = (uxsin_t *)malloc(sizeof(uxsin_t)))) {
(void) fprintf(stderr,
"%s: can't allocate %d bytes for uxsin struct\n",
- Pn, (int)sizeof(struct uxsin));
+ Pn, (int)sizeof(uxsin_t));
Exit(1);
}
up->inode = inode;
+ up->next = (uxsin_t *)NULL;
up->pcb = pcb;
up->sb_def = 0;
up->ty = ty;
@@ -2425,9 +2841,28 @@ get_unix(p)
up->sb_rdev = sb.st_rdev;
}
}
+
+#if defined(HASEPTOPTS) && defined(HASUXSOCKEPT)
+ /*
+ * Clean UNIX socket endpoint values.
+ */
+ up->icstat = 0;
+ up->pxinfo = (pxinfo_t *)NULL;
+ up->peer = up->icons = (uxsin_t *)NULL;
+#endif /* defined(HASEPTOPTS) && defined(HASUXSOCKEPT) */
+
up->next = Uxsin[h];
Uxsin[h] = up;
}
+
+#if defined(HASEPTOPTS) && defined(HASUXSOCKEPT)
+/*
+ * If endpoint info has been requested, get UNIX socket peer info.
+ */
+ if (FeptE)
+ get_uxpeeri();
+#endif /* defined(HASEPTOPTS) && defined(HASUXSOCKEPT) */
+
(void) fclose(us);
}
@@ -2702,7 +3137,7 @@ process_proc_sock(p, pbr, s, ss, l, lss)
int lss; /* *l status -- i.e, SB_* values */
{
struct ax25sin *ap;
- char *cp, *path, tbuf[64];
+ char *cp, *path = (char *)NULL, tbuf[64];
unsigned char *fa, *la;
struct in_addr fs, ls;
struct icmpin *icmpp;
@@ -2716,7 +3151,7 @@ process_proc_sock(p, pbr, s, ss, l, lss)
struct sctpsin *sp;
static ssize_t sz;
struct tcp_udp *tp;
- struct uxsin *up;
+ uxsin_t *up;
#if defined(HASIPv6)
int af;
@@ -3392,6 +3827,14 @@ process_proc_sock(p, pbr, s, ss, l, lss)
Lf->inode = (INODETYPE)s->st_ino;
Lf->inp_ty = 1;
}
+
+#if defined(HASEPTOPTS) && defined(HASUXSOCKEPT)
+ if (FeptE) {
+ (void) enter_uxsinfo(up);
+ Lf->sf |= SELUXSINFO;
+ }
+#endif /* defined(HASEPTOPTS) && defined(HASUXSOCKEPT) */
+
cp = sockty2str(up->ty, &rf);
(void) snpf(Namech, Namechl - 1, "%s%stype=%s",
up->path ? up->path : "",
@@ -3453,7 +3896,8 @@ process_proc_sock(p, pbr, s, ss, l, lss)
* If the file has not yet been found and the stat buffer has
* st_mode, search for the file by full path.
*/
- if (is_file_named(2, path, (struct mounts *)NULL,
+ if (is_file_named(2, up->path ? up->path : p,
+ (struct mounts *)NULL,
((s->st_mode & S_IFMT) == S_IFCHR)) ? 1 : 0)
{
Lf->sf |= SELNM;
diff --git a/dialects/sun/dnode.c b/dialects/sun/dnode.c
index 0b98e88..c27eb7a 100644
--- a/dialects/sun/dnode.c
+++ b/dialects/sun/dnode.c
@@ -32,7 +32,7 @@
#ifndef lint
static char copyright[] =
"@(#) Copyright 1994 Purdue Research Foundation.\nAll rights reserved.\n";
-static char *rcsid = "$Id: dnode.c,v 1.60 2014/10/13 22:24:09 abe Exp $";
+static char *rcsid = "$Id: dnode.c,v 1.61 2015/07/07 20:27:15 abe Exp $";
#endif
@@ -2367,16 +2367,13 @@ vfs_read_error:
#if solaris>=110000
case N_SDEV:
if (sdns) {
- dev = sdva.va_fsid;
- rdev = sdva.va_rdev;
- devs = rdevs = 1;
- }
- if (v->v_type == VDIR) {
- dev = v->v_rdev;
- devs = 1;
- } else {
- rdev = v->v_rdev;
- rdevs = 1;
+ if (v->v_type == VDIR) {
+ dev = v->v_rdev;
+ devs = 1;
+ } else {
+ rdev = v->v_rdev;
+ rdevs = 1;
+ }
}
break;
#endif /* solaris>=110000 */
diff --git a/lsof.8 b/lsof.8
index cab4a6f..56bc582 100644
--- a/lsof.8
+++ b/lsof.8
@@ -1,6 +1,10 @@
-.ds VN 4.88
+.ds VN 4.89
.TH LSOF 8 Revision-\*(VN
-.if !\n()P .nr )P 1v
+\" 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
@@ -190,7 +194,7 @@ host aaa.bbb OR ccc.ddd.
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
+However, since values are optional following
.BR +|\-f ,
.BR \-F ,
.BR \-g ,
@@ -293,7 +297,7 @@ 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
+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
@@ -543,7 +547,7 @@ 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) .
+.IR gethostname (2).
.IP
When available, the
.B b
@@ -638,12 +642,16 @@ option.)
.TP \w'names'u+4
.B +|-E
.B +E
-specifies that Linux files should be displayed with endpoint
-information and the files of the endpoints should also be
+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
-Endpoint information is displayed in the NAME column in the
-form ``\fIPID,cmd,FDmode\fP''.
+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
@@ -652,12 +660,31 @@ is the endpoint process command;
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 files should only be displayed with endpoint
-information.
+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
@@ -854,7 +881,12 @@ AND option selection.
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
@@ -1111,11 +1143,11 @@ and
options are available.
.TP \w'names'u+4
.B +|\-M
-Enables (\fB+\fP) or disables (\fB-\fP) the
+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 suported.)
+where portmapper registration reporting is supported.)
.IP
The default reporting mode is set by the
.I lsof
@@ -1125,7 +1157,7 @@ header file;
is distributed with the HASPMAPENABLED #define deactivated, so
portmapper reporting is disabled by default and must be requested
with
-.BR \+M .
+.BR +M .
Specifying
.I lsof's
.B \-h
@@ -1184,7 +1216,7 @@ help output will show the
option.
.TP \w'names'u+4
.B \-n
-inhibits the conversion of network numbers to
+inhibits the conversion of network numbers to
host names for network files.
Inhibiting conversion may make
.I lsof
@@ -1463,7 +1495,7 @@ 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
+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]"
@@ -1568,7 +1600,7 @@ The following seven values may be reported:
KEEPALIVE keep alive time (SO_KEEPALIVE)
LINGER linger time (SO_LINGER)
MSS maximum segment size (TCP_MAXSEG)
- PQLEN partial listen queue connections
+ PQLEN partial listen queue connections
QLEN established listen queue connections
QLIM established listen queue limit
RCVBUF receive buffer length (SO_RCVBUF)
@@ -1584,7 +1616,7 @@ questions in the
.I lsof
FAQ (The \fBFAQ\fP section gives its location.)
.TP \w'names'u+4
-.B \-t
+.B \-t
specifies that
.I lsof
should produce terse output with process identifiers only and no header \-
@@ -1873,7 +1905,7 @@ 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 --
+.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
@@ -1889,7 +1921,7 @@ The first name may be separated from the preceding options with
the ``--'' option.
.IP
If a
-.I name
+.I name
is the mounted\-on directory of a file system or the device of the
file system,
.I lsof
@@ -1925,7 +1957,7 @@ options.
.IP
If a
.I name
-is the base name of a family of multiplexed files \- e. g, AIX's
+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
@@ -2425,8 +2457,7 @@ the type of lock applied to the file:
\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;
+ \fBX\fP for an SCO OpenServer Xenix lock on the entire file;
.br
space if there is no lock.
.IP
@@ -2584,7 +2615,7 @@ file;
.IP
or ``PLWX'' for a
.I /proc/xregs
-file'
+file;
.IP
or ``PMAP'' for a
.I /proc
@@ -2915,7 +2946,7 @@ 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'';
+or the Internet protocol type \- e.g, ``TCP'';
.IP
or ``STR'' for a stream;
.IP
@@ -3168,7 +3199,7 @@ The single character listed first is the field identifier.
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 device character code
D file's major/minor device number (0x<hexadecimal>)
f file descriptor (always selected)
F file structure address (0x<hexadecimal>)
@@ -3737,7 +3768,7 @@ and be allowed to surrender setgid permission.
FreeBSD 4.x, 4.1x, 5.x and [6789].x for x86-based systems
FreeBSD 5.x and [6789].x for Alpha, AMD64 and Sparc64-based
systems
- HP\-UX 11.00
+ 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
@@ -3993,7 +4024,7 @@ be used to add a component of the personal device 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 specification of the dialect's
-.I machine.h
+.I machine.h
header file.
(It's placed right after the home directory in the default
.I lsof
@@ -4249,7 +4280,7 @@ For example, the major and minor device numbers that the
and
.IR stat (2)
functions report for the directory on which CD-ROM files are mounted
-(typically
+(typically
.IR /cdrom )
are not the same as the ones that it reports for the device on which
CD-ROM files are mounted (typically
@@ -4358,10 +4389,10 @@ device cache file
(The suffix,
.IR hostname ,
is the first component of the host's name returned by
-.IR gethostname (2) .)
+.IR gethostname (2).)
.SH AUTHORS
.I Lsof
-was written by Victor A. Abell <abe@purdue.edu> of Purdue University.
+was written by Victor A.\&Abell <abe@purdue.edu> of Purdue University.
Many others have contributed to
.IR lsof .
They're listed in the
diff --git a/lsof.h b/lsof.h
index b524440..93fbbeb 100644
--- a/lsof.h
+++ b/lsof.h
@@ -31,7 +31,7 @@
/*
- * $Id: lsof.h,v 1.67 2014/10/13 22:36:20 abe Exp $
+ * $Id: lsof.h,v 1.68 2015/07/07 20:16:58 abe Exp $
*/
@@ -80,6 +80,24 @@ struct l_dev {
};
+# if defined(HASEPTOPTS)
+/*
+ * End point definitions
+ */
+
+#define CHEND_PIPE 1 /* pipe endpoint ID */
+#define EPT_PIPE 1 /* process has pipe file */
+#define EPT_PIPE_END 2 /* process has pipe 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
*/
@@ -455,12 +473,6 @@ extern int ZoneColW;
* by PID or UID */
#define PS_SEC 2 /* secondary process selection -- e.g.,
* by directory or file */
-
-# if defined(HASEPTOPTS)
-#define PS_PIPE 1 /* process has a pipe file */
-#define PS_PIPE_END 2 /* process has a pipe end point file */
-# endif /* defined(HASEPTOPTS) */
-
#define SELCMD 0x0001 /* select process by command name */
#define SELCNTX 0x0002 /* select security context (-Z) */
#define SELFD 0x0004 /* select file by descriptor name */
@@ -478,6 +490,8 @@ extern int ZoneColW;
#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 SELALL (SELCMD|SELCNTX|SELFD|SELNA|SELNET|SELNM|SELNFS|SELPID|SELUID|SELUNX|SELZONE|SELTASK)
#define SELPROC (SELCMD|SELCNTX|SELPGID|SELPID|SELUID|SELZONE|SELTASK)
/* process selecters */
@@ -554,12 +568,34 @@ struct pff_tab { /* print file flags table structure */
# endif /* defined(HASFSTRUCT) */
# if defined(HASEPTOPTS)
-typedef struct pinfo { /* hashed pipe inode numbers */
- INODETYPE ino; /* pipe's inode */
- struct lfile *lf; /* connected pipe file */
+typedef struct pxinfo { /* hashed pipe or UNIX socket inode
+ * information */
+ INODETYPE ino; /* file's inode */
+ struct lfile *lf; /* connected peer file */
int lpx; /* connected process index */
- struct pinfo *next; /* next entry for hashed inode */
-} pinfo_t;
+ 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) */
@@ -639,7 +675,7 @@ extern int Fnfs;
extern int Fnlink;
extern int Foffset;
extern int Fovhd;
-extern int FpipeE;
+extern int FeptE;
extern int Fport;
@@ -725,7 +761,8 @@ struct lfile {
unsigned char off_def; /* offset definition status */
# if defined(HASEPTOPTS)
- unsigned char pipend; /* pipe endpoint file */
+ unsigned char chend; /* communication channel endpoint
+ * file */
# endif /* defined(HASEPTOPTS) */
unsigned char rdev_def; /* rdev definition status */
@@ -738,7 +775,7 @@ struct lfile {
char fd[FDLEN];
char iproto[IPROTOL];
char type[TYPEL];
- short sf; /* select flags -- SEL* symbols */
+ unsigned int sf; /* select flags -- SEL* symbols */
int ch; /* VMPC channel: -1 = none */
int ntype; /* node type -- N_* value */
SZOFFTYPE off;
@@ -864,7 +901,7 @@ struct lproc {
* 1 = wholly selected
* 2 = partially selected */
# if defined(HASEPTOPTS)
- short pipe; /* pipe status -- PS_PIPE* values */
+ short ept; /* end point status -- EPT_* values */
# endif /* defined(HASEPTOPTS) */
int pid; /* process ID */
diff --git a/lsof.man b/lsof.man
index e109a42..b9d925a 100644
--- a/lsof.man
+++ b/lsof.man
@@ -17,7 +17,7 @@ SYNOPSIS
[ -z [z] ] [ -Z [Z] ] [ -- ] [names]
DESCRIPTION
- Lsof revision 4.88 lists on its standard output file infor-
+ Lsof revision 4.89 lists on its standard output file infor-
mation about files opened by processes for the following
UNIX dialects:
@@ -60,7 +60,7 @@ OPTIONS
-SunOS 5.9 Last change: Revision-4.88 1
+SunOS 5.9 Last change: Revision-4.89 1
@@ -126,7 +126,7 @@ Maintenance Procedures LSOF(8)
-SunOS 5.9 Last change: Revision-4.88 2
+SunOS 5.9 Last change: Revision-4.89 2
@@ -192,7 +192,7 @@ Maintenance Procedures LSOF(8)
-SunOS 5.9 Last change: Revision-4.88 3
+SunOS 5.9 Last change: Revision-4.89 3
@@ -258,7 +258,7 @@ Maintenance Procedures LSOF(8)
-SunOS 5.9 Last change: Revision-4.88 4
+SunOS 5.9 Last change: Revision-4.89 4
@@ -324,7 +324,7 @@ Maintenance Procedures LSOF(8)
-SunOS 5.9 Last change: Revision-4.88 5
+SunOS 5.9 Last change: Revision-4.89 5
@@ -390,7 +390,7 @@ Maintenance Procedures LSOF(8)
-SunOS 5.9 Last change: Revision-4.88 6
+SunOS 5.9 Last change: Revision-4.89 6
@@ -456,7 +456,7 @@ Maintenance Procedures LSOF(8)
-SunOS 5.9 Last change: Revision-4.88 7
+SunOS 5.9 Last change: Revision-4.89 7
@@ -485,58 +485,73 @@ Maintenance Procedures LSOF(8)
information might be made available via the +|-m m
option.)
- +|-E +E specifies that Linux files should be displayed
- with endpoint information and the files of the end-
- points should also be displayed.
-
- Endpoint information is displayed in the NAME
- column in the form ``PID,cmd,FDmode''. PID is the
- endpoint process ID; cmd is the endpoint process
- command; FD is the endpoint file's descriptor; and
- mode is the endpoint file's access mode. Multiple
- occurrences of this information can appear in a
- file's NAME column.
-
- -E specfies that Linux pipe files should only be
- displayed with endpoint information.
+ +|-E +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 infor-
+ mation is available only when the compile flags
+ line of -v output contains HASUXSOCKEPT.
+
+ 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.
+
+ 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
+ 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
+SunOS 5.9 Last change: Revision-4.89 8
-SunOS 5.9 Last change: Revision-4.88 8
+Maintenance Procedures LSOF(8)
-Maintenance Procedures LSOF(8)
+ 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.
- arguments 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.
+ 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.,
@@ -570,6 +585,20 @@ Maintenance Procedures LSOF(8)
node addresses may be used to detect more readily
identical files inherited by child processes and
identical files in use by different processes.
+
+
+
+SunOS 5.9 Last change: Revision-4.89 9
+
+
+
+
+
+
+Maintenance Procedures LSOF(8)
+
+
+
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
@@ -585,20 +614,6 @@ Maintenance Procedures LSOF(8)
description of the field identification characters
and the field output process.
-
-
-
-SunOS 5.9 Last change: Revision-4.88 9
-
-
-
-
-
-
-Maintenance Procedures LSOF(8)
-
-
-
When the field selection character list is empty,
all standard fields are selected (except the raw
device field, security context and zone field for
@@ -636,35 +651,35 @@ Maintenance Procedures LSOF(8)
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
+SunOS 5.9 Last change: Revision-4.89 10
-SunOS 5.9 Last change: Revision-4.88 10
+Maintenance Procedures LSOF(8)
-Maintenance Procedures LSOF(8)
+ 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
@@ -683,7 +698,7 @@ Maintenance Procedures LSOF(8)
An Internet address is specified in the form (Items
in square brackets are optional.):
- [46][protocol][@hostname|hostaddr][:service|port]
+ [46][protocol][@hostname|hostaddr][:service|port]
where:
46 specifies the IP version, IPv4 or IPv6
@@ -702,6 +717,20 @@ Maintenance Procedures LSOF(8)
colon form, enclosed in brackets, if the
UNIX dialect supports IPv6. When an IP
version is selected, only its numeric
+
+
+
+SunOS 5.9 Last change: Revision-4.89 11
+
+
+
+
+
+
+Maintenance Procedures LSOF(8)
+
+
+
addresses may be specified.
service is an /etc/services name - e.g., smtp -
or a list of them.
@@ -717,20 +746,6 @@ Maintenance Procedures LSOF(8)
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
-
-
-
-SunOS 5.9 Last change: Revision-4.88 11
-
-
-
-
-
-
-Maintenance Procedures LSOF(8)
-
-
-
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
@@ -768,6 +783,20 @@ Maintenance Procedures LSOF(8)
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,
+
+
+
+SunOS 5.9 Last change: Revision-4.89 12
+
+
+
+
+
+
+Maintenance Procedures LSOF(8)
+
+
+
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
@@ -783,20 +812,6 @@ Maintenance Procedures LSOF(8)
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
-
-
-
-SunOS 5.9 Last change: Revision-4.88 12
-
-
-
-
-
-
-Maintenance Procedures LSOF(8)
-
-
-
the description of the TID column in the OUTPUT
section.)
@@ -834,35 +849,35 @@ Maintenance Procedures LSOF(8)
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.
+SunOS 5.9 Last change: Revision-4.89 13
- There will be a line in the mount supplement file
- for each mounted file system, containing the
-SunOS 5.9 Last change: Revision-4.88 13
+Maintenance Procedures LSOF(8)
+ (-F) and a post-processing script or program.
-Maintenance Procedures LSOF(8)
+ +|-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.,
@@ -887,7 +902,7 @@ Maintenance Procedures LSOF(8)
ports, where port mapping is supported. (See the
last paragraph of this option description for
information about where portmapper registration
- reporting is suported.)
+ reporting is supported.)
The default reporting mode is set by the lsof
builder with the HASPMAPENABLED #define in the
@@ -900,6 +915,20 @@ Maintenance Procedures LSOF(8)
or enabling it when already enabled is acceptable.
When portmapper registration reporting is enabled,
lsof displays the portmapper registration (if any)
+
+
+
+SunOS 5.9 Last change: Revision-4.89 14
+
+
+
+
+
+
+Maintenance Procedures LSOF(8)
+
+
+
for local TCP, UDP or UDPLITE ports in square
brackets immediately following the port numbers or
service names - e.g., ``:1234[name]'' or
@@ -915,20 +944,6 @@ Maintenance Procedures LSOF(8)
determine if portmapper registration reporting is
slowing or blocking lsof.
-
-
-
-SunOS 5.9 Last change: Revision-4.88 14
-
-
-
-
-
-
-Maintenance Procedures LSOF(8)
-
-
-
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
@@ -966,6 +981,20 @@ Maintenance Procedures LSOF(8)
changed to OFFSET. Note: on some UNIX dialects
lsof can't obtain accurate or consistent file
offset information from its kernel data sources,
+
+
+
+SunOS 5.9 Last change: Revision-4.89 15
+
+
+
+
+
+
+Maintenance Procedures LSOF(8)
+
+
+
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.
@@ -982,19 +1011,6 @@ Maintenance Procedures LSOF(8)
zero (unlimited) directs lsof to use the ``0t''
form for all offset output.
-
-
-SunOS 5.9 Last change: Revision-4.88 15
-
-
-
-
-
-
-Maintenance Procedures LSOF(8)
-
-
-
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
@@ -1032,6 +1048,19 @@ Maintenance Procedures LSOF(8)
e.g., ``123'' or ``123,^456''. (There should be no
spaces in the set.)
+
+
+SunOS 5.9 Last change: Revision-4.89 16
+
+
+
+
+
+
+Maintenance Procedures LSOF(8)
+
+
+
PID numbers that begin with `^' (negation)
represent exclusions.
@@ -1047,20 +1076,6 @@ Maintenance Procedures LSOF(8)
ful when port name lookup is not working properly.
+|-r [t[m<fmt>]]
-
-
-
-SunOS 5.9 Last change: Revision-4.88 16
-
-
-
-
-
-
-Maintenance Procedures LSOF(8)
-
-
-
puts lsof in repeat mode. There lsof lists open
files as selected by other options, delays t
seconds (default fifteen), then repeats the list-
@@ -1098,35 +1113,35 @@ Maintenance Procedures LSOF(8)
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
+SunOS 5.9 Last change: Revision-4.89 17
-SunOS 5.9 Last change: Revision-4.88 17
+Maintenance Procedures LSOF(8)
-Maintenance Procedures LSOF(8)
+ 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-
@@ -1164,35 +1179,35 @@ Maintenance Procedures LSOF(8)
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
+SunOS 5.9 Last change: Revision-4.89 18
- 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
+Maintenance Procedures LSOF(8)
-SunOS 5.9 Last change: Revision-4.88 18
+ name as an argument to the -i option.
+ For example, to list only network files with TCP
+ state LISTEN, use:
+ -iTCP -sTCP:LISTEN
-Maintenance Procedures LSOF(8)
+ 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,
@@ -1230,6 +1245,20 @@ Maintenance Procedures LSOF(8)
addresses. In normal output the information
appears in parentheses, each item except TCP or TPI
state name identified by a keyword, followed by
+
+
+
+SunOS 5.9 Last change: Revision-4.89 19
+
+
+
+
+
+
+Maintenance Procedures LSOF(8)
+
+
+
`=', separated from others by a single space:
@@ -1246,19 +1275,6 @@ Maintenance Procedures LSOF(8)
Items values (when available) are reported after
the item name and '='.
-
-
-SunOS 5.9 Last change: Revision-4.88 19
-
-
-
-
-
-
-Maintenance Procedures LSOF(8)
-
-
-
When the field output mode is in effect (See OUTPUT
FOR OTHER PROGRAMS.) each item appears as a field
with a `T' leading character.
@@ -1295,34 +1311,34 @@ Maintenance Procedures LSOF(8)
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:
+SunOS 5.9 Last change: Revision-4.89 20
-SunOS 5.9 Last change: Revision-4.88 20
+Maintenance Procedures LSOF(8)
+ 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.
-Maintenance Procedures LSOF(8)
+ ``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
@@ -1331,7 +1347,7 @@ Maintenance Procedures LSOF(8)
KEEPALIVE keep alive time (SO_KEEPALIVE)
LINGER linger time (SO_LINGER)
MSS maximum segment size (TCP_MAXSEG)
- PQLEN partial listen queue connections
+ PQLEN partial listen queue connections
QLEN established listen queue connections
QLIM established listen queue limit
RCVBUF receive buffer length (SO_RCVBUF)
@@ -1362,6 +1378,19 @@ Maintenance Procedures LSOF(8)
in a single ORed set before participating in AND
option selection.
+
+
+SunOS 5.9 Last change: Revision-4.89 21
+
+
+
+
+
+
+Maintenance Procedures LSOF(8)
+
+
+
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.
@@ -1377,20 +1406,6 @@ Maintenance Procedures LSOF(8)
-v selects the listing of lsof version information,
including: revision number; when the lsof binary
-
-
-
-SunOS 5.9 Last change: Revision-4.88 21
-
-
-
-
-
-
-Maintenance Procedures LSOF(8)
-
-
-
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
@@ -1429,34 +1444,33 @@ Maintenance Procedures LSOF(8)
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
+SunOS 5.9 Last change: Revision-4.89 22
-SunOS 5.9 Last change: Revision-4.88 22
+Maintenance Procedures LSOF(8)
-Maintenance Procedures LSOF(8)
+ 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.
@@ -1496,23 +1510,9 @@ Maintenance Procedures LSOF(8)
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
-
-SunOS 5.9 Last change: Revision-4.88 23
+SunOS 5.9 Last change: Revision-4.89 23
@@ -1523,7 +1523,20 @@ Maintenance Procedures LSOF(8)
- distribution for a more complete description of the
+ 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.
@@ -1562,33 +1575,33 @@ Maintenance Procedures LSOF(8)
-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
+SunOS 5.9 Last change: Revision-4.89 24
-SunOS 5.9 Last change: Revision-4.88 24
+Maintenance Procedures LSOF(8)
-Maintenance Procedures LSOF(8)
+ 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
@@ -1628,6 +1641,20 @@ Maintenance Procedures LSOF(8)
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
+
+
+
+SunOS 5.9 Last change: Revision-4.89 25
+
+
+
+
+
+
+Maintenance Procedures LSOF(8)
+
+
+
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
@@ -1642,21 +1669,8 @@ Maintenance Procedures LSOF(8)
request that lsof look for open files inside a
directory name, use the +d s and +D D options.
-
-
-SunOS 5.9 Last change: Revision-4.88 25
-
-
-
-
-
-
-Maintenance Procedures LSOF(8)
-
-
-
If a name is the base name of a family of multi-
- plexed files - e. g, AIX's /dev/pt[cs] - lsof will
+ 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.
@@ -1693,33 +1707,32 @@ Maintenance Procedures LSOF(8)
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):
+SunOS 5.9 Last change: Revision-4.89 26
-SunOS 5.9 Last change: Revision-4.88 26
+Maintenance Procedures LSOF(8)
-Maintenance Procedures LSOF(8)
+ 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)
@@ -1760,6 +1773,20 @@ 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
+
+
+
+SunOS 5.9 Last change: Revision-4.89 27
+
+
+
+
+
+
+Maintenance Procedures LSOF(8)
+
+
+
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-
@@ -1774,19 +1801,6 @@ SECURITY
tion number as the real user ID number of the lsof process
(the one that its user logged on with).
-
-
-SunOS 5.9 Last change: Revision-4.88 27
-
-
-
-
-
-
-Maintenance Procedures LSOF(8)
-
-
-
However, if HASSECURITY and HASNOSOCKSECURITY are both
defined, anyone may list open socket files, provided they
are selected with the -i option.
@@ -1826,33 +1840,32 @@ Maintenance Procedures LSOF(8)
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
+SunOS 5.9 Last change: Revision-4.89 28
-SunOS 5.9 Last change: Revision-4.88 28
+Maintenance Procedures LSOF(8)
-Maintenance Procedures LSOF(8)
+ 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.
@@ -1893,22 +1906,9 @@ Maintenance Procedures LSOF(8)
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
-
-SunOS 5.9 Last change: Revision-4.88 29
+SunOS 5.9 Last change: Revision-4.89 29
@@ -1919,6 +1919,18 @@ Maintenance Procedures LSOF(8)
+ 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.)
@@ -1960,31 +1972,30 @@ Maintenance Procedures LSOF(8)
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
+SunOS 5.9 Last change: Revision-4.89 30
-SunOS 5.9 Last change: Revision-4.88 30
+Maintenance Procedures LSOF(8)
-Maintenance Procedures LSOF(8)
+ 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
process. Usually that is the same value reported
@@ -2026,21 +2037,10 @@ Maintenance Procedures LSOF(8)
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;
-SunOS 5.9 Last change: Revision-4.88 31
+SunOS 5.9 Last change: Revision-4.89 31
@@ -2051,6 +2051,17 @@ Maintenance Procedures LSOF(8)
+ 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.
See the LOCKS section for more information on the
@@ -2093,29 +2104,29 @@ Maintenance Procedures LSOF(8)
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;
+SunOS 5.9 Last change: Revision-4.89 32
- or ``MPB'' for a multiplexed block file;
- or ``MPC'' for a multiplexed character file;
-SunOS 5.9 Last change: Revision-4.88 32
+Maintenance Procedures LSOF(8)
+ or ``FIFO'' for a FIFO special file;
+ or ``KQUEUE'' for a BSD style kernel event queue
+ file;
-Maintenance Procedures LSOF(8)
+ 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
that can't be opened -- the directory path
@@ -2158,36 +2169,37 @@ Maintenance Procedures LSOF(8)
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;
+SunOS 5.9 Last change: Revision-4.89 33
- or ``PLWG'' for a /proc/gwindows file;
- or ``PLWI'' for a /proc/lwpsinfo file;
-SunOS 5.9 Last change: Revision-4.88 33
+Maintenance Procedures LSOF(8)
+ or ``PLDT'' for a /proc/ldt file;
+ or ``PLPI'' for a /proc/lpsinfo file;
-Maintenance Procedures LSOF(8)
+ 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;
or ``PLWS'' for a /proc/lwpstatus file;
or ``PLWU'' for a /proc/lwpusage file;
- or ``PLWX'' for a /proc/xregs file'
+ or ``PLWX'' for a /proc/xregs file;
or ``PMAP'' for a /proc map file (map);
@@ -2223,31 +2235,31 @@ Maintenance Procedures LSOF(8)
or ``PSXSEM'' for a POSIX semaphore file;
- or ``PSXSHM'' for a POSIX shared memory file;
- or ``PUSG'' for a /proc/usage file;
- or ``PW'' for a /proc/watch file;
- or ``PXMP'' for a /proc/xmap file;
+SunOS 5.9 Last change: Revision-4.89 34
- or ``REG'' for a regular file;
- or ``SMT'' for a shared memory transport file;
-SunOS 5.9 Last change: Revision-4.88 34
+Maintenance Procedures LSOF(8)
+ or ``PSXSHM'' for a POSIX shared memory file;
+ or ``PUSG'' for a /proc/usage file;
+ or ``PW'' for a /proc/watch file;
-Maintenance Procedures LSOF(8)
+ or ``PXMP'' for a /proc/xmap file;
+ or ``REG'' for a regular file;
+ or ``SMT'' for a shared memory transport file;
or ``STSO'' for a stream socket;
@@ -2289,22 +2301,10 @@ Maintenance Procedures LSOF(8)
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
-SunOS 5.9 Last change: Revision-4.88 35
+SunOS 5.9 Last change: Revision-4.89 35
@@ -2315,6 +2315,18 @@ Maintenance Procedures LSOF(8)
+ 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
@@ -2355,22 +2367,10 @@ Maintenance Procedures LSOF(8)
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
-SunOS 5.9 Last change: Revision-4.88 36
+SunOS 5.9 Last change: Revision-4.89 36
@@ -2381,6 +2381,18 @@ Maintenance Procedures LSOF(8)
+ 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
@@ -2421,32 +2433,32 @@ Maintenance Procedures LSOF(8)
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;
- or a kernel reference address that identifies the
- file (The kernel reference address may be used
+SunOS 5.9 Last change: Revision-4.89 37
-SunOS 5.9 Last change: Revision-4.88 37
+Maintenance Procedures LSOF(8)
-Maintenance Procedures LSOF(8)
+ 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;
+ 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
@@ -2487,32 +2499,32 @@ Maintenance Procedures LSOF(8)
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
- displays the file size (or nothing if no size is
- available) and labels the column SIZE. The -o
+SunOS 5.9 Last change: Revision-4.89 38
-SunOS 5.9 Last change: Revision-4.88 38
+Maintenance Procedures LSOF(8)
-Maintenance Procedures LSOF(8)
+ 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
+ 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.
@@ -2530,7 +2542,7 @@ Maintenance Procedures LSOF(8)
or the inode number of an NFS file in the server
host;
- or the Internet protocol type - e. g, ``TCP'';
+ or the Internet protocol type - e.g, ``TCP'';
or ``STR'' for a stream;
@@ -2553,22 +2565,10 @@ Maintenance Procedures LSOF(8)
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
- - state (e.g., ``(ESTABLISHED)'', ``(Unbound)''),
- queue sizes, and window sizes (not all dialects)
-SunOS 5.9 Last change: Revision-4.88 39
+SunOS 5.9 Last change: Revision-4.89 39
@@ -2579,6 +2579,18 @@ Maintenance Procedures LSOF(8)
+ 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
+ - 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
@@ -2620,30 +2632,29 @@ Maintenance Procedures LSOF(8)
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
- values of the read and write offsets of a FIFO;
+SunOS 5.9 Last change: Revision-4.89 40
-SunOS 5.9 Last change: Revision-4.88 40
-
+Maintenance Procedures LSOF(8)
-Maintenance Procedures LSOF(8)
+ 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
+ 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
@@ -2686,30 +2697,30 @@ Maintenance Procedures LSOF(8)
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
- NAME column additions.
+SunOS 5.9 Last change: Revision-4.89 41
-SunOS 5.9 Last change: Revision-4.88 41
+Maintenance Procedures LSOF(8)
-Maintenance Procedures LSOF(8)
+ 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
+ NAME column additions.
LOCKS
Lsof can't adequately report the wide variety of UNIX
@@ -2752,21 +2763,10 @@ OUTPUT FOR OTHER PROGRAMS
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
- file's access mode, lock state, type, device, size, offset,
- inode, protocol, name and stream module names. It extends
-SunOS 5.9 Last change: Revision-4.88 42
+SunOS 5.9 Last change: Revision-4.89 42
@@ -2777,6 +2777,17 @@ Maintenance Procedures LSOF(8)
+ 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
+ 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.
@@ -2818,21 +2829,10 @@ Maintenance Procedures LSOF(8)
K tasK ID
k link count
l file's lock status
- L process login name
- m marker between repeated output
- 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
-SunOS 5.9 Last change: Revision-4.88 43
+SunOS 5.9 Last change: Revision-4.89 43
@@ -2843,6 +2843,17 @@ Maintenance Procedures LSOF(8)
+ L process login name
+ m marker between repeated output
+ 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):
@@ -2884,30 +2895,30 @@ Maintenance Procedures LSOF(8)
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 out-
- put. When the NUL field terminator is in use, lsof ends
- each process and file set with a NL (012).
+SunOS 5.9 Last change: Revision-4.89 44
-SunOS 5.9 Last change: Revision-4.88 44
+Maintenance Procedures LSOF(8)
-Maintenance Procedures LSOF(8)
+ 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 out-
+ put. 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
@@ -2950,30 +2961,30 @@ BLOCKS AND TIMEOUTS
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.
-AVOIDING KERNEL BLOCKS
- You can use the -b option to tell lsof to avoid using kernel
- functions that would block. Some cautions apply.
+SunOS 5.9 Last change: Revision-4.89 45
-SunOS 5.9 Last change: Revision-4.88 45
+Maintenance Procedures LSOF(8)
-Maintenance Procedures LSOF(8)
+ 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.
+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
@@ -3016,21 +3027,10 @@ ALTERNATE DEVICE NUMBERS
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.
-
- 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
-SunOS 5.9 Last change: Revision-4.88 46
+SunOS 5.9 Last change: Revision-4.89 46
@@ -3041,6 +3041,17 @@ Maintenance Procedures LSOF(8)
+ 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.
+
+ 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
@@ -3081,22 +3092,11 @@ Maintenance Procedures LSOF(8)
``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.)
- 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
-SunOS 5.9 Last change: Revision-4.88 47
+SunOS 5.9 Last change: Revision-4.89 47
@@ -3107,6 +3107,18 @@ Maintenance Procedures LSOF(8)
+ 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.)
+
+ 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
@@ -3147,32 +3159,32 @@ Maintenance Procedures LSOF(8)
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.
- 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
+SunOS 5.9 Last change: Revision-4.89 48
-SunOS 5.9 Last change: Revision-4.88 48
+Maintenance Procedures LSOF(8)
-Maintenance Procedures LSOF(8)
+ 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.
+ 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:
@@ -3213,32 +3225,32 @@ Maintenance Procedures LSOF(8)
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.
-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
+SunOS 5.9 Last change: Revision-4.89 49
-SunOS 5.9 Last change: Revision-4.88 49
+Maintenance Procedures LSOF(8)
-Maintenance Procedures LSOF(8)
+ 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.
+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
@@ -3278,33 +3290,34 @@ Maintenance Procedures LSOF(8)
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
-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
+SunOS 5.9 Last change: Revision-4.89 50
-SunOS 5.9 Last change: Revision-4.88 50
+Maintenance Procedures LSOF(8)
-Maintenance Procedures LSOF(8)
+ (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
+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
@@ -3343,24 +3356,11 @@ Maintenance Procedures LSOF(8)
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
- PERMISSIONS THAT AFFECT DEVICE CACHE FILE ACCESS section for
- information on implementations that don't surrender their
- setgid permission.)
-SunOS 5.9 Last change: Revision-4.88 51
+SunOS 5.9 Last change: Revision-4.89 51
@@ -3371,6 +3371,20 @@ Maintenance Procedures LSOF(8)
+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
+ 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-
@@ -3409,33 +3423,33 @@ PERSONAL DEVICE CACHE PATH (DEFAULT)
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
- 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.
+SunOS 5.9 Last change: Revision-4.89 52
-SunOS 5.9 Last change: Revision-4.88 52
+Maintenance Procedures LSOF(8)
-Maintenance Procedures LSOF(8)
+ 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
+ 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
@@ -3475,33 +3489,32 @@ MODIFIED PERSONAL DEVICE CACHE PATH
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
- device cache files at the standard personal path and move
- them to your subdirectory with shell commands.
+SunOS 5.9 Last change: Revision-4.89 53
-SunOS 5.9 Last change: Revision-4.88 53
+Maintenance Procedures LSOF(8)
-Maintenance Procedures LSOF(8)
+ 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
+ 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
@@ -3541,33 +3554,33 @@ DIAGNOSTICS
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:
- lsof
+SunOS 5.9 Last change: Revision-4.89 54
-SunOS 5.9 Last change: Revision-4.88 54
+Maintenance Procedures LSOF(8)
+ Inaccessible /dev warnings are disabled.
+ Inaccessible device warning messages usually disappear after
+ lsof has created a working device cache file.
-Maintenance Procedures LSOF(8)
+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:
+ lsof
To list all open Internet, x.25 (HP-UX), and UNIX domain
files, use:
@@ -3608,33 +3621,33 @@ Maintenance Procedures LSOF(8)
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.89 55
- 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
-SunOS 5.9 Last change: Revision-4.88 55
+Maintenance Procedures LSOF(8)
+ To send a SIGHUP to the processes that have /u/abe/bar open,
+ use:
-Maintenance Procedures LSOF(8)
+ 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
+ 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
@@ -3674,32 +3687,33 @@ Maintenance Procedures LSOF(8)
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.89 56
- To obtain a repeat mode marker line that contains the
- current time, use:
-SunOS 5.9 Last change: Revision-4.88 56
+Maintenance Procedures LSOF(8)
+ use:
-Maintenance Procedures LSOF(8)
+ 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]
+
+ To obtain a repeat mode marker line that contains the
+ current time, use:
lsof -rm====%T====
@@ -3739,34 +3753,34 @@ BUGS
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.
- Lsof can't search for Tru64 UNIX named pipes by name,
- because their kernel implementation of lstat(2) returns an
+SunOS 5.9 Last change: Revision-4.89 57
-SunOS 5.9 Last change: Revision-4.88 57
+Maintenance Procedures LSOF(8)
-Maintenance Procedures LSOF(8)
+ 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.
+ 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,
@@ -3806,38 +3820,37 @@ 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
+SunOS 5.9 Last change: Revision-4.89 58
- /dev/mem physical memory device
- /dev/swap system paging device
-
- .lsof_hostname lsof's device cache file (The suffix,
-SunOS 5.9 Last change: Revision-4.88 58
+Maintenance Procedures LSOF(8)
+ 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
-Maintenance Procedures LSOF(8)
+FILES
+ /dev/kmem kernel virtual memory device
+ /dev/mem physical memory device
+ /dev/swap system paging device
+ .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-
+ 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.
@@ -3872,6 +3885,20 @@ DISTRIBUTION
README.lsof_<version> and the other 00* files of the distri-
bution before sending questions to the author.
+
+
+
+SunOS 5.9 Last change: Revision-4.89 59
+
+
+
+
+
+
+Maintenance Procedures LSOF(8)
+
+
+
SEE ALSO
Not all the following manual pages may exist in every UNIX
dialect to which lsof has been ported.
@@ -3888,7 +3915,46 @@ SEE ALSO
-SunOS 5.9 Last change: Revision-4.88 59
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+SunOS 5.9 Last change: Revision-4.89 60
diff --git a/main.c b/main.c
index 70b245f..78fdac1 100644
--- a/main.c
+++ b/main.c
@@ -34,7 +34,7 @@
#ifndef lint
static char copyright[] =
"@(#) Copyright 1994 Purdue Research Foundation.\nAll rights reserved.\n";
-static char *rcsid = "$Id: main.c,v 1.56 2014/10/13 22:36:20 abe Exp $";
+static char *rcsid = "$Id: main.c,v 1.57 2015/07/07 20:16:58 abe Exp $";
#endif
@@ -87,7 +87,7 @@ main(argc, argv)
#if defined(HAS_STRFTIME)
char *fmt = (char *)NULL;
- size_t fmtl;
+ size_t fmtl = (size_t)0;
#endif /* defined(HAS_STRFTIME) */
#if defined(HASZONES)
@@ -365,7 +365,7 @@ main(argc, argv)
#if defined(HASEPTOPTS)
case 'E':
- FpipeE = (GOp == '+') ? 2 : 1;
+ FeptE = (GOp == '+') ? 2 : 1;
break;
#endif /* defined(HASEPTOPTS) */
@@ -1299,7 +1299,7 @@ main(argc, argv)
* Lf contents must be preserved, since they may point to a
* malloc()'d area, and since Lf is used throughout the print
*/
- if (FpipeE) {
+ if (FeptE) {
lf = Lf;
/*
@@ -1308,7 +1308,7 @@ main(argc, argv)
*/
for (i = 0; i < Nlproc; i++) {
Lp = (Nlproc > 1) ? slp[i] : &Lproc[i];
- if (Lp->pss && (Lp->pipe & PS_PIPE))
+ if (Lp->pss && (Lp->ept & EPT_PIPE))
(void) process_pinfo(0);
}
/*
@@ -1317,9 +1317,27 @@ main(argc, argv)
*/
for (i = 0; i < Nlproc; i++) {
Lp = (Nlproc > 1) ? slp[i] : &Lproc[i];
- if (Lp->pipe & PS_PIPE_END)
+ 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) */
diff --git a/proc.c b/proc.c
index a75546a..8d40aa4 100644
--- a/proc.c
+++ b/proc.c
@@ -32,7 +32,7 @@
#ifndef lint
static char copyright[] =
"@(#) Copyright 1994 Purdue Research Foundation.\nAll rights reserved.\n";
-static char *rcsid = "$Id: proc.c,v 1.48 2014/10/13 22:36:20 abe Exp $";
+static char *rcsid = "$Id: proc.c,v 1.49 2015/07/07 20:16:58 abe Exp $";
#endif
@@ -40,13 +40,6 @@ static char *rcsid = "$Id: proc.c,v 1.48 2014/10/13 22:36:20 abe Exp $";
/*
- * Local function prototypes
- */
-
-_PROTOTYPE(static int is_file_sel,(struct lproc *lp, struct lfile *lf));
-
-
-/*
* add_nma() - add to NAME column addition
*/
@@ -60,12 +53,12 @@ add_nma(cp, len)
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));
+ 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));
+ Lf->nma = (char *) malloc((MALLOC_S)(len + 1));
}
if (!Lf->nma) {
(void) fprintf(stderr, "%s: no name addition space: PID %ld, FD %s",
@@ -170,7 +163,7 @@ alloc_lfile(nm, num)
#endif /* defined(HASMNTSTAT) */
#if defined(HASEPTOPTS)
- Lf->pipend = 0;
+ Lf->chend = 0;
#endif /* defined(HASEPTOPTS) */
#if defined(HASSOOPT)
@@ -308,7 +301,7 @@ alloc_lproc(pid, pgid, ppid, uid, cmd, pss, sf)
Lp->pid = pid;
#if defined(HASEPTOPTS)
- Lp->pipe = 0;
+ Lp->ept = 0;
#endif /* defined(HASEPTOPTS) */
#if defined(HASTASKS)
@@ -639,7 +632,7 @@ is_cmd_excl(cmd, pss, sf)
* is_file_sel() - is file selected?
*/
-static int
+int
is_file_sel(lp, lf)
struct lproc *lp; /* lproc structure pointer */
struct lfile *lf; /* lfile structure pointer */
@@ -894,20 +887,33 @@ link_lfile()
#if defined(HASEPTOPTS)
/*
* If endpoint info has been requested, clear the SELPINFO flag from the local
- * 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 PS_PIPE flag for
- * the process.
- *
- * Also set the SELPINFO flag for the process.
+ * 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 (FpipeE) {
- Lf->sf &= ~SELPINFO;
- Lp->pipe |= PS_PIPE;
+ 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) */
- Lp->pss |= PS_SEC;
+ if (Lf->sf)
+ Lp->pss |= PS_SEC;
if (Plf)
Plf->next = Lf;
else
@@ -940,14 +946,14 @@ process_pinfo(f)
struct lfile *ef; /* pipe endpoint file */
int i; /* temporary index */
char nma[1024]; /* name addition buffer */
- pinfo_t *pp; /* previous pipe info */
+ pxinfo_t *pp; /* previous pipe info */
- if (!FpipeE)
+ if (!FeptE)
return;
for (Lf = Lp->file; Lf; Lf = Lf->next) {
if ((Lf->ntype != N_FIFO) || (Lf->inp_ty != 1))
continue;
- pp = (pinfo_t *)NULL;
+ pp = (pxinfo_t *)NULL;
switch(f) {
case 0:
@@ -957,8 +963,8 @@ process_pinfo(f)
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.
+ * 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))) {
@@ -978,14 +984,14 @@ process_pinfo(f)
ep->pid, CmdLim, ep->cmd,&ef->fd[i],
ef->access);
(void) add_nma(nma, strlen(nma));
- if (FpipeE == 2) {
+ if (FeptE == 2) {
/*
* Endpoint files have been selected, so mark this
- * one for selection later.
+ * one for selection later. Set the type to PIPE.
*/
- ef->pipend = 1;
- ep->pipe |= PS_PIPE_END;
+ ef->chend = CHEND_PIPE;
+ ep->ept |= EPT_PIPE_END;
}
pp = pp->next;
}
@@ -993,7 +999,7 @@ process_pinfo(f)
}
break;
case 1:
- if (!is_file_sel(Lp, Lf) && Lf->pipend) {
+ if (!is_file_sel(Lp, Lf) && (Lf->chend & CHEND_PIPE)) {
/*
* This is an unselected end point file. Select it and add
diff --git a/proto.h b/proto.h
index 040d667..15a2673 100644
--- a/proto.h
+++ b/proto.h
@@ -31,7 +31,7 @@
/*
- * $Id: proto.h,v 1.37 2014/10/13 22:36:20 abe Exp $
+ * $Id: proto.h,v 1.38 2015/07/07 20:16:58 abe Exp $
*/
@@ -112,8 +112,12 @@ _PROTOTYPE(extern void find_ch_ino,(void));
# if defined(HASEPTOPTS)
_PROTOTYPE(extern void clear_pinfo,(void));
-_PROTOTYPE(extern pinfo_t *find_pendinfo,(struct lfile *lf, pinfo_t *pp));
+_PROTOTYPE(extern pxinfo_t *find_pendinfo,(struct lfile *lf, pxinfo_t *pp));
_PROTOTYPE(extern void process_pinfo,(int f));
+# if defined(HASUXSOCKEPT)
+_PROTOTYPE(extern struct uxsin *find_uxsepti,(struct lfile *lf));
+_PROTOTYPE(extern void process_uxsinfo,(int f));
+# endif /* defined(HASUXSOCKEPT) */
# endif /* defined(HASEPTOPTS) */
_PROTOTYPE(extern void free_lproc,(struct lproc *lp));
diff --git a/store.c b/store.c
index 55953bd..dcc6555 100644
--- a/store.c
+++ b/store.c
@@ -32,7 +32,7 @@
#ifndef lint
static char copyright[] =
"@(#) Copyright 1994 Purdue Research Foundation.\nAll rights reserved.\n";
-static char *rcsid = "$Id: store.c,v 1.42 2014/10/13 22:36:20 abe Exp $";
+static char *rcsid = "$Id: store.c,v 1.43 2015/07/07 20:16:58 abe Exp $";
#endif
@@ -131,6 +131,8 @@ int Fblock = 0; /* -b option status */
int FcColW; /* FCT column width */
int Fcntx = 0; /* -Z option status */
int FdColW; /* FD column width */
+int FeptE = 0; /* -E option status: 0==none, 1==info,
+ * 2==info+files */
int Ffilesys = 0; /* -f option status:
* 0 = paths may be file systems
* 1 = paths are just files
@@ -156,8 +158,6 @@ int Fnfs = 0; /* -N option status: 0==none, 1==find all,
int Fnlink = 0; /* -L option status */
int Foffset = 0; /* -o option status */
int Fovhd = 0; /* -O option status */
-int FpipeE = 0; /* -E option status: 0==none, 1==info,
- * 2==info+files */
int Fport = 1; /* -P option status */
#if !defined(HASNORPC_H)
diff --git a/tests/Add2TestDB b/tests/Add2TestDB
index 48603f9..893c8a1 100755
--- a/tests/Add2TestDB
+++ b/tests/Add2TestDB
@@ -7,7 +7,7 @@
# removed, the words are sorted, and they are joint in a single
# line that is catenated to TestDB if it isn't already there.
#
-# $Id: Add2TestDB,v 1.2 2002/04/19 11:53:37 abe Exp $
+# $Id: Add2TestDB,v 1.3 2015/07/07 20:22:07 abe Exp $
# Check for config.flags.
@@ -28,7 +28,7 @@ fi
# Form a new data base line.
new=""
-for i in `sort < config.cflags`
+for i in `LC_ALL=C sort < config.cflags`
do
w=`echo $i | sed 's/^-D//'`
if test "X$new" = "X"
diff --git a/tests/TestDB b/tests/TestDB
index e3f669f..4e6a44a 100644
--- a/tests/TestDB
+++ b/tests/TestDB
@@ -5,7 +5,7 @@
#
# See Add2TestDB for a script that will build a line for this file.
#
-# $Id: TestDB,v 1.39 2014/10/13 22:26:55 abe Exp $
+# $Id: TestDB,v 1.40 2015/07/07 20:22:07 abe Exp $
LT_AIXA=0 LT_BIGF LT_CC LT_DIAL_aix LT_KMEM LT_VERS=4320
LT_AIXA=0 LT_BIGF LT_CC LT_DIAL_aix LT_KMEM LT_VERS=4330
@@ -89,6 +89,7 @@ LT_BIGF LT_CC LT_DIAL_linux LT_VERS=26018 _FILE_OFFSET_BITS=64
LT_BIGF LT_CC LT_DIAL_linux LT_VERS=26022 _FILE_OFFSET_BITS=64
LT_BIGF LT_CC LT_DIAL_linux LT_VERS=26032 _FILE_OFFSET_BITS=64
LT_BIGF LT_CC LT_DIAL_linux LT_VERS=26038 _FILE_OFFSET_BITS=64
+LT_BIGF LT_CC LT_DIAL_linux LT_VERS=310000 _FILE_OFFSET_BITS=64
LT_BIGF LT_CC LT_DIAL_linux LT_VERS=310004 _FILE_OFFSET_BITS=64
LT_BIGF LT_CC LT_DIAL_linux LT_VERS=31008 _FILE_OFFSET_BITS=64
LT_BIGF LT_CC LT_DIAL_netbsd LT_KMEM LT_VERS=1005000
diff --git a/version b/version
index fdb27c3..369cc11 100644
--- a/version
+++ b/version
@@ -1 +1 @@
-.ds VN 4.88
+.ds VN 4.89