I'm using MAC policy API in one of my kernel extension. In file operation related callback functions, like mpo_vnode_check_open, I'd like to get the process's real path. I can use proc_selfpid() to get the PID, but I have no idea how to get process path from there.
The functionality I need is to check if a process is built-in system process or not. If I could get the process path, I'd compare it with some known ones(/bin, /sbin, /usr/bin, /usr/sbin, /usr/libexec, /System/Library, etc.). Could anybody show me some code on how to get process path? If possible, how to check if a process is from Apple? Thanks!