在Unix中,如何找出哪些可执行文件或进程正在使用我的共享库?

时间:2022-09-17 07:14:44

How do I find out which executables or processes are using my shared library objects in a Unix environment, specifically the AIX environment. Is there any command for it?

如何在Unix环境(特别是AIX环境)中找出哪些可执行文件或进程正在使用我的共享库对象。有没有命令呢?

4 个解决方案

#1


In linux, you would:

在linux中,你会:

for i in /usr/bin /bin /usr/local/bin /sbin /...; do
  # edit: bug fix to display which filename has the library
  # the egrep component will extract line with your library
  # or line with ":::", which contains name of the binary
  find /usr/bin -printf '::: %p\n' -exec ldd \{\} \; | egrep 'your lib. name|:::'
done

The ldd package for AIX can be found as described here

可以按照此处所述找到AIX的ldd包

To check running processes, you could: lsof | grep 'your library name'. How to obtain lsof for AIX can be found here

要检查正在运行的进程,您可以:lsof | grep'你的图书馆名称'。如何获取AIX的lsof可以在这里找到

#2


Not sure if it will help, but maybe you could lsof.

不确定它是否会有所帮助,但也许你可以帮助。

#3


fuser might be what you want.

定影器可能是你想要的。

#4


In Solaris Open or otherwise:

在Solaris Open或其他方面:

For example; some of the output supressed...

mybox@myplace02:~$ pldd ``pgrep pidgin
5451: pidgin
/usr/lib/libc/libc_hwcap1.so.1
/usr/lib/libgdk-x11-2.0.so.0.1400.3
/usr/lib/libgdk_pixbuf-2.0.so.0.1400.3
/usr/lib/libglib-2.0.so.0.1800.0
/usr/lib/libgobject-2.0.so.0.1800.0
/usr/lib/libmlib.so.2
/usr/lib/libmlib/libmlib_sse2.so.2
/usr/lib/libgthread-2.0.so.0.1800.0
/lib/libpthread.so.1
/usr/lib/locale/en_US.UTF-8/en_US.UTF-8.so.3
/usr/lib/locale/common/methods_unicode.so.3
/lib/libthread.so.1
/usr/lib/libpurple.so.0.5.1
/lib/libnsl.so.1
/usr/lib/libgtk-x11-2.0.so.0.1400.3

例如;一些输出压缩... mybox @myplace02:〜$ pldd``pgrep pidgin 5451:pidgin /usr/lib/libc/libc_hwcap1.so.1 /usr/lib/libgdk-x11-2.0.so.0.1400.3 /usr/lib/libgdk_pixbuf-2.0.so.0.1400.3 /usr/lib/libglib-2.0.so.0.1800.0 /usr/lib/libgobject-2.0.so.0.1800.0 /usr/lib/libmlib.so .2 /usr/lib/libmlib/libmlib_sse2.so.2 /usr/lib/libgthread-2.0.so.0.1800.0 /lib/libpthread.so.1 /usr/lib/locale/en_US.UTF-8/en_US .UTF-8.so.3 /usr/lib/locale/common/methods_unicode.so.3 /lib/libthread.so.1 /usr/lib/libpurple.so.0.5.1 /lib/libnsl.so.1 /usr/lib/libgtk-x11-2.0.so.0.1400.3

#1


In linux, you would:

在linux中,你会:

for i in /usr/bin /bin /usr/local/bin /sbin /...; do
  # edit: bug fix to display which filename has the library
  # the egrep component will extract line with your library
  # or line with ":::", which contains name of the binary
  find /usr/bin -printf '::: %p\n' -exec ldd \{\} \; | egrep 'your lib. name|:::'
done

The ldd package for AIX can be found as described here

可以按照此处所述找到AIX的ldd包

To check running processes, you could: lsof | grep 'your library name'. How to obtain lsof for AIX can be found here

要检查正在运行的进程,您可以:lsof | grep'你的图书馆名称'。如何获取AIX的lsof可以在这里找到

#2


Not sure if it will help, but maybe you could lsof.

不确定它是否会有所帮助,但也许你可以帮助。

#3


fuser might be what you want.

定影器可能是你想要的。

#4


In Solaris Open or otherwise:

在Solaris Open或其他方面:

For example; some of the output supressed...

mybox@myplace02:~$ pldd ``pgrep pidgin
5451: pidgin
/usr/lib/libc/libc_hwcap1.so.1
/usr/lib/libgdk-x11-2.0.so.0.1400.3
/usr/lib/libgdk_pixbuf-2.0.so.0.1400.3
/usr/lib/libglib-2.0.so.0.1800.0
/usr/lib/libgobject-2.0.so.0.1800.0
/usr/lib/libmlib.so.2
/usr/lib/libmlib/libmlib_sse2.so.2
/usr/lib/libgthread-2.0.so.0.1800.0
/lib/libpthread.so.1
/usr/lib/locale/en_US.UTF-8/en_US.UTF-8.so.3
/usr/lib/locale/common/methods_unicode.so.3
/lib/libthread.so.1
/usr/lib/libpurple.so.0.5.1
/lib/libnsl.so.1
/usr/lib/libgtk-x11-2.0.so.0.1400.3

例如;一些输出压缩... mybox @myplace02:〜$ pldd``pgrep pidgin 5451:pidgin /usr/lib/libc/libc_hwcap1.so.1 /usr/lib/libgdk-x11-2.0.so.0.1400.3 /usr/lib/libgdk_pixbuf-2.0.so.0.1400.3 /usr/lib/libglib-2.0.so.0.1800.0 /usr/lib/libgobject-2.0.so.0.1800.0 /usr/lib/libmlib.so .2 /usr/lib/libmlib/libmlib_sse2.so.2 /usr/lib/libgthread-2.0.so.0.1800.0 /lib/libpthread.so.1 /usr/lib/locale/en_US.UTF-8/en_US .UTF-8.so.3 /usr/lib/locale/common/methods_unicode.so.3 /lib/libthread.so.1 /usr/lib/libpurple.so.0.5.1 /lib/libnsl.so.1 /usr/lib/libgtk-x11-2.0.so.0.1400.3