以编程方式检查进程是否正在Mac上运行 [英] Programmatically check if a process is running on Mac
问题描述
在Mac上是否有可用于枚举进程的Carbon / Cocoa / C API?我在Windows上寻找 EnumProcesses
。
我的目标是从代码检查一个进程是否
a href =http://developer.apple.com/mac/library/documentation/Carbon/Reference/Process_Manager/Reference/reference.html =nofollow noreferrer>流程管理器参考
看起来像 GetNextProcess
和 GetProcessInfo
有助于弄清楚正在运行的是什么。正如Dave所建议的,如果你正在寻找守护进程而不只是Carbon / Cocoa进程,可以使用 GetBSDProcessList
。
Is there any Carbon/Cocoa/C API available on Macs that I can use to enumerate processes? I'm looking for something like EnumProcesses
on Windows.
My goal is to check from code whether a process is running (by name).
Thanks!
TechZen says: The Process Manager is, as of Dec 2013, completely deprecated.
Ah, I just found the Process Manager reference
Looks like GetNextProcess
and GetProcessInfo
help in figuring out what's running. As suggested by Dave, GetBSDProcessList
can be used if you're looking for daemons and not just Carbon/Cocoa processes.
这篇关于以编程方式检查进程是否正在Mac上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!