首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在预3.0内核上检测内核线程

在预3.0内核上检测内核线程
EN

Unix & Linux用户
提问于 2013-10-18 16:48:57
回答 1查看 805关注 0票数 2

查看proc手册页(http://man7.org/linux/man-pages/man5/proc.5.html),可以通过查看flags值(PF_KTHREAD)来检测哪些进程是/proc/<pid>/stat中的内核线程。

代码语言:javascript
复制
flags %u (%lu before Linux 2.6.22)
     (9) The kernel flags word of the process.  For bit
     meanings, see the PF_* defines in the Linux kernel
     source file include/linux/sched.h.  Details depend
     on the kernel version.

这个进程标志(PF_KTHREAD)似乎不存在于内核版本2.6.18 (在RHEL5中使用),该值由一个不同的标志使用。

是否有另一种方法来确定pid是否是内核线程?

EN

回答 1

Unix & Linux用户

发布于 2013-10-18 17:10:51

在3.8系列内核上内核线程的/proc条目中,很明显,exe链接是空的,statm中满是零,status缺少所有Vm*条目,maps也是空的。

其中一些可能适用于所讨论的旧内核。

票数 0
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/96651

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档