![](/img/trans.png)
[英]How to get start address of the current process and other process's heap from pid?
[英]How to get current process pid?
我需要获取Mac OS上当前进程的pid吗? 我发现不赞成使用GetCurrentProcess函数。 那么还有其他方法吗?
通过使用getpid()
,就像其他任何UNIX系统一样。 (我链接到的文档与iOS有关,但是系统调用在macOS上的工作方式相同。)
GetCurrentProcess调用是Carbon API的一部分,该API可用于从Mac OS 9移植应用程序。在当前版本的macOS中不再可用。
您可以使用Homebrew安装pidof:
`
brew install pidof
pidof <process_name>
`
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.