linux-获取进程的pid [英] linux - get pid of process
本文介绍了linux-获取进程的pid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在Linux上使用C ++获得名为 abc
的服务的PID,而不使用系统调用?如果您愿意提供任何示例,我将不胜感激.
How can I get the PID of a service called abc
using C++ on Linux without using a system call? I would appreciate any examples that you care to offer.
推荐答案
Google对此进行了介绍:)
Google has this covered :)
http://programming-in-linux.blogspot.com/2008/03/get-process-id-by-name-in-c.html
尽管它确实使用sysctl,这是系统调用!
Although it does use sysctl, which is a system call!
它是C语言,但在C ++中应该也能正常工作
It's C but should work just as well in C++
这篇关于linux-获取进程的pid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文