大佬教程收集整理的这篇文章主要介绍了linux-kernel – 在linux内核中遍历task_struct-> children,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
这是我的代码的相关部分.
struct list_head * p; struct task_struct ts,*tsk; pid_t tmp_pid; INIT_LIST_HEAD(&ts.children); current = tsk; list_for_each(p,&(tsk->children)){ ts = *list_entry(p,struct task_struct,children); tmp_pid = ts.pid; printk("the pid is %d\n",tmp_pid); }
我认为问题在于list_entry但我不知道如何解决它,我能找到的所有例子似乎都是以同样的方式调用它.
这应该打印出所有子PID,而不是我总是得到相同的数字-17 ….它是10 ^ 9或10 ^ 11的数量级.
有人可以帮我从这里出去吗?编译大约需要30分钟,所以尝试记录不同的东西并不是一个真正的选择.
以上是大佬教程为你收集整理的linux-kernel – 在linux内核中遍历task_struct-> children全部内容,希望文章能够帮你解决linux-kernel – 在linux内核中遍历task_struct-> children所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。