Step 1: Find device and Inode of a library or binary:

# istat /usr/lib/libssh2.a
Inode 12880 on device 10/9 File
Protection: rwxr-xr-x
Owner: 0(root) Group: 0(system)
Link count: 1 Length 572979 bytes

Last updated: Tue Oct 22 15:01:13 CEST 2013
Last modified: Fri Jun 21 23:43:08 CEST 2013
Last accessed: Tue May 27 12:01:54 CEST 2014

From the above output we read the information we need for the next step:

Device Major: 10
Device Minor: 9
Inode: 12880

Step 2: Search for jfs2.<Major>.<Minor>.<Inode> under /proc:

# find /proc/*/object -name “jfs2.10.9.12880”
/proc/4194450/object/jfs2.10.9.12880
/proc/5111820/object/jfs2.10.9.12880
/proc/6095050/object/jfs2.10.9.12880
/proc/7077940/object/jfs2.10.9.12880
/proc/7405804/object/jfs2.10.9.12880

Conclusion: The library /usr/lib/libssh2.a is currently in use by 5 processes with the PIDs 4194450, 5111820, 6095050, 7077940 und 7405804.

Step 3: Find processes of the PIDs

# for p in 4194450 5111820 6095050 7077940 7405804 ; do ps -fp $p ; done
UID PID PPID C STIME TTY TIME CMD
apache 4194450 6095050 0 Mar 04 – 6:53 /opt/freeware/sbin/httpd -k start
UID PID PPID C STIME TTY TIME CMD
apache 5111820 6095050 0 Mar 04 – 6:49 /opt/freeware/sbin/httpd -k start
UID PID PPID C STIME TTY TIME CMD
root 6095050 1 0 Mar 04 – 1:51 /opt/freeware/sbin/httpd -k start
UID PID PPID C STIME TTY TIME CMD
apache 7077940 6095050 0 Mar 04 – 6:54 /opt/freeware/sbin/httpd -k start
UID PID PPID C STIME TTY TIME CMD
apache 7405804 6095050 0 Mar 04 – 7:02 /opt/freeware/sbin/httpd -k start

Advertisements