使用C ++以编程方式监视进程状态 [英] Programmatically monitor process state using C++

查看:74
本文介绍了使用C ++以编程方式监视进程状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须用C ++开发一个应用程序,以监视Linux系统中进程的状态,并且还需要知道是否创建了新进程或现有进程已终止.是否有可用的API?如果有人可以告诉我如何开始使用它,也将有所帮助.

I have to develop an application in C++ to monitor the state of processes in my Linux system and also need to know if a new process is created or an existing process is terminated. Is there an API available for this? Also it will be helpful if someone could tell me how to start it with.

推荐答案

inotify适用于我尝试过的所有目录,除了proc文件系统.因此,我再次继续寻找解决方案,并找到了 proc connectorsocket filters .文献记载不多,但确实值得.看看:

inotify works well for all directories I tried, except the proc filesystem. So again I continued to search for a solution and where I reached was the proc connector and socket filters. Not much documented, but really worthy. Just have a look at:

得出此结论的方法是通过 David Crookes 提供的答案 检测在Linux平台上启动的程序.

The way to reach this conclusion was through the answer provided by David Crookes to Detect launching of programs on Linux platform.

希望它将对以后的人有所帮助.

Hope it will help someone in future.

这篇关于使用C ++以编程方式监视进程状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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