pidof for macOS #54
jiacai2050
started this conversation in
作品分享
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
一直好奇没什么 macOS 上为啥没有 pidof 这个命令,它还挺方便的,在 Linux 上经常用到,今天突然想为什么不自己实现一个,其实也比较简单,核心代码如下:
主要就是利用 sysctl 这个 API 来查询系统信息,然后进行匹配就好了。
完整代码在:https://github.com/jiacai2050/zigcli/blob/main/src/pidof.zig
Beta Was this translation helpful? Give feedback.
All reactions