How to get current process pid?
问题 I need to get the pid of current processs on Mac OS? I find that GetCurrentProcess function is deprecated. So is there any other methods? 回答1: By using getpid(), just like any other UNIX system. (The documentation I've linked to is related to iOS, but the system call works identically on macOS.) The GetCurrentProcess call was part of the Carbon API, which was made available for porting applications from Mac OS 9. It's no longer available in current versions of macOS. 回答2: You can install