以编程方式检查进程是否在 Mac 上运行
Mac 上是否有任何可用的 Carbon/Cocoa/C API 可用于枚举进程?我正在 Windows 上寻找类似 EnumProcesses
的东西.
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).
谢谢!
TechZen 说:流程管理器已于 2013 年 12 月完全弃用.
TechZen says: The Process Manager is, as of Dec 2013, completely deprecated.
啊,我刚刚找到了 Process经理参考
看起来 GetNextProcess
和 GetProcessInfo
有助于确定正在运行的内容.正如 Dave 所建议的,如果您正在寻找守护进程而不仅仅是 Carbon/Cocoa 进程,则可以使用 GetBSDProcessList
.
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.