先用ps看目前存在的所有进程的进程号,然后可以对具体进程采用以下这些操作:(11345就是对应具体的进程号)
只查看该进程:ps -ef | grep 11345
查看该进程打开的文件:lsof -p 11345
查看内存分配:lcat /proc/11345/maps
查看堆栈:pstack 11345
查看发出的系统调用:strace -p 11345
查看调用库函数:ltrace -p 11345
用
pthread_getattr_np (pthread_t tid, pthread_attr_t *attr);
即可。
具体你需要先了解一下pthread 相关接口。
比如,
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include
int main()
{
...
tid = pthread_create(xxxx,xxx...);
...
pthread_getattr_np(tid, &attr);
/* 后面就可以用 pthread_attr_getstack 之类的接口从 attr 中获得这个线程的 stack 信息(比如地址,大小等)*/
}
你的问题好深奥。。。。