AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.


#Power
 View Only
  • 1.  lsof +D usage (trouble) on AIX 5.3 / lsof 4.61

    Posted Tue July 26, 2011 02:37 PM

    Originally posted by: mobrien022


    Folks,
    I'm trying to use lsof to see exact file names that a given process has open. Here a simple lsof returns:
    ====================
    bash-2.05b# lsof -p 487610
    COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
    java 487610 root cwd VDIR 10,11 0 0 /opt2 (/dev/fslv00)
    java 487610 root 0u VCHR 31,5 0t273089 12677 /dev/pts/5
    java 487610 root 1w VREG 10,11 0 0 /opt2 (/dev/fslv00)
    java 487610 root 2w VREG 10,11 0 0 /opt2 (/dev/fslv00)
    java 487610 root 3r VREG 10,5 5005 37288 /usr (/dev/hd2)
    java 487610 root 4r VREG 10,11 0 0 /opt2 (/dev/fslv00)
    java 487610 root 5r VREG 10,11 0 0 /opt2 (/dev/fslv00)
    .....
    ====================

    But when I add (+D to derive full file names/paths), I get nothing:
    ====================
    bash-2.05b# lsof +D /opt2
    bash-2.05b#
    ====================

    The OS and lsof versions for this test are:
    ====================
    bash-2.05b# oslevel -r
    5300-08
    ====================
    bash-2.05b# lsof -v
    lsof version information:
    revision: 4.61
    latest revision: ftp://vic.cc.purdue.edu/pub/tools/unix/lsof/
    latest FAQ: ftp://vic.cc.purdue.edu/pub/tools/unix/lsof/FAQ
    latest man page: ftp://vic.cc.purdue.edu/pub/tools/unix/lsof/lsof_man
    configuration info: 64 bit kernel
    constructed: Tue Feb 21 10:06:47 CST 2006
    constructed by and on: root@va08
    compiler: gcc
    compiler version: 3.3.2
    compiler flags: -DHASXOPT_ROOT -DHASIPv6 -DHASSTAT64 -maix64 -DAIX_KERNBITS=64 -DAIXA=1 -DAIXV=5300 -DLSOF_VSTR="5.3.0.0" -O
    loader flags: -L./lib -llsof
    system info: AIX va08 3 5 000974AF4C00 unknown unknown AIX
    ====================

    However, on AIX 6.1 / lsof 4.77, the same syntax does reveal full paths:
    ====================
    (pts/4)root@wbigblue: /# lsof -p 528440
    Value of I :116 np:0
    COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
    java 528440 root cwd VDIR 10,9 4096 202339 /opt (/dev/hd10opt)
    java 528440 root 0u VCHR 30,2 0t91567 21543 /dev/pts/2
    java 528440 root 1u VCHR 30,2 0t91567 21543 /dev/pts/2
    java 528440 root 2u VCHR 30,2 0t91567 21543 /dev/pts/2
    java 528440 root 3r VREG 10,5 6325 21264 /usr (/dev/hd2)
    java 528440 root 4r VREG 10,9 330391 154588 /opt (/dev/hd10opt)
    ...
    ====================

    ...and with +D:
    ====================
    bash-2.05b#lsof +D /opt
    ...
    java 528440 root 5r VREG 10,9 10160 154326 /opt/2010-09-09_mjobrien-temp/SAG8/jvm/aix160_64/jre/lib/annotation.jar
    java 528440 root 6r VREG 10,9 181501 154328 /opt/2010-09-09_mjobrien-temp/SAG8/jvm/aix160_64/jre/lib/beans.jar
    java 528440 root 7r VREG 10,9 415283 154480 /opt/2010-09-09_mjobrien-temp/SAG8/jvm/aix160_64/jre/lib/java.util.jar
    java 528440 root 8r VREG 10,9 212507 154485 /opt/2010-09-09_mjobrien-temp/SAG8/jvm/aix160_64/jre/lib/jndi.jar
    java 528440 root 9r VREG 10,9 54296 154500 /opt/2010-09-09_mjobrien-temp/SAG8/jvm/aix160_64/jre/lib/logging.jar
    ...
    ====================

    And the versions of OS / lsof for the working test are:
    ====================
    (pts/3)root@wbigblue: /# oslevel -r
    6100-03
    ====================
    (pts/3)root@wbigblue: /# lsof -v
    lsof version information:
    revision: 4.77
    latest revision: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/
    latest FAQ: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/FAQ
    latest man page: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_man
    configuration info: 64 bit kernel
    constructed: Wed Mar 25 07:49:51 PAKDT 2009
    constructed by and on: root@mars06
    compiler: cc
    compiler version: IBM XL C Enterprise Edition for AIX, Version 8.0.0.13
    compiler flags: -DHASIPv6 -DHASSTAT64 -DHAS_JFS2 -I/Jyoti/lsof_4.77_src/dialects/aix/aix5 -q64 -DAIX_KERNBITS=64 -DAIXA=1 -DAIXV=6100 -qmaxmem=-1 -DLSOF_VSTR="6.1.0.0" -O
    loader flags: -L./lib -llsof -bnolibpath
    system info: AIX mars06 1 6 00014F21D600
    Only root can list all files.
    /dev warnings are enabled.
    Kernel ID check is enabled.
    Device cache file read-only paths:
    Named via -D: none
    Named in environment variable LSOFDEVCACHE: none
    Personal path format (HASPERSDC): "%h/%p.lsof_%L"
    Modified personal path environment variable: LSOFPERSDCPATH
    LSOFPERSDCPATH value: none
    Personal path: /.lsof_wbigblue
    Device cache file write paths:
    Named via -D: none
    Named in environment variable LSOFDEVCACHE: none
    Personal path format (HASPERSDC): "%h/%p.lsof_%L"
    Modified personal path environment variable: LSOFPERSDCPATH
    LSOFPERSDCPATH value: none
    Personal path: /.lsof_wbigblue
    ====================

    Any help appreciated. Thanks.
    #AIX-Forum


  • 2.  Re: lsof +D usage (trouble) on AIX 5.3 / lsof 4.61

    Posted Tue July 26, 2011 05:24 PM

    Originally posted by: mobrien022


    ...or if anyone has an alternate approach / utility for determining specific files opened for a given process, please share. Thx.
    #AIX-Forum


  • 3.  Re: lsof +D usage (trouble) on AIX 5.3 / lsof 4.61

    Posted Wed September 07, 2011 03:26 PM

    Originally posted by: CristianLagos


    try procfiles:

    procfiles -nF <PID>
    #AIX-Forum