lsof

list open files

AIX

Compilation V4.87

Configure -clean aix
make
cd tests
make opt

Configuration (AIX 3.2, lsof 4.0)

Seems to work out-of-the-box.

Configuration (AIX >=4)

To allow ordinary users to use lsof on AIX, access to /dev/mem and /dev/kmem has to be enabled. This is accomplished by means of acl options.
  1. Check if the group kmem exists (lsgroup kmem). If not, create it, either locally or on the appropriate NIS server.
  2. Create (or use an already existing) file lsof.acl
    base permissions
        owner(root):  r--
        group(system):  r--
        others:  ---
    extended permissions
        enabled
        permit   r--     g:kmem
        permit   r--     g:kmem
        permit   r--     g:kmem
    
    (Existing acl-options can be read out by aclget /dev/mem > lsof.acl )
  3. Set the acl-options
    aclput -i lsof.acl /dev/mem
    aclput -i lsof.acl /dev/kmem
    
  4. Modify the binary's permissions:
    chgrp kmem lsof
    chmod g+s  lsof
    
Note:

Tru64, Ultrix

To allow all users to lsof, change the binary:
chgrp kmem lsof
chmod g+s  lsof

HP-UX

Compilation (V4.77)

  1. Check if the kernel is prepared for debugging.
    q4pxdb -s status /stand/vmunix
                                   # or:
      pxdb -s status /stand/vmunix
    
  2. If not prepared, do it now (caution, kernel will be written !):
    cp -p /stand/vmunix /stand/vmunix.save # save old kernel
    q4pxdb  /stand/vmunix
                          # or: 
      pxdb  /stand/vmunix
    
  3. configure and compile
    Configure hpuxgcc # for the gcc compiler
    Configure hpux    # for the native compiler 
    make
    
    Note that I suspect /usr/include/sys/socketvar.h to be buggy on HP-UX 11.00, the line
    extern struct sotimeq sotimeqhash[];
    
    should obviously appear after definition of struct sotimeq

Configuration

  1. If not yet existing, create group kmem (assume next free id is 202), insert in /etc/group
    kmem:!:202:kmem   
    
  2. To allow all users to lsof, change the binary:
    chgrp kmem lsof
    chmod g+s  lsof
    

Last updated: 20-Jun-2009, M.Kraemer

Impressum Data privacy protection