我编写了一个模块,用户可以在其中读取或写入 proc 文件 - 如何确定在内核级编程中读取或写入的用户进程中的线程数?
Use current
作为指向当前任务的指针(当前task_struct
)在你的读/写函数中:
#include <linux/sched.h>
struct task_struct * t;
for (t = next_thread(current); t != current; t = next_thread(t)) {
// do the stuff
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)