通过正在运行的进程(unix)获取已用库的列表 [英] Getting a list of used libraries by a running process (unix)

查看:69
本文介绍了通过正在运行的进程(unix)获取已用库的列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要找出unix进程已加载了哪些库,并可能在其整个生命周期内使用它们.这可能吗?或者更好的是,我有一个库名,我需要找出正在使用它的进程,这可能吗.

I need to find out what libraries a unix process has loaded and might use throughout it's lifetime. Is this possible and how. Or better yet, i have a library name and i need to find out what processes are using it, is this possible.

同样,是否可以通知启动UNIX进程的时间以及退出UNIX进程的方式.它们不是我的过程的子过程,我只需要全局了解即可.

On the same note, is it possible to get notified some how when a unix process is launched and when it is quit. They would not be child processes of my process, i just need to know globally.

更新:

我想我没有提供足够的信息.我正在谈论的Unix是MacOS X(尽管有人说它不是真的完全是unix),我正在寻找一种方法来查找进程具有的加载库,而我需要用C/C ++来完成.

I think I didn't give enough information. The unix i was talking about was MacOS X ( even though some say its not really completely unix ), and I was looking for a way to find the loaded libraries a process has and i need to do it in C/C++.

推荐答案

Solaris具有 pldd .对于Linux,您可以在可执行文件上调用 ldd

Solaris has pldd. For Linux you can call ldd on the executable or pmap on a running process or look into /proc/PID/maps for mapped libraries.

这篇关于通过正在运行的进程(unix)获取已用库的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆