如何检查c中的内核是否仍在运行进程? [英] How can I check if a process is still running from the kernel in c?

查看:75
本文介绍了如何检查c中的内核是否仍在运行进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

到目前为止,我所看到的所有答案似乎都只是在用户空间内进行检查.我需要一种从设备驱动程序内的内核空间进行检查的方法.我通过来自流程的ioctl调用获得了与流程相关联的task_struct,因此我可以随意使用其中包含的所有信息.

All the answers I've seen so far appear to just be checking within user space. I need a way to check from kernel space specifically within a device driver. I get the task_struct associated with the process through an ioctl call from the process so I have all the information contained in that at my disposal.

注意:我正在寻找的进程正在用户空间中运行

Note: the process I'm looking for is running in user space

推荐答案

此帮助吗?

struct task_struct { 
   volatile long state;    /* -1 unrunnable, 0 runnable, >0 stopped */
   ...
}

这篇关于如何检查c中的内核是否仍在运行进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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