Check if any running binary is 32 or 64 bit

房东的猫 提交于 2020-01-05 09:11:44

问题


It is possible to check if an app bundle's binary process is running in 32 or 64 bit mode, as answered in this question, but I can verify that it only works with GUI processes.

However, I need to also check processes that don't have a GUI and is not part of a bundle.

So, programmatically, without calling system functions or other executables, how can I test if any process is running in 32 or 64 bit mode, given the process pid?


回答1:


Ok, so I finally found the answer was already on SO here, for Carbon. In order to use that code now, this include is required:

#include <sys/sysctl.h>

Also, it appears that the member to the process structure has changed from

proc->kp_proc.p_flags 

to this:

proc->kp_proc.p_flag


来源:https://stackoverflow.com/questions/19138043/check-if-any-running-binary-is-32-or-64-bit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!